diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..17ed1a3 Binary files /dev/null and b/.DS_Store differ diff --git a/API/MetaWebLog/Handler.ashx b/API/MetaWebLog/Handler.ashx new file mode 100755 index 0000000..695139d --- /dev/null +++ b/API/MetaWebLog/Handler.ashx @@ -0,0 +1 @@ +<%@ WebHandler Language="VB" CodeBehind="Handler.ashx.vb" Class="Ventrian.NewsArticles.API.MetaWebLog.Handler" %> diff --git a/API/MetaWebLog/Handler.ashx.vb b/API/MetaWebLog/Handler.ashx.vb new file mode 100755 index 0000000..2cd328b --- /dev/null +++ b/API/MetaWebLog/Handler.ashx.vb @@ -0,0 +1,514 @@ +Imports System.Web +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Common.Utilities +Imports System.Linq +Imports DotNetNuke.Entities.Portals +Imports DotNetNuke.Services.Log.EventLog +Imports DotNetNuke.Services.FileSystem +Imports DotNetNuke.Entities.Users +Imports System.IO +Imports DotNetNuke.Security.Membership +Imports DotNetNuke.Entities.Tabs + +Namespace Ventrian.NewsArticles.API.MetaWebLog + + Public Class Handler + Implements IHttpHandler + + ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable + Get + Return False + End Get + End Property + + Private ReadOnly Property PortalSettings() As PortalSettings + Get + Return PortalController.GetCurrentPortalSettings() + End Get + End Property + + Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest + + Dim methodName As String = "" + Try + Dim input As New XmlrpcRequest(context) + Dim output As New XmlrpcResponse(input.MethodName) + + Dim objLoginStatus As UserLoginStatus + UserController.ValidateUser(PortalSettings.PortalId, input.UserName, input.Password, "", PortalSettings.PortalName, context.Request.UserHostAddress, objLoginStatus) + + If (objLoginStatus = UserLoginStatus.LOGIN_SUCCESS Or objLoginStatus = UserLoginStatus.LOGIN_SUPERUSER) = False Then + Throw New MetaException("10", "Unauthorized") + End If + + methodName = input.MethodName + + Select Case methodName + Case "metaWeblog.newPost" + output.PostId = NewPost(input.BlogId, input.UserName, input.Password, input.Post, input.Publish) + Exit Select + Case "metaWeblog.editPost" + output.Completed = EditPost(input.BlogId, input.PostId, input.UserName, input.Password, input.Post, input.Publish) + Exit Select + Case "metaWeblog.getPost" + output.Post = GetPost(input.PostId, input.UserName, input.Password) + Exit Select + Case "metaWeblog.newMediaObject" + output.MediaUrlInfo = NewMediaObject(input.BlogId, input.UserName, input.Password, input.MediaObject, context) + Exit Select + Case "metaWeblog.getCategories" + output.Categories = GetCategories(input.BlogId, input.UserName, input.Password) + Exit Select + Case "metaWeblog.getRecentPosts" + output.Posts = GetRecentPosts(input.BlogId, input.UserName, input.Password, input.NumberOfPosts) + Exit Select + Case "blogger.getUsersBlogs", "metaWeblog.getUsersBlogs" + output.Blogs = GetUserBlogs(input.AppKey, input.UserName, input.Password) + Exit Select + Case "blogger.deletePost" + output.Completed = DeletePost(input.AppKey, input.PostId, input.UserName, input.Password) + Exit Select + Case "blogger.getUserInfo" + ' Not implemented. Not planned. + Throw New MetaException("10", "The method GetUserInfo is not implemented.") + Case "wp.getTags" + output.Keywords = GetKeywords(input.BlogId, input.UserName, input.Password) + Exit Select + End Select + + output.Response(context) + Catch mex As MetaException + Dim objEventLog As New EventLogController + objEventLog.AddLog(methodName, mex.Message, PortalSettings, -1, EventLogController.EventLogType.ADMIN_ALERT) + Dim output = New XmlrpcResponse("fault") + Dim fault = New MetaFaultInfo() With { _ + .FaultCode = mex.Code, _ + .FaultString = mex.Message _ + } + output.Fault = fault + output.Response(context) + Catch ex As Exception + ' Log DNN Event + Dim objEventLog As New EventLogController + objEventLog.AddLog(methodName, ex.Message + ex.StackTrace, PortalSettings, -1, EventLogController.EventLogType.ADMIN_ALERT) + + ' Raise RPC Fault + Dim outputFault = New XmlrpcResponse("fault") + Dim fault = New MetaFaultInfo() With { _ + .FaultCode = "0", _ + .FaultString = ex.StackTrace _ + } + outputFault.Fault = fault + outputFault.Response(context) + End Try + + End Sub + + Private Shared Function CheckPermission(permission As String, moduleId As Integer, user As UserInfo) + + Dim check As Boolean = False + + Dim objModuleController As New ModuleController + Dim settings As Hashtable = objModuleController.GetModuleSettings(moduleId) + + If (user.IsSuperUser) Then + Return True + End If + + If (settings.Contains(permission)) Then + + If settings(permission).ToString().Split(New Char() {";"c}).Any(Function(role) user.IsInRole(role)) Then + check = True + End If + + End If + + Return check + + End Function + + Private Shared Function IsAuthor(moduleId As Integer, user As UserInfo) + + Return CheckPermission(ArticleConstants.PERMISSION_SUBMISSION_SETTING, moduleId, user) + + End Function + + Private Shared Function IsAutoApprover(moduleId As Integer, user As UserInfo) + + Return CheckPermission(ArticleConstants.PERMISSION_AUTO_APPROVAL_SETTING, moduleId, user) + + End Function + + Private Shared Function IsApprover(moduleId As Integer, user As UserInfo) + + Return CheckPermission(ArticleConstants.PERMISSION_APPROVAL_SETTING, moduleId, user) + + End Function + + Friend Function DeletePost(appKey As String, postId As String, userName As String, password As String) As Boolean + + Try + + Dim objArticleController As New ArticleController() + Dim objArticle As ArticleInfo = objArticleController.GetArticle(postId) + + If (objArticle Is Nothing) Then + Throw New MetaException("01", "Article Not Found") + End If + + Dim objUser As UserInfo = UserController.GetUserByName(PortalSettings.PortalId, userName) + + If (objUser Is Nothing) Then + Throw New MetaException("01", "Username not found") + End If + + If (IsAuthor(objArticle.ModuleID, objUser) = False) Then + Throw New MetaException("01", "You do not have permission to delete posts") + End If + + If (objUser.UserID <> objArticle.AuthorID) Then + If (IsApprover(objArticle.ModuleID, objUser) = False) Then + Throw New MetaException("01", "You do not have permission to delete other's posts") + End If + End If + + objArticleController.DeleteArticle(postId) + + Catch ex As Exception + Throw New MetaException("12", String.Format("DeletePost failed. Error: {0}", ex.Message)) + End Try + + Return True + + End Function + + Friend Function EditPost(blogId As Integer, postId As String, userName As String, password As String, sentPost As MetaPostInfo, publish As Boolean) As Boolean + + Dim objArticleController As New ArticleController() + Dim objArticle As ArticleInfo = objArticleController.GetArticle(postId) + + If (objArticle Is Nothing) Then + Throw New MetaException("01", "Article Not Found") + End If + + Dim objUser As UserInfo = UserController.GetUserByName(PortalSettings.PortalId, userName) + + If (objUser Is Nothing) Then + Throw New MetaException("01", "Username not found") + End If + + If (IsAuthor(objArticle.ModuleID, objUser) = False) Then + Throw New MetaException("01", "You do not have permission to edit posts") + End If + + If (objUser.UserID <> objArticle.AuthorID) Then + If (IsApprover(objArticle.ModuleID, objUser) = False) Then + Throw New MetaException("01", "You do not have permission to edit other's posts") + End If + End If + + objArticle.Title = sentPost.Title + objArticle.LastUpdate = DateTime.Now + objArticle.LastUpdateID = objUser.UserID + + objArticleController.UpdateArticle(objArticle) + + Dim objPageController As PageController = New PageController + Dim pages As ArrayList = objPageController.GetPageList(objArticle.ArticleID) + + If (pages.Count > 0) Then + Dim objPage As PageInfo = pages(0) + objPage.PageText = sentPost.Description + objPageController.UpdatePage(objPage) + End If + + objArticleController.DeleteArticleCategories(objArticle.ArticleID) + + Dim objCategoryController As New CategoryController() + Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(objArticle.ModuleID) + + For Each item As String In sentPost.Categories.Where(Function(c) c IsNot Nothing AndAlso c.Trim() <> String.Empty) + + Dim categoryId As Integer = Null.NullInteger + + For Each objCategory As CategoryInfo In objCategories + If (objCategory.Name.ToLower() = item.ToLower()) Then + categoryId = objCategory.CategoryID + Exit For + End If + Next + + If (categoryId <> Null.NullInteger) Then + objArticleController.AddArticleCategory(objArticle.ArticleID, categoryId) + End If + + Next + + Dim objTagController As New TagController + objTagController.DeleteArticleTag(objArticle.ArticleID) + + For Each itemTag As String In sentPost.Tags.Where(Function(item) item IsNot Nothing AndAlso item.Trim() <> String.Empty) + Dim objTag As TagInfo = objTagController.Get(objArticle.ModuleID, itemTag) + + If (objTag Is Nothing) Then + objTag = New TagInfo + objTag.Name = itemTag + objTag.NameLowered = itemTag.ToLower() + objTag.ModuleID = objArticle.ModuleID + objTag.TagID = objTagController.Add(objTag) + End If + + objTagController.Add(objArticle.ArticleID, objTag.TagID) + Next + + Return True + End Function + + Friend Function GetCategories(blogId As String, userName As String, password As String) As List(Of MetaCategoryInfo) + + Dim objModuleController As New ModuleController() + Dim objTabModule As ModuleInfo = objModuleController.GetTabModule(blogId) + + Dim objCategoryController As New CategoryController() + Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(objTabModule.ModuleID) + Dim objMetaCategories As New List(Of MetaCategoryInfo) + + For Each objCategory As CategoryInfo In objCategories + Dim objMetaCategory As New MetaCategoryInfo + objMetaCategory.Title = objCategory.Name + objMetaCategory.Description = objCategory.Description + objMetaCategory.HtmlUrl = "#" + objMetaCategory.RssUrl = "#" + objMetaCategories.Add(objMetaCategory) + Next + + Return objMetaCategories + + End Function + + Friend Function GetKeywords(blogId As String, userName As String, password As String) As List(Of String) + + Dim objModuleController As New ModuleController() + Dim objTabModule As ModuleInfo = objModuleController.GetTabModule(blogId) + + Dim objTagController As New TagController + Dim objTags As ArrayList = objTagController.List(objTabModule.ModuleID, 1000) + + Return (From objTag As TagInfo In objTags Where (objTag.Name.Trim() <> "") Select objTag.Name).ToList() + + End Function + + Friend Function GetPost(postId As String, userName As String, password As String) As MetaPostInfo + + Dim objArticleController As New ArticleController() + Dim objArticle As ArticleInfo = objArticleController.GetArticle(postId) + + If (objArticle Is Nothing) Then + Throw New MetaException("01", "Article Not Found") + End If + + Dim sendPost As New MetaPostInfo() + + sendPost.PostId = objArticle.ArticleID.ToString() + sendPost.PostDate = objArticle.StartDate + sendPost.Title = objArticle.Title + sendPost.Description = HttpUtility.HtmlDecode(objArticle.Body) + sendPost.Link = objArticle.Url + sendPost.Excerpt = objArticle.Summary + sendPost.Publish = (objArticle.Status = StatusType.Published) + + Dim objArticleCategories As ArrayList = objArticleController.GetArticleCategories(objArticle.ArticleID) + sendPost.Categories = (From objCategory As CategoryInfo In objArticleCategories Select objCategory.Name).ToList() + sendPost.Tags = objArticle.Tags.Split(","c).ToList() + + Return sendPost + End Function + + Friend Function GetRecentPosts(blogId As String, userName As String, password As String, numberOfPosts As Integer) As List(Of MetaPostInfo) + + Dim objUser As UserInfo = UserController.GetUserByName(PortalSettings.PortalId, userName) + + If (objUser Is Nothing) Then + Throw New MetaException("01", "Username not found") + End If + + Dim objModuleController As New ModuleController() + Dim objTabModule As ModuleInfo = objModuleController.GetTabModule(blogId) + + Dim authorId As Integer = objUser.UserID + If (IsApprover(objTabModule.ModuleID, objUser)) Then + authorId = Null.NullInteger + End If + + Dim sendPosts As New List(Of MetaPostInfo)() + + Dim objArticleController As New ArticleController + Dim objArticles As List(Of ArticleInfo) = objArticleController.GetArticleList(objTabModule.ModuleID, DateTime.Now, Null.NullDate, Nothing, False, Nothing, numberOfPosts, 1, numberOfPosts, "StartDate", "DESC", True, False, Null.NullString, authorId, False, False, False, False, False, False, Null.NullString, Nothing, False, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, Nothing) + + For Each objArticle As ArticleInfo In objArticles + + Dim tempPost As New MetaPostInfo() With { _ + .PostId = objArticle.ArticleID, _ + .PostDate = DateTime.Now, _ + .Title = objArticle.Title, _ + .Description = objArticle.ArticleText, _ + .Link = objArticle.Url, _ + .Excerpt = objArticle.Summary, _ + .Publish = (objArticle.Status = StatusType.Published) _ + } + + Dim objArticleCategories As ArrayList = objArticleController.GetArticleCategories(objArticle.ArticleID) + tempPost.Categories = (From objCategory As CategoryInfo In objArticleCategories Select objCategory.Name).ToList() + tempPost.Tags = objArticle.Tags.Split(","c).ToList() + + sendPosts.Add(tempPost) + Next + + Return sendPosts + + End Function + + Friend Function GetUserBlogs(appKey As String, userName As String, password As String) As List(Of MetaBlogInfo) + + Dim blogs As New List(Of MetaBlogInfo)() + For Each objModule As ModuleInfo In Common.GetArticleModules(PortalSettings.PortalId) + Dim modulePath As String = objModule.ParentTab.TabPath.Replace("//", "/") + If (modulePath.Length > 1 And modulePath.Substring(0, 1) = "/") Then + modulePath = modulePath.Substring(1) + End If + Dim temp As New MetaBlogInfo() With { _ + .Url = DotNetNuke.Common.Globals.NavigateURL(objModule.TabID), _ + .BlogId = objModule.TabModuleID, _ + .BlogName = objModule.ModuleTitle + " (" + modulePath + ")" _ + } + blogs.Add(temp) + Next + + Return blogs + + End Function + + Friend Function NewMediaObject(blogId As String, userName As String, password As String, mediaObject As MetaMediaInfo, request As HttpContext) As MetaMediaUrlInfo + + Dim objUser As UserInfo = UserController.GetUserByName(PortalSettings.PortalId, userName) + + If (objUser Is Nothing) Then + Throw New MetaException("01", "Username not found") + End If + + Dim folders As IFolderManager = FolderManager.Instance() + Dim files As IFileManager = FileManager.Instance + + Dim userFolder = folders.GetUserFolder(objUser) + Dim ms As New MemoryStream(mediaObject.Bits) + Dim fileInfo As DotNetNuke.Services.FileSystem.FileInfo = files.AddFile(userFolder, mediaObject.Name.Replace(" ", "_").Replace(":", "-"), ms, True) + ms.Close() + + Dim mediaInfo As New MetaMediaUrlInfo() + mediaInfo.Url = FileManager.Instance.GetUrl(fileInfo) + + Return mediaInfo + + End Function + + Friend Function NewPost(blogId As String, userName As String, password As String, sentPost As MetaPostInfo, publish As Boolean) As String + + Dim objModuleController As New ModuleController() + Dim objTabModule As ModuleInfo = objModuleController.GetTabModule(blogId) + + If (objTabModule Is Nothing) Then + Throw New MetaException("11", "BlogID not found.") + End If + + Dim objTabController As New TabController() + Dim objTab As TabInfo = objTabController.GetTab(objTabModule.TabID, PortalSettings.PortalId, False) + + Dim objUser As UserInfo = UserController.GetUserByName(PortalSettings.PortalId, userName) + + If (objUser Is Nothing) Then + Throw New MetaException("01", "Username not found") + End If + + Dim author As Boolean = IsAuthor(objTabModule.ModuleID, objUser) + Dim autoApprove As Boolean = IsAutoApprover(objTabModule.ModuleID, objUser) + Dim approver As Boolean = IsApprover(objTabModule.ModuleID, objUser) + + If (author = False) Then + Throw New MetaException("01", "You do not have permission to post articles") + End If + + Dim objSettings As Hashtable = objModuleController.GetModuleSettings(objTabModule.ModuleID) + Dim objArticleSettings As New ArticleSettings(objSettings, PortalSettings, objTabModule) + + Dim objArticle As New ArticleInfo + + objArticle.ModuleID = objTabModule.ModuleID + objArticle.Title = sentPost.Title + objArticle.ArticleText = HttpUtility.HtmlEncode(sentPost.Description) + objArticle.AuthorID = objUser.UserID + objArticle.CreatedDate = DateTime.Now + objArticle.StartDate = Null.NullDate + objArticle.EndDate = Null.NullDate + objArticle.LastUpdate = DateTime.Now + objArticle.LastUpdateID = objUser.UserID + objArticle.Summary = HttpUtility.HtmlEncode(sentPost.Excerpt) + + objArticle.CommentCount = 0 + objArticle.RatingCount = 0 + objArticle.FileCount = 0 + objArticle.Rating = 0 + objArticle.ShortUrl = "" + + If (publish) Then + objArticle.Status = StatusType.Published + objArticle.StartDate = DateTime.Now + If (approver = False) Then + If (autoApprove = False) Then + objArticle.Status = StatusType.AwaitingApproval + + If (objSettings.Contains(ArticleConstants.NOTIFY_SUBMISSION_SETTING)) Then + If (Convert.ToBoolean(objSettings(ArticleConstants.NOTIFY_SUBMISSION_SETTING)) = True) Then + Dim objEmailTemplateController As New EmailTemplateController + Dim emails As String = objEmailTemplateController.GetApproverDistributionList(objTabModule.ModuleID) + + For Each email As String In emails.Split(Convert.ToChar(";")) + If (email <> "") Then + objEmailTemplateController.SendFormattedEmail(objTabModule.ModuleID, Common.GetArticleLink(objArticle, objTab, objArticleSettings, False), objArticle, EmailTemplateType.ArticleSubmission, email, objArticleSettings) + End If + Next + End If + End If + + If (objSettings.Contains(ArticleConstants.NOTIFY_SUBMISSION_SETTING_EMAIL)) Then + If (objSettings(ArticleConstants.NOTIFY_SUBMISSION_SETTING_EMAIL).ToString() <> "") Then + Dim objEmailTemplateController As New EmailTemplateController + For Each email As String In objSettings(ArticleConstants.NOTIFY_SUBMISSION_SETTING_EMAIL).ToString().Split(","c) + objEmailTemplateController.SendFormattedEmail(objTabModule.ModuleID, Common.GetArticleLink(objArticle, objTab, objArticleSettings, False), objArticle, EmailTemplateType.ArticleSubmission, email, objArticleSettings) + Next + End If + End If + + End If + End If + Else + objArticle.Status = StatusType.Draft + End If + + Dim objArticleController As New ArticleController() + objArticle.ArticleID = objArticleController.AddArticle(objArticle) + + Dim objPage As New PageInfo + objPage.PageText = HttpUtility.HtmlEncode(sentPost.Description) + objPage.ArticleID = objArticle.ArticleID + objPage.Title = sentPost.Title + + Dim objPageController As New PageController() + objPageController.AddPage(objPage) + + Return objArticle.ArticleID.ToString() + + End Function + + End Class + +End Namespace \ No newline at end of file diff --git a/API/MetaWebLog/MetaBlogInfo.vb b/API/MetaWebLog/MetaBlogInfo.vb new file mode 100755 index 0000000..610ee64 --- /dev/null +++ b/API/MetaWebLog/MetaBlogInfo.vb @@ -0,0 +1,11 @@ +Namespace Ventrian.NewsArticles.API.MetaWebLog + + Friend Class MetaBlogInfo + + Public BlogId As String + Public BlogName As String + Public Url As String + + End Class + +End Namespace diff --git a/API/MetaWebLog/MetaCategoryInfo.vb b/API/MetaWebLog/MetaCategoryInfo.vb new file mode 100755 index 0000000..69b0926 --- /dev/null +++ b/API/MetaWebLog/MetaCategoryInfo.vb @@ -0,0 +1,13 @@ +Namespace Ventrian.NewsArticles.API.MetaWebLog + + Friend Class MetaCategoryInfo + + Public Description As String + Public HtmlUrl As String + Public Id As String + Public RssUrl As String + Public Title As String + + End Class + +End Namespace diff --git a/API/MetaWebLog/MetaException.vb b/API/MetaWebLog/MetaException.vb new file mode 100755 index 0000000..affc9b5 --- /dev/null +++ b/API/MetaWebLog/MetaException.vb @@ -0,0 +1,24 @@ +Namespace Ventrian.NewsArticles.API.MetaWebLog + + _ + Public Class MetaException + Inherits Exception + +#Region "Constructors" + + Public Sub New(code As String, message As String) + MyBase.New(message) + Me.Code = code + End Sub + +#End Region + +#Region "Properties" + + Public Property Code As String + +#End Region + + End Class + +End Namespace diff --git a/API/MetaWebLog/MetaFaultInfo.vb b/API/MetaWebLog/MetaFaultInfo.vb new file mode 100755 index 0000000..69065f7 --- /dev/null +++ b/API/MetaWebLog/MetaFaultInfo.vb @@ -0,0 +1,10 @@ +Namespace Ventrian.NewsArticles.API.MetaWebLog + + Public Class MetaFaultInfo + + Public FaultCode As String + Public FaultString As String + + End Class + +End Namespace diff --git a/API/MetaWebLog/MetaMediaInfo.vb b/API/MetaWebLog/MetaMediaInfo.vb new file mode 100755 index 0000000..aa2c9e6 --- /dev/null +++ b/API/MetaWebLog/MetaMediaInfo.vb @@ -0,0 +1,15 @@ +Namespace Ventrian.NewsArticles.API.MetaWebLog + + Friend Structure MetaMediaInfo + +#Region "Properties" + + Public Bits As Byte() + Public Name As String + Public Type As String + +#End Region + + End Structure + +End Namespace diff --git a/API/MetaWebLog/MetaMediaUrlInfo.vb b/API/MetaWebLog/MetaMediaUrlInfo.vb new file mode 100755 index 0000000..770205e --- /dev/null +++ b/API/MetaWebLog/MetaMediaUrlInfo.vb @@ -0,0 +1,13 @@ +Namespace Ventrian.NewsArticles.API.MetaWebLog + + Friend Structure MetaMediaUrlInfo + +#Region "Constants and Fields" + + Public Url As String + +#End Region + + End Structure + +End Namespace diff --git a/API/MetaWebLog/MetaPostInfo.vb b/API/MetaWebLog/MetaPostInfo.vb new file mode 100755 index 0000000..6e14d4f --- /dev/null +++ b/API/MetaWebLog/MetaPostInfo.vb @@ -0,0 +1,18 @@ +Namespace Ventrian.NewsArticles.API.MetaWebLog + + Friend Class MetaPostInfo + + Public Author As String + Public Categories As List(Of String) + Public Description As String + Public Excerpt As String + Public Link As String + Public PostDate As DateTime + Public PostId As String + Public Publish As Boolean + Public Tags As List(Of String) + Public Title As String + + End Class + +End Namespace diff --git a/API/MetaWebLog/XmlrpcRequest.vb b/API/MetaWebLog/XmlrpcRequest.vb new file mode 100755 index 0000000..4bd09a5 --- /dev/null +++ b/API/MetaWebLog/XmlrpcRequest.vb @@ -0,0 +1,223 @@ +Imports System.Xml +Imports System.Globalization +Imports System.Linq + +Namespace Ventrian.NewsArticles.API.MetaWebLog + + Friend Class XmlrpcRequest + +#Region "Private Members" + + Private _inputParams As List(Of XmlNode) + +#End Region + +#Region "Constructor" + + Public Sub New(input As HttpContext) + + Dim inputXml = ParseRequest(input) + LoadXmlRequest(inputXml) + + End Sub + +#End Region + +#Region "Properties" + + Public Property AppKey As String + Public Property BlogId As String + Public Property MediaObject As MetaMediaInfo + Public Property MethodName As String + Public Property NumberOfPosts As Integer + Public Property Password As String + Public Property Post As MetaPostInfo + Public Property PostId As String + Public Property Publish As Boolean + Public Property UserName As String + +#End Region + +#Region "Methods" + + Private Shared Function GetMediaObject(node As XmlNode) As MetaMediaInfo + Dim name = node.SelectSingleNode("value/struct/member[name='name']") + Dim type = node.SelectSingleNode("value/struct/member[name='type']") + Dim bits = node.SelectSingleNode("value/struct/member[name='bits']") + Dim temp = New MetaMediaInfo() With { _ + .name = If(name Is Nothing, String.Empty, name.LastChild.InnerText), _ + .type = If(type Is Nothing, "notsent", type.LastChild.InnerText), _ + .bits = Convert.FromBase64String(If(bits Is Nothing, String.Empty, bits.LastChild.InnerText)) _ + } + + Return temp + End Function + + Private Shared Function GetPost(node As XmlNode) As MetaPostInfo + Dim temp = New MetaPostInfo() + + ' Require Title and Description + Dim title = node.SelectSingleNode("value/struct/member[name='title']") + If title Is Nothing Then + Throw New MetaException("05", "Page Struct Element, Title, not Sent.") + End If + + temp.title = title.LastChild.InnerText + + Dim description = node.SelectSingleNode("value/struct/member[name='description']") + If description Is Nothing Then + Throw New MetaException("05", "Page Struct Element, Description, not Sent.") + End If + + temp.description = description.LastChild.InnerText + + Dim link = node.SelectSingleNode("value/struct/member[name='link']") + temp.link = If(link Is Nothing, String.Empty, link.LastChild.InnerText) + + Dim excerpt = node.SelectSingleNode("value/struct/member[name='mt_excerpt']") + temp.excerpt = If(excerpt Is Nothing, String.Empty, excerpt.LastChild.InnerText) + + Dim cats = New List(Of String)() + Dim categories = node.SelectSingleNode("value/struct/member[name='categories']") + If categories IsNot Nothing Then + Dim categoryArray = categories.LastChild + Dim categoryArrayNodes As XmlNodeList = categoryArray.SelectNodes("array/data/value/string") + If categoryArrayNodes IsNot Nothing Then + For Each objNode As XmlNode In categoryArrayNodes + cats.Add(objNode.InnerText) + Next + End If + End If + + temp.categories = cats + + ' postDate has a few different names to worry about + Dim dateCreated = node.SelectSingleNode("value/struct/member[name='dateCreated']") + Dim pubDate = node.SelectSingleNode("value/struct/member[name='pubDate']") + If dateCreated IsNot Nothing Then + Try + Dim tempDate = dateCreated.LastChild.InnerText + temp.postDate = DateTime.ParseExact(tempDate, "yyyyMMdd'T'HH':'mm':'ss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + Catch ex As Exception + ' Ignore PubDate Error + Debug.WriteLine(ex.Message) + End Try + ElseIf pubDate IsNot Nothing Then + Try + Dim tempPubDate = pubDate.LastChild.InnerText + temp.postDate = DateTime.ParseExact(tempPubDate, "yyyyMMdd'T'HH':'mm':'ss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + Catch ex As Exception + ' Ignore PubDate Error + Debug.WriteLine(ex.Message) + End Try + End If + + ' WLW tags implementation using mt_keywords + Dim tags = New List(Of String)() + Dim keywords = node.SelectSingleNode("value/struct/member[name='mt_keywords']") + If keywords IsNot Nothing Then + Dim tagsList = keywords.LastChild.InnerText + For Each item As String In tagsList.Split(","c) + If (item.Trim() <> "") Then + tags.Add(item.Trim()) + End If + Next + End If + + temp.tags = tags + + Return temp + End Function + + Private Sub LoadXmlRequest(xml As String) + Dim request = New XmlDocument() + Try + If Not (xml.StartsWith(" "0" AndAlso _inputParams(4).InnerText <> "false" + Exit Select + Case "metaWeblog.editPost" + PostId = _inputParams(0).InnerText + UserName = _inputParams(1).InnerText + Password = _inputParams(2).InnerText + Post = GetPost(_inputParams(3)) + Publish = _inputParams(4).InnerText <> "0" AndAlso _inputParams(4).InnerText <> "false" + Exit Select + Case "metaWeblog.getPost" + PostId = _inputParams(0).InnerText + UserName = _inputParams(1).InnerText + Password = _inputParams(2).InnerText + Exit Select + Case "metaWeblog.newMediaObject" + BlogId = _inputParams(0).InnerText + UserName = _inputParams(1).InnerText + Password = _inputParams(2).InnerText + MediaObject = GetMediaObject(_inputParams(3)) + Exit Select + Case "metaWeblog.getCategories", "wp.getTags" + BlogId = _inputParams(0).InnerText + UserName = _inputParams(1).InnerText + Password = _inputParams(2).InnerText + Exit Select + Case "metaWeblog.getRecentPosts" + BlogId = _inputParams(0).InnerText + UserName = _inputParams(1).InnerText + Password = _inputParams(2).InnerText + NumberOfPosts = Int32.Parse(_inputParams(3).InnerText, CultureInfo.InvariantCulture) + Exit Select + Case "blogger.getUsersBlogs", "metaWeblog.getUsersBlogs" + AppKey = _inputParams(0).InnerText + UserName = _inputParams(1).InnerText + Password = _inputParams(2).InnerText + Exit Select + Case "blogger.deletePost" + AppKey = _inputParams(0).InnerText + PostId = _inputParams(1).InnerText + UserName = _inputParams(2).InnerText + Password = _inputParams(3).InnerText + Publish = _inputParams(4).InnerText <> "0" AndAlso _inputParams(4).InnerText <> "false" + Exit Select + Case Else + Throw New MetaException("02", String.Format("Unknown Method. ({0})", MethodName)) + End Select + End Sub + + Private Shared Function ParseRequest(context As HttpContext) As String + Dim buffer = New Byte(context.Request.InputStream.Length - 1) {} + + context.Request.InputStream.Position = 0 + context.Request.InputStream.Read(buffer, 0, buffer.Length) + + Return Encoding.UTF8.GetString(buffer) + End Function + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/API/MetaWebLog/XmlrpcResponse.vb b/API/MetaWebLog/XmlrpcResponse.vb new file mode 100755 index 0000000..7915be5 --- /dev/null +++ b/API/MetaWebLog/XmlrpcResponse.vb @@ -0,0 +1,488 @@ +Imports System.Xml + +Namespace Ventrian.NewsArticles.API.MetaWebLog + + Friend Class XmlrpcResponse + +#Region "Private Members" + + Private ReadOnly _methodName As String + +#End Region + +#Region "Constructors and Destructors" + + Public Sub New(methodName As String) + _methodName = methodName + Blogs = New List(Of MetaBlogInfo)() + Categories = New List(Of MetaCategoryInfo)() + Keywords = New List(Of String)() + Posts = New List(Of MetaPostInfo)() + End Sub + +#End Region + +#Region "Properties" + + Public Property Blogs As List(Of MetaBlogInfo) + Public Property Categories As List(Of MetaCategoryInfo) + Public Property Completed As Boolean + Public Property Fault As MetaFaultInfo + Public Property Keywords As List(Of String) + Public Property MediaUrlInfo As MetaMediaUrlInfo + Public Property Post As MetaPostInfo + Public Property PostId As String + Public Property Posts As List(Of MetaPostInfo) + +#End Region + +#Region "Public Methods" + + Public Sub Response(context As HttpContext) + + context.Response.ContentType = "text/xml" + Using data As New XmlTextWriter(context.Response.OutputStream, Encoding.UTF8) + data.Formatting = Formatting.Indented + data.WriteStartDocument() + data.WriteStartElement("methodResponse") + data.WriteStartElement(If(_methodName = "fault", "fault", "params")) + + Select Case _methodName + Case "metaWeblog.newPost" + WriteNewPost(data) + Exit Select + Case "metaWeblog.getPost" + WritePost(data) + Exit Select + Case "metaWeblog.newMediaObject" + WriteMediaInfo(data) + Exit Select + Case "metaWeblog.getCategories" + WriteGetCategories(data) + Exit Select + Case "metaWeblog.getRecentPosts" + WritePosts(data) + Exit Select + Case "blogger.getUsersBlogs", "metaWeblog.getUsersBlogs" + WriteGetUsersBlogs(data) + Exit Select + Case "metaWeblog.editPost", "blogger.deletePost" + WriteBool(data) + Exit Select + Case "wp.getTags" + WriteKeywords(data) + Exit Select + Case "fault" + WriteFault(data) + Exit Select + End Select + + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndDocument() + End Using + + End Sub + +#End Region + +#Region "Methods" + + Private Shared Function ConvertDatetoIso8601([date] As DateTime) As String + Dim temp = String.Format("{0}{1}{2}T{3}:{4}:{5}", [date].Year, [date].Month.ToString().PadLeft(2, "0"c), [date].Day.ToString().PadLeft(2, "0"c), [date].Hour.ToString().PadLeft(2, "0"c), [date].Minute.ToString().PadLeft(2, "0"c), _ + [date].Second.ToString().PadLeft(2, "0"c)) + Return temp + End Function + + Private Sub WriteBool(data As XmlWriter) + Dim postValue = "0" + If Completed Then + postValue = "1" + End If + + data.WriteStartElement("param") + data.WriteStartElement("value") + data.WriteElementString("boolean", postValue) + data.WriteEndElement() + data.WriteEndElement() + End Sub + + Private Sub WriteFault(data As XmlWriter) + data.WriteStartElement("value") + data.WriteStartElement("struct") + + ' faultCode + data.WriteStartElement("member") + data.WriteElementString("name", "faultCode") + data.WriteElementString("value", Fault.FaultCode) + data.WriteEndElement() + + ' faultString + data.WriteStartElement("member") + data.WriteElementString("name", "faultString") + data.WriteElementString("value", Fault.FaultString) + data.WriteEndElement() + + data.WriteEndElement() + data.WriteEndElement() + End Sub + + Private Sub WriteGetCategories(data As XmlWriter) + data.WriteStartElement("param") + data.WriteStartElement("value") + data.WriteStartElement("array") + data.WriteStartElement("data") + + For Each category As MetaCategoryInfo In Categories + data.WriteStartElement("value") + data.WriteStartElement("struct") + + ' description + data.WriteStartElement("member") + data.WriteElementString("name", "description") + data.WriteElementString("value", category.Description) + data.WriteEndElement() + + ' categoryid + data.WriteStartElement("member") + data.WriteElementString("name", "categoryid") + data.WriteElementString("value", category.Id) + data.WriteEndElement() + + ' title + data.WriteStartElement("member") + data.WriteElementString("name", "title") + data.WriteElementString("value", category.Title) + data.WriteEndElement() + + ' htmlUrl + data.WriteStartElement("member") + data.WriteElementString("name", "htmlUrl") + data.WriteElementString("value", category.HtmlUrl) + data.WriteEndElement() + + ' rssUrl + data.WriteStartElement("member") + data.WriteElementString("name", "rssUrl") + data.WriteElementString("value", category.RssUrl) + data.WriteEndElement() + + data.WriteEndElement() + data.WriteEndElement() + Next + + ' Close tags + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndElement() + End Sub + + Private Sub WriteGetUsersBlogs(data As XmlWriter) + data.WriteStartElement("param") + data.WriteStartElement("value") + data.WriteStartElement("array") + data.WriteStartElement("data") + + For Each blog As MetaBlogInfo In Blogs + data.WriteStartElement("value") + data.WriteStartElement("struct") + + ' url + data.WriteStartElement("member") + data.WriteElementString("name", "url") + data.WriteElementString("value", blog.Url) + data.WriteEndElement() + + ' blogid + data.WriteStartElement("member") + data.WriteElementString("name", "blogid") + data.WriteElementString("value", blog.BlogId) + data.WriteEndElement() + + ' blogName + data.WriteStartElement("member") + data.WriteElementString("name", "blogName") + data.WriteElementString("value", blog.BlogName) + data.WriteEndElement() + + data.WriteEndElement() + data.WriteEndElement() + Next + + ' Close tags + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndElement() + End Sub + + Private Sub WriteKeywords(data As XmlWriter) + data.WriteStartElement("param") + data.WriteStartElement("value") + data.WriteStartElement("array") + data.WriteStartElement("data") + + For Each keyword As String In Keywords + data.WriteStartElement("value") + data.WriteStartElement("struct") + + ' keywordName + data.WriteStartElement("member") + data.WriteElementString("name", "name") + data.WriteElementString("value", keyword) + data.WriteEndElement() + + data.WriteEndElement() + data.WriteEndElement() + Next + + ' Close tags + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndElement() + End Sub + + Private Sub WriteMediaInfo(data As XmlWriter) + data.WriteStartElement("param") + data.WriteStartElement("value") + data.WriteStartElement("struct") + + ' url + data.WriteStartElement("member") + data.WriteElementString("name", "url") + data.WriteStartElement("value") + data.WriteElementString("string", MediaUrlInfo.Url) + data.WriteEndElement() + data.WriteEndElement() + + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndElement() + End Sub + + Private Sub WriteNewPost(data As XmlWriter) + data.WriteStartElement("param") + data.WriteStartElement("value") + data.WriteElementString("string", PostId) + data.WriteEndElement() + data.WriteEndElement() + End Sub + + Private Sub WritePost(data As XmlWriter) + data.WriteStartElement("param") + data.WriteStartElement("value") + data.WriteStartElement("struct") + + ' postid + data.WriteStartElement("member") + data.WriteElementString("name", "postid") + data.WriteStartElement("value") + data.WriteElementString("string", Post.PostId) + data.WriteEndElement() + data.WriteEndElement() + + ' title + data.WriteStartElement("member") + data.WriteElementString("name", "title") + data.WriteStartElement("value") + data.WriteElementString("string", Post.Title) + data.WriteEndElement() + data.WriteEndElement() + + ' description + data.WriteStartElement("member") + data.WriteElementString("name", "description") + data.WriteStartElement("value") + data.WriteElementString("string", Post.Description) + data.WriteEndElement() + data.WriteEndElement() + + ' link + data.WriteStartElement("member") + data.WriteElementString("name", "link") + data.WriteStartElement("value") + data.WriteElementString("string", Post.Link) + data.WriteEndElement() + data.WriteEndElement() + + ' excerpt + data.WriteStartElement("member") + data.WriteElementString("name", "mt_excerpt") + data.WriteStartElement("value") + data.WriteElementString("string", Post.Excerpt) + data.WriteEndElement() + data.WriteEndElement() + + ' dateCreated + data.WriteStartElement("member") + data.WriteElementString("name", "dateCreated") + data.WriteStartElement("value") + data.WriteElementString("dateTime.iso8601", ConvertDatetoIso8601(Post.PostDate)) + data.WriteEndElement() + data.WriteEndElement() + + ' publish + data.WriteStartElement("member") + data.WriteElementString("name", "publish") + data.WriteStartElement("value") + data.WriteElementString("boolean", If(Post.Publish, "1", "0")) + + data.WriteEndElement() + data.WriteEndElement() + + ' tags (mt_keywords) + data.WriteStartElement("member") + data.WriteElementString("name", "mt_keywords") + data.WriteStartElement("value") + Dim tags = New String(Post.Tags.Count - 1) {} + For i As Integer = 0 To Post.Tags.Count - 1 + tags(i) = Post.Tags(i) + Next + + Dim tagList = String.Join(",", tags) + data.WriteElementString("string", tagList) + data.WriteEndElement() + data.WriteEndElement() + + ' categories + If Post.Categories.Count > 0 Then + data.WriteStartElement("member") + data.WriteElementString("name", "categories") + data.WriteStartElement("value") + data.WriteStartElement("array") + data.WriteStartElement("data") + For Each cat As String In Post.Categories + data.WriteStartElement("value") + data.WriteElementString("string", cat) + data.WriteEndElement() + Next + + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndElement() + End If + + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndElement() + End Sub + + Private Sub WritePosts(data As XmlWriter) + data.WriteStartElement("param") + data.WriteStartElement("value") + data.WriteStartElement("array") + data.WriteStartElement("data") + + For Each childPost As MetaPostInfo In Posts + data.WriteStartElement("value") + data.WriteStartElement("struct") + + ' postid + data.WriteStartElement("member") + data.WriteElementString("name", "postid") + data.WriteStartElement("value") + data.WriteElementString("string", childPost.PostId) + data.WriteEndElement() + data.WriteEndElement() + + ' dateCreated + data.WriteStartElement("member") + data.WriteElementString("name", "dateCreated") + data.WriteStartElement("value") + data.WriteElementString("dateTime.iso8601", ConvertDatetoIso8601(childPost.PostDate)) + data.WriteEndElement() + data.WriteEndElement() + + ' title + data.WriteStartElement("member") + data.WriteElementString("name", "title") + data.WriteStartElement("value") + data.WriteElementString("string", childPost.Title) + data.WriteEndElement() + data.WriteEndElement() + + ' description + data.WriteStartElement("member") + data.WriteElementString("name", "description") + data.WriteStartElement("value") + data.WriteElementString("string", childPost.Description) + data.WriteEndElement() + data.WriteEndElement() + + ' link + data.WriteStartElement("member") + data.WriteElementString("name", "link") + data.WriteStartElement("value") + data.WriteElementString("string", childPost.Link) + data.WriteEndElement() + data.WriteEndElement() + + ' excerpt + data.WriteStartElement("member") + data.WriteElementString("name", "mt_excerpt") + data.WriteStartElement("value") + data.WriteElementString("string", childPost.Excerpt) + data.WriteEndElement() + data.WriteEndElement() + + ' tags (mt_keywords) + data.WriteStartElement("member") + data.WriteElementString("name", "mt_keywords") + data.WriteStartElement("value") + Dim tags = New String(childPost.Tags.Count - 1) {} + For i As Integer = 0 To childPost.Tags.Count - 1 + tags(i) = childPost.Tags(i) + Next + + Dim tagList = String.Join(",", tags) + data.WriteElementString("string", tagList) + data.WriteEndElement() + data.WriteEndElement() + + ' publish + data.WriteStartElement("member") + data.WriteElementString("name", "publish") + data.WriteStartElement("value") + data.WriteElementString("boolean", If(childPost.Publish, "1", "0")) + + data.WriteEndElement() + data.WriteEndElement() + + ' categories + If childPost.Categories.Count > 0 Then + data.WriteStartElement("member") + data.WriteElementString("name", "categories") + data.WriteStartElement("value") + data.WriteStartElement("array") + data.WriteStartElement("data") + For Each cat As String In childPost.Categories + data.WriteStartElement("value") + data.WriteElementString("string", cat) + data.WriteEndElement() + Next + + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndElement() + End If + + data.WriteEndElement() + data.WriteEndElement() + Next + + ' Close tags + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndElement() + data.WriteEndElement() + End Sub + +#End Region + + End Class + +End Namespace diff --git a/API/MetaWebLog/wlwmanifest.xml b/API/MetaWebLog/wlwmanifest.xml new file mode 100755 index 0000000..7669dee --- /dev/null +++ b/API/MetaWebLog/wlwmanifest.xml @@ -0,0 +1,19 @@ + + + + Metaweblog + Yes + Yes + No + No + No + No + Yes + No + No + No + Yes + No + {FileName} + + \ No newline at end of file diff --git a/API/Rsd.ashx b/API/Rsd.ashx new file mode 100755 index 0000000..3b2750f --- /dev/null +++ b/API/Rsd.ashx @@ -0,0 +1 @@ +<%@ WebHandler Language="VB" CodeBehind="Rsd.ashx.vb" Class="Ventrian.NewsArticles.API.Rsd" %> diff --git a/API/Rsd.ashx.vb b/API/Rsd.ashx.vb new file mode 100755 index 0000000..75438ad --- /dev/null +++ b/API/Rsd.ashx.vb @@ -0,0 +1,53 @@ +Imports System.Web +Imports System.Xml +Imports Ventrian.NewsArticles.Components.Common + +Namespace Ventrian.NewsArticles.API + + Public Class Rsd + Implements IHttpHandler + + Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest + + context.Response.ContentType = "text/xml" + + Using data As New XmlTextWriter(context.Response.OutputStream, Encoding.UTF8) + data.Formatting = Formatting.Indented + data.WriteStartDocument() + data.WriteStartElement("rsd") + data.WriteAttributeString("version", "1.0") + + data.WriteStartElement("service") + + data.WriteElementString("engineName", "Ventrian News Articles") + data.WriteElementString("engineLink", "http://www.ventrian.com/") + data.WriteElementString("homePageLink", context.Request("url")) + + data.WriteStartElement("apis") + + data.WriteStartElement("api") + data.WriteAttributeString("name", "MetaWeblog") + data.WriteAttributeString("preferred", "true") + data.WriteAttributeString("apiLink", ArticleUtilities.ToAbsoluteUrl("~/desktopmodules/dnnforge%20-%20newsarticles/api/metaweblog/handler.ashx")) + data.WriteAttributeString("blogID", context.Request("id")) + data.WriteEndElement() + + data.WriteEndElement() + + data.WriteEndElement() + + data.WriteEndElement() + data.WriteEndDocument() + End Using + + End Sub + + ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable + Get + Return False + End Get + End Property + + End Class + +End Namespace \ No newline at end of file diff --git a/App_LocalResources/Archives.ascx.resx b/App_LocalResources/Archives.ascx.resx new file mode 100755 index 0000000..0de79fb --- /dev/null +++ b/App_LocalResources/Archives.ascx.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + articles + + + By Author + + + By Category + + + By Month + + + Archives + + + Latest 25 Articles + + \ No newline at end of file diff --git a/App_LocalResources/Handout.ascx.resx b/App_LocalResources/Handout.ascx.resx new file mode 100755 index 0000000..ef38e9f --- /dev/null +++ b/App_LocalResources/Handout.ascx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add New Handout + + + Add New Handout + + + View/Print + + + Are You Sure You Want To Delete This Handout? + + + My Handouts + + + You must configure this module first via "Settings". + + + Suggested Handouts + + + There are no suggested handouts found. + + \ No newline at end of file diff --git a/App_LocalResources/HandoutDetail.ascx.resx b/App_LocalResources/HandoutDetail.ascx.resx new file mode 100755 index 0000000..e02a860 --- /dev/null +++ b/App_LocalResources/HandoutDetail.ascx.resx @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add Articles + + + Selected Article List + + + Add Articles + + + Handout Details + + + There are no articles in the handout currently. + + + Select categories to add articles from. + + + Select Categories + + + Optionally specify a description for the Handout. + + + Description + + + Specify a name for the Handout. + + + Handout Name + + + You Must Enter a Name For The Handout + + + view full article... + + + Clear List + + + Save Handout + + + Are You Sure You Want To Delete This Handout? + + + Hold down ctrl to select multiple categories. + + \ No newline at end of file diff --git a/App_LocalResources/HandoutSettings.ascx.resx b/App_LocalResources/HandoutSettings.ascx.resx new file mode 100755 index 0000000..5baf3bc --- /dev/null +++ b/App_LocalResources/HandoutSettings.ascx.resx @@ -0,0 +1,468 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Article Module + + + Set the article module to link to. + + + News Handout Settings + + + A0 + + + A1 + + + A10 + + + A2 + + + A3 + + + A4 + + + A5 + + + A6 + + + A7 + + + A8 + + + A9 + + + ArchA + + + ArchB + + + ArchC + + + ArchD + + + ArchE + + + B0 + + + B1 + + + B2 + + + B3 + + + B4 + + + B5 + + + Custom + + + Flsa + + + HalfLetter + + + Ledger + + + Legal + + + Letter + + + Letter11x17 + + + Note + + + PDF Settings + + + Specify the page size for the pdf. + + + Page Size + + + Best + + + Landscape + + + No Compression + + + Normal + + + Specify a height for the footer. + + + Footer Height + + + Specify a height for the header. + + + Header Height + + + Specify a bottom margin. + + + Margin Bottom + + + Specify a left margin. + + + Margin Left + + + Specify a right margin. + + + Margin Right + + + Specify a top margin. + + + Margin Top + + + Specify the page compression for the pdf. + + + Page Compression + + + Specify the page orientation for the pdf. + + + Page Orientation + + + Pick display option for footer. + + + Footer Mode + + + Pick display option for header. + + + Header Mode + + + Suggested Handout Username + + + Portrait + + + Footer Height is Required + + + Footer Height must be a Number + + + Header Height is Required + + + Header Height must be a Number + + + Margin Bottom is Required + + + Margin Bottom must be a Number + + + Margin Left is Required + + + Margin Left must be a Number + + + Margin Right is Required + + + Margin Right must be a Number + + + Margin Top is Required + + + Margin Top must be a Number + + + Username is invalid. + + + Check to show footer on the cover page. + + + On Cover Page? + + + Check to show header on the cover page. + + + On Cover Page? + + + Footer Settings + + + Header Settings + + + Specify text to show in the footer, leave blank to use template html. + + + Footer Text + + + Specify text to show in the header, leave blank to use template html. + + + Header Text + + + Check to show page numbers. + + + Page Numbers? + + + Select the font color for the footer. + + + Font Color + + + Select the font for the footer. + + + Font Type + + + Select the font size for the footer. + + + Font Size + + + Select the font color for the header. + + + Font Color + + + Select the font for the header. + + + Font Type + + + Select the font size for the header. + + + Font Size + + + Handout.Footer.html + + + Handout.Header.html + + + Text + + + Text + + + Footer Text Size is required. + + + Footer Text Size must be a number. + + + Header Text Size is required. + + + Header Text Size must be a number. + + + Select the categories available to users for handout creation. + + + Available Categories + + + All Categories + + + Selected Categories + + + Hold down ctrl to select multiple categories. + + + Specify permissions for handouts. + + + Permissions + + + Security Settings + + + Submit + + \ No newline at end of file diff --git a/App_LocalResources/LatestArticles.ascx.resx b/App_LocalResources/LatestArticles.ascx.resx new file mode 100755 index 0000000..5f405ca --- /dev/null +++ b/App_LocalResources/LatestArticles.ascx.resx @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + You must configure this module first via "Module Settings" + + + <h1>Latest Articles</h1><p>This module allows you to display a list of latest articles.</p> + + + Expiry Date + + + Highest Rated + + + Last Update + + + Most Commented + + + Most Viewed + + + Publish Date + + + Random + + + Title + + + All Time + + + 7 Days + + + Last Year + + + -- Select Category -- + + + Three Days + + + Today + + + Yesterday + + + 90 Days + + + 30 Days + + + This Year + + + -- Select Author -- + + + -- Select {0} -- + + \ No newline at end of file diff --git a/App_LocalResources/LatestArticlesOptions.ascx.resx b/App_LocalResources/LatestArticlesOptions.ascx.resx new file mode 100755 index 0000000..4a8eba8 --- /dev/null +++ b/App_LocalResources/LatestArticlesOptions.ascx.resx @@ -0,0 +1,678 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + In this section, you can adjust the settings for the "Latest Articles" module. + + + Latest Articles Settings + + + Basic Settings + + + Article Module + + + Set the article module to link to. + + + Categories + + + Select categories to display. + + + All Categories + + + Match Any + + + Match All + + + Number of Articles + + + Number of articles to display. + + + Start Date + + + Date to begin showing articles from. + + + <br>* Leave blank to always start from the current date. + + + <br>Invalid start date! + + + Max Age + + + Maximum age of articles (days), leave blank for no filter. + + + (days), leave blank for no filter. + + + Sort By + + + Select field to sort articles by. + + + Sort Direction + + + Select direction for sort. + + + Ascending + + + Descending + + + Publish Date + + + Last Update + + + Highest Rated + + + Most Commented + + + Most Viewed + + + Title + + + Launch Links? + + + Check to launch links into page by itself (no other modules loaded). + + + Featured Only: + + + Show Featured Articles Only. + + + Not Featured Only: + + + Show Articles that are not featured only. + + + Author: + + + Optionally filter by author. + + + Select Author + + + -- All Authors -- + + + Layout Mode + + + Select a layout mode for displaying latest articles. + + + Simple + + + Advanced + + + HTML Header + + + Enter the header html for the latest articles module. + + + HTML Body + + + Enter the body html for the latest articles module. + + + HTML Footer + + + Enter the footer html for the latest articles module. + + + Items Per Row + + + Enter the number of items to display per row. + + + <br>Items Per Row Is Required. + + + <br>Items Per Row Must Be A Number. + + + Template Help + + + In this section, you can view the tags for customizing the latest articles template. + + + The ID of the article + + + The link to the actual article + + + The name of the author based on the configuration settings. + + + The email of the author + + + The username of the author + + + The first name of the author + + + The last name of the author + + + The full name of the author + + + The ID of the author + + + Comma delimited list of categories hyperlinked + + + The link to the comment section of the article. + + + The creation date of the article + + + The creation date of the article, the XXX can be replaced with a date format expression + + + The creation time of the article + + + The comment count of the article + + + Displays the details of the current page. + + + Displays a edit link to authorised users. + + + Allows the option to show a section of html if an article has categories. + + + Allows the option to show a section of html if an article has comments enabled. + + + Allows the option to show a section of html if an article has a link. + + + Allows the option to show a section of html if an article has more detail. + + + Allows the option to show a section of html if an article has multiple pages. + + + Allows the option to show a section of html if an article has ratings enabled. + + + The image of the article, displays nothing if no image selected. + + + The link to the image of the article, displays nothing if no image selected. + + + The image of the article (thumbnailed to a width of XXX), displays nothing if no image selected. + + + The link to the article image (thumbnailed to a width of XXX), displays nothing if no image selected. + + + The link to the article, url, another page or file. + + + The target of the link based on launch links. + + + The module ID of the article module. + + + The number of pages within an article. + + + The detail of the article. + + + The link to print an article. + + + The publish date of the article + + + The publish date of the article, the XXX can be replaced with a date format expression + + + The publish time of the article + + + The publish end date of the article + + + The publish end time of the article + + + The rating of the article + + + The number of the ratings on an article + + + The actual rating value of an article + + + The link to the rss feed + + + A list of pages within the article hyperlinked. If there is only 1 page, token is blank. + + + The summary of the article + + + The summary of the article restricted by number of characters, e.g. replace XXX with 50 to restrict to 50 chars. + + + The title of the article + + + The last update date of the article + + + The last update date of the article, the XXX can be replaced with a date format expression + + + The last update time of the article + + + You must specify the number of articles to display. + + + Must be a valid number. + + + Must be a valid number. + + + The view count for the article + + + Latest Articles Options + + + <h1>Latest Articles Options</h1><p>This module allows you to choose from the various admin options.</p> + + + Random + + + Filter Settings + + + Check to filter by author on the querystring parameter. + + + UserID Filter: + + + Enter the name of the parameter to filter on. + + + UserID Parameter: + + + Template + + + Latest Articles + + + Expiry Date + + + Start Point + + + (0 to start at beginning) + + + Enter a start point to begin showing articles (0 to start at beginning). + + + <br>Start Point Is Required. + + + <br>Start Point Must Be A Number. + + + Enter the text to display when no articles match filter settings. + + + HTML No Articles + + + Check to only show unsecured articles. + + + Not Secured Only + + + Check to only show secured articles. + + + Secured Only + + + Check to bring featured articles to the top of the listing. + + + Featured Articles to Top? + + + Enable Pager? + + + Check to enable a pager at the bottom fo latest articles. + + + Specify how many articles per page. + + + Pager Size + + + Page Size is Required. + + + Page Size Must Be A Number. + + + Enter a comma separated list of article IDs. + + + Article IDs + + + Hold down ctrl to select multiple. + + + Author Filter Settings + + + Check to filter by the logged in user. + + + Logged in user Filter: + + + Check to filter by username. + + + Username Filter: + + + Specify what parameter to select from. + + + Username Parameter: + + + Check to show pending articles. + + + Show Pending + + + Select categories to exclude. + + + Exclude Categories + + + Check to show related articles when viewing a category or an article. + + + Show Related + + + Filter by tags + + + Tags: + + + Separate keywords by commas e.g. Cowboy,Texas Rodeo,2009 + + + Tag Filter Settings + + + A dropdown to filter by category. + + + Header/Footer Tokens + + + Item Tokens + + + A dropdown to sort by available options. + + + A link to sort by the chosen field, valid values are PublishDate, ExpiryDate, LastUpdate, HighestRated, MostCommented, MostViewed, Random, SortTitle + + + A dropdown to filter by time periods. + + + A dropdown with the field XXX selected by default, e.g. Today, Yesterday, ThreeDays, SevenDays, ThirtyDays, NinetyDays, ThisYear, AllTime + + + Specify a custom field to filter on. + + + Custom Field Filter: + + + -- Custom Field -- + + + A dropdown to filter by author. + + + A dropdown to filter by custom field where XXX is the name of the field. This only works for dropdown lists. + + + Check to include the template stylesheet. + + + Include Stylesheet? + + + Link Filter: + + + None + + + Page + + + Url + + + Load from Template + + + Save as reusable Template + + + Select to load from template + + + Load from Template + + + Optionally save the current template for use later. + + + Save Template + + + (template name) + + + Template Saves + + \ No newline at end of file diff --git a/App_LocalResources/LatestComments.ascx.resx b/App_LocalResources/LatestComments.ascx.resx new file mode 100755 index 0000000..5d968a7 --- /dev/null +++ b/App_LocalResources/LatestComments.ascx.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + You must configure this module first via "Module Settings" + + \ No newline at end of file diff --git a/App_LocalResources/LatestCommentsOptions.ascx.resx b/App_LocalResources/LatestCommentsOptions.ascx.resx new file mode 100755 index 0000000..3afd7a1 --- /dev/null +++ b/App_LocalResources/LatestCommentsOptions.ascx.resx @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Latest Comments Settings + + + Number of comments to display. + + + Comment Count + + + Enter the body html for the latest comments module. + + + HTML Body + + + Enter the footer html for the latest comments module. + + + HTML Footer + + + Enter the header html for the latest comments module. + + + HTML Header + + + Enter the text to display when no comments match filter settings. + + + HTML No Comments + + + Check to include the template stylesheet. + + + Include Stylesheet? + + + Set the article module to link to. + + + Article Module + + + Template + + + You must specify the number of comments to display. + + + Must be a valid number. + + \ No newline at end of file diff --git a/App_LocalResources/NewsArchives.ascx.resx b/App_LocalResources/NewsArchives.ascx.resx new file mode 100755 index 0000000..4e7ec90 --- /dev/null +++ b/App_LocalResources/NewsArchives.ascx.resx @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +text/microsoft-resx + + +1.3 + + +System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + +System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + +You must configure this module first via "Module Settings" + + +View Options + + +<h1>Latest Articles</h1><p>This module allows you to display a list of latest articles.</p> + + \ No newline at end of file diff --git a/App_LocalResources/NewsArchivesOptions.ascx.resx b/App_LocalResources/NewsArchivesOptions.ascx.resx new file mode 100755 index 0000000..2fe2e94 --- /dev/null +++ b/App_LocalResources/NewsArchivesOptions.ascx.resx @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Archive Mode + + + Set the mode for the archives. + + + Date + + + Category + + + Author + + + Article Module + + + Set the article module to link to. + + + Layout Mode + + + Select a layout mode for displaying archives. + + + Simple + + + Advanced + + + Hide Zero Categories + + + Check to hide categories with 0 articles. + + + HTML Header + + + Enter the header html for the news archives module. + + + HTML Body + + + Enter the body html for the news archives module. + + + HTML Footer + + + Enter the footer html for the news archives module. + + + Items Per Row + + + Enter the number of items to display per row. + + + Items Per Row Is Required. + + + Items Per Row Must Be A Number + + + News Archive Options + + + <h1>News Archives Options</h1><p>This module allows you to choose from the various admin options.</p> + + + Change how date archives are grouped. + + + Group By + + + Display Name + + + First Name + + + Last Name + + + Select which field to sort authors by. + + + Sort By + + + Username + + + Optionally specify how many levels deep to show, leave blank for unlimited. + + + Max Depth + + + * Leave blank for unlimited. + + + -- No Parent Category -- + + + Select a parent category to filter by. + + + Parent Category + + + * Must be a number. + + + Basic Settings + + + Template Settings + + + Article Count + + \ No newline at end of file diff --git a/App_LocalResources/NewsSearch.ascx.resx b/App_LocalResources/NewsSearch.ascx.resx new file mode 100755 index 0000000..0114756 --- /dev/null +++ b/App_LocalResources/NewsSearch.ascx.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + You must configure this module first via "Module Settings" + + + <h1>Search Articles</h1><p>This module allows you to search articles.</p> + + + Search + + \ No newline at end of file diff --git a/App_LocalResources/NewsSearchOptions.ascx.resx b/App_LocalResources/NewsSearchOptions.ascx.resx new file mode 100755 index 0000000..63cc918 --- /dev/null +++ b/App_LocalResources/NewsSearchOptions.ascx.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Article Module + + + Set the article module to link to. + + + News Search Options + + + <h1>News Search Options</h1><p>This module allows you to choose from the various admin options.</p> + + + -- No Parent Category -- + + \ No newline at end of file diff --git a/App_LocalResources/PostComment.ascx.resx b/App_LocalResources/PostComment.ascx.resx new file mode 100755 index 0000000..fa4265e --- /dev/null +++ b/App_LocalResources/PostComment.ascx.resx @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Email (required) + + + Name (required) + + + Email Is Required + + + Name Is Required + + + Website + + + Add Comment + + + Notify me of followup comments via e-mail + + + Only registered users may post comments. + + + Your comment has been submitted, but requires approval. + + + <br>Comment Is Required + + + Code is invalid. + + + Invalid Email Address + + + Enter the code shown above: + + + Email (not required) + + + Name (not required) + + \ No newline at end of file diff --git a/App_LocalResources/PostRating.ascx.resx b/App_LocalResources/PostRating.ascx.resx new file mode 100755 index 0000000..7e5fee5 --- /dev/null +++ b/App_LocalResources/PostRating.ascx.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Rating Saved! + + \ No newline at end of file diff --git a/App_LocalResources/SharedResources.resx b/App_LocalResources/SharedResources.resx new file mode 100755 index 0000000..da39c4b --- /dev/null +++ b/App_LocalResources/SharedResources.resx @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Current Articles + + + Archives + + + Search + + + Create Article + + + My Articles + + + Approve Articles + + + Admin Options + + + Previous Page + + + Next Page + + + Currently, there are no comments. Be the first to post one!<br> + + + <br>No Articles Found. + + + You must be logged in to post a comment. You can login <a href="{0}" class="CommandButton">here</a> + + + Click <a href="{0}" class="CommandButton">here</a> to post a comment + + + Approve Comments + + + [AUTHOR] created the article <a title='[ARTICLETITLE]' href='[ARTICLELINK]'>[ARTICLETITLE]</a> + + + [AUTHOR] created a comment on article <a title='[ARTICLETITLE]' href='[ARTICLELINK]'>[ARTICLETITLE]</a> + + + [AUTHOR] added a rating on article <a title='[ARTICLETITLE]' href='[ARTICLELINK]'>[ARTICLETITLE]</a> + + + Close + + + Image + + + Next + + + Of + + + Previous + + + All Time + + + Expiry Date + + + Highest Rated + + + Last Update + + + Most Commented + + + Most Viewed + + + 90 Days + + + Last Year + + + Publish Date + + + Random + + + -- Select Author -- + + + -- Select Category -- + + + -- Select {0} -- + + + 7 Days + + + Title + + + 30 Days + + + This Year + + + Three Days + + + Today + + + Yesterday + + + Root + + \ No newline at end of file diff --git a/App_LocalResources/UploadFiles.ascx.resx b/App_LocalResources/UploadFiles.ascx.resx new file mode 100755 index 0000000..72086ee --- /dev/null +++ b/App_LocalResources/UploadFiles.ascx.resx @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Are you sure you want to remove this file? + + + Files + + + In this section, you can associate files with articles. + + + No files are currently attached. + + + Attached Files + + + Select Existing Files + + + Select Files + + + Upload New Files + + + Add Existing File + + \ No newline at end of file diff --git a/App_LocalResources/UploadImages.ascx.resx b/App_LocalResources/UploadImages.ascx.resx new file mode 100755 index 0000000..962c71f --- /dev/null +++ b/App_LocalResources/UploadImages.ascx.resx @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Are you sure you want to delete this image? + + + External Image + + + Images + + + In this section, you can associate images with articles. + + + No images are currently attached. + + + Attached Images + + + Select Existing Images + + + Select Images + + + Upload New Images + + \ No newline at end of file diff --git a/App_LocalResources/ViewArchive.ascx.resx b/App_LocalResources/ViewArchive.ascx.resx new file mode 100755 index 0000000..eb38602 --- /dev/null +++ b/App_LocalResources/ViewArchive.ascx.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Archive + + + Articles from + + + View Archive + + + <h1>About View Archive</h1><p>The module shows a articles in archive.</p> + + + Entries for {0} {1} + + + Entries for {0} + + \ No newline at end of file diff --git a/App_LocalResources/ViewArticle.ascx.resx b/App_LocalResources/ViewArticle.ascx.resx new file mode 100755 index 0000000..d39d543 --- /dev/null +++ b/App_LocalResources/ViewArticle.ascx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Anonymous + + + Anonymous + + + Anonymous User + + + Anonymous + + + View Article + + + <h1>About View Article</h1><p>The module shows a single article.</p> + + + Click to Print + + + Delete + + \ No newline at end of file diff --git a/App_LocalResources/ViewAuthor.ascx.resx b/App_LocalResources/ViewAuthor.ascx.resx new file mode 100755 index 0000000..1b7cb9f --- /dev/null +++ b/App_LocalResources/ViewAuthor.ascx.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Entries for '{0}' + + + Viewing Author + + \ No newline at end of file diff --git a/App_LocalResources/ViewCategory.ascx.resx b/App_LocalResources/ViewCategory.ascx.resx new file mode 100755 index 0000000..6f85fc5 --- /dev/null +++ b/App_LocalResources/ViewCategory.ascx.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Entries for the '{0}' Category + + + Viewing Category + + \ No newline at end of file diff --git a/App_LocalResources/ViewSearch.ascx.resx b/App_LocalResources/ViewSearch.ascx.resx new file mode 100755 index 0000000..e9a3baf --- /dev/null +++ b/App_LocalResources/ViewSearch.ascx.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Search + + + Articles for '{0}' + + + Search Articles + + \ No newline at end of file diff --git a/App_LocalResources/ViewTag.ascx.resx b/App_LocalResources/ViewTag.ascx.resx new file mode 100755 index 0000000..fd91464 --- /dev/null +++ b/App_LocalResources/ViewTag.ascx.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Viewing Tag + + + Entries for '{0}' + + \ No newline at end of file diff --git a/App_LocalResources/ucAdminOptions.ascx.resx b/App_LocalResources/ucAdminOptions.ascx.resx new file mode 100755 index 0000000..5cc773b --- /dev/null +++ b/App_LocalResources/ucAdminOptions.ascx.resx @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Main Options + + + Maintain settings for your News Articles setup. + + + Categories + + + Create, edit and delete categories.. + + + Email Templates + + + Customize the emails that are sent from this module.. + + + Site Templates + + + Customize the site templates that used in this module.. + + + Admin Options + + + <h1>Admin Options</h1><p>This module allows you to choose from the various admin options.</p> + + + Custom Fields + + + Create, edit and delete custom fields.. + + + Tags + + + Create, edit and delete tags.. + + + Import Feeds + + + Configure RSS feeds to import.. + + \ No newline at end of file diff --git a/App_LocalResources/ucApproveArticles.ascx.resx b/App_LocalResources/ucApproveArticles.ascx.resx new file mode 100755 index 0000000..9f0d18b --- /dev/null +++ b/App_LocalResources/ucApproveArticles.ascx.resx @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + <br>There are no articles awaiting approval. + + + Add New Category + + + Created Date + + + Title + + + Approve? + + + Author + + + Approve Selected Articles + + + Approve All Articles + + + Approve Articles + + + <h1>About Approve Articles</h1><p>Approvers can approve articles from this screen.</p> + + + Approve Articles + + + Publish Date + + \ No newline at end of file diff --git a/App_LocalResources/ucApproveComments.ascx.resx b/App_LocalResources/ucApproveComments.ascx.resx new file mode 100755 index 0000000..8aceef4 --- /dev/null +++ b/App_LocalResources/ucApproveComments.ascx.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + <br>There are no comments awaiting approval. + + + Reject + + + Approve + + + Approve Comments + + + <h1>About Approve Comments</h1><p>Approvers can approve comments from this screen.</p> + + + Author + + + Comment + + + Date + + + Article + + + IP Address + + + Website + + \ No newline at end of file diff --git a/App_LocalResources/ucEditCategories.ascx.resx b/App_LocalResources/ucEditCategories.ascx.resx new file mode 100755 index 0000000..a972b77 --- /dev/null +++ b/App_LocalResources/ucEditCategories.ascx.resx @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + <br>There are no categories currently. + + + Add New Category + + + Edit Categories + + + <h1>About Edit Categories</h1><p>The administrator can manage the categories available for this module.</p> + + + Actions + + + Category sort order updated. + + + The child categories of the parent selection. + + + Child Categories + + + Move category down + + + Edit Category + + + Move category up + + + Update Sort Order + + + View Category + + + Move Category + + + -- No Parent Category -- + + + Select a parent category to filter on. + + + Parent Category + + + No categories exist at this level. + + \ No newline at end of file diff --git a/App_LocalResources/ucEditCategory.ascx.resx b/App_LocalResources/ucEditCategory.ascx.resx new file mode 100755 index 0000000..63c092e --- /dev/null +++ b/App_LocalResources/ucEditCategory.ascx.resx @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Category Settings + + + In this section, you can edit a category. + + + Name + + + Enter the name of the category. + + + <br>You Must Enter a Valid Title + + + Edit Category + + + <h1>About Edit Category</h1><p>The module allows you to edit a category.</p> + + + -- No Parent Category -- + + + Optionally select a parent category. + + + Parent Category + + + <br>Invalid Parent Category. Possible Loop Detected. + + + Enter the description of the category. + + + Description + + + Inherit Security? + + + Permissions + + + Submit + + + View + + + Uncheck to override security roles for categories. + + + Loose - You only have to the meet the requirement of ONE category on an article. + + + Select the permissions for these roles, view governs who can see the article and submit is for who can add to that category. + + + Restrictive - You must meet the requirements of ALL categories on an article. + + + Select the security mode for this category. + + + Security Mode + + + Meta Information + + + Optionally overrides the description for the category. + + + Description + + + Optionally overrides the keywords for the category. + + + Keywords + + + Optionally overrides the title for the category. + + + Title + + + Specify an image for a category. + + + Image + + + Security Settings + + \ No newline at end of file diff --git a/App_LocalResources/ucEditComment.ascx.resx b/App_LocalResources/ucEditComment.ascx.resx new file mode 100755 index 0000000..575cc31 --- /dev/null +++ b/App_LocalResources/ucEditComment.ascx.resx @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Specify the comment. + + + Comment + + + Edit Comment + + + Specify the email of the comment. + + + Email + + + Specify the name of the comment. + + + Name + + + Specify the url of the comment. + + + Url + + + <br>Comment Is Required + + + <br>Email Is Required + + + <br>Invalid Email Address + + + <br>Name Is Required + + \ No newline at end of file diff --git a/App_LocalResources/ucEditCustomField.ascx.resx b/App_LocalResources/ucEditCustomField.ascx.resx new file mode 100755 index 0000000..399f8ae --- /dev/null +++ b/App_LocalResources/ucEditCustomField.ascx.resx @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Enter a caption for the custom field + + + Caption + + + Enter help text for the caption. + + + Caption Help + + + Checkbox + + + Are you sure you want to delete this custom field? + + + Edit Custom Field + + + Currency + + + Custom Field Details + + + Enter the details of your custom field and then click "update". + + + Date + + + Enter a default value for the custom field + + + Default Value + + + Double + + + Drop Down List + + + Email + + + Separate values with a |, e.g. House|Land|Unit + + + Enter field elements for the custom field, separate values with a |, e.g. House|Land|Unit + + + Field Elements + + + Select a field type for the custom field + + + Field Type + + + Integer + + + <h1>Edit Custom Field</h1><p>Allows an administrator to edit or add a custom field.</p> + + + Multi Checkbox + + + Multi Line Text Box + + + Enter a name for the custom field + + + Name + + + One Line Text Box + + + Type a number for the maximum number of characters. + + + Maximum Length + + + Enter a regular expression to validate against. + + + Regular Expression + + + Radio Button + + + Regular Expression + + + Check to make the field required. + + + Required? + + + Requirement Details + + + Specify details about requirement settings. + + + Rich Text Box + + + Select a validation type for the custom field + + + Validation Type + + + Check to make the custom field visible when using the [CUSTOMFIELDS] token. + + + Visible? + + + <br>You must enter a valid caption. + + + Color Picker + + \ No newline at end of file diff --git a/App_LocalResources/ucEditCustomFields.ascx.resx b/App_LocalResources/ucEditCustomFields.ascx.resx new file mode 100755 index 0000000..1167d8e --- /dev/null +++ b/App_LocalResources/ucEditCustomFields.ascx.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add Custom Field + + + Edit Custom Fields + + + <h1>Edit Custom Fields</h1><p>Allows an administrator to edit custom fields.</p> + + + Caption + + + Field Type + + + Name + + + No custom fields currently exist. + + + Sort Order + + + Required? + + + Visible? + + \ No newline at end of file diff --git a/App_LocalResources/ucEditPage.ascx.resx b/App_LocalResources/ucEditPage.ascx.resx new file mode 100755 index 0000000..c3ce11d --- /dev/null +++ b/App_LocalResources/ucEditPage.ascx.resx @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Page Settings + + + In this section, you can edit a page settings for this article. + + + Title + + + Enter the name of the page. + + + <br>You Must Enter a Valid Title + + + Page Text + + + Enter the text for the page here. + + + Page Text Is Required + + + Edit Page + + + <h1>About Edit Page</h1><p>The module allows you to edit a page for your article.</p> + + \ No newline at end of file diff --git a/App_LocalResources/ucEditPageSortOrder.ascx.resx b/App_LocalResources/ucEditPageSortOrder.ascx.resx new file mode 100755 index 0000000..6e09b48 --- /dev/null +++ b/App_LocalResources/ucEditPageSortOrder.ascx.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Edit Sort order + + + In this section, you can change the sort order for pages in an article. + + + Sort Order + + + Change the sort order for pages. + + + Edit Sort Order + + + <h1>About Edit Sort Order</h1><p>The module allows you to edit the sort order for pages in your article.</p> + + \ No newline at end of file diff --git a/App_LocalResources/ucEditPages.ascx.resx b/App_LocalResources/ucEditPages.ascx.resx new file mode 100755 index 0000000..9371ed2 --- /dev/null +++ b/App_LocalResources/ucEditPages.ascx.resx @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +text/microsoft-resx + + +1.0.0.0 + + +System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + +System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + +<br>There are no pages currently associated with this article. (summary will be displayed) + + +Sort Order + + +Title + + +Editing pages of the article: {0} + + +Add Page + + +Edit Sort Order + + +Edit Summary + + +Are You Sure You Wish To Submit This Item ? (You will no longer be able to edit it if approved) + + +Submit For Approval + + +Edit Pages + + +<h1>Edit Pages</h1><p>Authors can add pages to an article. The module allows you to add new pages, modify existing pages and delete existing pages.</p> + + \ No newline at end of file diff --git a/App_LocalResources/ucEditTag.ascx.resx b/App_LocalResources/ucEditTag.ascx.resx new file mode 100755 index 0000000..82a51ae --- /dev/null +++ b/App_LocalResources/ucEditTag.ascx.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Are You Sure You Wish To Delete This Item ? + + + Edit Tag + + + Edit Tag + + + Edit Tags + + + <h1>About Edit Tag</h1><p>The module allows you to edit an tag.</p> + + + Enter a name for the tag. + + + Name + + + Tag Settings + + + In this section, you can edit the tag settings. + + + <br>You Must Enter a Valid Name + + \ No newline at end of file diff --git a/App_LocalResources/ucEditTags.ascx.resx b/App_LocalResources/ucEditTags.ascx.resx new file mode 100755 index 0000000..e314440 --- /dev/null +++ b/App_LocalResources/ucEditTags.ascx.resx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add Tag + + + All Albums + + + Edit Tags + + + Edit Tags + + + <h1>Edit Tags</h1><p>The module allows you to add new tags, modify existing tags and delete existing tags.</p> + + + Name + + + <br>There are no tags currently. + + \ No newline at end of file diff --git a/App_LocalResources/ucEmailTemplates.ascx.resx b/App_LocalResources/ucEmailTemplates.ascx.resx new file mode 100755 index 0000000..4de2205 --- /dev/null +++ b/App_LocalResources/ucEmailTemplates.ascx.resx @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Email Templates + + + In this section, you can customize the emails that are sent by this module. + + + Name + + + Select a Template to edit. + + + Subject + + + Subject of the email. + + + <br>You Must Enter a Valid Subject + + + Template + + + Enter the template for the email here. + + + Template Text Is Required + + + Email Template Help + + + In this section, you can view the tags for customizing emails for articles (ArticleSubmission, ArticleApproval). + + + In this section, you can view the tags for customizing emails for comments (CommentNotification, CommentRequiringApproval, CommentApproved). + + + Displays the username of article's author + + + Displays the first name of article's author + + + Displays the last name of article's author + + + Displays the surname of article's author + + + Displays the name of the portal + + + Displays the date and time the article is due to be published. + + + Displays the title of the article + + + Displays the summary of the article + + + Displays the link to access the article + + + Displays the username of comment's author + + + Displays the first name of comment's author + + + Displays the last name of comment's author + + + Displays the full name of comment's author + + + Displays the date and time the comment was posted + + + Displays the details of the comment + + + Displays the link to access the comment + + + Edit Email Templates + + + <h1>About Email Templates</h1><p>The module allows you to customize the emails that are sent from this module.</p> + + + Displays the display name of article's author + + + Displays the display name of comment's author + + + Displays the email of comment's author + + + Displays the email of article's author + + + Displays the date and time the article is created. + + \ No newline at end of file diff --git a/App_LocalResources/ucImportFeed.ascx.resx b/App_LocalResources/ucImportFeed.ascx.resx new file mode 100755 index 0000000..03d889c --- /dev/null +++ b/App_LocalResources/ucImportFeed.ascx.resx @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Select the default author for the feed. + + + Default Author + + + Check to auto-feature the articles imported from this feed. + + + Auto-Feature + + + Select the default categories to associate with the feed. Hold down ctrl to select multiple. + + + Default Categories + + + <br />Hold down ctrl to select multiple categories. + + + (Change Author) + + + Are You Sure You Wish To Delete This Item ? + + + Import Feed + + + Feed Settings + + + In this section, you can edit the feed settings. + + + Check to mark the feed active. + + + Active + + + <h1>About Import Feed</h1><p>The module allows you to import RSS feeds.</p> + + + -- Select Author -- + + + Enter a title for the feed. + + + Title + + + Enter a url for the feed. + + + Feed Url + + + <br>You Must Enter a Valid Title + + + <br>You Must Enter a Valid Url + + + Article Settings + + + In this section, you can customize the imported articles. + + + (username) + + + Date Mode + + + Feed Date + + + Import Date + + + <br />Invalid author. + + + Specify whether to auto-expire articles. + + + Auto-Expire + + \ No newline at end of file diff --git a/App_LocalResources/ucImportFeeds.ascx.resx b/App_LocalResources/ucImportFeeds.ascx.resx new file mode 100755 index 0000000..6ac8772 --- /dev/null +++ b/App_LocalResources/ucImportFeeds.ascx.resx @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add Feed + + + Import Feeds + + + Is Active? + + + <h1>Edit Feeds</h1><p>The module allows you to new feeds to import.</p> + + + <br>There are no feeds currently. + + + There is currently no history available. + + + Example: "5" and select "Minutes" to retry the task every 5 minutes after a failure. Leave blank to disable retry-timer for this task. + + + Retry Frequency + + + Check to enable the scheduler. + + + Scheduler Enabled + + + Example: "5" and select "Minutes" to run task every 5 minutes. Leave blank to disable timer for this task. + + + Time Lapse + + + Scheduler History + + + View the scheduler history for importing RSS feeds. + + + Scheduler Settings + + + Customize the settings for the scheduler to import feeds. + + + Title + + + Url + + + Description + + + Duration + + + The scheduler is not currently enabled, please contact your system administrator. + + + Start/End/Next + + + Succeeded + + + Check to delete existing articles upon import. + + + Delete Articles? + + \ No newline at end of file diff --git a/App_LocalResources/ucMyArticles.ascx.resx b/App_LocalResources/ucMyArticles.ascx.resx new file mode 100755 index 0000000..52642b0 --- /dev/null +++ b/App_LocalResources/ucMyArticles.ascx.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + There are no articles matching your criteria. + + + Created Date + + + Title + + + Author + + + Draft Articles Only + + + Unapproved Articles Only + + + Approved Articles Only + + + My Articles + + + <h1>About My Articles</h1><p>Authors can view there own articles from this screen, filtered by Draft/Unapproved/Approved.</p> + + + Publish Date + + + Show all articles (from all authors) + + \ No newline at end of file diff --git a/App_LocalResources/ucNotAuthenticated.ascx.resx b/App_LocalResources/ucNotAuthenticated.ascx.resx new file mode 100755 index 0000000..ab372a2 --- /dev/null +++ b/App_LocalResources/ucNotAuthenticated.ascx.resx @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +text/microsoft-resx + + +1.0.0.0 + + +System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + +System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + +You must be authenticated to use this feature. You may... + + +Login to this site + + +Go to the home page for this site + + +Not Authenticated + + + + + \ No newline at end of file diff --git a/App_LocalResources/ucNotAuthorized.ascx.resx b/App_LocalResources/ucNotAuthorized.ascx.resx new file mode 100755 index 0000000..7376e13 --- /dev/null +++ b/App_LocalResources/ucNotAuthorized.ascx.resx @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +text/microsoft-resx + + +1.0.0.0 + + +System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + +System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + +You must be authorized to use this feature. You may... + + +Go to the home page for this site + + +Not Authorized + + + + + \ No newline at end of file diff --git a/App_LocalResources/ucSubmitNews.ascx.resx b/App_LocalResources/ucSubmitNews.ascx.resx new file mode 100755 index 0000000..1ce9ccc --- /dev/null +++ b/App_LocalResources/ucSubmitNews.ascx.resx @@ -0,0 +1,462 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Details + + + Appearance + + + Link to + + + Article Summary + + + Enter the details of your article including title (required), categories (if applicable) and summary text (required).<br>Once complete, you can save your article via the buttons above the form. + + + Title: + + + Enter a title for the article here. + + + Title is Required + + + Author: + + + Select author for the article. + + + (Change Author) + + + No Author + + + Categories: + + + Select categories for the article here. + + + Advanced Settings + + + Article Details + + + Enter the main body of your article (optional).<br>Once complete, you can save your article via the buttons above the form. + + + Details + + + Enter the body of your article here. + + + Article Appearance + + + Mark your article as featured or to be associated with an image.<br>Once complete, you can save your article via the buttons above the form. + + + Image: + + + You can choose an image to associate with this article. + + + Featured: + + + Optionally mark the content as featured to highlight it. + + + Secure: + + + If the article is secured, the complete article (except for summary) will only be available to the roles configured in admin options. + + + Article Link + + + Optionally link your article to another resource.<br>Once complete, you can save your article via the buttons above the form. + + + New Window? + + + Check to launch the link in a new window. + + + Article Publishing + + + Optionally specify a date & time to publish/expire your article.<br>Once complete, you can save your article via the buttons above the form. + + + Publish Date & Time: + + + Enter the start date for displaying this article. + + + Publish Date & Time is Invalid + + + Publish Date & Time is Required + + + Expiry Date & Time: + + + Enter the end date for displaying this article. + + + Expiry Date & Time is Invalid + + + Are You Sure You Wish To Delete This Item ? + + + Publish + + + Approve Article + + + Add/Edit Pages + + + Delete Article + + + Submit Article + + + <h1>Article Management</h1><p>Users allowed to submit articles can submit or edit an article on this page. This module allows you to create a new article, modify an existing article, delete an article, add pages to an article or submit an article for approval.</p> + + + Links + + + In this section, you can specify your content. + + + Enter the body of your article. + + + Body: + + + Create + + + Organize + + + In this section, you can organize your content. + + + Publish + + + In this section, you can control how and when your content is published. + + + Summary + + + Link the article to a URL/Page/File. + + + Link: + + + Body is Required + + + Action + + + In this section, you can perform actions relating to the content. + + + Awaiting Approval + + + Draft + + + Select the status for the content. + + + Status: + + + Publish + + + Published + + + Category is Required + + + Meta Information + + + Optionally overrides the description for the page. + + + Description + + + Optionally overrides the keywords for the page. + + + Keywords + + + Optionally overrides the title for the page. + + + Title + + + Enter any tags (i.e. META tags) that should be rendered in the "HEAD" tag of the HTML for this page. + + + Page Header Tags + + + Custom Fields + + + <Select [VALUE]> + + + [CUSTOMFIELD] must be a currency. + + + [CUSTOMFIELD] must be a date. + + + [CUSTOMFIELD] must be a decimal. + + + [CUSTOMFIELD] must be an email address. + + + [CUSTOMFIELD] must be a number. + + + [CUSTOMFIELD] is an invalid format. + + + [CUSTOMFIELD] is required. + + + Invalid publish date. + + + <br>Required + + + Enter tags for your article e.g. Dairy Farmer 2009 + + + Tags: + + + Separate keywords by commas e.g. Cowboy,Texas Rodeo,2009 + + + (username) + + + <br />Invalid author. + + + Specify an external image url to associate with the article. + + + Image Url: + + + -- Select Author -- + + + Attach Existing Image + + + Mirror + + + Specify if you want to mirror the article from another portal. + + + Check to mirror the article from another portal. + + + Mirror Article? + + + Select article to mirror. + + + Select Article: + + + Check to auto update article when source article is updated. + + + Auto Update? + + + Select module to pick articles from. + + + Select Module: + + + You must select an article to mirror. + + + <br />This article has been mirrored from portal {0}. + + + <br />This article has been mirrored from portal {0}. Auto-update is enabled. You are not authorized to edit this version of the article. + + + <br />This article has been mirrored from {0} portals. + + + Select the folder to upload to. + + + Upload Folder: + + \ No newline at end of file diff --git a/App_LocalResources/ucSubmitNewsComplete.ascx.resx b/App_LocalResources/ucSubmitNewsComplete.ascx.resx new file mode 100755 index 0000000..a441c37 --- /dev/null +++ b/App_LocalResources/ucSubmitNewsComplete.ascx.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +text/microsoft-resx + + +1.0.0.0 + + +System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + +System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + +Your article has been submitted for approval. You may... + + +View My Articles + + +Submit Another Article + + +View Current Articles + + +Submit Complete + + +<h1>Submit Article Complete</h1><p>Users allowed to submit articles can submit or edit an article on this page. This module allows you to create a new article, modify an existing article, delete an article, add pages to an article or submit an article for approval.</p> + + \ No newline at end of file diff --git a/App_LocalResources/ucTemplateEditor.ascx.resx b/App_LocalResources/ucTemplateEditor.ascx.resx new file mode 100755 index 0000000..2355125 --- /dev/null +++ b/App_LocalResources/ucTemplateEditor.ascx.resx @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Site Templates + + + In this section, you can customize the templates that are sent by this module. + + + Template + + + Select a Template to edit. + + + File + + + Select a File to edit. + + + Template Text + + + Enter the text for the template here. + + + Site Template Help + + + You can find a list of tokens <a href='http://www.ventrian.com/Support/ProductForums/tabid/118/forumid/4/postid/5025/view/topic/Default.aspx' target='_blank'>here</a>. + + + Create New Template + + + Create a new template for you to customize. + + + Template Name + + + Enter a name for your template. + + + Create Template + + + Edit Site Templates + + + <h1>About Site Templates</h1><p>The module allows you to customize the templates that are used to render the module.</p> + + + Your new template has been created. + + + <br />The template has been updated. + + \ No newline at end of file diff --git a/App_LocalResources/ucViewOptions.ascx.resx b/App_LocalResources/ucViewOptions.ascx.resx new file mode 100755 index 0000000..72caad6 --- /dev/null +++ b/App_LocalResources/ucViewOptions.ascx.resx @@ -0,0 +1,1200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Article Settings + + + In this section, you can set up the settings that control the Article module. + + + Basic Settings + + + Allow Portal Images? + + + Check to allow portal images to be associated with articles. + + + Allow External Images? + + + Check to allow external images to be associated with articles. + + + Allow Comments? + + + Check to allow comments to be posted with articles. + + + Allow Ratings? + + + Check to allow ratings to be posted with articles. + + + Allow Anonymous Comments? + + + Check to allow comments to be posted by anonymous users. + + + Allow Anonymous Ratings? + + + Check to allow ratings to be posted by anonymous users. + + + Allow Core Search Integration? + + + Check to allow core search integration for articles. + + + Allow Syndication? + + + Check to allow syndication of articles. + + + Allow Html in Syndication? + + + Check to allow html tags in syndication. + + + Enable Notification Ping? + + + Check to notify weblogs.com (when created or updated). + + + Auto Trackback? + + + Check to scan articles for links when published and attempt to notify any linked sites. + + + Enable Incoming Trackback? + + + Check to allow incoming trackback/pings as new comments. + + + Launch Links? + + + Check to launch links into page by itself (no other modules loaded). + + + Featured Articles to Top? + + + Check to bring featured articles to the top of the listing. + + + User Display Mode + + + Set the display mode for any occurance of a user. + + + Username + + + First Name + + + Last Name + + + Display Name + + + Articles per page + + + Allows you to specify the default number of articles to page. + + + No Restriction + + + 1 + + + 2 + + + 3 + + + 4 + + + 5 + + + 10 + + + 15 + + + 20 + + + 50 + + + Article Template + + + Allows you to specify the template for displaying articles. + + + Text Editor Width + + + Enter the width of the text editor e.g. 100%, 400. + + + Server TimeZone + + + Enter the time zone of the server. + + + <br>Required + + + <br>Must be a valid value, e.g. 100%, 400 + + + Text Editor Height + + + Enter the height of the text editor e.g. 100%, 400. + + + <br>Required + + + <br>Must be a valid value, e.g. 100%, 400 + + + All Categories + + + Filter Settings + + + Max Articles + + + Enter the maximum number of articles to return in current articles. + + + Required + + + Must be a valid value, e.g. 10, 20 + + + Category Filter + + + Specify categories to only show articles from those categories. + + + Match Any + + + Match All + + + Show Featured Only? + + + Only show articles matched as 'Featured'. + + + Show Not Featured Only? + + + Only show articles not matched as 'Featured'. + + + Author + + + Optionally filter by author. + + + -- All Authors -- + + + Select Author + + + Security Settings + + + Secure Url + + + Enter the url to redirect non-secured users. + + + Notification Settings + + + Notify Approvers on Submission + + + Notify users in the approval role of an article submission. + + + Notify Email Address on Submission + + + Notify this email address of an article submission. + + + Notify Owner on Approval + + + Notify owner of the article on approval. + + + Notify Owner on Comment + + + Notify owner of the article when a comment is posted. + + + Sort By + + + Select field to sort articles by. + + + Sort Direction + + + Select direction for sort. + + + Ascending + + + Descending + + + Publish Date + + + Last Update + + + Highest Rated + + + Most Commented + + + Most Viewed + + + Title + + + Main Options + + + <h1>Main Options</h1><p>This module allows administrators to set options for the News Articles module.</p> + + + Turkish + + + Comment Settings + + + Check to use captcha validation on the post comment screen. + + + Use Captcha? + + + Check to require comments to be moderated before posting. + + + Enable Comment Moderation? + + + Notify email address(s) on comment, separate with a ; + + + Notify Email Address on Comment + + + <br>Required + + + Random + + + Approve + + + Auto-Approve + + + Auto-Feature + + + Feature + + + Secure + + + Submit + + + Enter the height of the text editor e.g. 100%, 400. + + + Text Editor Summary Height + + + Enter the width of the text editor e.g. 100%, 400. + + + Text Editor Summary Width + + + Set the basic security settings. + + + Categories + + + Summary + + + Expiry Date + + + Show/hide features on the 'Create Article' form. + + + Form Settings + + + * A role must have submit permissions to view the above items on the create article form. + + + Image + + + Link + + + 6 + + + 7 + + + 8 + + + 9 + + + Check to require a category when creating an article. + + + Require Category + + + Only show articles not marked as 'Secure'. + + + Show Not Secured Only? + + + Only show articles marked as 'Secure'. + + + Show Secured Only? + + + Category Settings + + + Check categories to auto-select them on the create article screen. + + + Default Categories + + + SEO Settings + + + Basic Text + + + Rich Text + + + Select how to render the summary text area. + + + Text Editor Summary Mode: + + + Auto-Secure + + + Hold down ctrl to select multiple. + + + Check to show authors on the archives page. + + + Show Authors? + + + Check to show categories on the archives page. + + + Show Categories? + + + Check to show current articles on the archives page. + + + Show Current Articles? + + + Check to show months on the archives page. + + + Show Months? + + + Archive Settings + + + Enter the height of the category selection listbox, e.g. 200, 400 + + + Category Selection Height + + + <br>Required + + + <br>Must be a valid value, e.g. 200, 400 + + + Check to include in the page's breadcrumb. + + + Include in breadcrumb? + + + Check to include in the page's name. + + + Include in page name? + + + Single Category (Category View) + + + Check to make the notification checkbox on by default. + + + Notify Default + + + Article + + + Article/Attachments + + + Select to always link to an article or directly to attachment/article. + + + Syndication Link Mode: + + + Check to expand summary by default. + + + Expand Summary? + + + 3rd Party Settings + + + Check to integrate with the Smart-Thinker Story Feed (Smart-Thinker UserProfile 4.3.12+) + + + Publish Group Events to Smart-Thinker Story Feed + + + - + + + Select a character to replace spaces in title with. + + + Title Replacement + + + _ + + + Optionally enter a maximum number of characters to show in RSS summary. + + + Syndication Summary Length: + + + Leave blank for unlimited. + + + Must be a valid number e.g. 100, 200 + + + Check to enable enclosures in syndication. + + + Enable Syndication Enclosures? + + + Check to show pending articles. + + + Show Pending? + + + Attachments + + + Image + + + Specify which field to use for enclosures. + + + Syndication Enclosure Type + + + Author Filter Settings + + + Check to filter by the logged in user. + + + Logged in user Filter: + + + Check to filter by author on the querystring parameter. + + + UserID Filter: + + + Enter the name of the parameter to filter on. + + + UserID Parameter: + + + Check to filter by username. + + + Username Filter: + + + Specify what parameter to select from. + + + Username Parameter: + + + Bottom + + + Specify where to place the menu. + + + Menu Position + + + Top + + + Check to always show PageID in the url. + + + Always Show PageID + + + Select the default image folder. + + + Default Image Folder: + + + Root + + + Classic + + + Shorterned + + + Specify an alias for article ID in shorterned mode. + + + Shortened Article ID + + + Select a url mode for formatting urls. + + + Url Mode + + + <br>Required + + + Check to notify approvers when a comment requires approval. + + + Notify Approvers for Comment Approval + + + Notify email address(s) when a comment requires approval, separate with a ; + + + Notify Email Address for Comment Approval + + + Check to use the canonical link in the head tag. + + + Use Canonical Link + + + Maximum age of articles (days), leave blank for no filter. + + + Max Age + + + (days), leave blank for no filter. + + + Meta + + + Specify the maximum number of items to display in an RSS feed. + + + Syndication Max Count: + + + Syndication Settings + + + <br>Required + + + <br>Must be a valid value, e.g. 50 + + + Custom Fields + + + Match Categories (All) + + + Match Categories (All) and Tags (Any) + + + Match Categories (Any) + + + Match Categories (Any) and Tags (All) + + + Match Categories (Any) and Tags (Any) + + + Match Tags (All) + + + Match Tags (Any) + + + Pick a mode to show related articles. + + + Related Mode + + + Related Settings + + + The API key for generating bit.ly urls. + + + Bit.Ly API Key + + + The login for generating bit.ly urls. + + + Bit.Ly Login + + + Your twitter username to be used in [TWITTERNAME] + + + Twitter Name + + + Twitter Settings + + + Customise the settings usually available to host only. + + + Admin Settings + + + Site Templates + + + Auto-Approve Comment + + + Image Settings + + + Specify the maximum image height to resize. + + + Maximum Image Height + + + Specify the maximum image width to resize. + + + Maximum Image Width + + + Check to resize images upon upload. + + + Resize Images? + + + <br>Required + + + <br>Image Max Height must be a number. + + + <br>Required + + + <br>Image Max Width must be a number. + + + Check to include the jquery script. + + + Include jQuery? + + + Shortened + + + By Dropdown + + + By Username + + + Specity the author selection mode for add/edit article. + + + Author Select Mode + + + Check to enable uploading of new images. + + + Enable Upload Images + + + Select how categories are ordered. + + + Category Sort Order + + + Name + + + Sort Order + + + File Settings + + + Specify the default folder to upload files. + + + Default File Folder + + + File + + + Select direction for sort. + + + Sort Direction + + + Check to publish events to the Active Social wall + + + Publish events to Active Social + + + Bottom Left + + + Bottom Right + + + Top Left + + + Top Right + + + Check to apply a watermark on uploaded images. The watermark is applied during the upload process. + + + Use Watermark? + + + Specify an image to apply as a watermark. + + + Watermark Image + + + Specify the position to place the watermark image. + + + Watermark Position + + + Specify a text string to apply as a watermark. + + + Watermark Text + + + Specify the access key for comment + + + Active Social Key - Comment + + + Specify the access key for rate + + + Active Social Key - Rate + + + Specify the access key for submission + + + Active Social Key - Submit + + + Specify thumbnail cropping algorithm. + + + Thumbnail Type + + + Proportion + + + Square (cropped) + + + Select portal/module combination to be available for sharing articles. + + + Add Article Module + + + Available modules to mirror articles. + + + Available Modules + + + Allows articles to be shared from other portals. + + + No article instances available in other portals. + + + Content Sharing Settings + + + Module + + + No modules currently linked. + + + Portal + + + Remove + + + Remove + + + Check to hide website on the comment form. + + + Hide Website? + + + Expand meta information on the submit article form. + + + Expand Meta Information + + + Check to enforce unique page titles in articles. + + + Unique Page Titles + + + Require email for anonymous users? + + + Require Email? + + + Require name for anonymous users? + + + Require Name? + + + Filter categories on submit article screen. + + + Filter Category Submit + + + -- All Groups -- + + + Specify a default author for creating articles + + + Author Default + + + Specify the path to jquery + + + jQuery Path + + + -- Select Default Author -- + + + Optionally filter roles by role group. + + + Role Group Filter + + + Optionally specify rss image path. + + + RSS Image Path + + + Specify an Akismet key to protect against comment spam. + + + Akismet Key + + + Display Name + + + Process tokens embedded in article. + + + Process Post Tokens? + + + Check to integrate Create, Comment & Rate Article into journal. + + + Journal Integration + + + Check security on categories and post to associates social groups/roles if applicable. + + + Journal Group Posting + + \ No newline at end of file diff --git a/Archives.ascx b/Archives.ascx new file mode 100755 index 0000000..6411c79 --- /dev/null +++ b/Archives.ascx @@ -0,0 +1,66 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Archives.ascx.vb" Inherits="Ventrian.NewsArticles.Archives" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + +
+ + +

+
+ Latest RSS Link  + +
+
+ + +

+ + + + + +
+ + +

+ + + + + +
+ + +

+ + + + + +
+ +
+ \ No newline at end of file diff --git a/Archives.ascx.designer.vb b/Archives.ascx.designer.vb new file mode 100755 index 0000000..ff4a131 --- /dev/null +++ b/Archives.ascx.designer.vb @@ -0,0 +1,152 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class Archives + + ''' + '''Header1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Header1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''phCurrentArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phCurrentArticles As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''lblCurrentArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCurrentArticles As Global.System.Web.UI.WebControls.Label + + ''' + '''phArchives control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phArchives As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''lblLatest control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblLatest As Global.System.Web.UI.WebControls.Label + + ''' + '''phCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phCategory As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''lblByCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblByCategory As Global.System.Web.UI.WebControls.Label + + ''' + '''rptCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents rptCategories As Global.System.Web.UI.WebControls.Repeater + + ''' + '''phAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phAuthor As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''lblByAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblByAuthor As Global.System.Web.UI.WebControls.Label + + ''' + '''rptAuthors control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents rptAuthors As Global.System.Web.UI.WebControls.Repeater + + ''' + '''phMonth control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phMonth As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''lblByMonth control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblByMonth As Global.System.Web.UI.WebControls.Label + + ''' + '''rptMonth control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents rptMonth As Global.System.Web.UI.WebControls.Repeater + + ''' + '''Header2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Header2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/Archives.ascx.vb b/Archives.ascx.vb new file mode 100755 index 0000000..5093445 --- /dev/null +++ b/Archives.ascx.vb @@ -0,0 +1,310 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Security + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class Archives + Inherits NewsArticleModuleBase + +#Region " Protected Properties " + + Protected ReadOnly Property AuthorID() As Integer + Get + Dim id As Integer = Null.NullInteger + If (ArticleSettings.AuthorUserIDFilter) Then + If (Request.QueryString(ArticleSettings.AuthorUserIDParam) <> "") Then + Try + id = Convert.ToInt32(Request.QueryString(ArticleSettings.AuthorUserIDParam)) + Catch + End Try + End If + End If + + If (ArticleSettings.AuthorUsernameFilter) Then + If (Request.QueryString(ArticleSettings.AuthorUsernameParam) <> "") Then + Try + Dim objUser As DotNetNuke.Entities.Users.UserInfo = DotNetNuke.Entities.Users.UserController.GetUserByName(Me.PortalId, Request.QueryString(ArticleSettings.AuthorUsernameParam)) + If (objUser IsNot Nothing) Then + id = objUser.UserID + End If + Catch + End Try + End If + End If + + If (ArticleSettings.AuthorLoggedInUserFilter) Then + If (Request.IsAuthenticated) Then + id = Me.UserId + Else + id = -100 + End If + End If + + If (ArticleSettings.Author <> Null.NullInteger) Then + id = ArticleSettings.Author + End If + + Return id + End Get + End Property + + Protected ReadOnly Property AuthorIDRSS() As String + Get + If (AuthorID <> Null.NullInteger) Then + Return "&AuthorID=" & AuthorID.ToString() + End If + Return "" + End Get + End Property + +#End Region + +#Region " Protected Methods " + + Protected Function GetAuthorLink(ByVal authorID As Integer, ByVal username As String) As String + + Return Common.GetAuthorLink(Me.TabId, Me.ModuleId, authorID, username, ArticleSettings.LaunchLinks, ArticleSettings) + + End Function + + Protected Function GetAuthorLinkRss(ByVal authorID As String) As String + + Return Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/RSS.aspx?TabID=" & TabId.ToString() & "&ModuleID=" & ModuleId.ToString() & "&AuthorID=" & authorID) + + End Function + + Protected Function GetCategoryLink(ByVal categoryID As String, ByVal name As String) As String + + Return Common.GetCategoryLink(Me.TabId, Me.ModuleId, categoryID, name, ArticleSettings.LaunchLinks, ArticleSettings) + + End Function + + Protected Function GetCategoryLinkRss(ByVal categoryID As String) As String + + Return Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/RSS.aspx?TabID=" & TabId.ToString() & "&ModuleID=" & ModuleId.ToString() & "&CategoryID=" & categoryID & AuthorIDRSS) + + End Function + + Protected Function GetCurrentLinkRss() As String + + Return Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/RSS.aspx?TabID=" & TabId.ToString() & "&ModuleID=" & ModuleId.ToString() & "&MaxCount=25" & AuthorIDRSS) + + End Function + + Protected Function GetCurrentLink() As String + + Return Common.GetModuleLink(TabId, ModuleId, "", ArticleSettings) + + End Function + + Protected Function GetMonthLink(ByVal month As Integer, ByVal year As Integer) As String + + Return Common.GetModuleLink(Me.TabId, Me.ModuleId, "ArchiveView", ArticleSettings, "month=" & month.ToString(), "year=" & year.ToString()) + + End Function + + Protected Function GetMonthLinkRss(ByVal month As Integer, ByVal year As Integer) As String + + Return Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/RSS.aspx?TabID=" & TabId.ToString() & "&ModuleID=" & ModuleId.ToString() & "&Month=" & month.ToString() & "&Year=" & year.ToString() & AuthorIDRSS) + + End Function + + Protected Function GetMonthName(ByVal month As Integer) As String + + Dim dt As New DateTime(2008, month, 1) + Return dt.ToString("MMMM") + + End Function + + Protected Function GetRssPath() As String + + Return Page.ResolveUrl(ArticleSettings.SyndicationImagePath) + + End Function + + Protected Function IsSyndicationEnabled() As Boolean + + Return ArticleSettings.IsSyndicationEnabled + + End Function + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + Dim objCategoryController As New CategoryController + If (ArticleSettings.FilterSingleCategory <> Null.NullInteger) Then + Dim categoriesToDisplay(1) As Integer + categoriesToDisplay(1) = ArticleSettings.FilterSingleCategory + + rptCategories.DataSource = objCategoryController.GetCategoriesAll(Me.ModuleId, Null.NullInteger, categoriesToDisplay, AuthorID, Null.NullInteger, ArticleSettings.ShowPending, ArticleSettings.CategorySortType) + rptCategories.DataBind() + Else + Dim objCategoriesSelected As New List(Of CategoryInfo) + Dim objCategoriesDisplay As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(Me.ModuleId, Null.NullInteger, ArticleSettings.FilterCategories, AuthorID, Null.NullInteger, ArticleSettings.ShowPending, ArticleSettings.CategorySortType) + For Each objCategory As CategoryInfo In objCategoriesDisplay + If (objCategory.InheritSecurity) Then + objCategoriesSelected.Add(objCategory) + Else + If (Request.IsAuthenticated) Then + If (Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + If (PortalSecurity.IsInRoles(Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString())) Then + objCategoriesSelected.Add(objCategory) + End If + End If + End If + End If + Next + + rptCategories.DataSource = objCategoriesSelected + rptCategories.DataBind() + End If + + Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(ModuleId, Null.NullInteger) + + Dim excludeCategoriesRestrictive As New List(Of Integer) + + For Each objCategory As CategoryInfo In objCategories + If (objCategory.InheritSecurity = False And objCategory.CategorySecurityType = CategorySecurityType.Restrict) Then + If (Request.IsAuthenticated) Then + If (Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + If (PortalSecurity.IsInRoles(Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString()) = False) Then + excludeCategoriesRestrictive.Add(objCategory.CategoryID) + End If + End If + Else + excludeCategoriesRestrictive.Add(objCategory.CategoryID) + End If + End If + Next + + Dim excludeCategories As New List(Of Integer) + + For Each objCategory As CategoryInfo In objCategories + If (objCategory.InheritSecurity = False And objCategory.CategorySecurityType = CategorySecurityType.Loose) Then + If (Request.IsAuthenticated) Then + If (Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + If (PortalSecurity.IsInRoles(Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString()) = False) Then + excludeCategories.Add(objCategory.CategoryID) + End If + End If + Else + excludeCategories.Add(objCategory.CategoryID) + End If + End If + Next + + Dim filterCategories As Integer() = ArticleSettings.FilterCategories + Dim includeCategories As New List(Of Integer) + + If (excludeCategories.Count > 0) Then + + For Each objCategoryToInclude As CategoryInfo In objCategories + + Dim includeCategory As Boolean = True + + For Each exclCategory As Integer In excludeCategories + If (exclCategory = objCategoryToInclude.CategoryID) Then + includeCategory = False + End If + Next + + If (ArticleSettings.FilterCategories IsNot Nothing) Then + If (ArticleSettings.FilterCategories.Length > 0) Then + Dim filter As Boolean = False + For Each cat As Integer In ArticleSettings.FilterCategories + If (cat = objCategoryToInclude.CategoryID) Then + filter = True + End If + Next + If (filter = False) Then + includeCategory = False + End If + End If + End If + + If (includeCategory) Then + includeCategories.Add(objCategoryToInclude.CategoryID) + End If + + Next + + If (includeCategories.Count > 0) Then + includeCategories.Add(-1) + End If + + filterCategories = includeCategories.ToArray() + + End If + + + If (ArticleSettings.FilterSingleCategory <> Null.NullInteger) Then + Dim categoriesToDisplay(1) As Integer + categoriesToDisplay(1) = ArticleSettings.FilterSingleCategory + + Dim objAuthorController As New AuthorController + rptAuthors.DataSource = objAuthorController.GetAuthorStatistics(Me.ModuleId, categoriesToDisplay, excludeCategoriesRestrictive.ToArray(), AuthorID, "DisplayName", ArticleSettings.ShowPending) + rptAuthors.DataBind() + Else + Dim objAuthorController As New AuthorController + rptAuthors.DataSource = objAuthorController.GetAuthorStatistics(Me.ModuleId, filterCategories, excludeCategoriesRestrictive.ToArray(), AuthorID, "DisplayName", ArticleSettings.ShowPending) + rptAuthors.DataBind() + End If + + If (ArticleSettings.FilterSingleCategory <> Null.NullInteger) Then + Dim categoriesToDisplay(1) As Integer + categoriesToDisplay(1) = ArticleSettings.FilterSingleCategory + Dim objArticleController As New ArticleController + rptMonth.DataSource = objArticleController.GetNewsArchive(Me.ModuleId, categoriesToDisplay, excludeCategoriesRestrictive.ToArray(), AuthorID, GroupByType.Month, ArticleSettings.ShowPending) + rptMonth.DataBind() + Else + Dim objArticleController As New ArticleController + rptMonth.DataSource = objArticleController.GetNewsArchive(Me.ModuleId, filterCategories, excludeCategoriesRestrictive.ToArray(), AuthorID, GroupByType.Month, ArticleSettings.ShowPending) + rptMonth.DataBind() + End If + + Me.BasePage.Title = "Archives | " & Me.BasePage.Title + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub Page_PreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + + Try + + LoadStyleSheet() + + phCurrentArticles.Visible = ArticleSettings.ArchiveCurrentArticles + phCategory.Visible = ArticleSettings.ArchiveCategories + phAuthor.Visible = ArticleSettings.ArchiveAuthor + phMonth.Visible = ArticleSettings.ArchiveMonth + + phArchives.Visible = IsSyndicationEnabled() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Base/NewsArticleControlBase.vb b/Base/NewsArticleControlBase.vb new file mode 100755 index 0000000..dd9ba27 --- /dev/null +++ b/Base/NewsArticleControlBase.vb @@ -0,0 +1,34 @@ +Namespace Ventrian.NewsArticles.Base + + Public Class NewsArticleControlBase + + Inherits UserControl + +#Region " Private Members " + + Private _articleID As Integer + +#End Region + +#Region " Public Properties " + + Public Property ArticleID() As Integer + Get + Return _articleID + End Get + Set(ByVal value As Integer) + _articleID = value + End Set + End Property + + Protected ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase + Get + Return CType(Parent, NewsArticleModuleBase) + End Get + End Property + +#End Region + + End Class + +End Namespace diff --git a/Base/NewsArticleModuleBase.vb b/Base/NewsArticleModuleBase.vb new file mode 100755 index 0000000..3b00ee9 --- /dev/null +++ b/Base/NewsArticleModuleBase.vb @@ -0,0 +1,409 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.ComponentModel +Imports System.Text.RegularExpressions +Imports System.Web +Imports System.Web.UI +Imports System.Web.UI.HtmlControls +Imports System.Xml + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Security +Imports DotNetNuke.Services.Localization + +Namespace Ventrian.NewsArticles.Base + + Public Class NewsArticleModuleBase + + Inherits PortalModuleBase + +#Region " Private Members " + + Private _articleSettings As ArticleSettings + +#End Region + +#Region " Public Properties " + + _ + Public ReadOnly Property BasePage() As DotNetNuke.Framework.CDefault + Get + Return CType(Page, DotNetNuke.Framework.CDefault) + End Get + End Property + + Public ReadOnly Property ArticleSettings() As ArticleSettings + Get + If (_articleSettings Is Nothing) Then + Try + _articleSettings = New ArticleSettings(Settings, PortalSettings, ModuleConfiguration) + Catch + Dim objModuleController As New ModuleController() + + Dim objSettings As Hashtable = objModuleController.GetModuleSettings(ModuleId) + Dim objTabSettings As Hashtable = objModuleController.GetTabModuleSettings(TabModuleId) + + For Each item As DictionaryEntry In objTabSettings + If (objSettings.ContainsKey(item.Key) = False) Then + objSettings.Add(item.Key, item.Value) + End If + Next + + _articleSettings = New ArticleSettings(objSettings, PortalSettings, ModuleConfiguration) + objModuleController.UpdateModuleSetting(ModuleId, "ResetArticleSettings", "true") + End Try + End If + Return _articleSettings + End Get + End Property + + Public ReadOnly Property ModuleKey() As String + Get + Return "NewsArticles-" & TabModuleId + End Get + End Property + +#End Region + +#Region " Protected Methods " + + Protected Function EditArticleUrl(ByVal ctl As String) As String + + If (ArticleSettings.AuthorUserIDFilter) Then + If (ArticleSettings.AuthorUserIDParam <> "") Then + If (HttpContext.Current.Request(ArticleSettings.AuthorUserIDParam) <> "") Then + Return EditUrl(ArticleSettings.AuthorUserIDParam, HttpContext.Current.Request(ArticleSettings.AuthorUserIDParam), ctl) + End If + End If + End If + + If (ArticleSettings.AuthorUsernameFilter) Then + If (ArticleSettings.AuthorUsernameParam <> "") Then + If (HttpContext.Current.Request(ArticleSettings.AuthorUsernameParam) <> "") Then + Return EditUrl(ArticleSettings.AuthorUsernameParam, HttpContext.Current.Request(ArticleSettings.AuthorUsernameParam), ctl) + End If + End If + End If + + Return EditUrl(ctl) + + End Function + + Protected Function EditArticleUrl(ByVal ctl As String, ByVal ParamArray params() As String) As String + + Dim parameters As New List(Of String) + + parameters.Add("mid=" & ModuleId.ToString()) + parameters.AddRange(params) + + If (ArticleSettings.AuthorUserIDFilter) Then + If (ArticleSettings.AuthorUserIDParam <> "") Then + If (HttpContext.Current.Request(ArticleSettings.AuthorUserIDParam) <> "") Then + parameters.Add(ArticleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(ArticleSettings.AuthorUserIDParam)) + End If + End If + End If + + If (ArticleSettings.AuthorUsernameFilter) Then + If (ArticleSettings.AuthorUsernameParam <> "") Then + If (HttpContext.Current.Request(ArticleSettings.AuthorUsernameParam) <> "") Then + parameters.Add(ArticleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(ArticleSettings.AuthorUsernameParam)) + End If + End If + End If + + Return NavigateURL(TabId, ctl, parameters.ToArray) + + End Function + + Public Sub LoadStyleSheet() + + + Dim objCSS As Control = BasePage.FindControl("CSS") + + If Not (objCSS Is Nothing) Then + Dim objLink As New HtmlLink() + objLink.ID = "Template_" & ModuleId.ToString() + objLink.Attributes("rel") = "stylesheet" + objLink.Attributes("type") = "text/css" + objLink.Href = Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Templates/" & _articleSettings.Template & "/Template.css") + + objCSS.Controls.AddAt(0, objLink) + End If + + End Sub + + Public Function GetSkinAttribute(ByVal xDoc As XmlDocument, ByVal tag As String, ByVal attrib As String, ByVal defaultValue As String) As String + Dim retValue As String = defaultValue + Dim xmlSkinAttributeRoot As XmlNode = xDoc.SelectSingleNode("descendant::Object[Token='[" & tag & "]']") + ' if the token is found + If Not xmlSkinAttributeRoot Is Nothing Then + ' process each token attribute + Dim xmlSkinAttribute As XmlNode + For Each xmlSkinAttribute In xmlSkinAttributeRoot.SelectNodes(".//Settings/Setting") + If xmlSkinAttribute.SelectSingleNode("Value").InnerText <> "" Then + ' append the formatted attribute to the inner contents of the control statement + If xmlSkinAttribute.SelectSingleNode("Name").InnerText = attrib Then + retValue = xmlSkinAttribute.SelectSingleNode("Value").InnerText + End If + End If + Next + End If + Return retValue + End Function + + + Protected Function FormatImageUrl(ByVal imageUrlResolved As String) As String + + Return PortalSettings.HomeDirectory & imageUrlResolved + + End Function + + Protected Function IsRated(ByVal objArticle As ArticleInfo) As Boolean + + If (objArticle.Rating = Null.NullDouble) Then + Return False + Else + Return True + End If + + End Function + + Protected Function IsRated(ByVal objDataItem As Object) As Boolean + + Dim objArticle As ArticleInfo = CType(objDataItem, ArticleInfo) + + Return IsRated(objArticle) + + End Function + + Protected Function GetRatingImage(ByVal objArticle As ArticleInfo) As String + + If (objArticle.Rating = Null.NullDouble) Then + Return ResolveUrl("Images\Rating\stars-0-0.gif") + Else + + Select Case RoundToUnit(objArticle.Rating, 0.5, False) + + Case 1 + Return ResolveUrl("Images\Rating\stars-1-0.gif") + + Case 1.5 + Return ResolveUrl("Images\Rating\stars-1-5.gif") + + Case 2 + Return ResolveUrl("Images\Rating\stars-2-0.gif") + + Case 2.5 + Return ResolveUrl("Images\Rating\stars-2-5.gif") + + Case 3 + Return ResolveUrl("Images\Rating\stars-3-0.gif") + + Case 3.5 + Return ResolveUrl("Images\Rating\stars-3-5.gif") + + Case 4 + Return ResolveUrl("Images\Rating\stars-4-0.gif") + + Case 4.5 + Return ResolveUrl("Images\Rating\stars-4-5.gif") + + Case 5 + Return ResolveUrl("Images\Rating\stars-5-0.gif") + + End Select + + Return ResolveUrl("Images\Rating\stars-0-0.gif") + + End If + + End Function + Protected Function StripHtml(ByVal html As String) As String + + Const pattern As String = "<(.|\n)*?>" + Return Regex.Replace(html, pattern, String.Empty) + + End Function + + + Private Function RoundToUnit(ByVal d As Double, ByVal unit As Double, ByVal roundDown As Boolean) As Double + + If (roundDown) Then + Return Math.Round(Math.Round((d / unit) - 0.5, 0) * unit, 2) + Else + Return Math.Round(Math.Round((d / unit) + 0.5, 0) * unit, 2) + End If + + End Function + + Protected Function GetRatingImage(ByVal objDataItem As Object) As String + + Dim objArticle As ArticleInfo = CType(objDataItem, ArticleInfo) + + Return GetRatingImage(objArticle) + + End Function + + Protected Function GetUserName(ByVal dataItem As Object) As String + + Dim objArticle As ArticleInfo = CType(dataItem, ArticleInfo) + + If Not (objArticle Is Nothing) Then + + Select Case ArticleSettings.DisplayMode + + Case DisplayType.UserName + Return objArticle.AuthorUserName + + Case DisplayType.FirstName + Return objArticle.AuthorFirstName + + Case DisplayType.LastName + Return objArticle.AuthorLastName + + Case DisplayType.FullName + Return objArticle.AuthorFullName + + End Select + + End If + + Return Null.NullString + + End Function + + Protected Function GetUserName(ByVal dataItem As Object, ByVal type As Integer) As String + + Dim objArticle As ArticleInfo = CType(dataItem, ArticleInfo) + + If Not (objArticle Is Nothing) Then + + Select Case type + + Case 1 'Last Updated + + Select Case ArticleSettings.DisplayMode + + Case DisplayType.UserName + Return objArticle.LastUpdateUserName + + Case DisplayType.FirstName + Return objArticle.LastUpdateFirstName + + Case DisplayType.LastName + Return objArticle.LastUpdateLastName + + Case DisplayType.FullName + Return objArticle.LastUpdateDisplayName + + End Select + + Case Else + + Select Case ArticleSettings.DisplayMode + + Case DisplayType.UserName + Return objArticle.AuthorUserName + + Case DisplayType.FirstName + Return objArticle.AuthorFirstName + + Case DisplayType.LastName + Return objArticle.AuthorLastName + + Case DisplayType.FullName + Return objArticle.AuthorDisplayName + + End Select + + End Select + + End If + + Return Null.NullString + + End Function + + Protected Function HasEditRights(ByVal articleId As Integer, ByVal moduleID As Integer, ByVal tabID As Integer) As Boolean + + ' Unauthenticated User + ' + If (Request.IsAuthenticated = False) Then + + Return False + + End If + + Dim objModuleController As ModuleController = New ModuleController + + Dim objModule As ModuleInfo = objModuleController.GetModule(moduleID, tabID) + + If Not (objModule Is Nothing) Then + + ' Admin of Module + ' + If (PortalSecurity.HasEditPermissions(objModule.ModulePermissions)) Then + + Return True + + End If + + End If + + + ' Approver + ' + If (ArticleSettings.IsApprover) Then + Return True + End If + + ' Submitter of New Article + ' + If (articleId = Null.NullInteger And ArticleSettings.IsSubmitter) Then + Return True + End If + + ' Owner of Article + ' + Dim objArticleController As ArticleController = New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(articleId) + If Not (objArticle Is Nothing) Then + If (objArticle.AuthorID = UserId And (objArticle.Status = StatusType.Draft Or ArticleSettings.IsAutoApprover)) Then + Return True + End If + End If + + Return False + + End Function + + Public Function GetSharedResource(ByVal key As String) As String + + Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/" & Localization.LocalResourceDirectory & "/" & Localization.LocalSharedResourceFile + Return Localization.GetString(key, path) + + End Function + +#End Region + +#Region " Shadowed Methods " + + Public Shadows Function ResolveUrl(ByVal url As String) As String + + Return MyBase.ResolveUrl(url).Replace(" ", "%20") + + End Function + +#End Region + + End Class + +End Namespace diff --git a/Components/Archives/ArchiveInfo.vb b/Components/Archives/ArchiveInfo.vb new file mode 100755 index 0000000..20fcb62 --- /dev/null +++ b/Components/Archives/ArchiveInfo.vb @@ -0,0 +1,63 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2005-2012 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Public Class ArchiveInfo + +#Region " Private Methods " + + ' local property declarations + Dim _day As Integer + Dim _month As Integer + Dim _year As Integer + Dim _count As Integer + +#End Region + +#Region " Public Properties " + + Public Property Day() As Integer + Get + Return _day + End Get + Set(ByVal Value As Integer) + _day = Value + End Set + End Property + + Public Property Month() As Integer + Get + Return _month + End Get + Set(ByVal Value As Integer) + _month = Value + End Set + End Property + + Public Property Year() As Integer + Get + Return _year + End Get + Set(ByVal Value As Integer) + _year = Value + End Set + End Property + + Public Property Count() As Integer + Get + Return _count + End Get + Set(ByVal Value As Integer) + _count = Value + End Set + End Property + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Components/Archives/ArchiveModeType.vb b/Components/Archives/ArchiveModeType.vb new file mode 100755 index 0000000..364e2d3 --- /dev/null +++ b/Components/Archives/ArchiveModeType.vb @@ -0,0 +1,17 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2005-2012 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Public Enum ArchiveModeType + + [Date] + Category + Author + + End Enum + +End Namespace diff --git a/Components/Archives/ArchiveSettings.vb b/Components/Archives/ArchiveSettings.vb new file mode 100755 index 0000000..d0b2a32 --- /dev/null +++ b/Components/Archives/ArchiveSettings.vb @@ -0,0 +1,293 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2005-2012 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Friend Class ArchiveSettings + +#Region " Private Properties " + + Private Property Settings As Hashtable + +#End Region + +#Region " Constructors " + + Public Sub New(ByVal moduleSettings As Hashtable) + Settings = moduleSettings + End Sub + +#End Region + +#Region " Public Properties " + + Public ReadOnly Property AuthorSortBy As AuthorSortByType + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_AUTHOR_SORT_BY)) Then + Return CType(System.Enum.Parse(GetType(AuthorSortByType), Settings(ArticleConstants.NEWS_ARCHIVES_AUTHOR_SORT_BY).ToString()), AuthorSortByType) + End If + Return ArticleConstants.NEWS_ARCHIVES_AUTHOR_SORT_BY_DEFAULT + End Get + End Property + + Public ReadOnly Property CategoryHideZeroCategories As Boolean + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_HIDE_ZERO_CATEGORIES)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.NEWS_ARCHIVES_HIDE_ZERO_CATEGORIES).ToString()) + End If + Return ArticleConstants.NEWS_ARCHIVES_HIDE_ZERO_CATEGORIES_DEFAULT + End Get + End Property + + Public ReadOnly Property CategoryMaxDepth As Integer + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_MAX_DEPTH)) Then + If (IsNumeric(Settings(ArticleConstants.NEWS_ARCHIVES_MAX_DEPTH).ToString())) Then + Return Convert.ToInt32(Settings(ArticleConstants.NEWS_ARCHIVES_MAX_DEPTH).ToString()) + End If + End If + Return ArticleConstants.NEWS_ARCHIVES_MAX_DEPTH_DEFAULT + End Get + End Property + + Public ReadOnly Property CategoryParent As Integer + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_PARENT_CATEGORY)) Then + If (IsNumeric(Settings(ArticleConstants.NEWS_ARCHIVES_PARENT_CATEGORY).ToString())) Then + Return Convert.ToInt32(Settings(ArticleConstants.NEWS_ARCHIVES_PARENT_CATEGORY).ToString()) + End If + End If + Return ArticleConstants.NEWS_ARCHIVES_PARENT_CATEGORY_DEFAULT + End Get + End Property + + Public ReadOnly Property GroupBy As GroupByType + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_GROUP_BY)) Then + Return CType(System.Enum.Parse(GetType(GroupByType), Settings(ArticleConstants.NEWS_ARCHIVES_GROUP_BY).ToString()), GroupByType) + End If + Return ArticleConstants.NEWS_ARCHIVES_GROUP_BY_DEFAULT + End Get + End Property + + Public ReadOnly Property ItemsPerRow As Integer + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_ITEMS_PER_ROW)) Then + If (IsNumeric(Settings(ArticleConstants.NEWS_ARCHIVES_ITEMS_PER_ROW).ToString())) Then + Return Convert.ToInt32(Settings(ArticleConstants.NEWS_ARCHIVES_ITEMS_PER_ROW).ToString()) + End If + End If + Return ArticleConstants.NEWS_ARCHIVES_ITEMS_PER_ROW_DEFAULT + End Get + End Property + + Public ReadOnly Property LayoutMode As LayoutModeType + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_LAYOUT_MODE)) Then + Return CType(System.Enum.Parse(GetType(LayoutModeType), Settings(ArticleConstants.NEWS_ARCHIVES_LAYOUT_MODE).ToString()), LayoutModeType) + End If + Return ArticleConstants.NEWS_ARCHIVES_LAYOUT_MODE_DEFAULT + End Get + End Property + + Public ReadOnly Property Mode As ArchiveModeType + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_MODE)) Then + Return CType(System.Enum.Parse(GetType(ArchiveModeType), Settings(ArticleConstants.NEWS_ARCHIVES_MODE).ToString()), ArchiveModeType) + End If + Return ArticleConstants.NEWS_ARCHIVES_MODE_DEFAULT + End Get + End Property + + Public ReadOnly Property ModuleId As Integer + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_MODULE_ID)) Then + If (IsNumeric(Settings(ArticleConstants.NEWS_ARCHIVES_MODULE_ID).ToString())) Then + Return Convert.ToInt32(Settings(ArticleConstants.NEWS_ARCHIVES_MODULE_ID).ToString()) + End If + End If + Return ArticleConstants.NEWS_ARCHIVES_MODULE_ID_DEFAULT + End Get + End Property + + Public ReadOnly Property TabId As Integer + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_TAB_ID)) Then + If (IsNumeric(Settings(ArticleConstants.NEWS_ARCHIVES_TAB_ID).ToString())) Then + Return Convert.ToInt32(Settings(ArticleConstants.NEWS_ARCHIVES_TAB_ID).ToString()) + End If + End If + Return ArticleConstants.NEWS_ARCHIVES_TAB_ID_DEFAULT + End Get + End Property + + Public ReadOnly Property TemplateAuthorAdvancedBody + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_BODY_ADVANCED)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_BODY_ADVANCED).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_BODY_ADVANCED + End Get + End Property + + Public ReadOnly Property TemplateAuthorAdvancedFooter + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_FOOTER_ADVANCED)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_FOOTER_ADVANCED).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_FOOTER_ADVANCED + End Get + End Property + + Public ReadOnly Property TemplateAuthorAdvancedHeader + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_HEADER_ADVANCED)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_HEADER_ADVANCED).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_HEADER_ADVANCED + End Get + End Property + + Public ReadOnly Property TemplateAuthorBody + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_BODY)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_BODY).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_BODY + End Get + End Property + + Public ReadOnly Property TemplateAuthorFooter + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_FOOTER)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_FOOTER).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_FOOTER + End Get + End Property + + Public ReadOnly Property TemplateAuthorHeader + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_HEADER)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_HEADER).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_HEADER + End Get + End Property + + Public ReadOnly Property TemplateCategoryAdvancedBody + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_BODY_ADVANCED)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_BODY_ADVANCED).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_BODY_ADVANCED + End Get + End Property + + Public ReadOnly Property TemplateCategoryAdvancedFooter + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_FOOTER_ADVANCED)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_FOOTER_ADVANCED).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_FOOTER_ADVANCED + End Get + End Property + + Public ReadOnly Property TemplateCategoryAdvancedHeader + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_HEADER_ADVANCED)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_HEADER_ADVANCED).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_HEADER_ADVANCED + End Get + End Property + + Public ReadOnly Property TemplateCategoryBody + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_BODY)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_BODY).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_BODY + End Get + End Property + + Public ReadOnly Property TemplateCategoryFooter + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_FOOTER)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_FOOTER).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_FOOTER + End Get + End Property + + Public ReadOnly Property TemplateCategoryHeader + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_HEADER)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_HEADER).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_HEADER + End Get + End Property + + Public ReadOnly Property TemplateDateAdvancedBody + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_BODY_ADVANCED)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_BODY_ADVANCED).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_HTML_BODY_ADVANCED + End Get + End Property + + Public ReadOnly Property TemplateDateAdvancedFooter + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_FOOTER_ADVANCED)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_FOOTER_ADVANCED).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_HTML_FOOTER_ADVANCED + End Get + End Property + + Public ReadOnly Property TemplateDateAdvancedHeader + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_HEADER_ADVANCED)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_HEADER_ADVANCED).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_HTML_HEADER_ADVANCED + End Get + End Property + + Public ReadOnly Property TemplateDateBody + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_BODY)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_BODY).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_HTML_BODY + End Get + End Property + + Public ReadOnly Property TemplateDateFooter + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_FOOTER)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_FOOTER).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_HTML_FOOTER + End Get + End Property + + Public ReadOnly Property TemplateDateHeader + Get + If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_HEADER)) Then + Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_HEADER).ToString() + End If + Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_HTML_HEADER + End Get + End Property + +#End Region + + End Class + +End Namespace diff --git a/Components/ArticleController.vb b/Components/ArticleController.vb new file mode 100755 index 0000000..f007b05 --- /dev/null +++ b/Components/ArticleController.vb @@ -0,0 +1,930 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Data + +Imports DotNetNuke +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Entities.Users +Imports DotNetNuke.Security.Roles +Imports DotNetNuke.Services.Search +Imports System.Xml +Imports System.Security.Cryptography +Imports Ventrian.NewsArticles.Components.CustomFields + +Namespace Ventrian.NewsArticles + + Public Class ArticleController + Implements ISearchable + Implements IPortable + +#Region " Private Methods " + + Private Function FillArticleCollection(ByVal dr As IDataReader, ByRef totalRecords As Integer, ByVal maxCount As Integer) As List(Of ArticleInfo) + + Dim objArticles As New List(Of ArticleInfo) + While dr.Read + objArticles.Add(CType(CBO.FillObject(dr, GetType(ArticleInfo), False), ArticleInfo)) + End While + + Dim nextResult As Boolean = dr.NextResult() + totalRecords = 0 + + If dr.Read Then + totalRecords = Convert.ToInt32(Null.SetNull(dr("TotalRecords"), totalRecords)) + If (maxCount <> Null.NullInteger AndAlso maxCount < totalRecords) Then + totalRecords = maxCount + End If + End If + + If Not dr Is Nothing Then + dr.Close() + End If + + Return objArticles + + End Function + +#End Region + +#Region " Static Methods " + + Public Shared Sub ClearArchiveCache(ByVal moduleID As Integer) + + Dim itemsToRemove As New List(Of String)() + + If (HttpContext.Current IsNot Nothing) Then + Dim enumerator As IDictionaryEnumerator = HttpContext.Current.Cache.GetEnumerator() + While enumerator.MoveNext() + If enumerator.Key.ToString().ToLower().Contains("ventrian-newsarticles-archive-" & moduleID.ToString()) Then + itemsToRemove.Add(enumerator.Key.ToString()) + End If + End While + + For Each itemToRemove As String In itemsToRemove + DataCache.RemoveCache(itemToRemove.Replace("DNN_", "")) + Next + End If + + End Sub + + Public Shared Sub ClearArticleCache(ByVal articleID As Integer) + + Dim cacheKey As String = "ventrian-newsarticles-article-" & articleID.ToString() + DataCache.RemoveCache(cacheKey) + + + + End Sub + +#End Region + +#Region " Public Methods " + + Public Function GetArticleList(ByVal moduleID As Integer) As List(Of ArticleInfo) + + Return GetArticleList(moduleID, True) + + End Function + + Public Function GetArticleList(ByVal moduleID As Integer, ByVal isApproved As Boolean) As List(Of ArticleInfo) + + Return GetArticleList(moduleID, Null.NullDate, Null.NullDate, Nothing, Null.NullBoolean, Nothing, Null.NullInteger, Null.NullInteger, Null.NullInteger, "CreatedDate", "DESC", isApproved, Null.NullBoolean, Null.NullString, Null.NullInteger, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullString, Nothing, False, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, Null.NullInteger) + + End Function + + Public Function GetArticleList(ByVal moduleID As Integer, ByVal isApproved As Boolean, ByVal sort As String) As List(Of ArticleInfo) + + Return GetArticleList(moduleID, Null.NullDate, Null.NullDate, Nothing, Null.NullBoolean, Nothing, Null.NullInteger, Null.NullInteger, Null.NullInteger, sort, "DESC", isApproved, Null.NullBoolean, Null.NullString, Null.NullInteger, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullString, Nothing, False, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, Null.NullInteger) + + End Function + + Public Function GetArticleList(ByVal moduleID As Integer, ByVal currentDate As DateTime, ByVal agedDate As DateTime, ByVal categoryID As Integer(), ByVal matchAll As Boolean, ByVal maxCount As Integer, ByVal pageNumber As Integer, ByVal pageSize As Integer, ByVal sortBy As String, ByVal sortDirection As String, ByVal isApproved As Boolean, ByVal isDraft As Boolean, ByVal keywords As String, ByVal authorID As Integer, ByVal showPending As Boolean, ByVal showExpired As Boolean, ByVal showFeaturedOnly As Boolean, ByVal showNotFeaturedOnly As Boolean, ByVal showSecuredOnly As Boolean, ByVal showNotSecuredOnly As Boolean, ByVal articleIDs As String, ByRef totalRecords As Integer) As List(Of ArticleInfo) + + Return GetArticleList(moduleID, currentDate, agedDate, categoryID, matchAll, Nothing, maxCount, pageNumber, pageSize, sortBy, sortDirection, isApproved, isDraft, keywords, authorID, showPending, showExpired, showFeaturedOnly, showNotFeaturedOnly, showSecuredOnly, showNotSecuredOnly, articleIDs, Nothing, False, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, totalRecords) + + End Function + + Public Function GetArticleList(ByVal moduleID As Integer, ByVal currentDate As DateTime, ByVal agedDate As DateTime, ByVal categoryID As Integer(), ByVal matchAll As Boolean, ByVal categoryIDExclude As Integer(), ByVal maxCount As Integer, ByVal pageNumber As Integer, ByVal pageSize As Integer, ByVal sortBy As String, ByVal sortDirection As String, ByVal isApproved As Boolean, ByVal isDraft As Boolean, ByVal keywords As String, ByVal authorID As Integer, ByVal showPending As Boolean, ByVal showExpired As Boolean, ByVal showFeaturedOnly As Boolean, ByVal showNotFeaturedOnly As Boolean, ByVal showSecuredOnly As Boolean, ByVal showNotSecuredOnly As Boolean, ByVal articleIDs As String, ByVal tagID As Integer(), ByVal matchAllTag As Boolean, ByVal rssGuid As String, ByVal customFieldID As Integer, ByVal customValue As String, ByVal linkFilter As String, ByRef totalRecords As Integer) As List(Of ArticleInfo) + + Return FillArticleCollection(DataProvider.Instance().GetArticleListBySearchCriteria(moduleID, currentDate, agedDate, categoryID, matchAll, categoryIDExclude, maxCount, pageNumber, pageSize, sortBy, sortDirection, isApproved, isDraft, keywords, authorID, showPending, showExpired, showFeaturedOnly, showNotFeaturedOnly, showSecuredOnly, showNotSecuredOnly, articleIDs, tagID, matchAllTag, rssGuid, customFieldID, customValue, linkFilter), totalRecords, maxCount) + + End Function + + Public Function GetArticle(ByVal articleID As Integer) As ArticleInfo + + Dim cacheKey As String = "ventrian-newsarticles-article-" & articleID.ToString() + + Dim objArticle As ArticleInfo = CType(DataCache.GetCache(cacheKey), ArticleInfo) + + If (objArticle Is Nothing) Then + objArticle = CType(CBO.FillObject(DataProvider.Instance().GetArticle(articleID), GetType(ArticleInfo)), ArticleInfo) + If (objArticle Is Nothing) Then + Return Nothing + End If + DataCache.SetCache(cacheKey, objArticle) + End If + + Return objArticle + + End Function + + Public Function GetArticleCategories(ByVal articleID As Integer) As ArrayList + + Dim objArticleCategories As ArrayList = CType(DataCache.GetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & articleID.ToString()), ArrayList) + + If (objArticleCategories Is Nothing) Then + objArticleCategories = CBO.FillCollection(DataProvider.Instance().GetArticleCategories(articleID), GetType(CategoryInfo)) + DataCache.SetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & articleID.ToString(), objArticleCategories) + End If + Return objArticleCategories + + End Function + + Public Function GetNewsArchive(ByVal moduleID As Integer, ByVal categoryID As Integer(), ByVal categoryIDExclude As Integer(), ByVal authorID As Integer, ByVal groupBy As GroupByType, ByVal showPending As Boolean) As List(Of ArchiveInfo) + + Dim categories As String = Null.NullString + + If Not (categoryID Is Nothing) Then + For Each category As Integer In categoryID + If Not (categories = Null.NullString) Then + categories = categories & "," + End If + categories = categories & category.ToString() + Next + End If + + Dim categoriesExclude As String = Null.NullString + + If Not (categoryIDExclude Is Nothing) Then + For Each category As Integer In categoryIDExclude + If Not (categoriesExclude = Null.NullString) Then + categoriesExclude = categoriesExclude & "," + End If + categoriesExclude = categoriesExclude & category.ToString() + Next + End If + + Dim hashCategories As String = "" + If (categories <> "" Or categoriesExclude <> "") Then + Dim Ue As New UnicodeEncoding() + Dim ByteSourceText() As Byte = Ue.GetBytes(categories & categoriesExclude) + Dim Md5 As New MD5CryptoServiceProvider() + Dim ByteHash() As Byte = Md5.ComputeHash(ByteSourceText) + hashCategories = Convert.ToBase64String(ByteHash) + End If + + Dim cacheKey As String = "ventrian-newsarticles-archive-" & moduleID.ToString() & "-" & hashCategories & "-" & authorID.ToString() & "-" & groupBy.ToString() & "-" & showPending.ToString() + + Dim objArchives As List(Of ArchiveInfo) = CType(DataCache.GetCache(cacheKey), List(Of ArchiveInfo)) + + If (objArchives Is Nothing) Then + objArchives = CBO.FillCollection(Of ArchiveInfo)(DataProvider.Instance().GetNewsArchive(moduleID, categoryID, categoryIDExclude, authorID, groupBy.ToString(), showPending)) + DataCache.SetCache(cacheKey, objArchives) + End If + + Return objArchives + + End Function + + Public Sub DeleteArticle(ByVal articleID As Integer) + + Dim objArticle As ArticleInfo = GetArticle(articleID) + + If (objArticle IsNot Nothing) Then + DeleteArticle(articleID, objArticle.ModuleID) + End If + + End Sub + + Public Sub DeleteArticle(ByVal articleID As Integer, ByVal moduleID As Integer) + + DataProvider.Instance().DeleteArticle(articleID) + CategoryController.ClearCache(moduleID) + AuthorController.ClearCache(moduleID) + ArticleController.ClearArchiveCache(moduleID) + ArticleController.ClearArticleCache(articleID) + + End Sub + + Public Sub DeleteArticleCategories(ByVal articleID As Integer) + + DataProvider.Instance().DeleteArticleCategories(articleID) + DataCache.RemoveCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & articleID.ToString()) + + End Sub + + Public Function AddArticle(ByVal objArticle As ArticleInfo) As Integer + + Dim articleID As Integer = CType(DataProvider.Instance().AddArticle(objArticle.AuthorID, objArticle.ApproverID, objArticle.CreatedDate, objArticle.LastUpdate, objArticle.Title, objArticle.Summary, objArticle.IsApproved, objArticle.NumberOfViews, objArticle.IsDraft, objArticle.StartDate, objArticle.EndDate, objArticle.ModuleID, objArticle.ImageUrl, objArticle.IsFeatured, objArticle.LastUpdateID, objArticle.Url, objArticle.IsSecure, objArticle.IsNewWindow, objArticle.MetaTitle, objArticle.MetaDescription, objArticle.MetaKeywords, objArticle.PageHeadText, objArticle.ShortUrl, objArticle.RssGuid), Integer) + + CategoryController.ClearCache(objArticle.ModuleID) + AuthorController.ClearCache(objArticle.ModuleID) + ArticleController.ClearArchiveCache(objArticle.ModuleID) + + Return articleID + + End Function + + Public Sub AddArticleCategory(ByVal articleID As Integer, ByVal categoryID As Integer) + + DataProvider.Instance().AddArticleCategory(articleID, categoryID) + DataCache.RemoveCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & articleID.ToString()) + + End Sub + + Public Sub UpdateArticle(ByVal objArticle As ArticleInfo) + + DataProvider.Instance().UpdateArticle(objArticle.ArticleID, objArticle.AuthorID, objArticle.ApproverID, objArticle.CreatedDate, objArticle.LastUpdate, objArticle.Title, objArticle.Summary, objArticle.IsApproved, objArticle.NumberOfViews, objArticle.IsDraft, objArticle.StartDate, objArticle.EndDate, objArticle.ModuleID, objArticle.ImageUrl, objArticle.IsFeatured, objArticle.LastUpdateID, objArticle.Url, objArticle.IsSecure, objArticle.IsNewWindow, objArticle.MetaTitle, objArticle.MetaDescription, objArticle.MetaKeywords, objArticle.PageHeadText, objArticle.ShortUrl, objArticle.RssGuid) + + CategoryController.ClearCache(objArticle.ModuleID) + AuthorController.ClearCache(objArticle.ModuleID) + ArticleController.ClearArchiveCache(objArticle.ModuleID) + ArticleController.ClearArticleCache(objArticle.ArticleID) + + End Sub + + Public Sub UpdateArticleCount(ByVal articleID As Integer, ByVal count As Integer) + + DataProvider.Instance().UpdateArticleCount(articleID, count) + + End Sub + + Public Function SecureCheck(ByVal portalID As Integer, ByVal articleID As Integer, ByVal userID As Integer) As Boolean + + Return DataProvider.Instance().SecureCheck(portalID, articleID, userID) + + End Function + +#End Region + + Private Function GetTabModuleSettings(ByVal TabModuleId As Integer, ByVal settings As Hashtable) As Hashtable + + Dim dr As IDataReader = DotNetNuke.Data.DataProvider.Instance().GetTabModuleSettings(TabModuleId) + + While dr.Read() + + If Not dr.IsDBNull(1) Then + settings(dr.GetString(0)) = dr.GetString(1) + Else + settings(dr.GetString(0)) = "" + End If + + End While + + dr.Close() + + Return settings + + End Function + +#Region " Optional Interfaces " + + Public Function GetSearchItems(ByVal ModInfo As DotNetNuke.Entities.Modules.ModuleInfo) As DotNetNuke.Services.Search.SearchItemInfoCollection Implements DotNetNuke.Entities.Modules.ISearchable.GetSearchItems + + Dim objModuleController As New ModuleController + Dim settings As Hashtable = objModuleController.GetModuleSettings(ModInfo.ModuleID) + settings = GetTabModuleSettings(ModInfo.TabModuleID, settings) + + Dim doSearch As Boolean = False + + If (settings.Contains(ArticleConstants.ENABLE_CORE_SEARCH_SETTING)) Then + doSearch = Convert.ToBoolean(settings(ArticleConstants.ENABLE_CORE_SEARCH_SETTING)) + End If + + Dim SearchItemCollection As New SearchItemInfoCollection + + If (doSearch) Then + + Dim objArticles As List(Of ArticleInfo) = GetArticleList(ModInfo.ModuleID) + + For Each objArticle As ArticleInfo In objArticles + With CType(objArticle, ArticleInfo) + + If (objArticle.IsApproved) Then + + Dim objPageController As New PageController + Dim objPages As ArrayList = objPageController.GetPageList(objArticle.ArticleID) + For i As Integer = 0 To objPages.Count - 1 + Dim SearchItem As SearchItemInfo + Dim objPage As PageInfo = CType(objPages(i), PageInfo) + Dim pageContent As String = HttpUtility.HtmlDecode(objArticle.Title) + " " + System.Web.HttpUtility.HtmlDecode(objPage.PageText) + + For Each Item As DictionaryEntry In objArticle.CustomList + If (Item.Value.ToString() <> "") Then + pageContent = pageContent & vbCrLf & Item.Value.ToString() + End If + Next + + Dim pageDescription As String = HtmlUtils.Shorten(HtmlUtils.Clean(System.Web.HttpUtility.HtmlDecode(objPage.PageText), False), 100, "...") + + Dim title As String = objArticle.Title & " - " & objPage.Title + If (objArticle.Title = objPage.Title) Then + title = objArticle.Title + End If + If (i = 0) Then + SearchItem = New SearchItemInfo(title, pageDescription, objArticle.AuthorID, objArticle.LastUpdate, ModInfo.ModuleID, ModInfo.ModuleID.ToString() & "_" & .ArticleID.ToString & "_" & objPage.PageID.ToString, pageContent, "ArticleType=ArticleView&ArticleID=" & .ArticleID.ToString) + Else + SearchItem = New SearchItemInfo(title, pageDescription, objArticle.AuthorID, objArticle.LastUpdate, ModInfo.ModuleID, ModInfo.ModuleID.ToString() & "_" & .ArticleID.ToString & "_" & objPage.PageID.ToString, pageContent, "ArticleType=ArticleView&ArticleID=" & .ArticleID.ToString & "&PageID=" + objPage.PageID.ToString()) + End If + SearchItemCollection.Add(SearchItem) + Next + + End If + + End With + Next + + End If + + Return SearchItemCollection + + End Function + + Public Function ExportModule(ByVal ModuleID As Integer) As String Implements IPortable.ExportModule + + Dim strXML As String = "" + strXML += WriteCategories(ModuleID, Null.NullInteger) + strXML += WriteTags(ModuleID) + strXML += WriteCustomFields(ModuleID) + strXML += WriteArticles(ModuleID) + Return strXML + + End Function + + Public Sub ImportModule(ByVal ModuleID As Integer, ByVal Content As String, ByVal Version As String, ByVal UserId As Integer) Implements IPortable.ImportModule + + Dim objXmlDocument As New XmlDocument() + objXmlDocument.LoadXml("" & Content & "") + + For Each xmlChildNode As XmlNode In objXmlDocument.ChildNodes(0).ChildNodes + If (xmlChildNode.Name = "categories") Then + Dim sortOrder As Integer = 0 + For Each xmlCategory As XmlNode In xmlChildNode.ChildNodes + ReadCategory(ModuleID, xmlCategory, Null.NullInteger, sortOrder) + sortOrder = sortOrder + 1 + Next + End If + + If (xmlChildNode.Name = "tags") Then + For Each xmlTag As XmlNode In xmlChildNode.ChildNodes + ReadTag(ModuleID, xmlTag) + Next + End If + + If (xmlChildNode.Name = "customfields") Then + For Each xmlCustomField As XmlNode In xmlChildNode.ChildNodes + ReadCustomField(ModuleID, xmlCustomField) + Next + End If + + If (xmlChildNode.Name = "articles") Then + For Each xmlArticle As XmlNode In xmlChildNode.ChildNodes + ReadArticle(ModuleID, xmlArticle) + Next + End If + Next + + End Sub + + Private Function WriteCategories(ByVal ModuleID As Integer, ByVal parentID As Integer) As String + + Dim strXML As String = "" + + Dim objCategoryController As New CategoryController + Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategories(ModuleID, parentID) + + If objCategories.Count <> 0 Then + strXML += "" + For Each objCategory As CategoryInfo In objCategories + strXML += "" + strXML += "" & XmlUtils.XMLEncode(objCategory.Name) & "" + strXML += "" & XmlUtils.XMLEncode(objCategory.Description) & "" + strXML += "" & XmlUtils.XMLEncode(objCategory.MetaTitle) & "" + strXML += "" & XmlUtils.XMLEncode(objCategory.MetaDescription) & "" + strXML += "" & XmlUtils.XMLEncode(objCategory.MetaKeywords) & "" + strXML += WriteCategories(ModuleID, objCategory.CategoryID) + strXML += "" + Next + strXML += "" + End If + + Return strXML + + End Function + + Public Sub ReadCategory(ByVal ModuleID As Integer, ByVal xmlCategory As XmlNode, ByVal parentCategoryID As Integer, ByVal sortOrder As Integer) + + Dim objCategory As New CategoryInfo + objCategory.ParentID = parentCategoryID + objCategory.ModuleID = ModuleID + objCategory.Name = xmlCategory.Item("name").InnerText + objCategory.Description = xmlCategory.Item("description").InnerText + + objCategory.InheritSecurity = True + objCategory.CategorySecurityType = CategorySecurityType.Loose + + objCategory.MetaTitle = xmlCategory.Item("metaTitle").InnerText + objCategory.MetaDescription = xmlCategory.Item("metaDescription").InnerText + objCategory.MetaKeywords = xmlCategory.Item("metaKeywords").InnerText + + objCategory.Image = Null.NullString() + objCategory.SortOrder = sortOrder + + Dim objCategoryController As New CategoryController + objCategory.CategoryID = objCategoryController.AddCategory(objCategory) + + Dim childSortOrder As Integer = 0 + For Each xmlChildNode As XmlNode In xmlCategory.ChildNodes + If (xmlChildNode.Name.ToLower() = "categories") Then + For Each xmlChildCategory As XmlNode In xmlChildNode.ChildNodes + ReadCategory(ModuleID, xmlChildCategory, objCategory.CategoryID, childSortOrder) + Next + End If + childSortOrder = childSortOrder + 1 + Next + + End Sub + + Private Function WriteTags(ByVal ModuleID As Integer) As String + + Dim strXML As String = "" + + Dim objTagController As New TagController() + Dim objTags As ArrayList = objTagController.List(ModuleID, Null.NullInteger) + + If objTags.Count <> 0 Then + strXML += "" + For Each objTag As TagInfo In objTags + strXML += "" + strXML += "" & XmlUtils.XMLEncode(objTag.Name) & "" + strXML += "" & XmlUtils.XMLEncode(objTag.Usages.ToString()) & "" + strXML += "" + Next + strXML += "" + End If + + Return strXML + + End Function + + Public Sub ReadTag(ByVal ModuleID As Integer, ByVal xmlTag As XmlNode) + + Dim objTag As New TagInfo + + objTag.ModuleID = ModuleID + objTag.Name = xmlTag.Item("name").InnerText + objTag.NameLowered = objTag.Name.ToLower() + objTag.Usages = Convert.ToInt32(xmlTag.Item("usage").InnerText) + + Dim objTagController As New TagController + objTagController.Add(objTag) + + End Sub + + Private Function WriteCustomFields(ByVal ModuleID As Integer) As String + + Dim strXML As String = "" + + Dim objCustomFieldController As New CustomFieldController() + Dim objCustomFields = objCustomFieldController.List(ModuleID) + + If objCustomFields.Count <> 0 Then + strXML += "" + For Each objCustomField As CustomFieldInfo In objCustomFields + strXML += "" + strXML += "" & XmlUtils.XMLEncode(objCustomField.Name) & "" + strXML += "" & XmlUtils.XMLEncode(CType(objCustomField.FieldType, Integer)) & "" + strXML += "" & XmlUtils.XMLEncode(objCustomField.FieldElements) & "" + strXML += "" & XmlUtils.XMLEncode(objCustomField.DefaultValue) & "" + strXML += "" & XmlUtils.XMLEncode(objCustomField.Caption) & "" + strXML += "" & XmlUtils.XMLEncode(objCustomField.CaptionHelp) & "" + strXML += "" & XmlUtils.XMLEncode(objCustomField.IsRequired) & "" + strXML += "" & XmlUtils.XMLEncode(objCustomField.IsVisible) & "" + strXML += "" & XmlUtils.XMLEncode(objCustomField.SortOrder) & "" + strXML += "" & XmlUtils.XMLEncode(CType(objCustomField.ValidationType, Integer)) & "" + strXML += "" & XmlUtils.XMLEncode(objCustomField.RegularExpression) & "" + strXML += "" & XmlUtils.XMLEncode(objCustomField.Length) & "" + strXML += "" + Next + strXML += "" + End If + + Return strXML + + End Function + + Public Sub ReadCustomField(ByVal ModuleID As Integer, ByVal xmlCustomField As XmlNode) + + Dim objCustomField As New CustomFieldInfo + + objCustomField.ModuleID = ModuleID + objCustomField.Name = xmlCustomField.Item("name").InnerText + objCustomField.FieldType = [Enum].Parse(GetType(CustomFieldType), xmlCustomField.Item("fieldtype").InnerText) + objCustomField.FieldElements = xmlCustomField.Item("fieldelements").InnerText + objCustomField.DefaultValue = xmlCustomField.Item("defaultvalue").InnerText + objCustomField.Caption = xmlCustomField.Item("caption").InnerText + objCustomField.CaptionHelp = xmlCustomField.Item("captionhelp").InnerText + objCustomField.IsRequired = Convert.ToBoolean(xmlCustomField.Item("isrequired").InnerText) + objCustomField.IsVisible = Convert.ToBoolean(xmlCustomField.Item("isvisible").InnerText) + objCustomField.SortOrder = Convert.ToInt32(xmlCustomField.Item("sortorder").InnerText) + objCustomField.ValidationType = [Enum].Parse(GetType(CustomFieldValidationType), xmlCustomField.Item("validationType").InnerText) + objCustomField.RegularExpression = xmlCustomField.Item("regularexpression").InnerText + objCustomField.Length = Convert.ToInt32(xmlCustomField.Item("length").InnerText) + + Dim objCustomFieldController As New CustomFieldController + objCustomFieldController.Add(objCustomField) + + End Sub + + Private Function WriteArticles(ByVal ModuleID As Integer) As String + + Dim strXML As String = "" + + Dim objCustomFieldController As New CustomFieldController + Dim objCustomFields As ArrayList = objCustomFieldController.List(ModuleID) + + Dim objArticleController As New ArticleController + Dim objArticles As List(Of ArticleInfo) = objArticleController.GetArticleList(ModuleID, DateTime.Now, Null.NullDate, Nothing, True, 10000, 1, 10000, "CreatedDate", "DESC", True, False, Null.NullString, Null.NullInteger, True, True, False, False, False, False, Null.NullString, Nothing) + + If objArticles.Count <> 0 Then + strXML += "" + For Each objArticle As ArticleInfo In objArticles + strXML += "
" + strXML += "" & XmlUtils.XMLEncode(objArticle.CreatedDate.ToString("O")) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.LastUpdate.ToString("O")) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.Title) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.IsApproved.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.NumberOfViews.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.IsDraft.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.StartDate.ToString("O")) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.EndDate.ToString("O")) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.ImageUrl.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.IsFeatured.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.Url) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.IsSecure.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.IsNewWindow.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.CommentCount.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.PageCount.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.FileCount.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.ImageCount.ToString()) & "" + If (objArticle.Rating <> Null.NullDouble) Then + strXML += "" & XmlUtils.XMLEncode(objArticle.Rating.ToString()) & "" + End If + strXML += "" & XmlUtils.XMLEncode(objArticle.RatingCount.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.Url) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.MetaTitle) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.MetaDescription) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.MetaKeywords) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.PageHeadText) & "" + strXML += "" & XmlUtils.XMLEncode(objArticle.ShortUrl) & "" + + Dim objArticleCategories As ArrayList = objArticleController.GetArticleCategories(objArticle.ArticleID) + If (objArticleCategories.Count > 0) Then + strXML += "" + For Each objCategory As CategoryInfo In objArticleCategories + strXML += "" + strXML += "" & XmlUtils.XMLEncode(objCategory.Name) & "" + strXML += "" + Next + strXML += "" + End If + + If (objArticle.Tags <> "") Then + strXML += "" + For Each tag As String In objArticle.Tags.Split(","c) + strXML += "" + strXML += "" & XmlUtils.XMLEncode(tag) & "" + strXML += "" + Next + strXML += "" + End If + + If (objArticle.CustomList.Count > 0) Then + strXML += "" + For Each item As DictionaryEntry In objArticle.CustomList + + For Each objCustomField As CustomFieldInfo In objCustomFields + If (objCustomField.CustomFieldID = item.Key) Then + strXML += "" + strXML += "" & XmlUtils.XMLEncode(objCustomField.Name) & "" + strXML += "" & XmlUtils.XMLEncode(item.Value) & "" + strXML += "" + Exit For + End If + Next + + Next + strXML += "" + End If + + If (objArticle.PageCount > 0) Then + Dim objPageController As New PageController + Dim objPages As ArrayList = objPageController.GetPageList(objArticle.ArticleID) + + If (objPages.Count > 0) Then + strXML += "" + For Each objPage As PageInfo In objPages + strXML += "" + strXML += "" & XmlUtils.XMLEncode(objPage.Title) & "" + strXML += "" & XmlUtils.XMLEncode(objPage.PageText) & "" + strXML += "" + Next + strXML += "" + End If + End If + + If (objArticle.ImageCount > 0) Then + Dim objImageController As New ImageController + Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString()) + + If (objImages.Count > 0) Then + strXML += "" + For Each objImage As ImageInfo In objImages + strXML += "" + strXML += "" & XmlUtils.XMLEncode(objImage.Title) & "" + strXML += "" & XmlUtils.XMLEncode(objImage.FileName) & "" + strXML += "" & XmlUtils.XMLEncode(objImage.Extension) & "" + strXML += "" & XmlUtils.XMLEncode(objImage.Size.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objImage.Width.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objImage.Height.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objImage.ContentType) & "" + strXML += "" & XmlUtils.XMLEncode(objImage.Folder) & "" + strXML += "" + Next + strXML += "" + End If + End If + + If (objArticle.FileCount > 0) Then + Dim objFileController As New FileController + Dim objFiles As List(Of FileInfo) = objFileController.GetFileList(objArticle.ArticleID, Null.NullString) + + If (objFiles.Count > 0) Then + strXML += "" + For Each objFile As FileInfo In objFiles + strXML += "" + strXML += "" & XmlUtils.XMLEncode(objFile.Title) & "" + strXML += "" & XmlUtils.XMLEncode(objFile.FileName) & "" + strXML += "" & XmlUtils.XMLEncode(objFile.Extension) & "" + strXML += "" & XmlUtils.XMLEncode(objFile.Size.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objFile.ContentType) & "" + strXML += "" & XmlUtils.XMLEncode(objFile.Folder) & "" + strXML += "" + Next + strXML += "" + End If + End If + + If (objArticle.CommentCount > 0) Then + Dim objCommentController As New CommentController + Dim objComments As List(Of CommentInfo) = objCommentController.GetCommentList(ModuleID, objArticle.ArticleID, True) + + If (objComments.Count > 0) Then + strXML += "" + For Each objComment As CommentInfo In objComments + strXML += "" + strXML += "" & XmlUtils.XMLEncode(objArticle.CreatedDate.ToString("O")) & "" + strXML += "" & XmlUtils.XMLEncode(objComment.Comment) & "" + strXML += "" & XmlUtils.XMLEncode(objComment.RemoteAddress) & "" + strXML += "" & XmlUtils.XMLEncode(objComment.Type.ToString()) & "" + strXML += "" & XmlUtils.XMLEncode(objComment.TrackbackUrl) & "" + strXML += "" & XmlUtils.XMLEncode(objComment.TrackbackTitle) & "" + strXML += "" & XmlUtils.XMLEncode(objComment.TrackbackBlogName) & "" + strXML += "" & XmlUtils.XMLEncode(objComment.TrackbackExcerpt) & "" + strXML += "" & XmlUtils.XMLEncode(objComment.AnonymousName) & "" + strXML += "" & XmlUtils.XMLEncode(objComment.AnonymousEmail) & "" + strXML += "" & XmlUtils.XMLEncode(objComment.AnonymousURL) & "" + strXML += "" & XmlUtils.XMLEncode(objComment.NotifyMe.ToString()) & "" + strXML += "" + Next + strXML += "" + End If + End If + + strXML += "
" + Next + strXML += "
" + End If + + Return strXML + + End Function + + Public Sub ReadArticle(ByVal ModuleID As Integer, ByVal xmlArticle As XmlNode) + + Dim objCustomFieldController As New CustomFieldController + Dim objCustomFields As ArrayList = objCustomFieldController.List(ModuleID) + + Dim objArticle As New ArticleInfo + + objArticle.ModuleID = ModuleID + + objArticle.CreatedDate = DateTime.Parse(xmlArticle.Item("createdDate").InnerText) + objArticle.LastUpdate = DateTime.Parse(xmlArticle.Item("lastUpdate").InnerText) + + objArticle.Title = xmlArticle.Item("title").InnerText + objArticle.IsApproved = Convert.ToBoolean(xmlArticle.Item("isApproved").InnerText) + objArticle.NumberOfViews = Convert.ToInt32(xmlArticle.Item("numberOfViews").InnerText) + objArticle.IsDraft = Convert.ToBoolean(xmlArticle.Item("isDraft").InnerText) + + objArticle.StartDate = DateTime.Parse(xmlArticle.Item("startDate").InnerText) + objArticle.EndDate = DateTime.Parse(xmlArticle.Item("endDate").InnerText) + + objArticle.ImageUrl = xmlArticle.Item("imageUrl").InnerText + objArticle.IsFeatured = Convert.ToBoolean(xmlArticle.Item("isFeatured").InnerText) + objArticle.Url = xmlArticle.Item("url").InnerText + objArticle.IsSecure = Convert.ToBoolean(xmlArticle.Item("isSecure").InnerText) + objArticle.IsNewWindow = Convert.ToBoolean(xmlArticle.Item("isNewWindow").InnerText) + + objArticle.CommentCount = Convert.ToInt32(xmlArticle.Item("commentCount").InnerText) + objArticle.PageCount = Convert.ToInt32(xmlArticle.Item("pageCount").InnerText) + objArticle.FileCount = Convert.ToInt32(xmlArticle.Item("fileCount").InnerText) + objArticle.ImageCount = Convert.ToInt32(xmlArticle.Item("imageCount").InnerText) + + objArticle.Rating = Null.NullInteger + objArticle.RatingCount = 0 + objArticle.Summary = xmlArticle.Item("summary").InnerText + + objArticle.MetaTitle = xmlArticle.Item("metaTitle").InnerText + objArticle.MetaDescription = xmlArticle.Item("metaDescription").InnerText + objArticle.MetaKeywords = xmlArticle.Item("metaKeywords").InnerText + objArticle.PageHeadText = xmlArticle.Item("pageHeadText").InnerText + objArticle.ShortUrl = xmlArticle.Item("shortUrl").InnerText + + Dim objArticleController As New ArticleController + objArticle.ArticleID = objArticleController.AddArticle(objArticle) + + Dim objCategoryController As New CategoryController + Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(ModuleID, Null.NullInteger) + For Each xmlChildNode As XmlNode In xmlArticle.ChildNodes + + If (xmlChildNode.Name = "categories") Then + For Each xmlCategoryNode As XmlNode In xmlChildNode.ChildNodes + Dim name As String = xmlCategoryNode.Item("name").InnerText + For Each objCategory As CategoryInfo In objCategories + If (objCategory.Name.ToLower() = name.ToLower()) Then + objArticleController.AddArticleCategory(objArticle.ArticleID, objCategory.CategoryID) + Exit For + End If + Next + Next + End If + + If (xmlChildNode.Name = "tags") Then + For Each xmlTagNode As XmlNode In xmlChildNode.ChildNodes + Dim name As String = xmlTagNode.Item("name").InnerText + Dim objTagController As New TagController() + Dim objTags As ArrayList = objTagController.List(ModuleID, Null.NullInteger) + For Each objTag As TagInfo In objTags + If (objTag.Name.ToLower() = name.ToLower()) Then + objTagController.Add(objArticle.ArticleID, objTag.TagID) + Exit For + End If + Next + Next + End If + + If (xmlChildNode.Name = "customfields") Then + For Each xmlTagNode As XmlNode In xmlChildNode.ChildNodes + + Dim name As String = xmlTagNode.Item("name").InnerText + Dim value As String = xmlTagNode.Item("value").InnerText + + For Each objCustomField As CustomFieldInfo In objCustomFields + If (objCustomField.Name.ToLower() = name.ToLower()) Then + Dim objCustomValue As New CustomValueInfo + objCustomValue.CustomFieldID = objCustomField.CustomFieldID + objCustomValue.ArticleID = objArticle.ArticleID + objCustomValue.CustomValue = value + + Dim objCustomValueController As New CustomValueController() + objCustomValueController.Add(objCustomValue) + Exit For + End If + Next + Next + End If + + If (xmlChildNode.Name = "images") Then + Dim sortOrder As Integer = 0 + For Each xmlImageNode As XmlNode In xmlChildNode.ChildNodes + Dim objImage As New ImageInfo + + objImage.ArticleID = objArticle.ArticleID + objImage.Title = xmlImageNode.Item("title").InnerText + objImage.FileName = xmlImageNode.Item("filename").InnerText + objImage.Extension = xmlImageNode.Item("extension").InnerText + objImage.Size = Convert.ToInt32(xmlImageNode.Item("size").InnerText) + objImage.Width = Convert.ToInt32(xmlImageNode.Item("width").InnerText) + objImage.Height = Convert.ToInt32(xmlImageNode.Item("height").InnerText) + objImage.ContentType = xmlImageNode.Item("contentType").InnerText + objImage.Folder = xmlImageNode.Item("folder").InnerText + objImage.SortOrder = sortOrder + + Dim objImageController As New ImageController() + objImageController.Add(objImage) + + sortOrder = sortOrder + 1 + Next + If (sortOrder > 0) Then + objArticle.ImageCount = sortOrder + objArticleController.UpdateArticle(objArticle) + End If + End If + + If (xmlChildNode.Name = "files") Then + Dim sortOrder As Integer = 0 + For Each xmlImageNode As XmlNode In xmlChildNode.ChildNodes + Dim objFile As New FileInfo + + objFile.ArticleID = objArticle.ArticleID + objFile.Title = xmlImageNode.Item("title").InnerText + objFile.FileName = xmlImageNode.Item("filename").InnerText + objFile.Extension = xmlImageNode.Item("extension").InnerText + objFile.Size = Convert.ToInt32(xmlImageNode.Item("size").InnerText) + objFile.ContentType = xmlImageNode.Item("contentType").InnerText + objFile.Folder = xmlImageNode.Item("folder").InnerText + objFile.SortOrder = sortOrder + + Dim objFileController As New FileController() + objFileController.Add(objFile) + + sortOrder = sortOrder + 1 + Next + If (sortOrder > 0) Then + objArticle.FileCount = sortOrder + objArticleController.UpdateArticle(objArticle) + End If + End If + + If (xmlChildNode.Name = "pages") Then + Dim sortOrder As Integer = 0 + For Each xmlImageNode As XmlNode In xmlChildNode.ChildNodes + + Dim objPage As New PageInfo + + objPage.ArticleID = objArticle.ArticleID + objPage.Title = xmlImageNode.Item("title").InnerText + objPage.PageText = xmlImageNode.Item("pageText").InnerText + objPage.SortOrder = sortOrder + + Dim objPageController As New PageController() + objPageController.AddPage(objPage) + + sortOrder = sortOrder + 1 + Next + If (sortOrder > 0) Then + objArticle.PageCount = sortOrder + objArticleController.UpdateArticle(objArticle) + End If + End If + + If (xmlChildNode.Name = "comments") Then + Dim sortOrder As Integer = 0 + For Each xmlImageNode As XmlNode In xmlChildNode.ChildNodes + + Dim objComment As New CommentInfo + + objComment.UserID = Null.NullInteger + objComment.ArticleID = objArticle.ArticleID + objComment.CreatedDate = DateTime.Parse(xmlImageNode.Item("createdDate").InnerText) + objComment.Comment = xmlImageNode.Item("commentText").InnerText + objComment.RemoteAddress = xmlImageNode.Item("remoteAddress").InnerText + objComment.Type = Convert.ToInt32(xmlImageNode.Item("type").InnerText) + objComment.TrackbackUrl = xmlImageNode.Item("trackbackUrl").InnerText + objComment.TrackbackTitle = xmlImageNode.Item("trackbackTitle").InnerText + objComment.TrackbackBlogName = xmlImageNode.Item("trackbackBlogName").InnerText + objComment.TrackbackExcerpt = xmlImageNode.Item("trackbackExcerpt").InnerText + objComment.AnonymousName = xmlImageNode.Item("anonymousName").InnerText + objComment.AnonymousEmail = xmlImageNode.Item("anonymousEmail").InnerText + objComment.AnonymousURL = xmlImageNode.Item("anonymousUrl").InnerText + objComment.NotifyMe = Convert.ToBoolean(xmlImageNode.Item("notifyMe").InnerText) + objComment.IsApproved = True + objComment.ApprovedBy = Null.NullInteger + + Dim objCommentController As New CommentController() + objCommentController.AddComment(objComment) + + sortOrder = sortOrder + 1 + Next + If (sortOrder > 0) Then + objArticle.CommentCount = sortOrder + objArticleController.UpdateArticle(objArticle) + End If + End If + Next + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Components/ArticleInfo.vb b/Components/ArticleInfo.vb new file mode 100755 index 0000000..1812774 --- /dev/null +++ b/Components/ArticleInfo.vb @@ -0,0 +1,580 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Data + +Imports DotNetNuke +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Users +Imports DotNetNuke.Security.Roles +Imports Ventrian.NewsArticles.Components.CustomFields + +Namespace Ventrian.NewsArticles + + Public Class ArticleInfo + +#Region " Private Members " + + ' local property declarations + Dim _articleID As Integer + Dim _authorID As Integer + Dim _approverID As Integer + Dim _createdDate As DateTime + Dim _lastUpdate As DateTime + Dim _title As String + Dim _summary As String + Dim _articleText As String + Dim _isApproved As Boolean + Dim _isDraft As Boolean + Dim _numberOfViews As Integer + Dim _startDate As DateTime + Dim _endDate As DateTime + Dim _moduleID As Integer + Dim _isFeatured As Boolean + Dim _rating As Double + Dim _ratingCount As Integer + Dim _lastUpdateID As Integer + Dim _isSecure As Boolean + Dim _isNewWindow As Boolean + + Dim _metaTitle As String + Dim _metaDescription As String + Dim _metaKeywords As String + Dim _pageHeadText As String + Dim _shortUrl As String + Dim _rssGuid As String + + Dim _imageUrl As String + Dim _url As String + + Dim _authorEmail As String + Dim _authorUserName As String + Dim _authorFirstName As String + Dim _authorLastName As String + Dim _authorDisplayName As String + + Dim _lastUpdateEmail As String + Dim _lastUpdateUserName As String + Dim _lastUpdateFirstName As String + Dim _lastUpdateLastName As String + Dim _lastUpdateDisplayName As String + + Dim _body As String + Dim _pageCount As Integer + Dim _commentCount As Integer + Dim _fileCount As Integer + Dim _imageCount As Integer + Dim _imageUrlResolved As String + + Dim _customList As Hashtable + + Dim _tags As String + + Dim _approver As UserInfo + +#End Region + +#Region " Private Methods " + + Private Sub InitializePropertyList() + + ' Add Caching + Dim objCustomFieldController As New CustomFieldController + Dim objCustomFields As ArrayList = objCustomFieldController.List(Me.ModuleID) + + Dim objCustomValueController As New CustomValueController + Dim objCustomValues As List(Of CustomValueInfo) = objCustomValueController.List(Me.ArticleID) + + _customList = New Hashtable + + For Each objCustomField As CustomFieldInfo In objCustomFields + Dim value As String = "" + For Each objCustomValue As CustomValueInfo In objCustomValues + If (objCustomValue.CustomFieldID = objCustomField.CustomFieldID) Then + value = objCustomValue.CustomValue + End If + Next + _customList.Add(objCustomField.CustomFieldID, value) + Next + + End Sub + +#End Region + +#Region " Public Properties " + + Public Property ArticleID() As Integer + Get + Return _articleID + End Get + Set(ByVal Value As Integer) + _articleID = Value + End Set + End Property + + Public Property AuthorID() As Integer + Get + Return _authorID + End Get + Set(ByVal Value As Integer) + _authorID = Value + End Set + End Property + + Public Property ApproverID() As Integer + Get + Return _approverID + End Get + Set(ByVal Value As Integer) + _approverID = Value + End Set + End Property + + Public Property CreatedDate() As DateTime + Get + Return _createdDate + End Get + Set(ByVal Value As DateTime) + _createdDate = Value + End Set + End Property + + Public Property LastUpdate() As DateTime + Get + Return _lastUpdate + End Get + Set(ByVal Value As DateTime) + _lastUpdate = Value + End Set + End Property + + Public Property Title() As String + Get + Return _title + End Get + Set(ByVal Value As String) + _title = Value + End Set + End Property + + Public Property Summary() As String + Get + Return _summary + End Get + Set(ByVal Value As String) + _summary = Value + End Set + End Property + + Public Property ArticleText() As String + Get + Return _articleText + End Get + Set(ByVal Value As String) + _articleText = Value + End Set + End Property + + Public Property IsApproved() As Boolean + Get + Return _isApproved + End Get + Set(ByVal Value As Boolean) + _isApproved = Value + End Set + End Property + + Public Property IsDraft() As Boolean + Get + Return _isDraft + End Get + Set(ByVal Value As Boolean) + _isDraft = Value + End Set + End Property + + Public Property NumberOfViews() As Integer + Get + Return _numberOfViews + End Get + Set(ByVal Value As Integer) + _numberOfViews = Value + End Set + End Property + + Public Property StartDate() As DateTime + Get + Return _startDate + End Get + Set(ByVal Value As DateTime) + _startDate = Value + End Set + End Property + + Public Property EndDate() As DateTime + Get + Return _endDate + End Get + Set(ByVal Value As DateTime) + _endDate = Value + End Set + End Property + + Public Property ModuleID() As Integer + Get + Return _moduleID + End Get + Set(ByVal Value As Integer) + _moduleID = Value + End Set + End Property + + Public Property ImageUrl() As String + Get + Return _imageUrl + End Get + Set(ByVal Value As String) + _imageUrl = Value + End Set + End Property + + Public Property Url() As String + Get + Return _url + End Get + Set(ByVal Value As String) + _url = Value + End Set + End Property + + Public Property IsFeatured() As Boolean + Get + Return _isFeatured + End Get + Set(ByVal Value As Boolean) + _isFeatured = Value + End Set + End Property + + Public Property Rating() As Double + Get + Return _rating + End Get + Set(ByVal Value As Double) + _rating = Value + End Set + End Property + + Public Property RatingCount() As Integer + Get + Return _ratingCount + End Get + Set(ByVal Value As Integer) + _ratingCount = Value + End Set + End Property + + Public Property LastUpdateID() As Integer + Get + Return _lastUpdateID + End Get + Set(ByVal Value As Integer) + _lastUpdateID = Value + End Set + End Property + + Public Property IsSecure() As Boolean + Get + Return _isSecure + End Get + Set(ByVal Value As Boolean) + _isSecure = Value + End Set + End Property + + Public Property IsNewWindow() As Boolean + Get + Return _isNewWindow + End Get + Set(ByVal Value As Boolean) + _isNewWindow = Value + End Set + End Property + + Public Property MetaTitle() As String + Get + Return _metaTitle + End Get + Set(ByVal Value As String) + _metaTitle = Value + End Set + End Property + + Public Property MetaDescription() As String + Get + Return _metaDescription + End Get + Set(ByVal Value As String) + _metaDescription = Value + End Set + End Property + + Public Property MetaKeywords() As String + Get + Return _metaKeywords + End Get + Set(ByVal Value As String) + _metaKeywords = Value + End Set + End Property + + Public Property PageHeadText() As String + Get + Return _pageHeadText + End Get + Set(ByVal Value As String) + _pageHeadText = Value + End Set + End Property + + Public Property ShortUrl() As String + Get + Return _shortUrl + End Get + Set(ByVal Value As String) + _shortUrl = Value + End Set + End Property + + Public Property RssGuid() As String + Get + Return _rssGuid + End Get + Set(ByVal Value As String) + _rssGuid = Value + End Set + End Property + + Public Property AuthorUserName() As String + Get + Return _authorUserName + End Get + Set(ByVal Value As String) + _authorUserName = Value + End Set + End Property + + Public Property AuthorEmail() As String + Get + Return _authorEmail + End Get + Set(ByVal Value As String) + _authorEmail = Value + End Set + End Property + + Public Property AuthorFirstName() As String + Get + Return _authorFirstName + End Get + Set(ByVal Value As String) + _authorFirstName = Value + End Set + End Property + + Public Property AuthorLastName() As String + Get + Return _authorLastName + End Get + Set(ByVal Value As String) + _authorLastName = Value + End Set + End Property + + Public Property AuthorDisplayName() As String + Get + Return _authorDisplayName + End Get + Set(ByVal Value As String) + _authorDisplayName = Value + End Set + End Property + + Public Property Status() As StatusType + Get + If (IsDraft = True) Then + Return StatusType.Draft + End If + + If (IsApproved = False) Then + Return StatusType.AwaitingApproval + Else + Return StatusType.Published + End If + End Get + Set(ByVal Value As StatusType) + Select Case Value + Case StatusType.Draft + _isDraft = True + _isApproved = False + Exit Select + Case StatusType.AwaitingApproval + _isDraft = False + _isApproved = False + Exit Select + Case StatusType.Published + _isDraft = False + _isApproved = True + Exit Select + Case Else + Exit Select + End Select + End Set + End Property + + Public ReadOnly Property AuthorFullName() As String + Get + Return _authorFirstName & " " & _authorLastName + End Get + End Property + + Public Property LastUpdateUserName() As String + Get + Return _lastUpdateUserName + End Get + Set(ByVal Value As String) + _lastUpdateUserName = Value + End Set + End Property + + Public Property LastUpdateEmail() As String + Get + Return _lastUpdateEmail + End Get + Set(ByVal Value As String) + _lastUpdateEmail = Value + End Set + End Property + + Public Property LastUpdateFirstName() As String + Get + Return _lastUpdateFirstName + End Get + Set(ByVal Value As String) + _lastUpdateFirstName = Value + End Set + End Property + + Public Property LastUpdateLastName() As String + Get + Return _lastUpdateLastName + End Get + Set(ByVal Value As String) + _lastUpdateLastName = Value + End Set + End Property + + Public Property LastUpdateDisplayName() As String + Get + Return _lastUpdateDisplayName + End Get + Set(ByVal Value As String) + _lastUpdateDisplayName = Value + End Set + End Property + + Public ReadOnly Property LastUpdateFullName() As String + Get + Return _lastUpdateFirstName & " " & _lastUpdateLastName + End Get + End Property + + Public Property Body() As String + Get + Return _body + End Get + Set(ByVal Value As String) + _body = Value + End Set + End Property + + Public Property PageCount() As Integer + Get + Return _pageCount + End Get + Set(ByVal Value As Integer) + _pageCount = Value + End Set + End Property + + Public Property CommentCount() As Integer + Get + Return _commentCount + End Get + Set(ByVal Value As Integer) + _commentCount = Value + End Set + End Property + + Public Property FileCount() As Integer + Get + Return _fileCount + End Get + Set(ByVal Value As Integer) + _fileCount = Value + End Set + End Property + + Public Property ImageCount() As Integer + Get + Return _imageCount + End Get + Set(ByVal Value As Integer) + _imageCount = Value + End Set + End Property + + Public ReadOnly Property CustomList() As Hashtable + Get + If (_customList Is Nothing) Then + InitializePropertyList() + End If + Return _customList + End Get + End Property + + Public Property Tags() As String + Get + Return _tags + End Get + Set(ByVal Value As String) + _tags = Value + End Set + End Property + + Public ReadOnly Property Approver(ByVal portalID As Integer) As UserInfo + Get + If (_approver Is Nothing And ApproverID <> Null.NullInteger) Then + Dim objUserController As New UserController + _approver = objUserController.GetUser(portalID, ApproverID) + End If + Return _approver + End Get + End Property + + Public ReadOnly Property TitleAlternate() As String + Get + Return "[" & StartDate.Year.ToString() & "-" & StartDate.Month.ToString() & "-" & StartDate.Day.ToString() & "] " & Title + End Get + End Property + +#End Region + + End Class + +End Namespace diff --git a/Components/ArticleSettings.vb b/Components/ArticleSettings.vb new file mode 100755 index 0000000..adf4728 --- /dev/null +++ b/Components/ArticleSettings.vb @@ -0,0 +1,1607 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Entities.Portals +Imports DotNetNuke.Entities.Users +Imports DotNetNuke.Security +Imports Ventrian.NewsArticles.Components.Types + +Namespace Ventrian.NewsArticles + + Public Class ArticleSettings + +#Region " Private Members " + + Private ReadOnly _settings As Hashtable + Private ReadOnly _portalSettings As PortalSettings + Private ReadOnly _moduleConfiguration As ModuleInfo + +#End Region + +#Region " Constructors " + + Public Sub New(ByVal settings As Hashtable, ByVal portalSettings As PortalSettings, ByVal moduleConfiguration As ModuleInfo) + _settings = settings + _portalSettings = portalSettings + _moduleConfiguration = moduleConfiguration + End Sub + +#End Region + +#Region " Private Properties " + + Public ReadOnly Property Settings() As Hashtable + Get + Return _settings + End Get + End Property + +#End Region + +#Region " Private Methods " + + Private Function IsInRoles(ByVal roles As String) As Boolean + + ' Replacement for core IsInRoles check because it doesn't auto-pass super users. + + If Not roles Is Nothing Then + Dim context As HttpContext = HttpContext.Current + Dim objUserInfo As UserInfo = UserController.GetCurrentUserInfo + Dim role As String + + For Each role In roles.Split(New Char() {";"c}) + If (role <> "" AndAlso Not role Is Nothing AndAlso _ + ((context.Request.IsAuthenticated = False And role = glbRoleUnauthUserName) Or _ + role = glbRoleAllUsersName Or _ + objUserInfo.IsInRole(role) = True _ + )) Then + Return True + End If + Next role + + End If + + Return False + + End Function + +#End Region + +#Region " Public Properties " + + Public ReadOnly Property AlwaysShowPageID() As Boolean + Get + If (Settings.Contains(ArticleConstants.SEO_ALWAYS_SHOW_PAGEID_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.SEO_ALWAYS_SHOW_PAGEID_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property Author() As Integer + Get + If (Settings.Contains(ArticleConstants.AUTHOR_SETTING)) Then + If (IsNumeric(Settings(ArticleConstants.AUTHOR_SETTING).ToString())) Then + Return Convert.ToInt32(Settings(ArticleConstants.AUTHOR_SETTING).ToString()) + Else + Return Null.NullInteger + End If + Else + Return Null.NullInteger + End If + End Get + End Property + + Public ReadOnly Property AuthorDefault() As Integer + Get + If (Settings.Contains(ArticleConstants.AUTHOR_DEFAULT_SETTING)) Then + If (IsNumeric(Settings(ArticleConstants.AUTHOR_DEFAULT_SETTING).ToString())) Then + Return Convert.ToInt32(Settings(ArticleConstants.AUTHOR_DEFAULT_SETTING).ToString()) + Else + Return Null.NullInteger + End If + Else + Return Null.NullInteger + End If + End Get + End Property + + Public ReadOnly Property AuthorSelect() As AuthorSelectType + Get + If (Settings.Contains(ArticleConstants.AUTHOR_SELECT_TYPE)) Then + Return CType(System.Enum.Parse(GetType(AuthorSelectType), Settings(ArticleConstants.AUTHOR_SELECT_TYPE).ToString()), AuthorSelectType) + Else + Return AuthorSelectType.ByDropdown + End If + End Get + End Property + + Public ReadOnly Property AuthorUserIDFilter() As Boolean + Get + If (Settings.Contains(ArticleConstants.AUTHOR_USERID_FILTER_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.AUTHOR_USERID_FILTER_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property AuthorUserIDParam() As String + Get + If (Settings.Contains(ArticleConstants.AUTHOR_USERID_PARAM_SETTING)) Then + Return Settings(ArticleConstants.AUTHOR_USERID_PARAM_SETTING).ToString() + Else + Return "ID" + End If + End Get + End Property + + Public ReadOnly Property AuthorUsernameFilter() As Boolean + Get + If (Settings.Contains(ArticleConstants.AUTHOR_USERNAME_FILTER_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.AUTHOR_USERNAME_FILTER_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property AuthorUsernameParam() As String + Get + If (Settings.Contains(ArticleConstants.AUTHOR_USERNAME_PARAM_SETTING)) Then + Return Settings(ArticleConstants.AUTHOR_USERNAME_PARAM_SETTING).ToString() + Else + Return "Username" + End If + End Get + End Property + + Public ReadOnly Property AuthorLoggedInUserFilter() As Boolean + Get + If (Settings.Contains(ArticleConstants.AUTHOR_LOGGED_IN_USER_FILTER_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.AUTHOR_LOGGED_IN_USER_FILTER_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property ArchiveAuthor() As Boolean + Get + If (Settings.Contains(ArticleConstants.ARCHIVE_AUTHOR_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ARCHIVE_AUTHOR_SETTING).ToString()) + Else + Return ArticleConstants.ARCHIVE_AUTHOR_SETTING_DEFAULT + End If + End Get + End Property + + Public ReadOnly Property ArchiveCategories() As Boolean + Get + If (Settings.Contains(ArticleConstants.ARCHIVE_CATEGORIES_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ARCHIVE_CATEGORIES_SETTING).ToString()) + Else + Return ArticleConstants.ARCHIVE_CATEGORIES_SETTING_DEFAULT + End If + End Get + End Property + + Public ReadOnly Property ArchiveCurrentArticles() As Boolean + Get + If (Settings.Contains(ArticleConstants.ARCHIVE_CURRENT_ARTICLES_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ARCHIVE_CURRENT_ARTICLES_SETTING).ToString()) + Else + Return ArticleConstants.ARCHIVE_CURRENT_ARTICLES_SETTING_DEFAULT + End If + End Get + End Property + + Public ReadOnly Property ArchiveMonth() As Boolean + Get + If (Settings.Contains(ArticleConstants.ARCHIVE_MONTH_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ARCHIVE_MONTH_SETTING).ToString()) + Else + Return ArticleConstants.ARCHIVE_MONTH_SETTING_DEFAULT + End If + End Get + End Property + + Public ReadOnly Property BubbleFeatured() As Boolean + Get + If (Settings.Contains(ArticleConstants.BUBBLE_FEATURED_ARTICLES)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.BUBBLE_FEATURED_ARTICLES).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property CategoryBreadcrumb() As Boolean + Get + If (Settings.Contains(ArticleConstants.CATEGORY_BREADCRUMB_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.CATEGORY_BREADCRUMB_SETTING).ToString()) + Else + Return ArticleConstants.CATEGORY_BREADCRUMB_SETTING_DEFAULT + End If + End Get + End Property + + Public ReadOnly Property CategoryFilterSubmit() As Boolean + Get + If (Settings.Contains(ArticleConstants.CATEGORY_FILTER_SUBMIT_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.CATEGORY_FILTER_SUBMIT_SETTING).ToString()) + Else + Return ArticleConstants.CATEGORY_FILTER_SUBMIT_SETTING_DEFAULT + End If + End Get + End Property + + Public ReadOnly Property IncludeInPageName() As Boolean + Get + If (Settings.Contains(ArticleConstants.CATEGORY_NAME_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.CATEGORY_NAME_SETTING).ToString()) + Else + Return ArticleConstants.CATEGORY_NAME_SETTING_DEFAULT + End If + End Get + End Property + + Public ReadOnly Property CategorySelectionHeight() As Integer + Get + If (Settings.Contains(ArticleConstants.CATEGORY_SELECTION_HEIGHT_SETTING)) Then + Return Convert.ToInt32(Settings(ArticleConstants.CATEGORY_SELECTION_HEIGHT_SETTING).ToString()) + Else + Return ArticleConstants.CATEGORY_SELECTION_HEIGHT_DEFAULT + End If + End Get + End Property + + Public ReadOnly Property CategorySortType() As CategorySortType + Get + If (Settings.Contains(ArticleConstants.CATEGORY_SORT_SETTING)) Then + Try + Return CType(System.Enum.Parse(GetType(CategorySortType), Settings(ArticleConstants.CATEGORY_SORT_SETTING).ToString()), CategorySortType) + Catch + Return ArticleConstants.CATEGORY_SORT_SETTING_DEFAULT + End Try + Else + Return ArticleConstants.CATEGORY_SORT_SETTING_DEFAULT + End If + End Get + End Property + + Public ReadOnly Property CommentAkismetKey() As String + Get + If (Settings.Contains(ArticleConstants.COMMENT_AKISMET_SETTING)) Then + Return Settings(ArticleConstants.COMMENT_AKISMET_SETTING).ToString() + Else + Return "" + End If + End Get + End Property + + Public ReadOnly Property CommentModeration() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_COMMENT_MODERATION_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_COMMENT_MODERATION_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property CommentRequireName() As Boolean + Get + If (Settings.Contains(ArticleConstants.COMMENT_REQUIRE_NAME_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.COMMENT_REQUIRE_NAME_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property CommentRequireEmail() As Boolean + Get + If (Settings.Contains(ArticleConstants.COMMENT_REQUIRE_EMAIL_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.COMMENT_REQUIRE_EMAIL_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property ContentSharingPortals() As String + Get + If (Settings.Contains(ArticleConstants.CONTENT_SHARING_SETTING)) Then + Return Settings(ArticleConstants.CONTENT_SHARING_SETTING).ToString() + Else + Return Null.NullString() + End If + End Get + End Property + + Public ReadOnly Property DefaultImagesFolder() As Integer + Get + If (Settings.Contains(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING)) Then + If (IsNumeric(Settings(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING).ToString())) Then + Return Convert.ToInt32(Settings(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING).ToString()) + Else + Return Null.NullInteger + End If + Else + Return Null.NullInteger + End If + End Get + End Property + + Public ReadOnly Property DefaultFilesFolder() As Integer + Get + If (Settings.Contains(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING)) Then + If (IsNumeric(Settings(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING).ToString())) Then + Return Convert.ToInt32(Settings(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING).ToString()) + Else + Return Null.NullInteger + End If + Else + Return Null.NullInteger + End If + End Get + End Property + + Public ReadOnly Property EnableActiveSocialFeed() As Boolean + Get + If (Settings.Contains(ArticleConstants.ACTIVE_SOCIAL_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ACTIVE_SOCIAL_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property JournalIntegration() As Boolean + Get + If (Settings.Contains(ArticleConstants.JOURNAL_INTEGRATION_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.JOURNAL_INTEGRATION_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property JournalIntegrationGroups() As Boolean + Get + If (Settings.Contains(ArticleConstants.JOURNAL_INTEGRATION_GROUPS_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.JOURNAL_INTEGRATION_GROUPS_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property ActiveSocialSubmitKey() As String + Get + If (Settings.Contains(ArticleConstants.ACTIVE_SOCIAL_SUBMIT_SETTING)) Then + Return Settings(ArticleConstants.ACTIVE_SOCIAL_SUBMIT_SETTING).ToString() + Else + Return "9F02B914-F565-4E5A-9194-8423431056CD" + End If + End Get + End Property + + Public ReadOnly Property ActiveSocialCommentKey() As String + Get + If (Settings.Contains(ArticleConstants.ACTIVE_SOCIAL_COMMENT_SETTING)) Then + Return Settings(ArticleConstants.ACTIVE_SOCIAL_COMMENT_SETTING).ToString() + Else + Return "" + End If + End Get + End Property + + Public ReadOnly Property ActiveSocialRateKey() As String + Get + If (Settings.Contains(ArticleConstants.ACTIVE_SOCIAL_RATE_SETTING)) Then + Return Settings(ArticleConstants.ACTIVE_SOCIAL_RATE_SETTING).ToString() + Else + Return "" + End If + End Get + End Property + + Public ReadOnly Property EnableAutoTrackback() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_AUTO_TRACKBACK_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_AUTO_TRACKBACK_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property EnableCoreSearch() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_CORE_SEARCH_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_CORE_SEARCH_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property EnableExternalImages() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_EXTERNAL_IMAGES_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_EXTERNAL_IMAGES_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property EnableNotificationPing() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_NOTIFICATION_PING_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_NOTIFICATION_PING_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property EnableImagesUpload() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_UPLOAD_IMAGES_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_UPLOAD_IMAGES_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property EnablePortalImages() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_PORTAL_IMAGES_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_PORTAL_IMAGES_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property EnableRatings() As Boolean + Get + If (EnableRatingsAnonymous Or EnableRatingsAuthenticated) Then + Return True + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property EnableRatingsAnonymous() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_RATINGS_ANONYMOUS_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_RATINGS_ANONYMOUS_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property EnableRatingsAuthenticated() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_RATINGS_AUTHENTICATED_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_RATINGS_AUTHENTICATED_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property EnableSmartThinkerStoryFeed() As Boolean + Get + If (Settings.Contains(ArticleConstants.SMART_THINKER_STORY_FEED_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.SMART_THINKER_STORY_FEED_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property EnableSyndication() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_SYNDICATION_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_SYNDICATION_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property EnableSyndicationEnclosures() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_SYNDICATION_ENCLOSURES_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_SYNDICATION_ENCLOSURES_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property EnableSyndicationHtml() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_SYNDICATION_HTML_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_SYNDICATION_HTML_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property ExpandSummary() As Boolean + Get + If (Settings.Contains(ArticleConstants.EXPAND_SUMMARY_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.EXPAND_SUMMARY_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property FeaturedOnly() As Boolean + Get + If (Settings.Contains(ArticleConstants.SHOW_FEATURED_ONLY_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.SHOW_FEATURED_ONLY_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property FilterCategories() As Integer() + Get + If (Settings.Contains(ArticleConstants.CATEGORIES_SETTING & _moduleConfiguration.TabID.ToString())) Then + If Not (Settings(ArticleConstants.CATEGORIES_SETTING & _moduleConfiguration.TabID.ToString()).ToString = Null.NullString Or Settings(ArticleConstants.CATEGORIES_SETTING & _moduleConfiguration.TabID.ToString()).ToString = "-1") Then + Dim categories As String() = Settings(ArticleConstants.CATEGORIES_SETTING & _moduleConfiguration.TabID.ToString()).ToString().Split(","c) + Dim cats As New List(Of Integer) + + For Each category As String In categories + If (IsNumeric(category)) Then + cats.Add(Convert.ToInt32(category)) + End If + Next + + Return cats.ToArray() + Else + Return Nothing + End If + Else + Return Nothing + End If + End Get + End Property + + Public ReadOnly Property FilterSingleCategory() As Integer + Get + If (Settings.Contains(ArticleConstants.CATEGORIES_FILTER_SINGLE_SETTING)) Then + If (IsNumeric(Settings(ArticleConstants.CATEGORIES_FILTER_SINGLE_SETTING))) Then + Return Convert.ToInt32(Settings(ArticleConstants.CATEGORIES_FILTER_SINGLE_SETTING)) + Else + Return Null.NullInteger + End If + Else + Return Null.NullInteger + End If + End Get + End Property + + Public ReadOnly Property ImageJQueryPath() As String + Get + If (Settings.Contains(ArticleConstants.IMAGE_JQUERY_PATH)) Then + Return Settings(ArticleConstants.IMAGE_JQUERY_PATH).ToString() + Else + Return "includes/fancybox/jquery.fancybox.pack.js" + End If + End Get + End Property + + Public ReadOnly Property ImageThumbnailType() As ThumbnailType + Get + If (Settings.Contains(ArticleConstants.IMAGE_THUMBNAIL_SETTING)) Then + Return CType(System.Enum.Parse(GetType(ThumbnailType), Settings(ArticleConstants.IMAGE_THUMBNAIL_SETTING).ToString()), ThumbnailType) + Else + Return ArticleConstants.DEFAULT_IMAGE_THUMBNAIL + End If + End Get + End Property + + Public ReadOnly Property IncludeJQuery() As Boolean + Get + If (Settings.Contains(ArticleConstants.INCLUDE_JQUERY_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.INCLUDE_JQUERY_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property MatchCategories() As MatchOperatorType + Get + If (Settings.Contains(ArticleConstants.MATCH_OPERATOR_SETTING)) Then + Return CType(System.Enum.Parse(GetType(MatchOperatorType), Settings(ArticleConstants.MATCH_OPERATOR_SETTING).ToString()), MatchOperatorType) + Else + Return MatchOperatorType.MatchAny + End If + End Get + End Property + + Public ReadOnly Property MaxArticles() As Integer + Get + If (Settings.Contains(ArticleConstants.MAX_ARTICLES_SETTING)) Then + If (IsNumeric(Settings(ArticleConstants.MAX_ARTICLES_SETTING).ToString())) Then + Return Convert.ToInt32(Settings(ArticleConstants.MAX_ARTICLES_SETTING).ToString()) + Else + Return Null.NullInteger + End If + Else + Return Null.NullInteger + End If + End Get + End Property + + Public ReadOnly Property MaxAge() As Integer + Get + If (Settings.Contains(ArticleConstants.MAX_AGE_SETTING)) Then + If (IsNumeric(Settings(ArticleConstants.MAX_AGE_SETTING).ToString())) Then + Return Convert.ToInt32(Settings(ArticleConstants.MAX_AGE_SETTING).ToString()) + Else + Return Null.NullInteger + End If + Else + Return Null.NullInteger + End If + End Get + End Property + + Public ReadOnly Property MaxImageHeight() As Integer + Get + If (Settings.Contains(ArticleConstants.IMAGE_MAX_HEIGHT_SETTING)) Then + If (IsNumeric(Settings(ArticleConstants.IMAGE_MAX_HEIGHT_SETTING).ToString())) Then + Return Convert.ToInt32(Settings(ArticleConstants.IMAGE_MAX_HEIGHT_SETTING).ToString()) + Else + Return ArticleConstants.DEFAULT_IMAGE_MAX_HEIGHT + End If + Else + Return ArticleConstants.DEFAULT_IMAGE_MAX_HEIGHT + End If + End Get + End Property + + Public ReadOnly Property MaxImageWidth() As Integer + Get + If (Settings.Contains(ArticleConstants.IMAGE_MAX_WIDTH_SETTING)) Then + If (IsNumeric(Settings(ArticleConstants.IMAGE_MAX_WIDTH_SETTING).ToString())) Then + Return Convert.ToInt32(Settings(ArticleConstants.IMAGE_MAX_WIDTH_SETTING).ToString()) + Else + Return ArticleConstants.DEFAULT_IMAGE_MAX_WIDTH + End If + Else + Return ArticleConstants.DEFAULT_IMAGE_MAX_WIDTH + End If + End Get + End Property + + Public ReadOnly Property MenuPosition() As MenuPositionType + Get + If (Settings.Contains(ArticleConstants.MENU_POSITION_TYPE)) Then + Return CType(System.Enum.Parse(GetType(MenuPositionType), Settings(ArticleConstants.MENU_POSITION_TYPE).ToString()), MenuPositionType) + Else + Return MenuPositionType.Top + End If + End Get + End Property + + Public ReadOnly Property NotFeaturedOnly() As Boolean + Get + If (Settings.Contains(ArticleConstants.SHOW_NOT_FEATURED_ONLY_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.SHOW_NOT_FEATURED_ONLY_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property NotifyAuthorOnComment() As Boolean + Get + If (Settings.Contains(ArticleConstants.NOTIFY_COMMENT_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_COMMENT_SETTING)) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property NotifyAuthorOnApproval() As Boolean + Get + If (Settings.Contains(ArticleConstants.NOTIFY_APPROVAL_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_APPROVAL_SETTING)) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property NotifyDefault() As Boolean + Get + If (Settings.Contains(ArticleConstants.NOTIFY_DEFAULT_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_DEFAULT_SETTING)) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property NotifyEmailOnComment() As String + Get + If (Settings.Contains(ArticleConstants.NOTIFY_COMMENT_SETTING_EMAIL)) Then + Return Settings(ArticleConstants.NOTIFY_COMMENT_SETTING_EMAIL).ToString() + Else + Return "" + End If + End Get + End Property + + Public ReadOnly Property NotifyApproverForCommentApproval() As Boolean + Get + If (Settings.Contains(ArticleConstants.NOTIFY_COMMENT_APPROVAL_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_COMMENT_APPROVAL_SETTING)) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property NotifyEmailForCommentApproval() As String + Get + If (Settings.Contains(ArticleConstants.NOTIFY_COMMENT_APPROVAL_EMAIL_SETTING)) Then + Return Settings(ArticleConstants.NOTIFY_COMMENT_APPROVAL_EMAIL_SETTING).ToString() + Else + Return "" + End If + End Get + End Property + + Public ReadOnly Property NotSecuredOnly() As Boolean + Get + If (Settings.Contains(ArticleConstants.SHOW_NOT_SECURED_ONLY_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.SHOW_NOT_SECURED_ONLY_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property ProcessPostTokens() As Boolean + Get + If (Settings.Contains(ArticleConstants.PROCESS_POST_TOKENS)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.PROCESS_POST_TOKENS).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property ResizeImages() As Boolean + Get + If (Settings.Contains(ArticleConstants.IMAGE_RESIZE_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.IMAGE_RESIZE_SETTING).ToString()) + Else + Return ArticleConstants.DEFAULT_IMAGE_RESIZE + End If + End Get + End Property + + Public ReadOnly Property SecuredOnly() As Boolean + Get + If (Settings.Contains(ArticleConstants.SHOW_SECURED_ONLY_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.SHOW_SECURED_ONLY_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property ShortenedID() As String + Get + If (Settings.Contains(ArticleConstants.SEO_SHORTEN_ID_SETTING)) Then + Return Settings(ArticleConstants.SEO_SHORTEN_ID_SETTING).ToString() + Else + Return "ID" + End If + End Get + End Property + + Public ReadOnly Property SortBy() As String + Get + If (Settings.Contains(ArticleConstants.SORT_BY)) Then + Return Settings(ArticleConstants.SORT_BY).ToString() + Else + Return ArticleConstants.DEFAULT_SORT_BY + End If + End Get + End Property + + Public ReadOnly Property SortDirection() As String + Get + If (Settings.Contains(ArticleConstants.SORT_DIRECTION)) Then + Return Settings(ArticleConstants.SORT_DIRECTION).ToString() + Else + Return ArticleConstants.DEFAULT_SORT_DIRECTION + End If + End Get + End Property + + Public ReadOnly Property SortDirectionComments() As Integer + Get + If (Settings.Contains(ArticleConstants.COMMENT_SORT_DIRECTION_SETTING)) Then + Return Convert.ToInt32(Settings(ArticleConstants.COMMENT_SORT_DIRECTION_SETTING).ToString()) + Else + Return 0 + End If + End Get + End Property + + Public ReadOnly Property SyndicationLinkType() As SyndicationLinkType + Get + If (Settings.Contains(ArticleConstants.SYNDICATION_LINK_TYPE)) Then + Return CType(System.Enum.Parse(GetType(SyndicationLinkType), Settings(ArticleConstants.SYNDICATION_LINK_TYPE).ToString()), SyndicationLinkType) + Else + Return SyndicationLinkType.Article + End If + End Get + End Property + + Public ReadOnly Property SyndicationEnclosureType() As SyndicationEnclosureType + Get + If (Settings.Contains(ArticleConstants.SYNDICATION_ENCLOSURE_TYPE)) Then + Return CType(System.Enum.Parse(GetType(SyndicationEnclosureType), Settings(ArticleConstants.SYNDICATION_ENCLOSURE_TYPE).ToString()), SyndicationEnclosureType) + Else + Return SyndicationEnclosureType.Attachment + End If + End Get + End Property + + Public ReadOnly Property SyndicationSummaryLength() As Integer + Get + If (Settings.Contains(ArticleConstants.SYNDICATION_SUMMARY_LENGTH)) Then + Return Convert.ToInt32(Settings(ArticleConstants.SYNDICATION_SUMMARY_LENGTH).ToString()) + Else + Return Null.NullInteger + End If + End Get + End Property + + Public ReadOnly Property SyndicationMaxCount() As Integer + Get + If (Settings.Contains(ArticleConstants.SYNDICATION_MAX_COUNT)) Then + Return Convert.ToInt32(Settings(ArticleConstants.SYNDICATION_MAX_COUNT).ToString()) + Else + Return 50 + End If + End Get + End Property + + Public ReadOnly Property SyndicationImagePath() As String + Get + If (Settings.Contains(ArticleConstants.SYNDICATION_IMAGE_PATH)) Then + Return Settings(ArticleConstants.SYNDICATION_IMAGE_PATH).ToString() + Else + Return "~/DesktopModules/DnnForge - NewsArticles/Images/rssbutton.gif" + End If + End Get + End Property + + Public ReadOnly Property UseCanonicalLink() As Boolean + Get + If (Settings.Contains(ArticleConstants.SEO_USE_CANONICAL_LINK_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.SEO_USE_CANONICAL_LINK_SETTING)) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property ExpandMetaInformation() As Boolean + Get + If (Settings.Contains(ArticleConstants.SEO_EXPAND_META_INFORMATION_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.SEO_EXPAND_META_INFORMATION_SETTING)) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property UniquePageTitles() As Boolean + Get + If (Settings.Contains(ArticleConstants.SEO_UNIQUE_PAGE_TITLES_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.SEO_UNIQUE_PAGE_TITLES_SETTING)) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property UseCaptcha() As Boolean + Get + If (Settings.Contains(ArticleConstants.USE_CAPTCHA_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.USE_CAPTCHA_SETTING)) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property UrlModeType() As UrlModeType + Get + If (Settings.Contains(ArticleConstants.SEO_URL_MODE_SETTING)) Then + Try + Return CType(System.Enum.Parse(GetType(UrlModeType), Settings(ArticleConstants.SEO_URL_MODE_SETTING).ToString()), UrlModeType) + Catch + Return UrlModeType.Shorterned + End Try + Else + Return UrlModeType.Shorterned + End If + End Get + End Property + + Public ReadOnly Property WatermarkEnabled() As Boolean + Get + If (_settings.Contains(ArticleConstants.IMAGE_WATERMARK_ENABLED_SETTING)) Then + Return Convert.ToBoolean(_settings(ArticleConstants.IMAGE_WATERMARK_ENABLED_SETTING).ToString()) + Else + Return ArticleConstants.IMAGE_WATERMARK_ENABLED_SETTING_DEFAULT + End If + End Get + End Property + + Public ReadOnly Property WatermarkText() As String + Get + If (_settings.Contains(ArticleConstants.IMAGE_WATERMARK_TEXT_SETTING)) Then + Return _settings(ArticleConstants.IMAGE_WATERMARK_TEXT_SETTING).ToString() + Else + Return ArticleConstants.IMAGE_WATERMARK_TEXT_SETTING_DEFAULT + End If + End Get + End Property + + Public ReadOnly Property WatermarkImage() As String + Get + If (_settings.Contains(ArticleConstants.IMAGE_WATERMARK_IMAGE_SETTING)) Then + Return _settings(ArticleConstants.IMAGE_WATERMARK_IMAGE_SETTING).ToString() + Else + Return ArticleConstants.IMAGE_WATERMARK_IMAGE_SETTING_DEFAULT + End If + End Get + End Property + + Public ReadOnly Property WatermarkPosition() As WatermarkPosition + Get + If (_settings.Contains(ArticleConstants.IMAGE_WATERMARK_IMAGE_POSITION_SETTING)) Then + Try + Return CType(System.Enum.Parse(GetType(WatermarkPosition), _settings(ArticleConstants.IMAGE_WATERMARK_IMAGE_POSITION_SETTING).ToString()), WatermarkPosition) + Catch + Return ArticleConstants.IMAGE_WATERMARK_IMAGE_POSITION_SETTING_DEFAULT + End Try + Else + Return ArticleConstants.IMAGE_WATERMARK_IMAGE_POSITION_SETTING_DEFAULT + End If + End Get + End Property + + + + + + + + + + + + + + + + + + + + + + + Public ReadOnly Property PageSize() As Integer + Get + If (Settings.Contains("Number")) Then + If (Convert.ToInt32(Settings("Number").ToString()) > 0) Then + Return Convert.ToInt32(Settings("Number").ToString()) + Else + If (Convert.ToInt32(Settings("Number").ToString()) = -1) Then + Return 10000 + Else + Return 10 + End If + End If + Else + Return 10 + End If + End Get + End Property + + Public ReadOnly Property IsCommentsAnonymous() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_ANONYMOUS_COMMENTS_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_ANONYMOUS_COMMENTS_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property IsCommentsEnabled() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_COMMENTS_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_COMMENTS_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property IsCommentModerationEnabled() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_COMMENT_MODERATION_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_COMMENT_MODERATION_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property IsCommentWebsiteHidden() As Boolean + Get + If (Settings.Contains(ArticleConstants.COMMENT_HIDE_WEBSITE_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.COMMENT_HIDE_WEBSITE_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property IsRateable() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated) Then + Return EnableRatingsAuthenticated + Else + Return EnableRatingsAnonymous + End If + End Get + End Property + + Public ReadOnly Property IsSyndicationEnabled() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_SYNDICATION_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_SYNDICATION_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property IsIncomingTrackbackEnabled() As Boolean + Get + If (Settings.Contains(ArticleConstants.ENABLE_INCOMING_TRACKBACK_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_INCOMING_TRACKBACK_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property LaunchLinks() As Boolean + Get + If (Settings.Contains(ArticleConstants.LAUNCH_LINKS)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.LAUNCH_LINKS).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property DisplayMode() As DisplayType + Get + If (Settings.Contains(ArticleConstants.DISPLAY_MODE)) Then + Return CType(System.Enum.Parse(GetType(DisplayType), Settings(ArticleConstants.DISPLAY_MODE).ToString()), DisplayType) + Else + Return DisplayType.FullName + End If + End Get + End Property + + Public ReadOnly Property RelatedMode() As RelatedType + Get + If (Settings.Contains(ArticleConstants.RELATED_MODE)) Then + Return CType(System.Enum.Parse(GetType(RelatedType), Settings(ArticleConstants.RELATED_MODE).ToString()), RelatedType) + Else + Return RelatedType.MatchCategoriesAnyTagsAny + End If + End Get + End Property + + Public ReadOnly Property Template() As String + Get + If (Settings.Contains(ArticleConstants.TEMPLATE_SETTING)) Then + Return Settings(ArticleConstants.TEMPLATE_SETTING).ToString() + Else + Return "Standard" + End If + End Get + End Property + + Public ReadOnly Property SEOTitleSpecified() As Boolean + Get + Return Settings.Contains(ArticleConstants.SEO_TITLE_SETTING) + End Get + End Property + + Public ReadOnly Property ShowPending() As Boolean + Get + If (Settings.Contains(ArticleConstants.SHOW_PENDING_SETTING)) Then + Return Convert.ToBoolean(Settings(ArticleConstants.SHOW_PENDING_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property TitleReplacement() As TitleReplacementType + Get + If (Settings.Contains(ArticleConstants.TITLE_REPLACEMENT_TYPE)) Then + Return CType(System.Enum.Parse(GetType(TitleReplacementType), Settings(ArticleConstants.TITLE_REPLACEMENT_TYPE).ToString()), TitleReplacementType) + Else + Return TitleReplacementType.Dash + End If + End Get + End Property + + Public ReadOnly Property TextEditorWidth() As String + Get + If (Settings.Contains(ArticleConstants.TEXT_EDITOR_WIDTH)) Then + Return Settings(ArticleConstants.TEXT_EDITOR_WIDTH).ToString() + Else + Return "100%" + End If + End Get + End Property + + Public ReadOnly Property TextEditorHeight() As String + Get + If (Settings.Contains(ArticleConstants.TEXT_EDITOR_HEIGHT)) Then + Return Settings(ArticleConstants.TEXT_EDITOR_HEIGHT).ToString() + Else + Return "400" + End If + End Get + End Property + + Public ReadOnly Property TextEditorSummaryMode() As TextEditorModeType + Get + If (Settings.Contains(ArticleConstants.TEXT_EDITOR_SUMMARY_MODE)) Then + Return CType(System.Enum.Parse(GetType(TextEditorModeType), Settings(ArticleConstants.TEXT_EDITOR_SUMMARY_MODE).ToString()), TextEditorModeType) + Else + Return TextEditorModeType.Rich + End If + End Get + End Property + + Public ReadOnly Property TextEditorSummaryWidth() As String + Get + If (Settings.Contains(ArticleConstants.TEXT_EDITOR_SUMMARY_WIDTH)) Then + Return Settings(ArticleConstants.TEXT_EDITOR_SUMMARY_WIDTH).ToString() + Else + Return "100%" + End If + End Get + End Property + + Public ReadOnly Property TextEditorSummaryHeight() As String + Get + If (Settings.Contains(ArticleConstants.TEXT_EDITOR_SUMMARY_HEIGHT)) Then + Return Settings(ArticleConstants.TEXT_EDITOR_SUMMARY_HEIGHT).ToString() + Else + Return "400" + End If + End Get + End Property + + Public ReadOnly Property TwitterName() As String + Get + If (Settings.Contains(ArticleConstants.TWITTER_USERNAME)) Then + Return Settings(ArticleConstants.TWITTER_USERNAME).ToString() + Else + Return "" + End If + End Get + End Property + + Public ReadOnly Property TwitterBitLyLogin() As String + Get + If (Settings.Contains(ArticleConstants.TWITTER_BITLY_LOGIN)) Then + Return Settings(ArticleConstants.TWITTER_BITLY_LOGIN).ToString() + Else + Return "" + End If + End Get + End Property + + Public ReadOnly Property TwitterBitLyAPIKey() As String + Get + If (Settings.Contains(ArticleConstants.TWITTER_BITLY_API_KEY)) Then + Return Settings(ArticleConstants.TWITTER_BITLY_API_KEY).ToString() + Else + Return "" + End If + End Get + End Property + + Public ReadOnly Property ServerTimeZone() As Integer + Get + If (Settings.Contains(ArticleConstants.SERVER_TIMEZONE)) Then + If (IsNumeric(Settings(ArticleConstants.SERVER_TIMEZONE).ToString())) Then + Return Convert.ToInt32(Settings(ArticleConstants.SERVER_TIMEZONE).ToString()) + Else + Return _portalSettings.TimeZoneOffset + End If + Else + Return _portalSettings.TimeZoneOffset + End If + End Get + End Property + + + + + Public ReadOnly Property TemplatePath() As String + Get + Return _portalSettings.HomeDirectoryMapPath & "DnnForge - NewsArticles/Templates/" & Template & "/" + End Get + End Property + + Public ReadOnly Property SecureUrl() As String + Get + If (Settings.Contains(ArticleConstants.PERMISSION_SECURE_URL_SETTING)) Then + Return Settings(ArticleConstants.PERMISSION_SECURE_URL_SETTING).ToString() + Else + Return "" + End If + End Get + End Property + + Public ReadOnly Property RoleGroupID() As Integer + Get + If (Settings.Contains(ArticleConstants.PERMISSION_ROLE_GROUP_ID)) Then + Return Convert.ToInt32(Settings(ArticleConstants.PERMISSION_ROLE_GROUP_ID).ToString()) + Else + Return -1 + End If + End Get + End Property + + Public ReadOnly Property IsApprover() As Boolean + Get + If (HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (IsAdmin) Then + Return True + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_APPROVAL_SETTING)) Then + Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_APPROVAL_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property IsCategoriesEnabled() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_CATEGORIES_SETTING)) Then + Return IsInRoles(Settings(ArticleConstants.PERMISSION_CATEGORIES_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property IsExcerptEnabled() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_EXCERPT_SETTING)) Then + Return IsInRoles(Settings(ArticleConstants.PERMISSION_EXCERPT_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property IsImagesEnabled() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_IMAGE_SETTING)) Then + Return IsInRoles(Settings(ArticleConstants.PERMISSION_IMAGE_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property IsFilesEnabled() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_FILE_SETTING)) Then + Return IsInRoles(Settings(ArticleConstants.PERMISSION_FILE_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property IsLinkEnabled() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_LINK_SETTING)) Then + Return IsInRoles(Settings(ArticleConstants.PERMISSION_LINK_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property IsFeaturedEnabled() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_FEATURE_SETTING)) Then + Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_FEATURE_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property IsSecureEnabled() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_SECURE_SETTING)) Then + Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_SECURE_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property IsPublishEnabled() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_PUBLISH_SETTING)) Then + Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_PUBLISH_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property IsExpiryEnabled() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_EXPIRY_SETTING)) Then + Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_EXPIRY_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property IsMetaEnabled() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_META_SETTING)) Then + If (Settings(ArticleConstants.PERMISSION_META_SETTING).ToString() = "") Then + Return False + End If + Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_META_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property IsCustomEnabled() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_CUSTOM_SETTING)) Then + If (Settings(ArticleConstants.PERMISSION_CUSTOM_SETTING).ToString() = "") Then + Return False + End If + Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_CUSTOM_SETTING).ToString()) + Else + Return True + End If + End Get + End Property + + Public ReadOnly Property IsAutoApprover() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (IsAdmin) Then + Return True + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_APPROVAL_SETTING)) Then + Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_AUTO_APPROVAL_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property IsAutoApproverComment() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (IsAdmin) Then + Return True + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_APPROVAL_COMMENT_SETTING)) Then + Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_AUTO_APPROVAL_COMMENT_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property IsAutoFeatured() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_FEATURE_SETTING)) Then + + For Each role As String In Settings(ArticleConstants.PERMISSION_AUTO_FEATURE_SETTING).ToString().Split(New Char() {";"c}) + If (role <> "") Then + If (UserController.GetCurrentUserInfo.IsInRole(role)) Then + Return True + End If + End If + Next + Return False + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property IsAutoSecured() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_SECURE_SETTING)) Then + + For Each role As String In Settings(ArticleConstants.PERMISSION_AUTO_SECURE_SETTING).ToString().Split(New Char() {";"c}) + If (role <> "") Then + If (UserController.GetCurrentUserInfo.IsInRole(role)) Then + Return True + End If + End If + Next + Return False + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property IsSubmitter() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + If (IsAdmin) Then + Return True + End If + + If (Settings.Contains(ArticleConstants.PERMISSION_SUBMISSION_SETTING)) Then + Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_SUBMISSION_SETTING).ToString()) + Else + Return False + End If + End Get + End Property + + Public ReadOnly Property IsAdmin() As Boolean + Get + If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then + Return False + End If + + Dim blnHasModuleEditPermissions As Boolean = PortalSecurity.IsInRoles(_moduleConfiguration.AuthorizedEditRoles) + + If (blnHasModuleEditPermissions = False) Then + blnHasModuleEditPermissions = PortalSecurity.IsInRoles(_portalSettings.ActiveTab.AdministratorRoles) + End If + + If (blnHasModuleEditPermissions = False) Then + blnHasModuleEditPermissions = PortalSecurity.IsInRoles(_portalSettings.AdministratorRoleName) + End If + + Return blnHasModuleEditPermissions + End Get + End Property + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Components/AuthorController.vb b/Components/AuthorController.vb new file mode 100755 index 0000000..f5aa930 --- /dev/null +++ b/Components/AuthorController.vb @@ -0,0 +1,102 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports DotNetNuke.Common.Utilities +Imports System.Security.Cryptography + +Namespace Ventrian.NewsArticles + + Public Class AuthorController + + Public Shared Sub ClearCache(ByVal moduleID As Integer) + + Dim itemsToRemove As New List(Of String)() + + If (HttpContext.Current IsNot Nothing) Then + Dim enumerator As IDictionaryEnumerator = HttpContext.Current.Cache.GetEnumerator() + While enumerator.MoveNext() + If enumerator.Key.ToString().ToLower().Contains("ventrian-newsarticles-authors-" & moduleID.ToString()) Then + itemsToRemove.Add(enumerator.Key.ToString()) + End If + End While + + For Each itemToRemove As String In itemsToRemove + DataCache.RemoveCache(itemToRemove.Replace("DNN_", "")) + Next + End If + + End Sub + + Public Function GetAuthorList(ByVal moduleID As Integer) As List(Of AuthorInfo) + + Dim cacheKey As String = "ventrian-newsarticles-authors-" & moduleID.ToString() + + Dim objAuthors As List(Of AuthorInfo) = CType(DataCache.GetCache(cacheKey), List(Of AuthorInfo)) + + If (objAuthors Is Nothing) Then + objAuthors = CBO.FillCollection(Of AuthorInfo)(DataProvider.Instance().GetAuthorList(moduleID)) + DataCache.SetCache(cacheKey, objAuthors) + End If + + Return objAuthors + + End Function + + Public Function GetAuthorStatistics(ByVal moduleID As Integer, ByVal categoryID As Integer(), ByVal categoryIDExclude As Integer(), ByVal authorID As Integer, ByVal sortBy As String, ByVal showPending As Boolean) As List(Of AuthorInfo) + + Dim categories As String = Null.NullString + + If Not (categoryID Is Nothing) Then + For Each category As Integer In categoryID + If Not (categories = Null.NullString) Then + categories = categories & "," + End If + categories = categories & category.ToString() + Next + End If + + Dim categoriesExclude As String = Null.NullString + + If Not (categoryIDExclude Is Nothing) Then + For Each category As Integer In categoryIDExclude + If Not (categoriesExclude = Null.NullString) Then + categoriesExclude = categoriesExclude & "," + End If + categoriesExclude = categoriesExclude & category.ToString() + Next + End If + + Dim hashCategories As String = "" + If (categories <> "" Or categoriesExclude <> "") Then + Dim Ue As New UnicodeEncoding() + Dim ByteSourceText() As Byte = Ue.GetBytes(categories & categoriesExclude) + Dim Md5 As New MD5CryptoServiceProvider() + Dim ByteHash() As Byte = Md5.ComputeHash(ByteSourceText) + hashCategories = Convert.ToBase64String(ByteHash) + End If + + If (sortBy = "ArticleCount") Then + sortBy = "ArticleCount DESC" + End If + + Dim cacheKey As String = "ventrian-newsarticles-authors-" & moduleID.ToString() & "-" & hashCategories & "-" & authorID.ToString() & "-" & sortBy.ToString() & "-" & showPending.ToString() + + Dim objAuthorStatistics As List(Of AuthorInfo) = CType(DataCache.GetCache(cacheKey), List(Of AuthorInfo)) + + If (objAuthorStatistics Is Nothing) Then + objAuthorStatistics = CBO.FillCollection(Of AuthorInfo)(DataProvider.Instance().GetAuthorStatistics(moduleID, categoryID, categoryIDExclude, authorID, sortBy, showPending)) + DataCache.SetCache(cacheKey, objAuthorStatistics) + End If + + Return objAuthorStatistics + + End Function + + + End Class + +End Namespace diff --git a/Components/AuthorInfo.vb b/Components/AuthorInfo.vb new file mode 100755 index 0000000..724db4b --- /dev/null +++ b/Components/AuthorInfo.vb @@ -0,0 +1,98 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Data + +Imports DotNetNuke +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Users +Imports DotNetNuke.Security.Roles + +Namespace Ventrian.NewsArticles + + Public Class AuthorInfo + +#Region " Private Members " + + ' local property declarations + Dim _userName As String + Dim _userID As Integer + Dim _firstName As String + Dim _lastName As String + Dim _displayName As String + Dim _articleCount As Integer + +#End Region + +#Region " Public Properties " + + Public Property UserName() As String + Get + Return _userName + End Get + Set(ByVal Value As String) + _userName = Value + End Set + End Property + + Public Property UserID() As Integer + Get + Return _userID + End Get + Set(ByVal Value As Integer) + _userID = Value + End Set + End Property + + Public Property FirstName() As String + Get + Return _firstName + End Get + Set(ByVal Value As String) + _firstName = Value + End Set + End Property + + Public Property LastName() As String + Get + Return _lastName + End Get + Set(ByVal Value As String) + _lastName = Value + End Set + End Property + + Public Property DisplayName() As String + Get + Return _displayName + End Get + Set(ByVal Value As String) + _displayName = Value + End Set + End Property + + Public ReadOnly Property FullName() As String + Get + Return FirstName & " " & LastName + End Get + End Property + + Public Property ArticleCount() As Integer + Get + Return _articleCount + End Get + Set(ByVal Value As Integer) + _articleCount = Value + End Set + End Property + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Components/AuthorSortByType.vb b/Components/AuthorSortByType.vb new file mode 100755 index 0000000..5bc3b23 --- /dev/null +++ b/Components/AuthorSortByType.vb @@ -0,0 +1,19 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Public Enum AuthorSortByType + + ArticleCount + DisplayName + FirstName + LastName + UserName + + End Enum + +End Namespace diff --git a/Components/Bitly.vb b/Components/Bitly.vb new file mode 100755 index 0000000..6365e51 --- /dev/null +++ b/Components/Bitly.vb @@ -0,0 +1,132 @@ +Imports System.Text +Imports System.Xml +Imports System.IO +Imports System.Net + +Namespace Ventrian.NewsArticles + + Public Class bitly + Private loginAccount As String + Private apiKeyForAccount As String + + Private submitPath As String = "http://api.bit.ly/shorten?version=2.0.1&format=xml" + Private errorStatus As Integer = 0 + Private errorStatusMessage As String = "" + + + ' Constructors (overloaded and chained) + Public Sub New() + Me.New("bitlyapidemo", "R_0da49e0a9118ff35f52f629d2d71bf07") + End Sub + + + Public Sub New(ByVal login As String, ByVal APIKey As String) + loginAccount = login + apiKeyForAccount = APIKey + + submitPath &= "&login=" & loginAccount & "&apiKey=" & apiKeyForAccount + End Sub + + + ' Properties to retrieve error information. + Public ReadOnly Property ErrorCode() As Integer + Get + Return errorStatus + End Get + End Property + + Public ReadOnly Property ErrorMessage() As String + Get + Return errorStatusMessage + End Get + End Property + + + ' Main shorten function which takes in the long URL and returns the bit.ly shortened URL + Public Function Shorten(ByVal url As String) As String + + errorStatus = 0 + errorStatusMessage = "" + + Dim doc As XmlDocument + doc = buildDocument(url) + + If Not doc.DocumentElement Is Nothing Then + + Dim shortenedNode As XmlNode = doc.DocumentElement.SelectSingleNode("results/nodeKeyVal/shortUrl") + + If Not shortenedNode Is Nothing Then + + Return shortenedNode.InnerText + + Else + + getErrorCode(doc) + + End If + Else + + errorStatus = -1 + errorStatusMessage = "Unable to connect to bit.ly for shortening of URL" + End If + + Return "" + + End Function + + + ' Sets error code and message in the situation we receive a response, but there was + ' something wrong with our submission. + Private Sub getErrorCode(ByVal doc As XmlDocument) + + Dim errorNode As XmlNode = doc.DocumentElement.SelectSingleNode("errorCode") + Dim errorMessageNode As XmlNode = doc.DocumentElement.SelectSingleNode("errorMessage") + + If Not errorNode Is Nothing Then + + errorStatus = Convert.ToInt32(errorNode.InnerText) + errorStatusMessage = errorMessageNode.InnerText + End If + End Sub + + + ' Builds an XmlDocument using the XML returned by bit.ly in response + ' to our URL being submitted + Private Function buildDocument(ByVal url As String) As XmlDocument + + Dim doc As New XmlDocument + + Try + + ' Load the XML response into an XML Document and return it. + doc.LoadXml(readSource(submitPath + "&longUrl=" + url)) + Return doc + + Catch e As Exception + + Return New XmlDocument() + End Try + End Function + + + ' Fetches a result from bit.ly provided the URL submitted + Private Function readSource(ByVal url As String) As String + Dim client As New WebClient + + Try + + Using reader As New StreamReader(client.OpenRead(url)) + ' Read all of the response + Return reader.ReadToEnd() + reader.Close() + End Using + + Catch e As Exception + Throw e + End Try + + End Function + + End Class + +End Namespace diff --git a/Components/CategoryController.vb b/Components/CategoryController.vb new file mode 100755 index 0000000..d547203 --- /dev/null +++ b/Components/CategoryController.vb @@ -0,0 +1,227 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Data + +Imports DotNetNuke +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Class CategoryController + +#Region " Public Methods " + + Public Shared Sub ClearCache(ByVal moduleID As Integer) + + Dim itemsToRemove As New List(Of String)() + + If (HttpContext.Current IsNot Nothing) Then + Dim enumerator As IDictionaryEnumerator = HttpContext.Current.Cache.GetEnumerator() + While enumerator.MoveNext() + If enumerator.Key.ToString().ToLower().Contains("ventrian-newsarticles-categories-" & moduleID.ToString()) Then + itemsToRemove.Add(enumerator.Key.ToString()) + End If + End While + + For Each itemToRemove As String In itemsToRemove + DataCache.RemoveCache(itemToRemove.Replace("DNN_", "")) + Next + End If + + End Sub + + Public Function GetCategories(ByVal moduleID As Integer, ByVal parentID As Integer) As List(Of CategoryInfo) + + Return GetCategoriesAll(moduleID, parentID, Nothing, Null.NullInteger, 1, Null.NullBoolean, CategorySortType.Name) + + End Function + + Public Function GetCategoriesAll(ByVal moduleID As Integer) As List(Of CategoryInfo) + + Return GetCategoriesAll(moduleID, Null.NullInteger, Nothing, Null.NullInteger, Null.NullInteger, Null.NullBoolean, CategorySortType.Name) + + End Function + + Public Function GetCategoriesAll(ByVal moduleID As Integer, ByVal parentID As Integer) As List(Of CategoryInfo) + + Return GetCategoriesAll(moduleID, parentID, CategorySortType.Name) + + End Function + + Public Function GetCategoriesAll(ByVal moduleID As Integer, ByVal parentID As Integer, ByVal sortType As CategorySortType) As List(Of CategoryInfo) + + Return GetCategoriesAll(moduleID, parentID, Nothing, Null.NullInteger, Null.NullInteger, False, sortType) + + End Function + + Public Function GetCategoriesAll(ByVal moduleID As Integer, ByVal parentID As Integer, ByVal categoryIDFilter As Integer(), ByVal authorID As Integer, ByVal maxDepth As Integer, ByVal showPending As Boolean, ByVal sortType As CategorySortType) As List(Of CategoryInfo) + + Dim cacheKey As String = "Ventrian-NewsArticles-Categories-" & moduleID.ToString() & "-" & sortType.ToString() + + If (authorID <> Null.NullInteger) Then + cacheKey = cacheKey & "-a-" & authorID.ToString() + End If + + If (showPending <> Null.NullBoolean) Then + cacheKey = cacheKey & "-sp-" & showPending.ToString() + End If + + Dim objCategories As List(Of CategoryInfo) = CType(DataCache.GetCache(cacheKey), List(Of CategoryInfo)) + + If (objCategories Is Nothing) Then + objCategories = CBO.FillCollection(Of CategoryInfo)(DataProvider.Instance().GetCategoryListAll(moduleID, authorID, showPending, sortType)) + DataCache.SetCache(cacheKey, objCategories) + End If + + If (categoryIDFilter IsNot Nothing) Then + Dim objNewCategories As New List(Of CategoryInfo) + For Each id As Integer In categoryIDFilter + For Each objCategory As CategoryInfo In objCategories + If (objCategory.CategoryID = id) Then + objNewCategories.Add(objCategory) + End If + Next + Next + objCategories = objNewCategories + End If + + Dim objCategoriesCopy As New List(Of CategoryInfo)(objCategories) + + If (parentID <> Null.NullInteger) Then + Dim level As Integer = Null.NullInteger + Dim objParentIDs As New List(Of Integer) + objParentIDs.Add(parentID) + Dim objNewCategories As New List(Of CategoryInfo) + For Each objCategory As CategoryInfo In objCategoriesCopy + For Each id As Integer In objParentIDs.ToArray() + If (objCategory.ParentID = id) Then + If (level = Null.NullInteger) Then + level = objCategory.Level + End If + + If (maxDepth = Null.NullInteger Or objCategory.Level < (level + maxDepth)) Then + Dim objCategoryNew As CategoryInfo = objCategory.Clone() + objCategoryNew.Level = objCategory.Level - level + 1 + objNewCategories.Add(objCategoryNew) + If (objParentIDs.Contains(objCategory.CategoryID) = False) Then + objParentIDs.Add(objCategory.CategoryID) + End If + Exit For + End If + End If + Next + Next + objCategoriesCopy = objNewCategories + Else + If (maxDepth <> Null.NullInteger) Then + Dim objNewCategories As New List(Of CategoryInfo) + For Each objCategory As CategoryInfo In objCategoriesCopy + If (objCategory.Level <= maxDepth) Then + objNewCategories.Add(objCategory) + End If + Next + objCategoriesCopy = objNewCategories + End If + End If + + Return objCategoriesCopy + + End Function + + + + _ + Public Function GetCategoryList(ByVal moduleID As Integer, ByVal parentID As Integer) As ArrayList + + Dim objCategories As List(Of CategoryInfo) = GetCategories(moduleID, parentID) + Dim objCategoriesToReturn As New ArrayList() + + For Each objCategory As CategoryInfo In objCategories + objCategoriesToReturn.Add(objCategory) + Next + + Return objCategoriesToReturn + + End Function + + _ + Public Function GetCategoryListAll(ByVal moduleID As Integer) As ArrayList + + Return GetCategoryListAll(moduleID, Null.NullInteger, Nothing, Null.NullInteger, Null.NullInteger, Null.NullBoolean, CategorySortType.Name) + + End Function + + _ + Public Function GetCategoryListAll(ByVal moduleID As Integer, ByVal parentID As Integer) As ArrayList + + Return GetCategoryListAll(moduleID, parentID, CategorySortType.Name) + + End Function + + _ + Public Function GetCategoryListAll(ByVal moduleID As Integer, ByVal parentID As Integer, ByVal sortType As CategorySortType) As ArrayList + + Return GetCategoryListAll(moduleID, parentID, Nothing, Null.NullInteger, Null.NullInteger, False, sortType) + + End Function + + _ + Public Function GetCategoryListAll(ByVal moduleID As Integer, ByVal parentID As Integer, ByVal categoryIDFilter As Integer(), ByVal authorID As Integer, ByVal maxDepth As Integer, ByVal showPending As Boolean, ByVal sortType As CategorySortType) As ArrayList + + Dim objCategories As List(Of CategoryInfo) = GetCategoriesAll(moduleID, parentID, categoryIDFilter, authorID, maxDepth, showPending, sortType) + Dim objCategoriesToReturn As New ArrayList() + + For Each objCategory As CategoryInfo In objCategories + objCategoriesToReturn.Add(objCategory) + Next + + Return objCategoriesToReturn + + End Function + + Public Function GetCategory(ByVal categoryID As Integer, ByVal moduleID As Integer) As CategoryInfo + + Dim objCategories As List(Of CategoryInfo) = GetCategoriesAll(moduleID) + + For Each objCategory As CategoryInfo In objCategories + If (objCategory.CategoryID = categoryID) Then + Return objCategory + End If + Next + + Return CType(CBO.FillObject(DataProvider.Instance().GetCategory(categoryID), GetType(CategoryInfo)), CategoryInfo) + + End Function + + Public Sub DeleteCategory(ByVal categoryID As Integer, ByVal moduleID As Integer) + + DataProvider.Instance().DeleteCategory(categoryID) + CategoryController.ClearCache(moduleID) + + End Sub + + Public Function AddCategory(ByVal objCategory As CategoryInfo) As Integer + + Dim categoryID As Integer = CType(DataProvider.Instance().AddCategory(objCategory.ModuleID, objCategory.ParentID, objCategory.Name, objCategory.Image, objCategory.Description, objCategory.SortOrder, objCategory.InheritSecurity, objCategory.CategorySecurityType, objCategory.MetaTitle, objCategory.MetaDescription, objCategory.MetaKeywords), Integer) + CategoryController.ClearCache(objCategory.ModuleID) + Return categoryID + + End Function + + Public Sub UpdateCategory(ByVal objCategory As CategoryInfo) + + DataProvider.Instance().UpdateCategory(objCategory.CategoryID, objCategory.ModuleID, objCategory.ParentID, objCategory.Name, objCategory.Image, objCategory.Description, objCategory.SortOrder, objCategory.InheritSecurity, objCategory.CategorySecurityType, objCategory.MetaTitle, objCategory.MetaDescription, objCategory.MetaKeywords) + CategoryController.ClearCache(objCategory.ModuleID) + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Components/CategoryInfo.vb b/Components/CategoryInfo.vb new file mode 100755 index 0000000..7af073a --- /dev/null +++ b/Components/CategoryInfo.vb @@ -0,0 +1,219 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Data + +Imports DotNetNuke +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Class CategoryInfo + +#Region " Private Methods " + + ' local property declarations + Dim _categoryID As Integer + Dim _moduleID As Integer + Dim _parentID As Integer + Dim _name As String + Dim _nameIndented As String + Dim _description As String + Dim _image As String + Dim _level As Integer + Dim _sortOrder As Integer + Dim _inheritSecurity As Boolean + Dim _categorySecurityType As CategorySecurityType + + Dim _numberOfArticles As Integer + Dim _numberOfViews As Integer + + Dim _metaTitle As String + Dim _metaDescription As String + Dim _metaKeywords As String + + Dim _levelParent As Integer = Null.NullInteger + +#End Region + +#Region " Public Properties " + + Public Property CategoryID() As Integer + Get + Return _categoryID + End Get + Set(ByVal Value As Integer) + _categoryID = Value + End Set + End Property + + Public Property ModuleID() As Integer + Get + Return _moduleID + End Get + Set(ByVal Value As Integer) + _moduleID = Value + End Set + End Property + + Public Property ParentID() As Integer + Get + Return _parentID + End Get + Set(ByVal Value As Integer) + _parentID = Value + End Set + End Property + + Public Property Name() As String + Get + Return _name + End Get + Set(ByVal Value As String) + _name = Value + End Set + End Property + + Public Property Description() As String + Get + Return _description + End Get + Set(ByVal Value As String) + _description = Value + End Set + End Property + + Public Property NameIndented() As String + Get + If (Level = 1) Then + Return Name + Else + If ((Level - 1) * 2 > 0) Then + Dim a As New String("."c, (Level - 1) * 2) + Return a & Name + Else + Return Name + End If + End If + End Get + Set(ByVal Value As String) + _nameIndented = Value + End Set + End Property + + Public Property Image() As String + Get + Return _image + End Get + Set(ByVal Value As String) + _image = Value + End Set + End Property + + Public Property Level() As Integer + Get + Return _level + End Get + Set(ByVal Value As Integer) + _level = Value + End Set + End Property + + Public Property LevelParent() As Integer + Get + Return _levelParent + End Get + Set(ByVal Value As Integer) + _levelParent = Value + End Set + End Property + + Public Property SortOrder() As Integer + Get + Return _sortOrder + End Get + Set(ByVal Value As Integer) + _sortOrder = Value + End Set + End Property + + Public Property InheritSecurity() As Boolean + Get + Return _inheritSecurity + End Get + Set(ByVal Value As Boolean) + _inheritSecurity = Value + End Set + End Property + + Public Property CategorySecurityType() As CategorySecurityType + Get + Return _categorySecurityType + End Get + Set(ByVal Value As CategorySecurityType) + _categorySecurityType = Value + End Set + End Property + + Public Property NumberOfArticles() As Integer + Get + Return _numberOfArticles + End Get + Set(ByVal Value As Integer) + _numberOfArticles = Value + End Set + End Property + + Public Property NumberOfViews() As Integer + Get + Return _numberOfViews + End Get + Set(ByVal Value As Integer) + _numberOfViews = Value + End Set + End Property + + Public Property MetaTitle() As String + Get + Return _metaTitle + End Get + Set(ByVal Value As String) + _metaTitle = Value + End Set + End Property + + Public Property MetaDescription() As String + Get + Return _metaDescription + End Get + Set(ByVal Value As String) + _metaDescription = Value + End Set + End Property + + Public Property MetaKeywords() As String + Get + Return _metaKeywords + End Get + Set(ByVal Value As String) + _metaKeywords = Value + End Set + End Property + +#End Region + +#Region " Public Methods " + + Public Function Clone() As CategoryInfo + Return DirectCast(Me.MemberwiseClone(), CategoryInfo) + End Function + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Components/CategorySecurityType.vb b/Components/CategorySecurityType.vb new file mode 100755 index 0000000..cd5fb03 --- /dev/null +++ b/Components/CategorySecurityType.vb @@ -0,0 +1,22 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Enum CategorySecurityType + + Restrict = 0 + Loose = 1 + + End Enum + +End Namespace diff --git a/Components/CategorySortType.vb b/Components/CategorySortType.vb new file mode 100755 index 0000000..983f0c3 --- /dev/null +++ b/Components/CategorySortType.vb @@ -0,0 +1,22 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Enum CategorySortType + + SortOrder = 0 + Name = 1 + + End Enum + +End Namespace diff --git a/Components/CommentController.vb b/Components/CommentController.vb new file mode 100755 index 0000000..b355b9c --- /dev/null +++ b/Components/CommentController.vb @@ -0,0 +1,96 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Data + +Imports DotNetNuke +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Class CommentController + + Public Shared Sub ClearCache(ByVal articleID As Integer) + + Dim itemsToRemove As New List(Of String)() + + Dim enumerator As IDictionaryEnumerator = HttpContext.Current.Cache.GetEnumerator() + While enumerator.MoveNext() + If enumerator.Key.ToString().ToLower().Contains("ventrian-newsarticles-comments") Then + itemsToRemove.Add(enumerator.Key.ToString()) + End If + End While + + For Each itemToRemove As String In itemsToRemove + DataCache.RemoveCache(itemToRemove.Replace("DNN_", "")) + Next + + End Sub + +#Region " Public Methods " + + Public Function GetCommentList(ByVal moduleID As Integer, ByVal articleID As Integer, ByVal isApproved As Boolean) As List(Of CommentInfo) + + Return GetCommentList(moduleID, articleID, isApproved, SortDirection.Ascending, Null.NullInteger) + + End Function + + Public Function GetCommentList(ByVal moduleID As Integer, ByVal articleID As Integer, ByVal isApproved As Boolean, ByVal direction As SortDirection, ByVal maxCount As Integer) As List(Of CommentInfo) + + Dim cacheKey As String = "ventrian-newsarticles-comments-" & moduleID.ToString() & "-" & articleID.ToString() & "-" & isApproved.ToString() & "-" & direction.ToString() & "-" & maxCount.ToString() + + Dim objComments As List(Of CommentInfo) = CType(DataCache.GetCache(cacheKey), List(Of CommentInfo)) + + If (objComments Is Nothing) Then + objComments = CBO.FillCollection(Of CommentInfo)(DataProvider.Instance().GetCommentList(moduleID, articleID, isApproved, direction, maxCount)) + DataCache.SetCache(cacheKey, objComments) + End If + + Return objComments + + End Function + + Public Function GetComment(ByVal commentID As Integer) As CommentInfo + + Return CType(CBO.FillObject(DataProvider.Instance().GetComment(commentID), GetType(CommentInfo)), CommentInfo) + + End Function + + Public Sub DeleteComment(ByVal commentID As Integer, ByVal articleID As Integer) + + DataProvider.Instance().DeleteComment(commentID) + + ArticleController.ClearArticleCache(articleID) + CommentController.ClearCache(articleID) + + End Sub + + Public Function AddComment(ByVal objComment As CommentInfo) As Integer + + Dim commentID As Integer = CType(DataProvider.Instance().AddComment(objComment.ArticleID, objComment.CreatedDate, objComment.UserID, objComment.Comment, objComment.RemoteAddress, objComment.Type, objComment.TrackbackUrl, objComment.TrackbackTitle, objComment.TrackbackBlogName, objComment.TrackbackExcerpt, objComment.AnonymousName, objComment.AnonymousEmail, objComment.AnonymousURL, objComment.NotifyMe, objComment.IsApproved, objComment.ApprovedBy), Integer) + + ArticleController.ClearArticleCache(objComment.ArticleID) + CommentController.ClearCache(objComment.ArticleID) + + Return commentID + + End Function + + Public Sub UpdateComment(ByVal objComment As CommentInfo) + + DataProvider.Instance().UpdateComment(objComment.CommentID, objComment.ArticleID, objComment.UserID, objComment.Comment, objComment.RemoteAddress, objComment.Type, objComment.TrackbackUrl, objComment.TrackbackTitle, objComment.TrackbackBlogName, objComment.TrackbackExcerpt, objComment.AnonymousName, objComment.AnonymousEmail, objComment.AnonymousURL, objComment.NotifyMe, objComment.IsApproved, objComment.ApprovedBy) + + ArticleController.ClearArticleCache(objComment.ArticleID) + CommentController.ClearCache(objComment.ArticleID) + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Components/CommentInfo.vb b/Components/CommentInfo.vb new file mode 100755 index 0000000..0f9c52f --- /dev/null +++ b/Components/CommentInfo.vb @@ -0,0 +1,251 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Data + +Imports DotNetNuke +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Class CommentInfo + +#Region " Private Methods " + + ' local property declarations + Dim _commentID As Integer + Dim _articleID As Integer + Dim _userID As Integer + Dim _comment As String + Dim _createdDate As DateTime + Dim _remoteAddress As String + Dim _type As Integer + Dim _trackbackUrl As String + Dim _trackbackTitle As String + Dim _trackbackBlogName As String + Dim _trackbackExcerpt As String + Dim _anonymousName As String + Dim _anonymousEmail As String + Dim _anonymousURL As String + Dim _notifyMe As Boolean = Null.NullBoolean + Dim _isApproved As Boolean = Null.NullBoolean + Dim _approvedBy As Integer + + Dim _authorEmail As String + Dim _authorUserName As String + Dim _authorFirstName As String + Dim _authorLastName As String + Dim _authorDisplayName As String + +#End Region + +#Region " Public Properties " + + Public Property CommentID() As Integer + Get + Return _commentID + End Get + Set(ByVal Value As Integer) + _commentID = Value + End Set + End Property + + Public Property ArticleID() As Integer + Get + Return _articleID + End Get + Set(ByVal Value As Integer) + _articleID = Value + End Set + End Property + + Public Property UserID() As Integer + Get + Return _userID + End Get + Set(ByVal Value As Integer) + _userID = Value + End Set + End Property + + + Public Property Comment() As String + Get + Return _comment + End Get + Set(ByVal Value As String) + _comment = Value + End Set + End Property + + Public Property CreatedDate() As DateTime + Get + Return _createdDate + End Get + Set(ByVal Value As DateTime) + _createdDate = Value + End Set + End Property + + Public Property RemoteAddress() As String + Get + Return _remoteAddress + End Get + Set(ByVal Value As String) + _remoteAddress = Value + End Set + End Property + + Public Property Type() As Integer + Get + Return _type + End Get + Set(ByVal Value As Integer) + _type = Value + End Set + End Property + + Public Property TrackbackUrl() As String + Get + Return _trackbackUrl + End Get + Set(ByVal Value As String) + _trackbackUrl = Value + End Set + End Property + + Public Property TrackbackTitle() As String + Get + Return _trackbackTitle + End Get + Set(ByVal Value As String) + _trackbackTitle = Value + End Set + End Property + + Public Property TrackbackBlogName() As String + Get + Return _trackbackBlogName + End Get + Set(ByVal Value As String) + _trackbackBlogName = Value + End Set + End Property + + Public Property TrackbackExcerpt() As String + Get + Return _trackbackExcerpt + End Get + Set(ByVal Value As String) + _trackbackExcerpt = Value + End Set + End Property + + Public Property NotifyMe() As Boolean + Get + Return _notifyMe + End Get + Set(ByVal Value As Boolean) + _notifyMe = Value + End Set + End Property + + Public Property IsApproved() As Boolean + Get + Return _isApproved + End Get + Set(ByVal Value As Boolean) + _isApproved = Value + End Set + End Property + + Public Property ApprovedBy() As Integer + Get + Return _approvedBy + End Get + Set(ByVal Value As Integer) + _approvedBy = Value + End Set + End Property + + Public Property AuthorUserName() As String + Get + Return _authorUserName + End Get + Set(ByVal Value As String) + _authorUserName = Value + End Set + End Property + + Public Property AuthorEmail() As String + Get + Return _authorEmail + End Get + Set(ByVal Value As String) + _authorEmail = Value + End Set + End Property + + Public Property AuthorFirstName() As String + Get + Return _authorFirstName + End Get + Set(ByVal Value As String) + _authorFirstName = Value + End Set + End Property + + Public Property AuthorLastName() As String + Get + Return _authorLastName + End Get + Set(ByVal Value As String) + _authorLastName = Value + End Set + End Property + + Public Property AuthorDisplayName() As String + Get + Return _authorDisplayName + End Get + Set(ByVal Value As String) + _authorDisplayName = Value + End Set + End Property + + Public Property AnonymousName() As String + Get + Return _anonymousName + End Get + Set(ByVal Value As String) + _anonymousName = Value + End Set + End Property + + Public Property AnonymousEmail() As String + Get + Return _anonymousEmail + End Get + Set(ByVal Value As String) + _anonymousEmail = Value + End Set + End Property + + Public Property AnonymousURL() As String + Get + Return _anonymousURL + End Get + Set(ByVal Value As String) + _anonymousURL = Value + End Set + End Property + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Components/Common.vb b/Components/Common.vb new file mode 100755 index 0000000..b3b028a --- /dev/null +++ b/Components/Common.vb @@ -0,0 +1,778 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System.Globalization +Imports System.Threading +Imports System.Web + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Entities.Portals +Imports DotNetNuke.Entities.Tabs +Imports DotNetNuke.Entities.Users +Imports DotNetNuke.Services.Localization +Imports DotNetNuke.UI.Modules + +Imports Ventrian.NewsArticles.Components.Utility +Imports DotNetNuke.Entities.Controllers +Imports DotNetNuke.Entities.Host +Imports DotNetNuke.Security + +Namespace Ventrian.NewsArticles + + Public Class Common + +#Region " Friend Shared Methods " + + Friend Shared Sub BindEnum(ByVal objListControl As ListControl, ByRef enumType As Type, ByVal resourceFile As String) + + For Each value As Integer In System.Enum.GetValues(enumType) + Dim li As New ListItem + li.Value = System.Enum.GetName(enumType, value) + li.Text = Localization.GetString(System.Enum.GetName(enumType, value), resourceFile) + objListControl.Items.Add(li) + Next + + End Sub + +#End Region + +#Region " Public Shared Methods " + + + Public Shared Function FormatTitle(ByVal title As String) As String + + If (title = "") Then + Return "Default.aspx" + End If + + Dim returnTitle As String = OnlyAlphaNumericChars(title, TitleReplacementType.Dash) + If (returnTitle = "") Then + Return "Default.aspx" + End If + + If (returnTitle.Replace("-", "").Replace("_", "") = "") Then + Return "Default.aspx" + End If + + Return returnTitle.Replace("--", "-") & ".aspx" + + End Function + + Public Shared Function FormatTitle(ByVal title As String, ByVal objArticleSettings As ArticleSettings) As String + + If (title = "") Then + Return "Default.aspx" + End If + + Dim returnTitle As String = OnlyAlphaNumericChars(title, objArticleSettings.TitleReplacement) + If (returnTitle = "") Then + Return "Default.aspx" + End If + + If (returnTitle.Replace("-", "").Replace("_", "") = "") Then + Return "Default.aspx" + End If + + Return returnTitle.Replace("--", "-") & ".aspx" + + End Function + + Public Shared Function OnlyAlphaNumericChars(ByVal OrigString As String, ByVal objReplacementType As TitleReplacementType) As String + + '*********************************************************** + 'INPUT: Any String + 'OUTPUT: The Input String with all non-alphanumeric characters + ' removed + 'EXAMPLE Debug.Print OnlyAlphaNumericChars("Hello World!") + 'output = "HelloWorld") + 'NOTES: Not optimized for speed and will run slow on long + ' strings. If you plan on using long strings, consider + ' using alternative method of appending to output string, + ' such as the method at + ' http://www.freevbcode.com/ShowCode.Asp?ID=154 + '*********************************************************** + Dim lLen As Integer + Dim sAns As String = "" + Dim lCtr As Integer + Dim sChar As String + + OrigString = RemoveDiacritics(Trim(OrigString)) + + lLen = Len(OrigString) + For lCtr = 1 To lLen + sChar = Mid(OrigString, lCtr, 1) + If IsAlphaNumeric(Mid(OrigString, lCtr, 1)) Or Mid(OrigString, lCtr, 1) = "-" Or Mid(OrigString, lCtr, 1) = "_" Then + sAns = sAns & sChar + End If + Next + + If (objReplacementType = TitleReplacementType.Dash) Then + OnlyAlphaNumericChars = Replace(sAns, " ", "-") + Else + OnlyAlphaNumericChars = Replace(sAns, " ", "_") + End If + + End Function + + Public Shared Function RemoveDiacritics(ByVal s As String) As String + s = s.Normalize(System.Text.NormalizationForm.FormD) + Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder() + Dim i As Integer + For i = 0 To s.Length - 1 + If s(i) = ChrW(305) Then + sb.Append("i"c) + Else + If CharUnicodeInfo.GetUnicodeCategory(s(i)) <> UnicodeCategory.NonSpacingMark Then + sb.Append(s(i)) + End If + End If + Next + Return sb.ToString() + End Function + + Public Shared Function IsAlphaNumeric(ByVal sChr As String) As Boolean + IsAlphaNumeric = sChr Like "[0-9A-Za-z ]" + End Function + + Public Shared Function GetAdjustedUserTime(ByVal dateString As String, ByVal format As String, ByVal timeZone As Integer) As String + + Dim dateToFormat As DateTime = DateTime.Parse(dateString) + + Return dateToFormat.ToString(format) + + End Function + + Public Shared Function GetAdjustedUserTime(ByVal articleSettings As ArticleSettings, ByVal dateString As String, ByVal format As String) As String + + Return GetAdjustedUserTime(dateString, format, articleSettings.ServerTimeZone) + + End Function + + Public Shared Function GetAdjustedUserTime(ByVal articleSettings As ArticleSettings, ByVal objDateTime As DateTime) As DateTime + + Return objDateTime + + End Function + + Public Shared Function GetAdjustedServerTime(ByVal articleSettings As ArticleSettings, ByVal objDateTime As DateTime) As DateTime + + Return objDateTime + + End Function + + Public Shared Function GetArticleLink(ByVal objArticle As ArticleInfo, ByVal objTab As DotNetNuke.Entities.Tabs.TabInfo, ByVal articleSettings As ArticleSettings, ByVal includeCategory As Boolean) As String + Return GetArticleLink(objArticle, objTab, articleSettings, includeCategory, Null.NullInteger) + End Function + + Public Shared Function GetArticleLink(ByVal objArticle As ArticleInfo, ByVal objTab As DotNetNuke.Entities.Tabs.TabInfo, ByVal articleSettings As ArticleSettings, ByVal includeCategory As Boolean, ByVal pageID As Integer) As String + + If (objTab Is Nothing) Then + Return "" + End If + + If Host.UseFriendlyUrls Then + + Dim strURL As String = ApplicationURL(objTab.TabID) + Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings + + If (articleSettings.LaunchLinks) Then + strURL = strURL & "&ctl=ArticleView" + strURL = strURL & "&mid=" & objArticle.ModuleID.ToString + strURL = strURL & "&articleId=" & objArticle.ArticleID + Else + If (articleSettings.UrlModeType = Components.Types.UrlModeType.Classic) Then + strURL = strURL & "&articleType=ArticleView" + strURL = strURL & "&articleId=" & objArticle.ArticleID + Else + strURL = strURL & "&" & articleSettings.ShortenedID & "=" & objArticle.ArticleID + End If + End If + + If (articleSettings.AlwaysShowPageID) Then + If (pageID <> Null.NullInteger) Then + strURL = strURL & "&PageID=" & pageID.ToString() + End If + End If + + If (includeCategory) Then + If (HttpContext.Current.Request("CategoryID") <> "") Then + strURL = strURL & "&categoryId=" & HttpContext.Current.Request("CategoryID") + End If + End If + + If (articleSettings.AuthorUserIDFilter) Then + If (articleSettings.AuthorUserIDParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then + strURL = strURL & "&" & articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam) + End If + End If + End If + + If (articleSettings.AuthorUsernameFilter) Then + If (articleSettings.AuthorUsernameParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then + strURL = strURL & "&" & articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam) + End If + End If + End If + + Dim title As String = FormatTitle(objArticle.Title, articleSettings) + + Dim link As String = FriendlyUrl(objTab, strURL, title, settings) + + If (link.ToLower().StartsWith("http://") Or link.ToLower().StartsWith("https://")) Then + Return link + Else + If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then + Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & link) + Else + Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & link) + End If + End If + Else + If (articleSettings.LaunchLinks) Then + Dim parameters As New List(Of String) + parameters.Add("mid=" & objArticle.ModuleID.ToString) + parameters.Add("ctl=ArticleView") + parameters.Add("articleId=" & objArticle.ArticleID) + + If (articleSettings.AlwaysShowPageID) Then + If (pageID <> Null.NullInteger) Then + parameters.Add("PageID=" & pageID.ToString()) + End If + End If + + If (articleSettings.AuthorUserIDFilter) Then + If (articleSettings.AuthorUserIDParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then + parameters.Add(articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam)) + End If + End If + End If + + If (articleSettings.AuthorUsernameFilter) Then + If (articleSettings.AuthorUsernameParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then + parameters.Add(articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam)) + End If + End If + End If + + If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then + Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray).Replace("&", "&")) + Else + Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray).Replace("&", "&")) + End If + Else + Dim parameters As New List(Of String) + + If (articleSettings.UrlModeType = Components.Types.UrlModeType.Classic) Then + parameters.Add("articleType=ArticleView") + parameters.Add("articleId=" & objArticle.ArticleID) + Else + parameters.Add(articleSettings.ShortenedID & "=" & objArticle.ArticleID) + End If + + If (articleSettings.AlwaysShowPageID) Then + If (pageID <> Null.NullInteger) Then + parameters.Add("PageID=" & pageID.ToString()) + End If + End If + + If (articleSettings.AuthorUserIDFilter) Then + If (articleSettings.AuthorUserIDParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then + parameters.Add(articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam)) + End If + End If + End If + + If (articleSettings.AuthorUsernameFilter) Then + If (articleSettings.AuthorUsernameParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then + parameters.Add(articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam)) + End If + End If + End If + + If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then + Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray)) + Else + Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray)) + End If + End If + + End If + + End Function + + Public Shared Function GetArticleLink(ByVal objArticle As ArticleInfo, ByVal objTab As DotNetNuke.Entities.Tabs.TabInfo, ByVal articleSettings As ArticleSettings, ByVal includeCategory As Boolean, ByVal ParamArray additionalParameters As String()) As String + Return GetArticleLink(objArticle, objTab, articleSettings, includeCategory, Null.NullInteger, additionalParameters) + End Function + + Public Shared Function GetArticleLink(ByVal objArticle As ArticleInfo, ByVal objTab As DotNetNuke.Entities.Tabs.TabInfo, ByVal articleSettings As ArticleSettings, ByVal includeCategory As Boolean, ByVal pageID As Integer, ByVal ParamArray additionalParameters As String()) As String + + If HostController.Instance.GetString("UseFriendlyUrls") = "Y" Then + + Dim strURL As String = ApplicationURL(objTab.TabID) + Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings + + If (articleSettings.LaunchLinks) Then + strURL = strURL & "&ctl=ArticleView" + strURL = strURL & "&mid=" & objArticle.ModuleID.ToString + strURL = strURL & "&articleId=" & objArticle.ArticleID + + Else + If (articleSettings.UrlModeType = Components.Types.UrlModeType.Classic) Then + strURL = strURL & "&articleType=ArticleView" + strURL = strURL & "&articleId=" & objArticle.ArticleID + Else + strURL = strURL & "&" & articleSettings.ShortenedID & "=" & objArticle.ArticleID + End If + End If + + If (articleSettings.AlwaysShowPageID) Then + If (pageID <> Null.NullInteger) Then + + Dim found As Boolean = False + For Each param As String In additionalParameters + If (param.ToLower().StartsWith("pageid")) Then + found = True + End If + Next + + If (found = False) Then + strURL = strURL & "&PageID=" & pageID.ToString() + End If + + End If + End If + + For Each param As String In additionalParameters + strURL = strURL & "&" & param + Next + + If (articleSettings.AuthorUserIDFilter) Then + If (articleSettings.AuthorUserIDParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then + strURL = strURL & "&" & articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam) + End If + End If + End If + + If (articleSettings.AuthorUsernameFilter) Then + If (articleSettings.AuthorUsernameParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then + strURL = strURL & "&" & articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam) + End If + End If + End If + + Return FriendlyUrl(objTab, strURL, FormatTitle(objArticle.Title, articleSettings), settings) + + + Else + + If (articleSettings.LaunchLinks) Then + Dim parameters As New List(Of String) + Dim pageFound As Boolean = False + For i As Integer = 0 To additionalParameters.Length - 1 + parameters.Add(additionalParameters(i)) + If (additionalParameters(i).ToLower().StartsWith("pageid=")) Then + pageFound = True + End If + Next + parameters.Add("mid=" & objArticle.ModuleID.ToString) + parameters.Add("ctl=ArticleView") + parameters.Add("articleId=" & objArticle.ArticleID) + + If (articleSettings.AlwaysShowPageID) Then + If (pageID <> Null.NullInteger) Then + If (pageFound = False) Then + parameters.Add("PageID=" & pageID.ToString()) + End If + End If + End If + + If (articleSettings.AuthorUserIDFilter) Then + If (articleSettings.AuthorUserIDParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then + parameters.Add(articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam)) + End If + End If + End If + + If (articleSettings.AuthorUsernameFilter) Then + If (articleSettings.AuthorUsernameParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then + parameters.Add(articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam)) + End If + End If + End If + + If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then + Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray)) + Else + Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray)) + End If + Else + Dim parameters As New List(Of String) + Dim pageFound As Boolean = False + For i As Integer = 0 To additionalParameters.Length - 1 + parameters.Add(additionalParameters(i)) + If (additionalParameters(i).ToLower().StartsWith("pageid=")) Then + pageFound = True + End If + Next + + If (articleSettings.UrlModeType = Components.Types.UrlModeType.Classic) Then + parameters.Add("articleType=ArticleView") + parameters.Add("articleId=" & objArticle.ArticleID) + Else + parameters.Add(articleSettings.ShortenedID & "=" & objArticle.ArticleID) + End If + + If (articleSettings.AlwaysShowPageID) Then + If (pageID <> Null.NullInteger) Then + If (pageFound = False) Then + parameters.Add("PageID=" & pageID.ToString()) + End If + End If + End If + + If (articleSettings.AuthorUserIDFilter) Then + If (articleSettings.AuthorUserIDParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then + parameters.Add(articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam)) + End If + End If + End If + + If (articleSettings.AuthorUsernameFilter) Then + If (articleSettings.AuthorUsernameParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then + parameters.Add(articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam)) + End If + End If + End If + + If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then + Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray)) + Else + Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray)) + End If + End If + + End If + + End Function + + Public Shared Function GetArticleModules(ByVal portalID As Integer) As List(Of ModuleInfo) + + Dim objModulesFound As New List(Of ModuleInfo) + + Dim objDesktopModuleController As New DesktopModuleController + Dim objDesktopModuleInfo As DesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByModuleName("DnnForge - NewsArticles") + + If Not (objDesktopModuleInfo Is Nothing) Then + + Dim objTabController As New TabController() + Dim objTabs As ArrayList = objTabController.GetTabs(portalID) + For Each objTab As DotNetNuke.Entities.Tabs.TabInfo In objTabs + If Not (objTab Is Nothing) Then + If (objTab.IsDeleted = False) Then + Dim objModules As New ModuleController + For Each pair As KeyValuePair(Of Integer, ModuleInfo) In objModules.GetTabModules(objTab.TabID) + Dim objModule As ModuleInfo = pair.Value + If (objModule.IsDeleted = False) Then + If (objModule.DesktopModuleID = objDesktopModuleInfo.DesktopModuleID) Then + If objModule.IsDeleted = False Then + Dim strPath As String = objTab.TabName + Dim objTabSelected As TabInfo = objTab + While objTabSelected.ParentId <> Null.NullInteger + objTabSelected = objTabController.GetTab(objTabSelected.ParentId, objTab.PortalID, False) + If (objTabSelected Is Nothing) Then + Exit While + End If + strPath = objTabSelected.TabName & " -> " & strPath + End While + + objModulesFound.Add(objModule) + End If + End If + End If + Next + End If + End If + Next + + End If + + Return objModulesFound + + End Function + + Public Shared Function GetAuthorLink(ByVal tabID As Integer, ByVal moduleID As Integer, ByVal authorID As Integer, ByVal username As String, ByVal launchLinks As Boolean, ByVal articleSettings As ArticleSettings) As String + + Dim objTab As TabInfo = PortalController.GetCurrentPortalSettings.ActiveTab + If (tabID <> PortalController.GetCurrentPortalSettings.ActiveTab.TabID) Then + Dim objTabController As New TabController + objTab = objTabController.GetTab(tabID, PortalController.GetCurrentPortalSettings.PortalId, False) + End If + Return GetAuthorLink(tabID, moduleID, authorID, username, launchLinks, objTab, articleSettings) + + End Function + + Public Shared Function GetAuthorLink(ByVal tabID As Integer, ByVal moduleID As Integer, ByVal authorID As Integer, ByVal username As String, ByVal launchLinks As Boolean, ByVal targetTab As TabInfo, ByVal articleSettings As ArticleSettings) As String + + If Host.UseFriendlyUrls Then + + Dim strURL As String = ApplicationURL(tabID) + + If (launchLinks) Then + strURL = strURL & "&ctl=AuthorView" + strURL = strURL & "&mid=" & moduleID.ToString + Else + strURL = strURL & "&articleType=AuthorView" + End If + strURL = strURL & "&authorID=" & authorID.ToString() + + ' TODO: Remove at a later date when minimum version raised. + If Localization.GetEnabledLocales.Count > 1 AndAlso LocalizationUtil.UseLanguageInUrl Then + strURL += "&language=" & Thread.CurrentThread.CurrentCulture.Name + End If + + If (articleSettings.AuthorUserIDFilter) Then + If (articleSettings.AuthorUserIDParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then + strURL = strURL & "&" & articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam) + End If + End If + End If + + If (articleSettings.AuthorUsernameFilter) Then + If (articleSettings.AuthorUsernameParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then + strURL = strURL & "&" & articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam) + End If + End If + End If + + Return FriendlyUrl(targetTab, strURL, Common.FormatTitle("", articleSettings), PortalController.GetCurrentPortalSettings) + + Else + + Return Common.GetModuleLink(tabID, moduleID, "AuthorView", articleSettings, "AuthorID=" & authorID.ToString()) + + End If + + End Function + + Public Shared Function GetCategoryLink(ByVal tabID As Integer, ByVal moduleID As Integer, ByVal categoryID As String, ByVal title As String, ByVal launchLinks As Boolean, ByVal articleSettings As ArticleSettings) As String + + Dim objTab As TabInfo = PortalController.GetCurrentPortalSettings.ActiveTab + If (tabID <> PortalController.GetCurrentPortalSettings.ActiveTab.TabID) Then + Dim objTabController As New TabController + objTab = objTabController.GetTab(tabID, PortalController.GetCurrentPortalSettings.PortalId, False) + End If + Return GetCategoryLink(tabID, moduleID, categoryID, title, launchLinks, objTab, articleSettings) + + End Function + + Public Shared Function GetCategoryLink(ByVal tabID As Integer, ByVal moduleID As Integer, ByVal categoryID As String, ByVal title As String, ByVal launchLinks As Boolean, ByVal targetTab As TabInfo, ByVal articleSettings As ArticleSettings) As String + + If DotNetNuke.Entities.Host.HostSettings.GetHostSetting("UseFriendlyUrls") = "Y" Then + + Dim strURL As String = ApplicationURL(tabID) + Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings + + If (launchLinks) Then + strURL = strURL & "&ctl=CategoryView" + strURL = strURL & "&mid=" & moduleID.ToString + Else + strURL = strURL & "&articleType=CategoryView" + End If + strURL = strURL & "&categoryId=" & categoryID + + ' TODO: Remove at a later date when minimum version raised. + If Localization.GetEnabledLocales.Count > 1 AndAlso LocalizationUtil.UseLanguageInUrl Then + strURL += "&language=" & Thread.CurrentThread.CurrentCulture.Name + End If + + If (articleSettings.AuthorUserIDFilter) Then + If (articleSettings.AuthorUserIDParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then + strURL = strURL & "&" & articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam) + End If + End If + End If + + If (articleSettings.AuthorUsernameFilter) Then + If (articleSettings.AuthorUsernameParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then + strURL = strURL & "&" & articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam) + End If + End If + End If + + Return FriendlyUrl(targetTab, strURL, Common.FormatTitle(title, articleSettings), settings) + + Else + + Return Common.GetModuleLink(tabID, moduleID, "CategoryView", articleSettings, "categoryId=" & categoryID) + + End If + + End Function + + Public Shared Function GetModuleLink(ByVal tabID As Integer, ByVal moduleID As Integer, ByVal ctl As String, ByVal articleSettings As ArticleSettings, ByVal ParamArray additionalParameters As String()) As String + + Dim parameters As New List(Of String) + For Each item As String In additionalParameters + parameters.Add(item) + Next + + If (articleSettings.AuthorUserIDFilter) Then + If (articleSettings.AuthorUserIDParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then + parameters.Add(articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam)) + End If + End If + End If + + If (articleSettings.AuthorUsernameFilter) Then + If (articleSettings.AuthorUsernameParam <> "") Then + If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then + parameters.Add(articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam)) + End If + End If + End If + + Dim link As String = "" + + If (ctl <> "") Then + + If (articleSettings.LaunchLinks) Then + parameters.Insert(0, "mid=" & moduleID.ToString()) + If (ctl.ToLower() = "submitnews") Then + link = NavigateURL(tabID, "edit", parameters.ToArray()) + Else + link = NavigateURL(tabID, ctl, parameters.ToArray()) + End If + Else + parameters.Insert(0, "articleType=" & ctl) + link = NavigateURL(tabID, Null.NullString, parameters.ToArray()) + End If + + Else + + link = NavigateURL(tabID, Null.NullString, parameters.ToArray()) + + End If + + If Not (link.ToLower().StartsWith("http://") Or link.ToLower().StartsWith("https://")) Then + + If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then + link = AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & link) + Else + link = AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & link) + End If + + End If + + Return link + + End Function + + Public Shared Sub NotifyAuthor(ByVal objArticle As ArticleInfo, ByVal settings As Hashtable, ByVal moduleID As Integer, ByVal objTab As DotNetNuke.Entities.Tabs.TabInfo, ByVal portalID As Integer, ByVal articleSettings As ArticleSettings) + + If (settings.Contains(ArticleConstants.NOTIFY_APPROVAL_SETTING)) Then + If (Convert.ToBoolean(settings(ArticleConstants.NOTIFY_APPROVAL_SETTING))) Then + + Dim objUserController As New UserController + Dim objUser As UserInfo = objUserController.GetUser(portalID, objArticle.AuthorID) + + Dim objEmailTemplateController As New EmailTemplateController + If Not (objUser Is Nothing) Then + objEmailTemplateController.SendFormattedEmail(moduleID, Common.GetArticleLink(objArticle, objTab, articleSettings, False), objArticle, EmailTemplateType.ArticleApproved, objUser.Email, articleSettings) + End If + + End If + End If + + End Sub + + Public Shared Function HtmlEncode(ByVal text As String) As String + + Return System.Web.HttpUtility.HtmlEncode(text) + + End Function + + Public Shared Function HtmlDecode(ByVal text As String) As String + + Return System.Web.HttpUtility.HtmlDecode(text) + + End Function + + Public Shared Function ProcessPostTokens(ByVal content As String, ByVal objTab As TabInfo, ByVal objArticleSettings As ArticleSettings) As String + + If (objArticleSettings.ProcessPostTokens = False) Then + Return content + End If + + Dim delimStr As String = "[]" + Dim delimiter As Char() = delimStr.ToCharArray() + + Dim layoutArray As String() = content.Split(delimiter) + Dim formattedContent As String = "" + + For iPtr As Integer = 0 To layoutArray.Length - 1 Step 2 + + formattedContent += layoutArray(iPtr).ToString() + + If iPtr < layoutArray.Length - 1 Then + Select Case layoutArray(iPtr + 1) + Case Else + If (layoutArray(iPtr + 1).ToUpper().StartsWith("ARTICLELINK:")) Then + If (IsNumeric(layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12))) Then + Dim articleID As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12)) + + Dim objArticleController As New ArticleController() + Dim objArticle As ArticleInfo = objArticleController.GetArticle(articleID) + + If (objArticle IsNot Nothing) Then + Dim link As String = Common.GetArticleLink(objArticle, objTab, objArticleSettings, False) + formattedContent += "" & objArticle.Title & "" + End If + End If + Exit Select + End If + + formattedContent += "[" & layoutArray(iPtr + 1) & "]" + End Select + End If + + Next + + Return formattedContent + + End Function + + Public Shared Function StripTags(ByVal HTML As String) As String + If (HTML Is Nothing OrElse HTML.Trim() = "") Then + Return "" + End If + Dim pattern As String = "<(.|\n)*?>" + Return Regex.Replace(HTML, pattern, String.Empty) + End Function + +#End Region + + End Class + +End Namespace diff --git a/Components/Common/ArticleConstants.vb b/Components/Common/ArticleConstants.vb new file mode 100755 index 0000000..bfb22d3 --- /dev/null +++ b/Components/Common/ArticleConstants.vb @@ -0,0 +1,375 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Public Class ArticleConstants + +#Region " Constants " + + 'Token Settings + Public Const DEFAULT_TEMPLATE = "Standard" + + ' Basic Settings + Public Const EXPAND_SUMMARY_SETTING As String = "ExpandSummary" + + Public Const ENABLE_RATINGS_AUTHENTICATED_SETTING As String = "EnableRatings" + Public Const ENABLE_RATINGS_ANONYMOUS_SETTING As String = "EnableAnonymousRatings" + + Public Const JOURNAL_INTEGRATION_SETTING As String = "JournalIntegration" + Public Const JOURNAL_INTEGRATION_GROUPS_SETTING As String = "JournalIntegrationGroups" + + Public Const ACTIVE_SOCIAL_SETTING As String = "ActiveSocialFeed" + Public Const ACTIVE_SOCIAL_SUBMIT_SETTING As String = "ActiveSocialFeedSubmit" + Public Const ACTIVE_SOCIAL_COMMENT_SETTING As String = "ActiveSocialFeedComment" + Public Const ACTIVE_SOCIAL_RATE_SETTING As String = "ActiveSocialFeedRate" + Public Const AUTHOR_SELECT_TYPE As String = "AuthorSelectType" + Public Const ENABLE_CORE_SEARCH_SETTING As String = "EnableCoreSearch" + Public Const ENABLE_SYNDICATION_SETTING As String = "EnableSyndication" + Public Const ENABLE_SYNDICATION_ENCLOSURES_SETTING As String = "EnableSyndicationEnclosures" + Public Const ENABLE_SYNDICATION_HTML_SETTING As String = "EnableSyndicationHtml" + Public Const ENABLE_NOTIFICATION_PING_SETTING As String = "NotificationPing" + Public Const ENABLE_AUTO_TRACKBACK_SETTING As String = "AutoTrackback" + Public Const ENABLE_INCOMING_TRACKBACK_SETTING As String = "IncomingTrackback" + Public Const PAGE_SIZE_SETTING As String = "Number" + Public Const LAUNCH_LINKS As String = "LaunchLinks" + Public Const BUBBLE_FEATURED_ARTICLES As String = "BubbleFeaturedArticles" + Public Const REQUIRE_CATEGORY As String = "RequireCategory" + Public Const DISPLAY_MODE As String = "DisplayMode" + Public Const PROCESS_POST_TOKENS As String = "ProcessPostTokens" + Public Const RELATED_MODE As String = "RelatedMode" + Public Const TEMPLATE_SETTING As String = "Template" + Public Const ENABLE_SEO_TITLE_SETTING As String = "EnableSEOTitle" + Public Const SEO_TITLE_SETTING As String = "SEOTitle" + Public Const TITLE_REPLACEMENT_TYPE As String = "TitleReplacementType" + Public Const SMART_THINKER_STORY_FEED_SETTING As String = "EnableSmartThinkerStoryFeed" + Public Const TEXT_EDITOR_WIDTH As String = "TextEditorWidth" + Public Const TEXT_EDITOR_HEIGHT As String = "TextEditorHeight" + Public Const TEXT_EDITOR_SUMMARY_MODE As String = "TextEditorSummaryMode" + Public Const TEXT_EDITOR_SUMMARY_WIDTH As String = "TextEditorSummaryWidth" + Public Const TEXT_EDITOR_SUMMARY_HEIGHT As String = "TextEditorSummaryHeight" + Public Const SERVER_TIMEZONE As String = "ServerTimeZone" + Public Const SORT_BY As String = "SortBy" + Public Const SORT_DIRECTION As String = "SortDirection" + Public Const SYNDICATION_LINK_TYPE As String = "SyndicationLinkType" + Public Const SYNDICATION_SUMMARY_LENGTH As String = "SyndicationSummaryLength" + Public Const SYNDICATION_MAX_COUNT As String = "SyndicationMaxCount" + Public Const SYNDICATION_ENCLOSURE_TYPE As String = "SyndicationEnclosureType" + Public Const SYNDICATION_IMAGE_PATH As String = "SyndicationImagePath" + Public Const MENU_POSITION_TYPE As String = "MenuPositionType" + + ' Image Settings + Public Const INCLUDE_JQUERY_SETTING As String = "IncludeJQuery" + Public Const IMAGE_JQUERY_PATH As String = "JQueryPath" + Public Const ENABLE_EXTERNAL_IMAGES_SETTING As String = "EnableImagesExternal" + Public Const ENABLE_UPLOAD_IMAGES_SETTING As String = "EnableImagesUpload" + Public Const ENABLE_PORTAL_IMAGES_SETTING As String = "EnableImages" + Public Const DEFAULT_IMAGES_FOLDER_SETTING As String = "DefaultImagesFolder" + Public Const DEFAULT_FILES_FOLDER_SETTING As String = "DefaultFilesFolder" + Public Const IMAGE_RESIZE_SETTING As String = "ResizeImages" + Public Const IMAGE_THUMBNAIL_SETTING As String = "ImageThumbnailType" + Public Const IMAGE_MAX_WIDTH_SETTING As String = "ImageMaxWidth" + Public Const IMAGE_MAX_HEIGHT_SETTING As String = "ImageMaxHeight" + + Public Const IMAGE_WATERMARK_ENABLED_SETTING As String = "ImageWatermarkEnabled" + Public Const IMAGE_WATERMARK_ENABLED_SETTING_DEFAULT As Boolean = False + Public Const IMAGE_WATERMARK_TEXT_SETTING As String = "ImageWatermarkText" + Public Const IMAGE_WATERMARK_TEXT_SETTING_DEFAULT As String = "" + Public Const IMAGE_WATERMARK_IMAGE_SETTING As String = "ImageWatermarkImage" + Public Const IMAGE_WATERMARK_IMAGE_SETTING_DEFAULT As String = "" + Public Const IMAGE_WATERMARK_IMAGE_POSITION_SETTING As String = "ImageWatermarkImagePosition" + Public Const IMAGE_WATERMARK_IMAGE_POSITION_SETTING_DEFAULT As WatermarkPosition = WatermarkPosition.BottomRight + + Public Const DEFAULT_IMAGE_RESIZE As Boolean = True + Public Const DEFAULT_IMAGE_THUMBNAIL As ThumbnailType = ThumbnailType.Proportion + Public Const DEFAULT_IMAGE_MAX_WIDTH As Integer = 600 + Public Const DEFAULT_IMAGE_MAX_HEIGHT As Integer = 480 + Public Const DEFAULT_THUMBNAIL_HEIGHT As Integer = 100 + Public Const DEFAULT_THUMBNAIL_WIDTH As Integer = 100 + + ' Category Settings + Public Const ARCHIVE_CURRENT_ARTICLES_SETTING As String = "ArchiveCurrentArticles" + Public Const ARCHIVE_CURRENT_ARTICLES_SETTING_DEFAULT As Boolean = True + Public Const ARCHIVE_CATEGORIES_SETTING As String = "ArchiveCategories" + Public Const ARCHIVE_CATEGORIES_SETTING_DEFAULT As Boolean = True + Public Const ARCHIVE_AUTHOR_SETTING As String = "ArchiveAuthor" + Public Const ARCHIVE_AUTHOR_SETTING_DEFAULT As Boolean = True + Public Const ARCHIVE_MONTH_SETTING As String = "ArchiveMonth" + Public Const ARCHIVE_MONTH_SETTING_DEFAULT As Boolean = True + + ' Category Settings + Public Const DEFAULT_CATEGORIES_SETTING As String = "DefaultCategories" + Public Const CATEGORY_SELECTION_HEIGHT_SETTING As String = "CategorySelectionHeight" + Public Const CATEGORY_SELECTION_HEIGHT_DEFAULT As Integer = 150 + Public Const CATEGORY_BREADCRUMB_SETTING As String = "CategoryBreadcrumb" + Public Const CATEGORY_BREADCRUMB_SETTING_DEFAULT As Boolean = True + Public Const CATEGORY_NAME_SETTING As String = "CategoryName" + Public Const CATEGORY_NAME_SETTING_DEFAULT As Boolean = True + Public Const CATEGORY_FILTER_SUBMIT_SETTING As String = "CategoryFilterSubmit" + 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 + + ' Category Security Settings + Public Const PERMISSION_CATEGORY_VIEW_SETTING As String = "PermissionCategoryView" + Public Const PERMISSION_CATEGORY_SUBMIT_SETTING As String = "PermissionCategorySubmit" + + ' Comment Settings + Public Const ENABLE_COMMENTS_SETTING As String = "EnableComments" + Public Const ENABLE_ANONYMOUS_COMMENTS_SETTING As String = "EnableAnonymousComments" + Public Const ENABLE_COMMENT_MODERATION_SETTING As String = "EnableCommentModeration" + Public Const COMMENT_HIDE_WEBSITE_SETTING As String = "CommentHideWebsite" + Public Const COMMENT_REQUIRE_NAME_SETTING As String = "CommentRequireName" + Public Const COMMENT_REQUIRE_EMAIL_SETTING As String = "CommentRequireEmail" + Public Const USE_CAPTCHA_SETTING As String = "UseCaptcha" + Public Const NOTIFY_DEFAULT_SETTING As String = "NotifyDefault" + Public Const COMMENT_SORT_DIRECTION_SETTING As String = "CommentSortDirection" + Public Const COMMENT_AKISMET_SETTING As String = "CommentAkismet" + + ' Content Sharing Settings + Public Const CONTENT_SHARING_SETTING As String = "ContentSharingPortals" + + ' Filter Settings + Public Const MAX_ARTICLES_SETTING As String = "MaxArticles" + Public Const MAX_AGE_SETTING As String = "MaxArticlesAge" + Public Const CATEGORIES_SETTING As String = "Categories" + Public Const CATEGORIES_FILTER_SINGLE_SETTING As String = "CategoriesFilterSingle" + Public Const SHOW_PENDING_SETTING As String = "ShowPending" + Public Const SHOW_FEATURED_ONLY_SETTING As String = "ShowFeaturedOnly" + Public Const SHOW_NOT_FEATURED_ONLY_SETTING As String = "ShowNotFeaturedOnly" + Public Const SHOW_SECURED_ONLY_SETTING As String = "ShowSecuredOnly" + Public Const SHOW_NOT_SECURED_ONLY_SETTING As String = "ShowNotSecuredOnly" + Public Const AUTHOR_SETTING As String = "Author" + Public Const AUTHOR_DEFAULT_SETTING As String = "AuthorDefault" + Public Const MATCH_OPERATOR_SETTING As String = "MatchOperator" + + Public Const AUTHOR_USERID_FILTER_SETTING As String = "AuthorUserIDFilter" + Public Const AUTHOR_USERID_PARAM_SETTING As String = "AuthorUserIDParam" + Public Const AUTHOR_USERNAME_FILTER_SETTING As String = "AuthorUsernameFilter" + Public Const AUTHOR_USERNAME_PARAM_SETTING As String = "AuthorUsernameParam" + Public Const AUTHOR_LOGGED_IN_USER_FILTER_SETTING As String = "AuthorLoggedInUserFilter" + + ' Security Settings + Public Const PERMISSION_ROLE_GROUP_ID As String = "RoleGroupIDFilter" + Public Const PERMISSION_SECURE_SETTING As String = "SecureRoles" + Public Const PERMISSION_SECURE_URL_SETTING As String = "SecureUrl" + Public Const PERMISSION_AUTO_SECURE_SETTING As String = "AutoSecureRoles" + Public Const PERMISSION_SUBMISSION_SETTING As String = "SubmissionRoles" + Public Const PERMISSION_APPROVAL_SETTING As String = "ApprovalRoles" + Public Const PERMISSION_AUTO_APPROVAL_SETTING As String = "AutoApprovalRoles" + Public Const PERMISSION_AUTO_APPROVAL_COMMENT_SETTING As String = "AutoApprovalCommentRoles" + Public Const PERMISSION_FEATURE_SETTING As String = "FeatureRoles" + Public Const PERMISSION_AUTO_FEATURE_SETTING As String = "AutoFeatureRoles" + + ' Security Form Settings + Public Const PERMISSION_CATEGORIES_SETTING As String = "PermissionCategoriesRoles" + Public Const PERMISSION_EXCERPT_SETTING As String = "PermissionExcerptRoles" + Public Const PERMISSION_IMAGE_SETTING As String = "PermissionImageRoles" + Public Const PERMISSION_FILE_SETTING As String = "PermissionFileRoles" + Public Const PERMISSION_LINK_SETTING As String = "PermissionLinkRoles" + Public Const PERMISSION_PUBLISH_SETTING As String = "PermissionPublishRoles" + Public Const PERMISSION_EXPIRY_SETTING As String = "PermissionExpiryRoles" + Public Const PERMISSION_META_SETTING As String = "PermissionMetaRoles" + Public Const PERMISSION_CUSTOM_SETTING As String = "PermissionCustomRoles" + + ' Admin Settings + Public Const PERMISSION_SITE_TEMPLATES_SETTING As String = "PermissionSiteTemplates" + + ' Notification Settings + Public Const NOTIFY_SUBMISSION_SETTING As String = "NotifySubmission" + Public Const NOTIFY_SUBMISSION_SETTING_EMAIL As String = "NotifySubmissionEmail" + Public Const NOTIFY_APPROVAL_SETTING As String = "NotifyApproval" + Public Const NOTIFY_COMMENT_SETTING As String = "NotifyComment" + Public Const NOTIFY_COMMENT_SETTING_EMAIL As String = "NotifyCommentEmail" + Public Const NOTIFY_COMMENT_APPROVAL_SETTING As String = "NotifyCommentApproval" + Public Const NOTIFY_COMMENT_APPROVAL_EMAIL_SETTING As String = "NotifyCommentApprovalEmail" + + ' SEO Settings + Public Const SEO_ALWAYS_SHOW_PAGEID_SETTING As String = "AlwaysShowPageID" + Public Const SEO_URL_MODE_SETTING As String = "SEOUrlMode" + Public Const SEO_SHORTEN_ID_SETTING As String = "SEOShorternID" + Public Const SEO_USE_CANONICAL_LINK_SETTING As String = "SEOUseCanonicalLink" + Public Const SEO_EXPAND_META_INFORMATION_SETTING As String = "SEOExpandMetaInformation" + Public Const SEO_UNIQUE_PAGE_TITLES_SETTING As String = "SEOUniquePageTitles" + + ' SEO Settings + Public Const TWITTER_USERNAME As String = "NA-TwitterUsername" + Public Const TWITTER_BITLY_LOGIN As String = "NA-BitLyLogin" + Public Const TWITTER_BITLY_API_KEY As String = "NA-BitLyAPI" + + ' Latest Articles + Public Const LATEST_ARTICLES_TAB_ID As String = "LatestArticlesTabID" + Public Const LATEST_ARTICLES_MODULE_ID As String = "LatestArticlesModuleID" + Public Const LATEST_ARTICLES_CATEGORIES As String = "LatestArticlesCategories" + Public Const LATEST_ARTICLES_CATEGORIES_EXCLUDE As String = "LatestArticlesCategoriesExclude" + Public Const LATEST_ARTICLES_MATCH_OPERATOR As String = "LatestArticlesMatchOperator" + Public Const LATEST_ARTICLES_TAGS As String = "LatestArticlesTags" + Public Const LATEST_ARTICLES_TAGS_MATCH_OPERATOR As String = "LatestArticlesTagsMatchOperator" + Public Const LATEST_ARTICLES_IDS As String = "LatestArticlesIDS" + Public Const LATEST_ARTICLES_COUNT As String = "LatestArticlesCount" + Public Const LATEST_ARTICLES_START_POINT As String = "LatestArticlesStartPoint" + Public Const LATEST_ARTICLES_MAX_AGE As String = "LatestArticlesMaxAge" + Public Const LATEST_ARTICLES_START_DATE As String = "LatestArticlesStartDate" + Public Const LATEST_ARTICLES_SHOW_PENDING As String = "LatestArticlesShowPending" + Public Const LATEST_ARTICLES_SHOW_RELATED As String = "LatestArticlesShowRelated" + Public Const LATEST_ARTICLES_FEATURED_ONLY As String = "LatestArticlesFeaturedOnly" + Public Const LATEST_ARTICLES_NOT_FEATURED_ONLY As String = "LatestArticlesNotFeaturedOnly" + Public Const LATEST_ARTICLES_SECURED_ONLY As String = "LatestArticlesSecuredOnly" + Public Const LATEST_ARTICLES_NOT_SECURED_ONLY As String = "LatestArticlesNotSecuredOnly" + Public Const LATEST_ARTICLES_CUSTOM_FIELD_FILTER As String = "LatestArticlesCustomFieldFilter" + Public Const LATEST_ARTICLES_CUSTOM_FIELD_VALUE As String = "LatestArticlesCustomFieldValue" + Public Const LATEST_ARTICLES_LINK_FILTER As String = "LatestArticlesLinkFilter" + Public Const LATEST_ARTICLES_SORT_BY As String = "LatestArticlesSortBy" + Public Const LATEST_ARTICLES_SORT_DIRECTION As String = "LatestArticlesSortDirection" + Public Const LATEST_ARTICLES_ITEMS_PER_ROW As String = "ItemsPerRow" + Public Const LATEST_ARTICLES_ITEMS_PER_ROW_DEFAULT As Integer = 1 + Public Const LATEST_ARTICLES_AUTHOR As String = "LatestArticlesAuthor" + Public Const LATEST_ARTICLES_AUTHOR_DEFAULT As Integer = -1 + Public Const LATEST_ARTICLES_QUERY_STRING_FILTER As String = "LatestArticlesQueryStringFilter" + Public Const LATEST_ARTICLES_QUERY_STRING_FILTER_DEFAULT As Boolean = False + Public Const LATEST_ARTICLES_QUERY_STRING_PARAM As String = "LatestArticlesQueryStringParam" + Public Const LATEST_ARTICLES_QUERY_STRING_PARAM_DEFAULT As String = "ID" + Public Const LATEST_ARTICLES_USERNAME_FILTER As String = "LatestArticlesUsernameFilter" + Public Const LATEST_ARTICLES_USERNAME_FILTER_DEFAULT As Boolean = False + Public Const LATEST_ARTICLES_USERNAME_PARAM As String = "LatestArticlesUsernameParam" + Public Const LATEST_ARTICLES_USERNAME_PARAM_DEFAULT As String = "Username" + Public Const LATEST_ARTICLES_LOGGED_IN_USER_FILTER As String = "LatestArticlesLoggedInUserFilter" + Public Const LATEST_ARTICLES_LOGGED_IN_USER_FILTER_DEFAULT As Boolean = False + Public Const LATEST_ARTICLES_INCLUDE_STYLESHEET As String = "LatestArticlesIncludeStylesheet" + Public Const LATEST_ARTICLES_INCLUDE_STYLESHEET_DEFAULT As Boolean = False + + Public Const LATEST_ENABLE_PAGER As String = "LatestEnablePager" + Public Const LATEST_ENABLE_PAGER_DEFAULT As Boolean = False + Public Const LATEST_PAGE_SIZE As String = "LatestPageSize" + Public Const LATEST_PAGE_SIZE_DEFAULT As Integer = 10 + + Public Const LATEST_ARTICLES_LAYOUT_MODE As String = "LayoutMode" + Public Const LATEST_ARTICLES_LAYOUT_MODE_DEFAULT As LayoutModeType = LayoutModeType.Simple + + Public Const SETTING_HTML_HEADER As String = "HtmlHeader" + Public Const SETTING_HTML_BODY As String = "HtmlBody" + Public Const SETTING_HTML_FOOTER As String = "HtmlFooter" + + Public Const SETTING_HTML_HEADER_ADVANCED As String = "HtmlHeaderAdvanced" + Public Const SETTING_HTML_BODY_ADVANCED As String = "HtmlBodyAdvanced" + Public Const SETTING_HTML_FOOTER_ADVANCED As String = "HtmlFooterAdvanced" + + Public Const SETTING_HTML_NO_ARTICLES As String = "HtmlNoArticles" + + Public Const DEFAULT_HTML_HEADER As String = "" + Public Const DEFAULT_HTML_BODY As String = "" + Public Const DEFAULT_HTML_FOOTER As String = "
[EDIT][TITLE] by [AUTHORUSERNAME]
[SUMMARY]
" + Public Const DEFAULT_HTML_HEADER_ADVANCED As String = "" + Public Const DEFAULT_HTML_BODY_ADVANCED As String = "[EDIT][TITLE] by [AUTHORUSERNAME]
[SUMMARY]" + Public Const DEFAULT_HTML_FOOTER_ADVANCED As String = "" + Public Const DEFAULT_HTML_NO_ARTICLES As String = "No articles match criteria." + Public Const DEFAULT_SORT_BY As String = "StartDate" + Public Const DEFAULT_SORT_DIRECTION As String = "DESC" + + ' Latest Comments + Public Const LATEST_COMMENTS_TAB_ID As String = "LatestCommentsTabID" + Public Const LATEST_COMMENTS_MODULE_ID As String = "LatestCommentsModuleID" + Public Const LATEST_COMMENTS_COUNT As String = "LatestCommentsCount" + + Public Const LATEST_COMMENTS_HTML_HEADER As String = "HtmlHeaderLatestComments" + Public Const LATEST_COMMENTS_HTML_BODY As String = "HtmlBodyLatestComments" + Public Const LATEST_COMMENTS_HTML_FOOTER As String = "HtmlFooterLatestComments" + Public Const LATEST_COMMENTS_HTML_NO_COMMENTS As String = "HtmlNoCommentsLatestComments" + Public Const LATEST_COMMENTS_INCLUDE_STYLESHEET As String = "LatestCommentsIncludeStylesheet" + + Public Const DEFAULT_LATEST_COMMENTS_HTML_HEADER As String = "" + Public Const DEFAULT_LATEST_COMMENTS_HTML_BODY As String = "" + Public Const DEFAULT_LATEST_COMMENTS_HTML_FOOTER As String = "
[ARTICLETITLE]
[COMMENT:50] by [AUTHOR]
" + Public Const DEFAULT_LATEST_COMMENTS_HTML_NO_COMMENTS As String = "No comments match criteria." + Public Const DEFAULT_LATEST_COMMENTS_INCLUDE_STYLESHEET As Boolean = False + + ' News Archives + Public Const NEWS_ARCHIVES_TAB_ID As String = "NewsArchivesTabID" + Public Const NEWS_ARCHIVES_TAB_ID_DEFAULT As Integer = -1 + Public Const NEWS_ARCHIVES_MODULE_ID As String = "NewsArchivesModuleID" + Public Const NEWS_ARCHIVES_MODULE_ID_DEFAULT As Integer = -1 + Public Const NEWS_ARCHIVES_MODE As String = "NewsArchivesMode" + Public Const NEWS_ARCHIVES_MODE_DEFAULT As ArchiveModeType = ArchiveModeType.Date + Public Const NEWS_ARCHIVES_HIDE_ZERO_CATEGORIES As String = "NewsArchivesHideZeroCategories" + Public Const NEWS_ARCHIVES_PARENT_CATEGORY As String = "NewsArchivesParentCategory" + Public Const NEWS_ARCHIVES_PARENT_CATEGORY_DEFAULT As Integer = -1 + Public Const NEWS_ARCHIVES_MAX_DEPTH As String = "NewsArchivesMaxDepth" + Public Const NEWS_ARCHIVES_MAX_DEPTH_DEFAULT As Integer = -1 + Public Const NEWS_ARCHIVES_AUTHOR_SORT_BY As String = "NewsArchivesAuthorSortBy" + Public Const NEWS_ARCHIVES_AUTHOR_SORT_BY_DEFAULT As AuthorSortByType = AuthorSortByType.DisplayName + Public Const NEWS_ARCHIVES_HIDE_ZERO_CATEGORIES_DEFAULT As Boolean = False + Public Const NEWS_ARCHIVES_GROUP_BY As String = "GroupBy" + Public Const NEWS_ARCHIVES_GROUP_BY_DEFAULT As GroupByType = GroupByType.Month + Public Const NEWS_ARCHIVES_LAYOUT_MODE As String = "LayoutMode" + Public Const NEWS_ARCHIVES_LAYOUT_MODE_DEFAULT As LayoutModeType = LayoutModeType.Simple + Public Const NEWS_ARCHIVES_ITEMS_PER_ROW As String = "ItemsPerRow" + Public Const NEWS_ARCHIVES_ITEMS_PER_ROW_DEFAULT As Integer = 1 + + Public Const NEWS_ARCHIVES_SETTING_HTML_HEADER As String = "NewsArchivesHtmlHeader" + Public Const NEWS_ARCHIVES_SETTING_HTML_BODY As String = "NewsArchivesHtmlBody" + Public Const NEWS_ARCHIVES_SETTING_HTML_FOOTER As String = "NewsArchivesHtmlFooter" + + Public Const NEWS_ARCHIVES_SETTING_HTML_HEADER_ADVANCED As String = "NewsArchivesHtmlHeaderAdvanced" + Public Const NEWS_ARCHIVES_SETTING_HTML_BODY_ADVANCED As String = "NewsArchivesHtmlBodyAdvanced" + Public Const NEWS_ARCHIVES_SETTING_HTML_FOOTER_ADVANCED As String = "NewsArchivesHtmlFooterAdvanced" + + Public Const NEWS_ARCHIVES_SETTING_CATEGORY_HTML_HEADER As String = "NewsArchivesCategoryHtmlHeader" + Public Const NEWS_ARCHIVES_SETTING_CATEGORY_HTML_BODY As String = "NewsArchivesCategoryHtmlBody" + Public Const NEWS_ARCHIVES_SETTING_CATEGORY_HTML_FOOTER As String = "NewsArchivesCategoryHtmlFooter" + + Public Const NEWS_ARCHIVES_SETTING_CATEGORY_HTML_HEADER_ADVANCED As String = "NewsArchivesCategoryHtmlHeaderAdvanced" + Public Const NEWS_ARCHIVES_SETTING_CATEGORY_HTML_BODY_ADVANCED As String = "NewsArchivesCategoryHtmlBodyAdvanced" + Public Const NEWS_ARCHIVES_SETTING_CATEGORY_HTML_FOOTER_ADVANCED As String = "NewsArchivesCategoryHtmlFooterAdvanced" + + Public Const NEWS_ARCHIVES_SETTING_AUTHOR_HTML_HEADER As String = "NewsArchivesAuthorHtmlHeader" + Public Const NEWS_ARCHIVES_SETTING_AUTHOR_HTML_BODY As String = "NewsArchivesAuthorHtmlBody" + Public Const NEWS_ARCHIVES_SETTING_AUTHOR_HTML_FOOTER As String = "NewsArchivesAuthorHtmlFooter" + + Public Const NEWS_ARCHIVES_SETTING_AUTHOR_HTML_HEADER_ADVANCED As String = "NewsArchivesAuthorHtmlHeaderAdvanced" + Public Const NEWS_ARCHIVES_SETTING_AUTHOR_HTML_BODY_ADVANCED As String = "NewsArchivesAuthorHtmlBodyAdvanced" + Public Const NEWS_ARCHIVES_SETTING_AUTHOR_HTML_FOOTER_ADVANCED As String = "NewsArchivesAuthorHtmlFooterAdvanced" + + Public Const NEWS_ARCHIVES_DEFAULT_HTML_HEADER As String = "" + Public Const NEWS_ARCHIVES_DEFAULT_HTML_BODY As String = "" + Public Const NEWS_ARCHIVES_DEFAULT_HTML_FOOTER As String = "
[MONTH] [YEAR] ([COUNT])
" + + Public Const NEWS_ARCHIVES_DEFAULT_HTML_HEADER_ADVANCED As String = "" + Public Const NEWS_ARCHIVES_DEFAULT_HTML_BODY_ADVANCED As String = "[MONTH] [YEAR] ([COUNT])" + Public Const NEWS_ARCHIVES_DEFAULT_HTML_FOOTER_ADVANCED As String = "" + + Public Const NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_HEADER As String = "" + Public Const NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_BODY As String = "" + Public Const NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_FOOTER As String = "
[CATEGORY] ([COUNT])
" + + Public Const NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_HEADER_ADVANCED As String = "" + Public Const NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_BODY_ADVANCED As String = "[CATEGORY] ([COUNT])" + Public Const NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_FOOTER_ADVANCED As String = "" + + Public Const NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_HEADER As String = "" + Public Const NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_BODY As String = "" + Public Const NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_FOOTER As String = "
[AUTHORDISPLAYNAME] ([COUNT])
" + + Public Const NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_HEADER_ADVANCED As String = "" + Public Const NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_BODY_ADVANCED As String = "[AUTHORDISPLAYNAME] ([COUNT])" + Public Const NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_FOOTER_ADVANCED As String = "" + + ' News Search + + Public Const NEWS_SEARCH_TAB_ID As String = "NewsSearchTabID" + Public Const NEWS_SEARCH_MODULE_ID As String = "NewsSearchModuleID" + + ' Caching Constants + Public Const CACHE_CATEGORY_ARTICLE As String = "NewsCategory_Cache_" + Public Const CACHE_IMAGE_ARTICLE As String = "NewsImage_Cache_" + Public Const CACHE_CATEGORY_ARTICLE_NO_LINK As String = "NewsCategory_Cache_NoLink" + Public Const CACHE_CATEGORY_ARTICLE_LATEST As String = "NewsCategory_Cache_Latest_" + +#End Region + + End Class + +End Namespace + diff --git a/Components/Common/ArticleUtilities.vb b/Components/Common/ArticleUtilities.vb new file mode 100755 index 0000000..71e00d2 --- /dev/null +++ b/Components/Common/ArticleUtilities.vb @@ -0,0 +1,49 @@ +Namespace Ventrian.NewsArticles.Components.Common + + Public Class ArticleUtilities + + Public Shared Function MapPath(ByVal path As String) + + If (HttpContext.Current IsNot Nothing) Then + Return HttpContext.Current.Server.MapPath(path) + End If + + Return path + + End Function + + Public Shared Function ResolveUrl(ByVal path As String) + + Return SafeToAbsolute(path) + + End Function + + Public Shared Function ToAbsoluteUrl(relativeUrl As String) As String + If String.IsNullOrEmpty(relativeUrl) Then + Return relativeUrl + End If + + If HttpContext.Current Is Nothing Then + Return relativeUrl + End If + + Dim url = HttpContext.Current.Request.Url + Dim port = If(url.Port <> 80, (":" & url.Port), [String].Empty) + + If relativeUrl.StartsWith("~") Then + Return [String].Format("{0}://{1}{2}{3}", url.Scheme, url.Host, port, SafeToAbsolute(relativeUrl)) + Else + Return [String].Format("{0}://{1}{2}{3}", url.Scheme, url.Host, port, relativeUrl) + End If + End Function + + Private Shared Function SafeToAbsolute(path As String) As String + Dim madeSafe As String = path.Replace("?", "UNLIKELY_TOKEN") + Dim absolute As String = VirtualPathUtility.ToAbsolute(madeSafe) + Dim restored As String = absolute.Replace("UNLIKELY_TOKEN", "?") + Return restored + End Function + + End Class + +End Namespace diff --git a/Components/ContentSharingInfo.vb b/Components/ContentSharingInfo.vb new file mode 100755 index 0000000..bf55364 --- /dev/null +++ b/Components/ContentSharingInfo.vb @@ -0,0 +1,115 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Data + +Imports DotNetNuke +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Portals + +Namespace Ventrian.NewsArticles + + Public Class ContentSharingInfo + +#Region " Private Methods " + + ' local property declarations + Dim _linkedPortalID As Integer + Dim _portalTitle As String + Dim _linkedTabID As Integer + Dim _tabTitle As String + Dim _linkedModuleID As Integer + Dim _moduleTitle As String + +#End Region + +#Region " Public Properties " + + Public Property LinkedPortalID() As Integer + Get + Return _linkedPortalID + End Get + Set(ByVal Value As Integer) + _linkedPortalID = Value + End Set + End Property + + Public ReadOnly Property PortalTitle() As String + Get + If (_portalTitle = "") Then + Dim objPortalController As New PortalController() + Dim objPortal As PortalInfo = objPortalController.GetPortal(LinkedPortalID) + + If (objPortal IsNot Nothing) Then + _portalTitle = objPortal.PortalName + + Dim o As New PortalAliasController + Dim portalAliases As ArrayList = o.GetPortalAliasArrayByPortalID(_linkedPortalID) + + If (portalAliases.Count > 0) Then + _portalTitle = DotNetNuke.Common.AddHTTP(CType(portalAliases(0), PortalAliasInfo).HTTPAlias) + End If + End If + + End If + Return _portalTitle + End Get + End Property + + Public Property LinkedTabID() As Integer + Get + Return _linkedTabID + End Get + Set(ByVal Value As Integer) + _linkedTabID = Value + End Set + End Property + + Public Property TabTitle() As String + Get + Return _tabTitle + End Get + Set(ByVal Value As String) + _tabTitle = Value + End Set + End Property + + Public Property LinkedModuleID() As Integer + Get + Return _linkedModuleID + End Get + Set(ByVal Value As Integer) + _linkedModuleID = Value + End Set + End Property + + Public Property ModuleTitle() As String + Get + Return _moduleTitle + End Get + Set(ByVal Value As String) + _moduleTitle = Value + End Set + End Property + + Public ReadOnly Property Title() As String + Get + Return PortalTitle & " -> " & _tabTitle & " -> " & _moduleTitle + End Get + End Property + + Public ReadOnly Property LinkedID() As String + Get + Return _linkedPortalID & "-" & _linkedModuleID + End Get + End Property + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Components/Controllers/PageController.vb b/Components/Controllers/PageController.vb new file mode 100755 index 0000000..9e4ff43 --- /dev/null +++ b/Components/Controllers/PageController.vb @@ -0,0 +1,53 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Class PageController + +#Region " Public Methods " + + Public Function GetPageList(ByVal articleId As Integer) As ArrayList + + Return CBO.FillCollection(DataProvider.Instance().GetPageList(articleId), GetType(PageInfo)) + + End Function + + Public Function GetPage(ByVal pageId As Integer) As PageInfo + + Return CType(CBO.FillObject(DataProvider.Instance().GetPage(pageId), GetType(PageInfo)), PageInfo) + + End Function + + Public Sub DeletePage(ByVal pageId As Integer) + + DataProvider.Instance().DeletePage(pageId) + + End Sub + + Public Function AddPage(ByVal objPage As PageInfo) As Integer + + Dim pageId As Integer = DataProvider.Instance().AddPage(objPage.ArticleID, objPage.Title, objPage.PageText, objPage.SortOrder) + ArticleController.ClearArticleCache(objPage.ArticleID) + Return pageId + + End Function + + Public Sub UpdatePage(ByVal objPage As PageInfo) + + DataProvider.Instance().UpdatePage(objPage.PageID, objPage.ArticleID, objPage.Title, objPage.PageText, objPage.SortOrder) + + ArticleController.ClearArticleCache(objPage.ArticleID) + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Components/Controllers/PageInfo.vb b/Components/Controllers/PageInfo.vb new file mode 100755 index 0000000..6437c1a --- /dev/null +++ b/Components/Controllers/PageInfo.vb @@ -0,0 +1,79 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Data + +Imports DotNetNuke +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Class PageInfo + +#Region " Private Methods " + + ' local property declarations + Dim _pageID As Integer + Dim _articleID As Integer + Dim _title As String + Dim _pageText As String + Dim _sortOrder As Integer + +#End Region + +#Region " Public Properties " + + Public Property PageID() As Integer + Get + Return _pageID + End Get + Set(ByVal Value As Integer) + _pageID = Value + End Set + End Property + + Public Property ArticleID() As Integer + Get + Return _articleID + End Get + Set(ByVal Value As Integer) + _articleID = Value + End Set + End Property + + Public Property Title() As String + Get + Return _title + End Get + Set(ByVal Value As String) + _title = Value + End Set + End Property + + Public Property PageText() As String + Get + Return _pageText + End Get + Set(ByVal Value As String) + _pageText = Value + End Set + End Property + + Public Property SortOrder() As Integer + Get + Return _sortOrder + End Get + Set(ByVal Value As Integer) + _sortOrder = Value + End Set + End Property + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Components/CustomFields/CustomFieldController.vb b/Components/CustomFields/CustomFieldController.vb new file mode 100755 index 0000000..ad1cbbe --- /dev/null +++ b/Components/CustomFields/CustomFieldController.vb @@ -0,0 +1,61 @@ +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles.Components.CustomFields + + Public Class CustomFieldController + +#Region " Private Members " + + Private Const CACHE_KEY As String = "-NewsArticles-CustomFields-All" + +#End Region + +#Region " Public Methods " + + Public Function [Get](ByVal customFieldID As Integer) As CustomFieldInfo + + Return CType(CBO.FillObject(DataProvider.Instance().GetCustomField(customFieldID), GetType(CustomFieldInfo)), CustomFieldInfo) + + End Function + + Public Function List(ByVal moduleID As Integer) As ArrayList + + Dim key As String = moduleID.ToString() & CACHE_KEY + + Dim objCustomFields As ArrayList = CType(DataCache.GetCache(key), ArrayList) + + If (objCustomFields Is Nothing) Then + objCustomFields = CBO.FillCollection(DataProvider.Instance().GetCustomFieldList(moduleID), GetType(CustomFieldInfo)) + DataCache.SetCache(key, objCustomFields) + End If + + Return objCustomFields + + End Function + + Public Sub Delete(ByVal moduleID As Integer, ByVal customFieldID As Integer) + + DataCache.RemoveCache(moduleID.ToString() & CACHE_KEY) + DataProvider.Instance().DeleteCustomField(customFieldID) + + End Sub + + Public Function Add(ByVal objCustomField As CustomFieldInfo) As Integer + + DataCache.RemoveCache(objCustomField.ModuleID.ToString() & CACHE_KEY) + Return CType(DataProvider.Instance().AddCustomField(objCustomField.ModuleID, objCustomField.Name, objCustomField.FieldType, objCustomField.FieldElements, objCustomField.DefaultValue, objCustomField.Caption, objCustomField.CaptionHelp, objCustomField.IsRequired, objCustomField.IsVisible, objCustomField.SortOrder, objCustomField.ValidationType, objCustomField.Length, objCustomField.RegularExpression), Integer) + + End Function + + Public Sub Update(ByVal objCustomField As CustomFieldInfo) + + DataCache.RemoveCache(objCustomField.ModuleID.ToString() & CACHE_KEY) + DataProvider.Instance().UpdateCustomField(objCustomField.CustomFieldID, objCustomField.ModuleID, objCustomField.Name, objCustomField.FieldType, objCustomField.FieldElements, objCustomField.DefaultValue, objCustomField.Caption, objCustomField.CaptionHelp, objCustomField.IsRequired, objCustomField.IsVisible, objCustomField.SortOrder, objCustomField.ValidationType, objCustomField.Length, objCustomField.RegularExpression) + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Components/CustomFields/CustomFieldInfo.vb b/Components/CustomFields/CustomFieldInfo.vb new file mode 100755 index 0000000..9d9e7c9 --- /dev/null +++ b/Components/CustomFields/CustomFieldInfo.vb @@ -0,0 +1,157 @@ +Namespace Ventrian.NewsArticles.Components.CustomFields + + Public Class CustomFieldInfo + +#Region " Private Members " + + Dim _customFieldID As Integer + Dim _moduleID As Integer + Dim _name As String + Dim _fieldType As CustomFieldType + Dim _fieldElements As String + Dim _defaultValue As String + Dim _caption As String + Dim _captionHelp As String + Dim _isRequired As Boolean + Dim _isVisible As Boolean + Dim _sortOrder As Integer + Dim _validationType As CustomFieldValidationType + Dim _regularExpression As String + Dim _length As Integer + +#End Region + +#Region " Public Properties " + + Public Property CustomFieldID() As Integer + Get + Return _customFieldID + End Get + Set(ByVal Value As Integer) + _customFieldID = Value + End Set + End Property + + Public Property ModuleID() As Integer + Get + Return _moduleID + End Get + Set(ByVal Value As Integer) + _moduleID = Value + End Set + End Property + + Public Property Name() As String + Get + Return _name + End Get + Set(ByVal Value As String) + _name = Value + End Set + End Property + + Public Property FieldElements() As String + Get + Return _fieldElements + End Get + Set(ByVal Value As String) + _fieldElements = Value + End Set + End Property + + Public Property FieldType() As CustomFieldType + Get + Return _fieldType + End Get + Set(ByVal Value As CustomFieldType) + _fieldType = Value + End Set + End Property + + Public Property DefaultValue() As String + Get + Return _defaultValue + End Get + Set(ByVal Value As String) + _defaultValue = Value + End Set + End Property + + Public Property Caption() As String + Get + Return _caption + End Get + Set(ByVal Value As String) + _caption = Value + End Set + End Property + + Public Property CaptionHelp() As String + Get + Return _captionHelp + End Get + Set(ByVal Value As String) + _captionHelp = Value + End Set + End Property + + Public Property SortOrder() As Integer + Get + Return _sortOrder + End Get + Set(ByVal Value As Integer) + _sortOrder = Value + End Set + End Property + + Public Property IsRequired() As Boolean + Get + Return _isRequired + End Get + Set(ByVal Value As Boolean) + _isRequired = Value + End Set + End Property + + Public Property IsVisible() As Boolean + Get + Return _isVisible + End Get + Set(ByVal Value As Boolean) + _isVisible = Value + End Set + End Property + + Public Property ValidationType() As CustomFieldValidationType + Get + Return _validationType + End Get + Set(ByVal Value As CustomFieldValidationType) + _validationType = Value + End Set + End Property + + Public Property Length() As Integer + Get + Return _length + End Get + Set(ByVal Value As Integer) + _length = Value + End Set + End Property + + Public Property RegularExpression() As String + Get + Return _regularExpression + End Get + Set(ByVal Value As String) + _regularExpression = Value + End Set + End Property + +#End Region + + End Class + +End Namespace + diff --git a/Components/CustomFields/CustomFieldType.vb b/Components/CustomFields/CustomFieldType.vb new file mode 100755 index 0000000..44d872a --- /dev/null +++ b/Components/CustomFields/CustomFieldType.vb @@ -0,0 +1,16 @@ +Namespace Ventrian.NewsArticles.Components.CustomFields + + Public Enum CustomFieldType + + OneLineTextBox = 0 + MultiLineTextBox = 1 + RichTextBox = 2 + DropDownList = 3 + CheckBox = 4 + MultiCheckBox = 5 + RadioButton = 6 + ColorPicker = 7 + + End Enum + +End Namespace diff --git a/Components/CustomFields/CustomFieldValidationType.vb b/Components/CustomFields/CustomFieldValidationType.vb new file mode 100755 index 0000000..bf0c64d --- /dev/null +++ b/Components/CustomFields/CustomFieldValidationType.vb @@ -0,0 +1,15 @@ +Namespace Ventrian.NewsArticles.Components.CustomFields + + Public Enum CustomFieldValidationType + + [None] = 0 + [Currency] = 1 + [Date] = 2 + [Double] = 3 + [Integer] = 4 + [Email] = 5 + [Regex] = 6 + + End Enum + +End Namespace diff --git a/Components/CustomFields/CustomValueController.vb b/Components/CustomFields/CustomValueController.vb new file mode 100755 index 0000000..6303081 --- /dev/null +++ b/Components/CustomFields/CustomValueController.vb @@ -0,0 +1,69 @@ +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles.Components.CustomFields + + Public Class CustomValueController + +#Region " Private Members " + + Private Const CACHE_KEY As String = "-NewsArticles-CustomValues-All" + +#End Region + +#Region " Public Methods " + + Public Function GetByCustomField(ByVal articleID As Integer, ByVal customFieldID As Integer) As CustomValueInfo + + Dim objCustomValues As List(Of CustomValueInfo) = List(articleID) + + For Each objCustomValue As CustomValueInfo In objCustomValues + If (objCustomValue.CustomFieldID = customFieldID) Then + Return objCustomValue + End If + Next + + Return Nothing + + End Function + + Public Function List(ByVal articleID As Integer) As List(Of CustomValueInfo) + + Dim key As String = articleID.ToString() & CACHE_KEY + + Dim objCustomValues As List(Of CustomValueInfo) = CType(DataCache.GetCache(key), List(Of CustomValueInfo)) + + If (objCustomValues Is Nothing) Then + objCustomValues = CBO.FillCollection(Of CustomValueInfo)(DataProvider.Instance().GetCustomValueList(articleID)) + DataCache.SetCache(key, objCustomValues) + End If + + Return objCustomValues + + End Function + + Public Function Add(ByVal objCustomValue As CustomValueInfo) As Integer + + DataCache.RemoveCache(objCustomValue.ArticleID.ToString() & CACHE_KEY) + Return CType(DataProvider.Instance().AddCustomValue(objCustomValue.ArticleID, objCustomValue.CustomFieldID, objCustomValue.CustomValue), Integer) + + End Function + + Public Sub Update(ByVal objCustomValue As CustomValueInfo) + + DataCache.RemoveCache(objCustomValue.ArticleID.ToString() & CACHE_KEY) + DataProvider.Instance().UpdateCustomValue(objCustomValue.CustomValueID, objCustomValue.ArticleID, objCustomValue.CustomFieldID, objCustomValue.CustomValue) + + End Sub + + Public Sub Delete(ByVal articleID As Integer, ByVal customFieldID As Integer) + + DataCache.RemoveCache(articleID.ToString() & CACHE_KEY) + DataProvider.Instance().DeleteCustomValue(articleID, customFieldID) + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Components/CustomFields/CustomValueInfo.vb b/Components/CustomFields/CustomValueInfo.vb new file mode 100755 index 0000000..7ea6352 --- /dev/null +++ b/Components/CustomFields/CustomValueInfo.vb @@ -0,0 +1,58 @@ +Namespace Ventrian.NewsArticles.Components.CustomFields + + Public Class CustomValueInfo + +#Region " Private Members " + + Dim _customValueID As Integer + Dim _articleID As Integer + Dim _customFieldID As Integer + Dim _customValue As String + +#End Region + +#Region " Public Properties " + + Public Property CustomValueID() As Integer + Get + Return _customValueID + End Get + Set(ByVal Value As Integer) + _customValueID = Value + End Set + End Property + + Public Property ArticleID() As Integer + Get + Return _articleID + End Get + Set(ByVal Value As Integer) + _articleID = Value + End Set + End Property + + Public Property CustomFieldID() As Integer + Get + Return _customFieldID + End Get + Set(ByVal Value As Integer) + _customFieldID = Value + End Set + End Property + + Public Property CustomValue() As String + Get + Return _customValue + End Get + Set(ByVal Value As String) + _customValue = Value + End Set + End Property + +#End Region + + End Class + +End Namespace + + diff --git a/Components/DisplayType.vb b/Components/DisplayType.vb new file mode 100755 index 0000000..7c23590 --- /dev/null +++ b/Components/DisplayType.vb @@ -0,0 +1,24 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Enum DisplayType + + UserName + FirstName + LastName + FullName + + End Enum + +End Namespace diff --git a/Components/EmailTemplateController.vb b/Components/EmailTemplateController.vb new file mode 100755 index 0000000..b5a7d9f --- /dev/null +++ b/Components/EmailTemplateController.vb @@ -0,0 +1,402 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Data + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports Dotnetnuke.Entities.Portals +Imports Dotnetnuke.Entities.Users +Imports DotNetNuke.Framework +Imports DotNetNuke.Security.Roles + +Namespace Ventrian.NewsArticles + + Public Class EmailTemplateController + +#Region " Private Methods " + + Public Function FormatArticleEmail(ByVal template As String, ByVal link As String, ByVal objArticle As ArticleInfo, ByVal articleSettings As ArticleSettings) As String + + Dim formatted As String = template + + formatted = formatted.Replace("[USERNAME]", objArticle.AuthorUserName) + formatted = formatted.Replace("[FIRSTNAME]", objArticle.AuthorFirstName) + formatted = formatted.Replace("[LASTNAME]", objArticle.AuthorLastName) + formatted = formatted.Replace("[FULLNAME]", objArticle.AuthorFullName) + formatted = formatted.Replace("[EMAIL]", objArticle.AuthorEmail) + formatted = formatted.Replace("[DISPLAYNAME]", objArticle.AuthorDisplayName) + + Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings() + + formatted = formatted.Replace("[PORTALNAME]", settings.PortalName) + formatted = formatted.Replace("[CREATEDATE]", objArticle.CreatedDate.ToString("d") & " " & objArticle.CreatedDate.ToString("t")) + formatted = formatted.Replace("[POSTDATE]", objArticle.StartDate.ToString("d") & " " & objArticle.CreatedDate.ToString("t")) + + formatted = formatted.Replace("[TITLE]", objArticle.Title) + formatted = formatted.Replace("[SUMMARY]", System.Web.HttpContext.Current.Server.HtmlDecode(objArticle.Summary)) + formatted = formatted.Replace("[LINK]", link) + + Return formatted + + End Function + + Public Function FormatCommentEmail(ByVal template As String, ByVal link As String, ByVal objArticle As ArticleInfo, ByVal objComment As CommentInfo, ByVal articleSettings As ArticleSettings) As String + + Dim formatted As String = template + + If (objComment.UserID = Null.NullInteger) Then + ' Anonymous Comment + formatted = formatted.Replace("[USERNAME]", objComment.AnonymousName) + formatted = formatted.Replace("[EMAIL]", objComment.AnonymousEmail) + formatted = formatted.Replace("[FIRSTNAME]", objComment.AnonymousName) + formatted = formatted.Replace("[LASTNAME]", objComment.AnonymousName) + formatted = formatted.Replace("[FULLNAME]", objComment.AnonymousName) + formatted = formatted.Replace("[DISPLAYNAME]", objComment.AnonymousName) + Else + ' Authenticated Comment + formatted = formatted.Replace("[USERNAME]", objComment.AuthorUserName) + formatted = formatted.Replace("[EMAIL]", objComment.AuthorEmail) + formatted = formatted.Replace("[FIRSTNAME]", objComment.AuthorFirstName) + formatted = formatted.Replace("[LASTNAME]", objComment.AuthorLastName) + formatted = formatted.Replace("[FULLNAME]", objComment.AuthorFirstName & " " & objComment.AuthorLastName) + formatted = formatted.Replace("[DISPLAYNAME]", objComment.AuthorDisplayName) + End If + + Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings() + + formatted = formatted.Replace("[PORTALNAME]", settings.PortalName) + formatted = formatted.Replace("[POSTDATE]", DateTime.Now.ToShortDateString & " " & DateTime.Now.ToShortTimeString) + + formatted = formatted.Replace("[TITLE]", objArticle.Title) + formatted = formatted.Replace("[COMMENT]", objComment.Comment.Replace("
", vbCrLf)) + formatted = formatted.Replace("[LINK]", link) + formatted = formatted.Replace("[APPROVELINK]", Common.GetModuleLink(settings.ActiveTab.TabID, objArticle.ModuleID, "ApproveComments", articleSettings)) + + Return formatted + + End Function + + Public Function GetApproverDistributionList(ByVal moduleID As Integer) As String + + Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings() + Dim moduleSettings As Hashtable = PortalSettings.GetModuleSettings(moduleID) + Dim distributionList As String = "" + + If (moduleSettings.Contains(ArticleConstants.PERMISSION_APPROVAL_SETTING)) Then + + Dim roles As String = moduleSettings(ArticleConstants.PERMISSION_APPROVAL_SETTING).ToString() + Dim rolesArray() As String = roles.Split(Convert.ToChar(";")) + Dim userList As Hashtable = New Hashtable + + For Each role As String In rolesArray + If (role.Length > 0) Then + Dim objRoleController As RoleController = New RoleController + Dim objRole As RoleInfo = objRoleController.GetRoleByName(settings.PortalId, role) + + If Not (objRole Is Nothing) Then + Dim objUsers As ArrayList = objRoleController.GetUserRolesByRoleName(settings.PortalId, objRole.RoleName) + For Each objUser As UserRoleInfo In objUsers + If (userList.Contains(objUser.UserID) = False) Then + Dim objUserController As UserController = New UserController + Dim objSelectedUser As UserInfo = objUserController.GetUser(settings.PortalId, objUser.UserID) + If Not (objSelectedUser Is Nothing) Then + If (objSelectedUser.Email.Length > 0) Then + userList.Add(objUser.UserID, objSelectedUser.Email) + End If + End If + End If + Next + End If + End If + Next + + For Each email As DictionaryEntry In userList + If (distributionList.Length > 0) Then + distributionList += "; " + End If + distributionList += email.Value.ToString() + Next + + End If + + Return distributionList + + End Function + + +#End Region + +#Region " Public Methods " + + Public Function [Get](ByVal templateID As Integer) As EmailTemplateInfo + + Return CType(CBO.FillObject(DataProvider.Instance().GetEmailTemplate(templateID), GetType(EmailTemplateInfo)), EmailTemplateInfo) + + End Function + + Public Function [Get](ByVal moduleID As Integer, ByVal type As EmailTemplateType) As EmailTemplateInfo + + Dim objEmailTemplate As EmailTemplateInfo = CType(CBO.FillObject(DataProvider.Instance().GetEmailTemplateByName(moduleID, type.ToString()), GetType(EmailTemplateInfo)), EmailTemplateInfo) + + If (objEmailTemplate Is Nothing) Then + + objEmailTemplate = New EmailTemplateInfo + objEmailTemplate.ModuleID = moduleID + objEmailTemplate.Name = type.ToString() + + Select Case type + + Case EmailTemplateType.ArticleApproved + objEmailTemplate.Subject = "[PORTALNAME]: Your Article Has Been Approved" + objEmailTemplate.Template = "" _ + & "Your article titled [TITLE] has been approved." & vbCrLf & vbCrLf _ + & "To visit the live article, please visit:" & vbCrLf _ + & "[LINK]" & vbCrLf & vbCrLf _ + & "Thank you," & vbCrLf _ + & "[PORTALNAME]" + Exit Select + + Case EmailTemplateType.ArticleSubmission + objEmailTemplate.Subject = "[PORTALNAME]: New Article Requires Approval" + objEmailTemplate.Template = "" _ + & "At [POSTDATE] an article title [TITLE] has been submitted for approval." & vbCrLf & vbCrLf _ + & "[SUMMARY]" & vbCrLf & vbCrLf _ + & "To view the complete article and approve, please visit:" & vbCrLf _ + & "[LINK]" & vbCrLf & vbCrLf _ + & "Thank you," & vbCrLf _ + & "[PORTALNAME]" + Exit Select + + Case EmailTemplateType.ArticleUpdateMirrored + objEmailTemplate.Subject = "[PORTALNAME]: An article has been updated" + objEmailTemplate.Template = "" _ + & "At [POSTDATE] an article you have mirrored '[TITLE]' was updated." & vbCrLf & vbCrLf _ + & "To visit the mirrored article, please visit:" & vbCrLf _ + & "[LINK]" & vbCrLf & vbCrLf _ + & "Thank you," & vbCrLf _ + & "[PORTALNAME]" + Exit Select + + Case EmailTemplateType.CommentNotification + objEmailTemplate.Subject = "[PORTALNAME]: Comment Notification" + objEmailTemplate.Template = "" _ + & "At [POSTDATE] a comment was posted to the article [TITLE]." & vbCrLf & vbCrLf _ + & "[COMMENT]" & vbCrLf & vbCrLf _ + & "To view the complete article and reply, please visit:" & vbCrLf _ + & "[LINK]" & vbCrLf & vbCrLf _ + & "Thank you," & vbCrLf _ + & "[PORTALNAME]" + Exit Select + + Case EmailTemplateType.CommentRequiringApproval + objEmailTemplate.Subject = "[PORTALNAME]: Comment requiring approval" + objEmailTemplate.Template = "" _ + & "At [POSTDATE], a comment requiring approval was posted to your article [TITLE]." & vbCrLf & vbCrLf _ + & "[COMMENT]" & vbCrLf & vbCrLf _ + & "To approve this comment, please visit:" & vbCrLf _ + & "[APPROVELINK]" & vbCrLf & vbCrLf _ + & "Thank you," & vbCrLf _ + & "[PORTALNAME]" + Exit Select + + Case EmailTemplateType.CommentApproved + objEmailTemplate.Subject = "[PORTALNAME]: Your Comment Has Been Approved" + objEmailTemplate.Template = "" _ + & "Your comment posted to [TITLE] has been approved." & vbCrLf & vbCrLf _ + & "To visit the live article, please visit:" & vbCrLf _ + & "[LINK]" & vbCrLf & vbCrLf _ + & "Thank you," & vbCrLf _ + & "[PORTALNAME]" + Exit Select + + End Select + + objEmailTemplate.TemplateID = Add(objEmailTemplate) + + End If + + Return objEmailTemplate + + End Function + + Public Function List(ByVal moduleID As Integer) As ArrayList + + Return CBO.FillCollection(DataProvider.Instance().ListEmailTemplate(moduleID), GetType(EmailTemplateInfo)) + + End Function + + Public Function Add(ByVal objEmailTemplate As EmailTemplateInfo) As Integer + + Return CType(DataProvider.Instance().AddEmailTemplate(objEmailTemplate.ModuleID, objEmailTemplate.Name, objEmailTemplate.Subject, objEmailTemplate.Template), Integer) + + End Function + + Public Sub Update(ByVal objEmailTemplate As EmailTemplateInfo) + + DataProvider.Instance().UpdateEmailTemplate(objEmailTemplate.TemplateID, objEmailTemplate.ModuleID, objEmailTemplate.Name, objEmailTemplate.Subject, objEmailTemplate.Template) + + End Sub + + Public Sub Delete(ByVal templateID As Integer) + + DataProvider.Instance().DeleteEmailTemplate(templateID) + + End Sub + + Public Sub SendFormattedEmail(ByVal moduleID As Integer, ByVal link As String, ByVal objArticle As ArticleInfo, ByVal type As EmailTemplateType, ByVal sendTo As String, ByVal articleSettings As ArticleSettings) + + Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings() + + Dim subject As String = "" + Dim template As String = "" + + Select Case type + + Case EmailTemplateType.ArticleSubmission + Dim objTemplate As EmailTemplateInfo = Me.Get(moduleID, EmailTemplateType.ArticleSubmission) + subject = objTemplate.Subject + template = objTemplate.Template + + Exit Select + + Case EmailTemplateType.ArticleApproved + Dim objTemplate As EmailTemplateInfo = Me.Get(moduleID, EmailTemplateType.ArticleApproved) + subject = objTemplate.Subject + template = objTemplate.Template + + Exit Select + + Case EmailTemplateType.ArticleUpdateMirrored + Dim objTemplate As EmailTemplateInfo = Me.Get(moduleID, EmailTemplateType.ArticleUpdateMirrored) + subject = objTemplate.Subject + template = objTemplate.Template + + Exit Select + + Case Else + Exit Sub + + End Select + + subject = FormatArticleEmail(subject, link, objArticle, articleSettings) + template = FormatArticleEmail(template, link, objArticle, articleSettings) + + ' SendNotification(settings.Email, sendTo, Null.NullString, subject, template) + Try + DotNetNuke.Services.Mail.Mail.SendMail(settings.Email, sendTo, "", subject, template, "", "", "", "", "", "") + Catch + End Try + + End Sub + + Public Sub SendFormattedEmail(ByVal moduleID As Integer, ByVal link As String, ByVal objArticle As ArticleInfo, ByVal objComment As CommentInfo, ByVal type As EmailTemplateType, ByVal articleSettings As ArticleSettings) + + Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings() + + Dim sendTo As String = "" + + Select Case type + + Case EmailTemplateType.CommentNotification + + Dim objUserController As New UserController + Dim objUser As UserInfo = objUserController.GetUser(settings.PortalId, objArticle.AuthorID) + + If Not (objUser Is Nothing) Then + sendTo = objUser.Membership.Email + SendFormattedEmail(moduleID, link, objArticle, objComment, EmailTemplateType.CommentNotification, articleSettings, sendTo) + End If + + Exit Select + + Case EmailTemplateType.CommentApproved + + If (objComment.UserID <> Null.NullInteger) Then + Dim objUserController As New UserController + Dim objUser As UserInfo = objUserController.GetUser(settings.PortalId, objComment.UserID) + + If Not (objUser Is Nothing) Then + sendTo = objUser.Membership.Email + SendFormattedEmail(moduleID, link, objArticle, objComment, EmailTemplateType.CommentApproved, articleSettings, sendTo) + End If + Else + SendFormattedEmail(moduleID, link, objArticle, objComment, EmailTemplateType.CommentApproved, articleSettings, objComment.AnonymousEmail) + End If + + Exit Select + + Case EmailTemplateType.CommentRequiringApproval + + Dim objUserController As New UserController + Dim objUser As UserInfo = objUserController.GetUser(settings.PortalId, objArticle.AuthorID) + + If Not (objUser Is Nothing) Then + sendTo = objUser.Membership.Email + SendFormattedEmail(moduleID, link, objArticle, objComment, EmailTemplateType.CommentRequiringApproval, articleSettings, sendTo) + End If + + Exit Select + + Case Else + Exit Sub + + End Select + + End Sub + + Public Sub SendFormattedEmail(ByVal moduleID As Integer, ByVal link As String, ByVal objArticle As ArticleInfo, ByVal objComment As CommentInfo, ByVal type As EmailTemplateType, ByVal articleSettings As ArticleSettings, ByVal email As String) + + Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings() + + Dim subject As String = "" + Dim template As String = "" + Dim sendTo As String = email + + Select Case type + + Case EmailTemplateType.CommentNotification + Dim objTemplate As EmailTemplateInfo = Me.Get(moduleID, EmailTemplateType.CommentNotification) + subject = objTemplate.Subject + template = objTemplate.Template + + Exit Select + + Case EmailTemplateType.CommentApproved + Dim objTemplate As EmailTemplateInfo = Me.Get(moduleID, EmailTemplateType.CommentApproved) + subject = objTemplate.Subject + template = objTemplate.Template + + Exit Select + + Case EmailTemplateType.CommentRequiringApproval + Dim objTemplate As EmailTemplateInfo = Me.Get(moduleID, EmailTemplateType.CommentRequiringApproval) + subject = objTemplate.Subject + template = objTemplate.Template + + Exit Select + + Case Else + Exit Sub + + End Select + + subject = FormatCommentEmail(subject, link, objArticle, objComment, articleSettings) + template = FormatCommentEmail(template, link, objArticle, objComment, articleSettings) + + Try + DotNetNuke.Services.Mail.Mail.SendMail(settings.Email, sendTo, "", subject, template, "", "", "", "", "", "") + Catch + End Try + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Components/EmailTemplateInfo.vb b/Components/EmailTemplateInfo.vb new file mode 100755 index 0000000..bb8c569 --- /dev/null +++ b/Components/EmailTemplateInfo.vb @@ -0,0 +1,81 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Public Class EmailTemplateInfo + +#Region "Private Members" + Dim _templateID As Integer + Dim _moduleID As Integer + Dim _name As String + Dim _subject As String + Dim _template As String +#End Region + +#Region "Constructors" + Public Sub New() + End Sub + + Public Sub New(ByVal templateID As Integer, ByVal moduleID As Integer, ByVal name As String, ByVal subject As String, ByVal template As String) + Me.TemplateID = templateID + Me.ModuleID = moduleID + Me.Name = name + Me.Subject = subject + Me.Template = template + End Sub +#End Region + +#Region "Public Properties" + Public Property TemplateID() As Integer + Get + Return _templateID + End Get + Set(ByVal Value As Integer) + _templateID = Value + End Set + End Property + + Public Property ModuleID() As Integer + Get + Return _moduleID + End Get + Set(ByVal Value As Integer) + _moduleID = Value + End Set + End Property + + Public Property Name() As String + Get + Return _name + End Get + Set(ByVal Value As String) + _name = Value + End Set + End Property + + Public Property Subject() As String + Get + Return _subject + End Get + Set(ByVal Value As String) + _subject = Value + End Set + End Property + + Public Property Template() As String + Get + Return _template + End Get + Set(ByVal Value As String) + _template = Value + End Set + End Property +#End Region + + End Class + +End Namespace diff --git a/Components/EmailTemplateType.vb b/Components/EmailTemplateType.vb new file mode 100755 index 0000000..54476e1 --- /dev/null +++ b/Components/EmailTemplateType.vb @@ -0,0 +1,26 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Enum EmailTemplateType + + ArticleSubmission + ArticleApproved + ArticleUpdateMirrored + CommentNotification + CommentRequiringApproval + CommentApproved + + End Enum + +End Namespace diff --git a/Components/ExpiryType.vb b/Components/ExpiryType.vb new file mode 100755 index 0000000..3febcca --- /dev/null +++ b/Components/ExpiryType.vb @@ -0,0 +1,22 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Enum ExpiryType + + HideAll = 0 + HidePartial = 1 + + End Enum + +End Namespace diff --git a/Components/GroupByType.vb b/Components/GroupByType.vb new file mode 100755 index 0000000..1ab4d7d --- /dev/null +++ b/Components/GroupByType.vb @@ -0,0 +1,16 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Public Enum GroupByType + + Month + Year + + End Enum + +End Namespace diff --git a/Components/Handout/HandoutArticle.vb b/Components/Handout/HandoutArticle.vb new file mode 100755 index 0000000..3dc31f7 --- /dev/null +++ b/Components/Handout/HandoutArticle.vb @@ -0,0 +1,57 @@ +Namespace Ventrian.NewsArticles + + _ + Public Class HandoutArticle + +#Region " Private Members " + + Private _articleID As Integer + Private _title As String + Private _summary As String + Private _sortOrder As Integer + +#End Region + +#Region " Public Properties " + + Public Property ArticleID() As Integer + Get + Return _articleID + End Get + Set(ByVal value As Integer) + _articleID = value + End Set + End Property + + Public Property Title() As String + Get + Return _title + End Get + Set(ByVal value As String) + _title = value + End Set + End Property + + Public Property Summary() As String + Get + Return _summary + End Get + Set(ByVal value As String) + _summary = value + End Set + End Property + + Public Property SortOrder() As Integer + Get + Return _sortOrder + End Get + Set(ByVal value As Integer) + _sortOrder = value + End Set + End Property + +#End Region + + End Class + +End Namespace diff --git a/Components/Handout/HandoutController.vb b/Components/Handout/HandoutController.vb new file mode 100755 index 0000000..6586525 --- /dev/null +++ b/Components/Handout/HandoutController.vb @@ -0,0 +1,62 @@ +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Class HandoutController + +#Region " Public Methods " + + Public Function AddHandout(ByVal objHandout As HandoutInfo) As Integer + + Dim handoutID As Integer = CType(DataProvider.Instance().AddHandout(objHandout.ModuleID, objHandout.UserID, objHandout.Name, objHandout.Description), Integer) + + Dim i As Integer = 0 + For Each objHandoutArticle As HandoutArticle In objHandout.Articles + DataProvider.Instance().AddHandoutArticle(handoutID, objHandoutArticle.ArticleID, i) + i = i + 1 + Next + + End Function + + Public Sub DeleteHandout(ByVal handoutID As Integer) + + DataProvider.Instance().DeleteHandout(handoutID) + DataProvider.Instance().DeleteHandoutArticleList(handoutID) + + End Sub + + Public Function GetHandout(ByVal handoutID As Integer) As HandoutInfo + + Dim objHandout As HandoutInfo = CType(CBO.FillObject(DataProvider.Instance().GetHandout(handoutID), GetType(HandoutInfo)), HandoutInfo) + + objHandout.Articles = CBO.FillCollection(Of HandoutArticle)(DataProvider.Instance().GetHandoutArticleList(handoutID)) + + Return objHandout + + End Function + + Public Function ListHandout(ByVal userID As Integer) As List(Of HandoutInfo) + + Return CBO.FillCollection(Of HandoutInfo)(DataProvider.Instance().GetHandoutList(userID)) + + End Function + + Public Sub UpdateHandout(ByVal objHandout As HandoutInfo) + + DataProvider.Instance().UpdateHandout(objHandout.HandoutID, objHandout.ModuleID, objHandout.UserID, objHandout.Name, objHandout.Description) + DataProvider.Instance().DeleteHandoutArticleList(objHandout.HandoutID) + + Dim i As Integer = 0 + For Each objHandoutArticle As HandoutArticle In objHandout.Articles + DataProvider.Instance().AddHandoutArticle(objHandout.HandoutID, objHandoutArticle.ArticleID, i) + i = i + 1 + Next + + End Sub + +#End Region + + End Class + +End Namespace + diff --git a/Components/Handout/HandoutFilterType.vb b/Components/Handout/HandoutFilterType.vb new file mode 100755 index 0000000..6a7c26a --- /dev/null +++ b/Components/Handout/HandoutFilterType.vb @@ -0,0 +1,16 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Public Enum HandoutFilterType + + All = 0 + Selected = 1 + + End Enum + +End Namespace diff --git a/Components/Handout/HandoutInfo.vb b/Components/Handout/HandoutInfo.vb new file mode 100755 index 0000000..ea49226 --- /dev/null +++ b/Components/Handout/HandoutInfo.vb @@ -0,0 +1,80 @@ +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Class HandoutInfo + +#Region " Private Members " + + Private _handoutID As Integer = Null.NullInteger + Private _moduleID As Integer = Null.NullInteger + Private _userID As Integer = Null.NullInteger + Private _name As String = Null.NullString + Private _description As String = Null.NullString + + Private _articles As List(Of HandoutArticle) + +#End Region + +#Region " Public Properties " + + Public Property HandoutID() As Integer + Get + Return _handoutID + End Get + Set(ByVal value As Integer) + _handoutID = value + End Set + End Property + + Public Property ModuleID() As Integer + Get + Return _moduleID + End Get + Set(ByVal value As Integer) + _moduleID = value + End Set + End Property + + Public Property UserID() As Integer + Get + Return _userID + End Get + Set(ByVal value As Integer) + _userID = value + End Set + End Property + + Public Property Name() As String + Get + Return _name + End Get + Set(ByVal value As String) + _name = value + End Set + End Property + + Public Property Description() As String + Get + Return _description + End Get + Set(ByVal value As String) + _description = value + End Set + End Property + + Public Property Articles() As List(Of HandoutArticle) + Get + Return _articles + End Get + Set(ByVal value As List(Of HandoutArticle)) + _articles = value + End Set + End Property + +#End Region + + End Class + +End Namespace + diff --git a/Components/Handout/HandoutType.vb b/Components/Handout/HandoutType.vb new file mode 100755 index 0000000..624341f --- /dev/null +++ b/Components/Handout/HandoutType.vb @@ -0,0 +1,17 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Public Enum HandoutOptionType + + None = 0 + Template = 1 + Text = 2 + + End Enum + +End Namespace diff --git a/Components/ImageController.vb b/Components/ImageController.vb new file mode 100755 index 0000000..f951782 --- /dev/null +++ b/Components/ImageController.vb @@ -0,0 +1,57 @@ +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Class ImageController + +#Region " Public Methods " + + Public Function [Get](ByVal imageID As Integer) As ImageInfo + + Return CType(CBO.FillObject(DataProvider.Instance().GetImage(imageID), GetType(ImageInfo)), ImageInfo) + + End Function + + Public Function GetImageList(ByVal articleID As Integer, ByVal imageGuid As String) As List(Of ImageInfo) + + Dim objImages As List(Of ImageInfo) = CType(DataCache.GetCache(ArticleConstants.CACHE_IMAGE_ARTICLE & articleID.ToString()), List(Of ImageInfo)) + + If (objImages Is Nothing) Then + objImages = CBO.FillCollection(Of ImageInfo)(DataProvider.Instance().GetImageList(articleID, imageGuid)) + DataCache.SetCache(ArticleConstants.CACHE_IMAGE_ARTICLE & articleID.ToString() & imageGuid, objImages) + End If + Return objImages + + End Function + + Public Function Add(ByVal objImage As ImageInfo) As Integer + + DataCache.RemoveCache(ArticleConstants.CACHE_IMAGE_ARTICLE & objImage.ArticleID.ToString() & objImage.ImageGuid) + Dim imageID As Integer = CType(DataProvider.Instance().AddImage(objImage.ArticleID, objImage.Title, objImage.FileName, objImage.Extension, objImage.Size, objImage.Width, objImage.Height, objImage.ContentType, objImage.Folder, objImage.SortOrder, objImage.ImageGuid, objImage.Description), Integer) + ArticleController.ClearArticleCache(objImage.ArticleID) + Return imageID + + End Function + + Public Sub Update(ByVal objImage As ImageInfo) + + DataProvider.Instance().UpdateImage(objImage.ImageID, objImage.ArticleID, objImage.Title, objImage.FileName, objImage.Extension, objImage.Size, objImage.Width, objImage.Height, objImage.ContentType, objImage.Folder, objImage.SortOrder, objImage.ImageGuid, objImage.Description) + DataCache.RemoveCache(ArticleConstants.CACHE_IMAGE_ARTICLE & objImage.ArticleID.ToString() & objImage.ImageGuid) + DataCache.RemoveCache(ArticleConstants.CACHE_IMAGE_ARTICLE & objImage.ArticleID.ToString()) + ArticleController.ClearArticleCache(objImage.ArticleID) + + End Sub + + Public Sub Delete(ByVal imageID As Integer, ByVal articleID As Integer, ByVal imageGuid As String) + + DataProvider.Instance().DeleteImage(imageID) + DataCache.RemoveCache(ArticleConstants.CACHE_IMAGE_ARTICLE & articleID.ToString() & imageGuid) + ArticleController.ClearArticleCache(articleID) + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Components/ImageInfo.vb b/Components/ImageInfo.vb new file mode 100755 index 0000000..3210643 --- /dev/null +++ b/Components/ImageInfo.vb @@ -0,0 +1,153 @@ +Namespace Ventrian.NewsArticles + + Public Class ImageInfo + Implements ICloneable + +#Region " Private Members " + + Dim _imageID As Integer + Dim _articleID As Integer + + Dim _title As String + + Dim _fileName As String + Dim _extension As String + Dim _size As Integer + Dim _width As Integer + Dim _height As Integer + Dim _contentType As String + Dim _folder As String + Dim _sortOrder As Integer + Dim _imageGuid As String + Dim _description As String + +#End Region + +#Region " Public Properties " + + Public Property ImageID() As Integer + Get + Return _imageID + End Get + Set(ByVal value As Integer) + _imageID = value + End Set + End Property + + Public Property ArticleID() As Integer + Get + Return _articleID + End Get + Set(ByVal value As Integer) + _articleID = value + End Set + End Property + + Public Property Title() As String + Get + Return _title + End Get + Set(ByVal value As String) + _title = value + End Set + End Property + + Public Property FileName() As String + Get + Return _fileName + End Get + Set(ByVal value As String) + _fileName = value + End Set + End Property + + Public Property Extension() As String + Get + Return _extension + End Get + Set(ByVal value As String) + _extension = value + End Set + End Property + + Public Property Size() As Integer + Get + Return _size + End Get + Set(ByVal value As Integer) + _size = value + End Set + End Property + + Public Property Width() As Integer + Get + Return _width + End Get + Set(ByVal value As Integer) + _width = value + End Set + End Property + + Public Property Height() As Integer + Get + Return _height + End Get + Set(ByVal value As Integer) + _height = value + End Set + End Property + + Public Property ContentType() As String + Get + Return _contentType + End Get + Set(ByVal value As String) + _contentType = value + End Set + End Property + + Public Property Folder() As String + Get + Return _folder + End Get + Set(ByVal value As String) + _folder = value + End Set + End Property + + Public Property SortOrder() As Integer + Get + Return _sortOrder + End Get + Set(ByVal value As Integer) + _sortOrder = value + End Set + End Property + + Public Property ImageGuid() As String + Get + Return _imageGuid + End Get + Set(ByVal value As String) + _imageGuid = value + End Set + End Property + + Public Property Description() As String + Get + Return _description + End Get + Set(ByVal value As String) + _description = value + End Set + End Property + +#End Region + + Public Function Clone() As Object Implements System.ICloneable.Clone + Return Me.MemberwiseClone + End Function + + End Class + +End Namespace diff --git a/Components/Import/FeedController.vb b/Components/Import/FeedController.vb new file mode 100755 index 0000000..52529c5 --- /dev/null +++ b/Components/Import/FeedController.vb @@ -0,0 +1,72 @@ +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles.Import + + Public Class FeedController + +#Region " Public Methods " + + Public Function [Get](ByVal feedID As Integer) As FeedInfo + + Return CType(CBO.FillObject(DataProvider.Instance().GetFeed(feedID), GetType(FeedInfo)), FeedInfo) + + End Function + + Public Function GetFeedList(ByVal moduleID As Integer, ByVal showActiveOnly As Boolean) As List(Of FeedInfo) + + Return CBO.FillCollection(Of FeedInfo)(DataProvider.Instance().GetFeedList(moduleID, showActiveOnly)) + + End Function + + Public Function Add(ByVal objFeed As FeedInfo) As Integer + + Dim feedID As Integer = CType(DataProvider.Instance().AddFeed(objFeed.ModuleID, objFeed.Title, objFeed.Url, objFeed.UserID, objFeed.AutoFeature, objFeed.IsActive, objFeed.DateMode, objFeed.AutoExpire, objFeed.AutoExpireUnit), Integer) + + For Each objCategory As CategoryInfo In objFeed.Categories + AddFeedCategory(feedID, objCategory.CategoryID) + Next + + Return feedID + + End Function + + Public Sub Update(ByVal objFeed As FeedInfo) + + DataProvider.Instance().UpdateFeed(objFeed.FeedID, objFeed.ModuleID, objFeed.Title, objFeed.Url, objFeed.UserID, objFeed.AutoFeature, objFeed.IsActive, objFeed.DateMode, objFeed.AutoExpire, objFeed.AutoExpireUnit) + + DeleteFeedCategory(objFeed.FeedID) + For Each objCategory As CategoryInfo In objFeed.Categories + AddFeedCategory(objFeed.FeedID, objCategory.CategoryID) + Next + + End Sub + + Public Sub Delete(ByVal feedID As Integer) + + DataProvider.Instance().DeleteFeed(feedID) + + End Sub + + Public Function AddFeedCategory(ByVal feedID As Integer, ByVal categoryID As Integer) As Integer + + DataProvider.Instance().AddFeedCategory(feedID, categoryID) + + End Function + + Public Function GetFeedCategoryList(ByVal feedID As Integer) As List(Of CategoryInfo) + + Return CBO.FillCollection(Of CategoryInfo)(DataProvider.Instance().GetFeedCategoryList(feedID)) + + End Function + + Public Sub DeleteFeedCategory(ByVal feedID As Integer) + + DataProvider.Instance().DeleteFeedCategory(feedID) + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Components/Import/FeedDateMode.vb b/Components/Import/FeedDateMode.vb new file mode 100755 index 0000000..ee102d6 --- /dev/null +++ b/Components/Import/FeedDateMode.vb @@ -0,0 +1,22 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2010 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles.Import + + Public Enum FeedDateMode + + ImportDate = 0 + FeedDate = 1 + + End Enum + +End Namespace diff --git a/Components/Import/FeedExpiryType.vb b/Components/Import/FeedExpiryType.vb new file mode 100755 index 0000000..ab62fce --- /dev/null +++ b/Components/Import/FeedExpiryType.vb @@ -0,0 +1,14 @@ +Namespace Ventrian.NewsArticles.Import + + Public Enum FeedExpiryType + + None = -1 + Minute = 0 + Hour = 1 + Day = 2 + Month = 3 + Year = 4 + + End Enum + +End Namespace diff --git a/Components/Import/FeedInfo.vb b/Components/Import/FeedInfo.vb new file mode 100755 index 0000000..3039b9d --- /dev/null +++ b/Components/Import/FeedInfo.vb @@ -0,0 +1,138 @@ +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles.Import + + Public Class FeedInfo + +#Region " Private Members " + + Dim _feedID As Integer = Null.NullInteger + Dim _moduleID As Integer + Dim _title As String + Dim _url As String + Dim _userID As Integer + Dim _autoFeature As Boolean + Dim _isActive As Boolean + Dim _dateMode As FeedDateMode + + Dim _autoExpire As Integer + Dim _autoExpireUnit As FeedExpiryType + + Dim _categories As List(Of CategoryInfo) + +#End Region + +#Region " Private Properties " + + Public Property FeedID() As Integer + Get + Return _feedID + End Get + Set(ByVal Value As Integer) + _feedID = Value + End Set + End Property + + Public Property ModuleID() As Integer + Get + Return _moduleID + End Get + Set(ByVal Value As Integer) + _moduleID = Value + End Set + End Property + + Public Property Title() As String + Get + Return _title + End Get + Set(ByVal Value As String) + _title = Value + End Set + End Property + + Public Property Url() As String + Get + Return _url + End Get + Set(ByVal Value As String) + _url = Value + End Set + End Property + + Public Property UserID() As Integer + Get + Return _userID + End Get + Set(ByVal Value As Integer) + _userID = Value + End Set + End Property + + Public Property AutoFeature() As Boolean + Get + Return _autoFeature + End Get + Set(ByVal Value As Boolean) + _autoFeature = Value + End Set + End Property + + Public Property IsActive() As Boolean + Get + Return _isActive + End Get + Set(ByVal Value As Boolean) + _isActive = Value + End Set + End Property + + Public Property DateMode() As FeedDateMode + Get + Return _dateMode + End Get + Set(ByVal Value As FeedDateMode) + _dateMode = Value + End Set + End Property + + Public Property AutoExpire() As Integer + Get + Return _autoExpire + End Get + Set(ByVal Value As Integer) + _autoExpire = Value + End Set + End Property + + Public Property AutoExpireUnit() As FeedExpiryType + Get + Return _autoExpireUnit + End Get + Set(ByVal Value As FeedExpiryType) + _autoExpireUnit = Value + End Set + End Property + + Public Property Categories() As List(Of CategoryInfo) + Get + If (_categories Is Nothing) Then + If (_feedID = Null.NullInteger) Then + _categories = New List(Of CategoryInfo) + Else + Dim objFeedController As New FeedController + _categories = objFeedController.GetFeedCategoryList(_feedID) + End If + End If + Return _categories + End Get + Set(ByVal Value As List(Of CategoryInfo)) + _categories = Value + End Set + End Property + +#End Region + + End Class + +End Namespace diff --git a/Components/Import/RssImportJob.vb b/Components/Import/RssImportJob.vb new file mode 100755 index 0000000..67552b0 --- /dev/null +++ b/Components/Import/RssImportJob.vb @@ -0,0 +1,437 @@ +Imports System.Xml.XPath + +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Scheduling +Imports System.Xml +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Entities.Portals + +Namespace Ventrian.NewsArticles.Import + + Public Class RssImportJob + Inherits SchedulerClient + +#Region " Private Methods " + + Private Sub ImportFeed(ByVal objFeed As FeedInfo) + + Dim doc As XPathDocument + Dim navigator As XPathNavigator + Dim nodes As XPathNodeIterator + Dim node As XPathNavigator + + ' Create a new XmlDocument + doc = New XPathDocument(objFeed.Url) + + ' Create navigator + navigator = doc.CreateNavigator() + + Dim mngr As New XmlNamespaceManager(navigator.NameTable) + mngr.AddNamespace("content", "http://purl.org/rss/1.0/modules/content/") + + ' Get forecast with XPath + nodes = navigator.Select("/rss/channel/item") + + If (nodes.Count = 0) Then + ImportFeedRDF(objFeed) + End If + + Dim publishedDate As DateTime = DateTime.Now + + While nodes.MoveNext() + node = nodes.Current + + Dim nodeTitle As XPathNavigator + Dim nodeDescription As XPathNavigator + Dim nodeLink As XPathNavigator + Dim nodeDate As XPathNavigator + Dim nodeGuid As XPathNavigator + Dim nodeEncoded As XPathNavigator + + nodeTitle = node.SelectSingleNode("title") + nodeDescription = node.SelectSingleNode("description") + nodeLink = node.SelectSingleNode("link") + nodeDate = node.SelectSingleNode("pubDate") + nodeGuid = node.SelectSingleNode("guid") + nodeEncoded = node.SelectSingleNode("content:encoded", mngr) + + Dim summary As String = "" + If (nodeDescription IsNot Nothing) Then + summary = nodeDescription.Value + End If + + Dim pageDetail As String = "" + If (nodeEncoded IsNot Nothing) Then + pageDetail = nodeEncoded.Value + Else + If (nodeDescription IsNot Nothing) Then + pageDetail = nodeDescription.Value + End If + End If + + Dim guid As String = "" + If (nodeGuid IsNot Nothing) Then + guid = nodeGuid.Value + Else + guid = nodeLink.Value + End If + + Dim objArticleController As New ArticleController() + Dim objArticles As List(Of ArticleInfo) = objArticleController.GetArticleList(objFeed.ModuleID, DateTime.Now, Null.NullDate, Nothing, False, Nothing, 25, 1, 25, ArticleConstants.DEFAULT_SORT_BY, ArticleConstants.DEFAULT_SORT_DIRECTION, True, False, Null.NullString, Null.NullInteger, True, True, False, False, False, False, Null.NullString, Nothing, False, guid, Null.NullInteger, Null.NullString, Null.NullString, Nothing) + + If (objArticles.Count = 0) Then + + Dim objArticle As New ArticleInfo + + objArticle.AuthorID = objFeed.UserID + objArticle.CreatedDate = DateTime.Now + objArticle.Status = StatusType.Published + objArticle.CommentCount = 0 + objArticle.RatingCount = 0 + objArticle.Rating = 0 + objArticle.ShortUrl = "" + + objArticle.Title = nodeTitle.Value + objArticle.IsFeatured = objFeed.AutoFeature + objArticle.IsSecure = False + objArticle.Summary = summary + + objArticle.LastUpdate = objArticle.CreatedDate + objArticle.LastUpdateID = objFeed.UserID + objArticle.ModuleID = objFeed.ModuleID + + objArticle.Url = nodeLink.Value + If (objFeed.DateMode = FeedDateMode.ImportDate) Then + objArticle.StartDate = publishedDate + Else + Try + Dim val As String = nodeDate.Value + + val = val.Replace("PST", "-0800") + val = val.Replace("MST", "-0700") + val = val.Replace("CST", "-0600") + val = val.Replace("EST", "-0500") + + objArticle.StartDate = DateTime.Parse(val) + Catch + objArticle.StartDate = publishedDate + End Try + End If + + objArticle.EndDate = Null.NullDate + If (objFeed.AutoExpire <> Null.NullInteger And objFeed.AutoExpireUnit <> FeedExpiryType.None) Then + Select Case objFeed.AutoExpireUnit + + Case FeedExpiryType.Minute + objArticle.EndDate = DateTime.Now.AddMinutes(objFeed.AutoExpire) + Exit Select + + Case FeedExpiryType.Hour + objArticle.EndDate = DateTime.Now.AddHours(objFeed.AutoExpire) + Exit Select + + Case FeedExpiryType.Day + objArticle.EndDate = DateTime.Now.AddDays(objFeed.AutoExpire) + Exit Select + + Case FeedExpiryType.Month + objArticle.EndDate = DateTime.Now.AddMonths(objFeed.AutoExpire) + Exit Select + + Case FeedExpiryType.Year + objArticle.EndDate = DateTime.Now.AddYears(objFeed.AutoExpire) + Exit Select + + End Select + End If + + objArticle.RssGuid = guid + + objArticle.ArticleID = objArticleController.AddArticle(objArticle) + + Dim objPage As New PageInfo + objPage.PageText = pageDetail + objPage.ArticleID = objArticle.ArticleID + objPage.Title = objArticle.Title + + Dim objPageController As New PageController() + objPageController.AddPage(objPage) + + For Each objCategory As CategoryInfo In objFeed.Categories + objArticleController.AddArticleCategory(objArticle.ArticleID, objCategory.CategoryID) + Next + + publishedDate = publishedDate.AddSeconds(-1) + + Else + + If (objArticles.Count = 1) Then + + objArticles(0).Title = nodeTitle.Value + objArticles(0).Summary = summary + objArticles(0).LastUpdate = DateTime.Now + objArticleController.UpdateArticle(objArticles(0)) + + Dim objPageController As New PageController() + Dim objPages As ArrayList = objPageController.GetPageList(objArticles(0).ArticleID) + + If (objPages.Count > 0) Then + objPages(0).PageText = pageDetail + objPageController.UpdatePage(objPages(0)) + End If + + End If + + End If + + End While + + End Sub + + Private Sub ImportFeedRDF(ByVal objFeed As FeedInfo) + + Dim doc As XPathDocument + Dim navigator As XPathNavigator + Dim nodes As XPathNodeIterator + Dim node As XPathNavigator + + ' Create a new XmlDocument + doc = New XPathDocument(objFeed.Url) + + ' Create navigator + navigator = doc.CreateNavigator() + + Dim mngr As New XmlNamespaceManager(navigator.NameTable) + mngr.AddNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#") + mngr.AddNamespace("dc", "http://purl.org/dc/elements/1.1/") + + ' Get forecast with XPath + nodes = navigator.Select("/rdf:RDF/*", mngr) + + While nodes.MoveNext() + node = nodes.Current + + If (node.Name.ToLower() = "item") Then + + Dim title As String = "" + Dim description As String = "" + Dim link As String = "" + Dim dateNode As String = "" + Dim guid As String = "" + + Dim objChildNodes As XPathNodeIterator = node.SelectChildren(XPathNodeType.All) + + While objChildNodes.MoveNext() + Dim objChildNode As XPathNavigator = objChildNodes.Current + + Select Case objChildNode.Name.ToLower() + + Case "title" + title = objChildNode.Value + Exit Select + + Case "description" + description = objChildNode.Value + Exit Select + + Case "link" + link = objChildNode.Value + Exit Select + + Case "date" + dateNode = objChildNode.Value + Exit Select + + Case "guid" + guid = objChildNode.Value + Exit Select + + End Select + End While + + If (title <> "" And link <> "") Then + + If (guid = "") Then + guid = link + End If + + Dim objArticleController As New ArticleController() + Dim objArticles As List(Of ArticleInfo) = objArticleController.GetArticleList(objFeed.ModuleID, DateTime.Now, Null.NullDate, Nothing, False, Nothing, 1, 1, 10, ArticleConstants.DEFAULT_SORT_BY, ArticleConstants.DEFAULT_SORT_DIRECTION, True, False, Null.NullString, Null.NullInteger, True, True, False, False, False, False, Null.NullString, Nothing, False, guid, Null.NullInteger, Null.NullString, Null.NullString, Nothing) + + If (objArticles.Count = 0) Then + + Dim publishedDate As DateTime = DateTime.Now + + Dim objArticle As New ArticleInfo + + objArticle.AuthorID = objFeed.UserID + objArticle.CreatedDate = DateTime.Now + objArticle.Status = StatusType.Published + objArticle.CommentCount = 0 + objArticle.RatingCount = 0 + objArticle.Rating = 0 + objArticle.ShortUrl = "" + + objArticle.Title = title + objArticle.IsFeatured = objFeed.AutoFeature + objArticle.IsSecure = False + objArticle.Summary = description + + objArticle.LastUpdate = publishedDate + objArticle.LastUpdateID = objFeed.UserID + objArticle.ModuleID = objFeed.ModuleID + + objArticle.Url = link + If (objFeed.DateMode = FeedDateMode.ImportDate) Then + objArticle.StartDate = publishedDate + Else + Try + Dim val As String = dateNode + + val = val.Replace("PST", "-0800") + val = val.Replace("MST", "-0700") + val = val.Replace("CST", "-0600") + val = val.Replace("EST", "-0500") + + objArticle.StartDate = DateTime.Parse(val) + Catch + objArticle.StartDate = publishedDate + End Try + End If + + objArticle.EndDate = Null.NullDate + If (objFeed.AutoExpire <> Null.NullInteger And objFeed.AutoExpireUnit <> FeedExpiryType.None) Then + Select Case objFeed.AutoExpireUnit + + Case FeedExpiryType.Minute + objArticle.EndDate = DateTime.Now.AddMinutes(objFeed.AutoExpire) + Exit Select + + Case FeedExpiryType.Hour + objArticle.EndDate = DateTime.Now.AddHours(objFeed.AutoExpire) + Exit Select + + Case FeedExpiryType.Day + objArticle.EndDate = DateTime.Now.AddDays(objFeed.AutoExpire) + Exit Select + + Case FeedExpiryType.Month + objArticle.EndDate = DateTime.Now.AddMonths(objFeed.AutoExpire) + Exit Select + + Case FeedExpiryType.Year + objArticle.EndDate = DateTime.Now.AddYears(objFeed.AutoExpire) + Exit Select + + End Select + End If + + objArticle.RssGuid = guid + + objArticle.ArticleID = objArticleController.AddArticle(objArticle) + + Dim objPage As New PageInfo + objPage.PageText = description + objPage.ArticleID = objArticle.ArticleID + objPage.Title = objArticle.Title + + Dim objPageController As New PageController() + objPageController.AddPage(objPage) + + For Each objCategory As CategoryInfo In objFeed.Categories + objArticleController.AddArticleCategory(objArticle.ArticleID, objCategory.CategoryID) + Next + + publishedDate = publishedDate.AddSeconds(-1) + + End If + + End If + + End If + + End While + + End Sub + +#End Region + +#Region " Public Methods " + + Public Sub ImportFeeds() + + Dim objFeedController As New FeedController + Dim objFeeds As List(Of FeedInfo) = objFeedController.GetFeedList(Null.NullInteger, True) + + + For Each objFeed As FeedInfo In objFeeds + If (Me.ScheduleHistoryItem.GetSetting("NewsArticles-Import-Clear-" & objFeed.ModuleID) <> "") Then + If (Convert.ToBoolean(Me.ScheduleHistoryItem.GetSetting("NewsArticles-Import-Clear-" & objFeed.ModuleID))) Then + ' Delete Articles + Dim objArticleController As New ArticleController + Dim objArticles As List(Of ArticleInfo) = objArticleController.GetArticleList(objFeed.ModuleID, DateTime.Now, Null.NullDate, Nothing, False, Nothing, 1000, 1, 1000, ArticleConstants.DEFAULT_SORT_BY, ArticleConstants.DEFAULT_SORT_DIRECTION, True, False, Null.NullString, Null.NullInteger, True, True, False, False, False, False, Null.NullString, Nothing, False, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, Nothing) + + Me.ScheduleHistoryItem.AddLogNote(objArticles.Count.ToString()) + For Each objArticle As ArticleInfo In objArticles + objArticleController.DeleteArticleCategories(objArticle.ArticleID) + objArticleController.DeleteArticle(objArticle.ArticleID, objFeed.ModuleID) + Next + + End If + End If + Next + + For Each objFeed As FeedInfo In objFeeds + Try + Me.ScheduleHistoryItem.AddLogNote(objFeed.Url) 'OPTIONAL + ImportFeed(objFeed) + Catch ex As Exception + Me.ScheduleHistoryItem.AddLogNote("News Articles -> Failure to import feed: " + objFeed.Url + ex.ToString()) 'OPTIONAL + End Try + Next + + End Sub + +#End Region + +#Region " Constructors " + + Public Sub New(ByVal objScheduleHistoryItem As DotNetNuke.Services.Scheduling.ScheduleHistoryItem) + + MyBase.new() + Me.ScheduleHistoryItem = objScheduleHistoryItem + + End Sub + +#End Region + +#Region " Interface Methods " + + Public Overrides Sub DoWork() + + + Try + 'notification that the event is progressing + Me.Progressing() 'OPTIONAL + ImportFeeds() + Me.ScheduleHistoryItem.Succeeded = True 'REQUIRED + + Catch exc As Exception 'REQUIRED + + Me.ScheduleHistoryItem.Succeeded = False 'REQUIRED + Me.ScheduleHistoryItem.AddLogNote("News Articles -> Import RSS job failed. " + exc.ToString) 'OPTIONAL + 'notification that we have errored + Me.Errored(exc) 'REQUIRED + 'log the exception + LogException(exc) 'OPTIONAL + + End Try + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Components/LatestArticleController.vb b/Components/LatestArticleController.vb new file mode 100755 index 0000000..64fa536 --- /dev/null +++ b/Components/LatestArticleController.vb @@ -0,0 +1,58 @@ +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Common.Utilities +Imports System.Xml + +Namespace Ventrian.NewsArticles + + Public Class LatestArticleController + Implements IPortable + + Public Function ExportModule(ByVal ModuleID As Integer) As String Implements IPortable.ExportModule + + Dim objModuleController As New ModuleController + Dim settings As Hashtable = objModuleController.GetModuleSettings(ModuleID) + + Dim objLatestLayoutController As New LatestLayoutController() + + Dim objLayoutHeader As LayoutInfo = objLatestLayoutController.GetLayout(LatestLayoutType.Listing_Header_Html, ModuleID, settings) + Dim objLayoutItem As LayoutInfo = objLatestLayoutController.GetLayout(LatestLayoutType.Listing_Item_Html, ModuleID, settings) + Dim objLayoutFooter As LayoutInfo = objLatestLayoutController.GetLayout(LatestLayoutType.Listing_Footer_Html, ModuleID, settings) + Dim objLayoutEmpty As LayoutInfo = objLatestLayoutController.GetLayout(LatestLayoutType.Listing_Empty_Html, ModuleID, settings) + + Dim strXML As String = "" + + strXML += "" & XmlUtils.XMLEncode(objLayoutHeader.Template) & "" + strXML += "" & XmlUtils.XMLEncode(objLayoutItem.Template) & "" + strXML += "" & XmlUtils.XMLEncode(objLayoutFooter.Template) & "" + strXML += "" & XmlUtils.XMLEncode(objLayoutEmpty.Template) & "" + + Return strXML + + End Function + + Public Sub ImportModule(ByVal ModuleID As Integer, ByVal Content As String, ByVal Version As String, ByVal UserId As Integer) Implements IPortable.ImportModule + + Dim objXmlDocument As New XmlDocument() + objXmlDocument.LoadXml("" & Content & "") + + Dim objLatestLayoutController As New LatestLayoutController() + For Each xmlChildNode As XmlNode In objXmlDocument.ChildNodes(0).ChildNodes + If (xmlChildNode.Name = "layoutHeader") Then + objLatestLayoutController.UpdateLayout(LatestLayoutType.Listing_Header_Html, ModuleID, xmlChildNode.InnerText) + End If + If (xmlChildNode.Name = "layoutItem") Then + objLatestLayoutController.UpdateLayout(LatestLayoutType.Listing_Item_Html, ModuleID, xmlChildNode.InnerText) + End If + If (xmlChildNode.Name = "layoutFooter") Then + objLatestLayoutController.UpdateLayout(LatestLayoutType.Listing_Footer_Html, ModuleID, xmlChildNode.InnerText) + End If + If (xmlChildNode.Name = "layoutEmpty") Then + objLatestLayoutController.UpdateLayout(LatestLayoutType.Listing_Empty_Html, ModuleID, xmlChildNode.InnerText) + End If + Next + + End Sub + + End Class + +End Namespace \ No newline at end of file diff --git a/Components/Layout/LatestLayoutController.vb b/Components/Layout/LatestLayoutController.vb new file mode 100755 index 0000000..590dbd0 --- /dev/null +++ b/Components/Layout/LatestLayoutController.vb @@ -0,0 +1,160 @@ +Imports System.IO + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Class LatestLayoutController + +#Region " Public Methods " + + Public Function GetLayout(ByVal type As LatestLayoutType, ByVal moduleID As Integer, ByVal settings As Hashtable) As LayoutInfo + + Dim cacheKey As String = "LatestArticles-" & moduleID.ToString() & "-" & type.ToString() + Dim objLayout As LayoutInfo = CType(DataCache.GetCache(cacheKey), LayoutInfo) + + If (objLayout Is Nothing) Then + + Dim delimStr As String = "[]" + Dim delimiter As Char() = delimStr.ToCharArray() + + objLayout = New LayoutInfo + Dim folderPath As String = HttpContext.Current.Server.MapPath("~\DesktopModules\DnnForge - LatestArticles\Templates\" & moduleID.ToString()) + Dim filePath As String = HttpContext.Current.Server.MapPath("~\DesktopModules\DnnForge - LatestArticles\Templates\" & moduleID.ToString() & "\" & type.ToString().Replace("_", ".")) + + If (File.Exists(filePath) = False) Then + ' Load from settings... + + Dim _layoutMode As LayoutModeType = ArticleConstants.LATEST_ARTICLES_LAYOUT_MODE_DEFAULT + If (settings.Contains(ArticleConstants.LATEST_ARTICLES_LAYOUT_MODE)) Then + _layoutMode = CType(System.Enum.Parse(GetType(LayoutModeType), settings(ArticleConstants.LATEST_ARTICLES_LAYOUT_MODE).ToString()), LayoutModeType) + End If + + Select Case type + + Case LatestLayoutType.Listing_Header_Html + + Dim layoutHeader As String + + If (_layoutMode = LayoutModeType.Simple) Then + If (settings.Contains(ArticleConstants.SETTING_HTML_HEADER)) Then + layoutHeader = settings(ArticleConstants.SETTING_HTML_HEADER).ToString() + Else + layoutHeader = ArticleConstants.DEFAULT_HTML_HEADER + End If + Else + If (settings.Contains(ArticleConstants.SETTING_HTML_HEADER_ADVANCED)) Then + layoutHeader = settings(ArticleConstants.SETTING_HTML_HEADER_ADVANCED).ToString() + Else + layoutHeader = ArticleConstants.DEFAULT_HTML_HEADER_ADVANCED + End If + End If + + If Not (Directory.Exists(folderPath)) Then + Directory.CreateDirectory(folderPath) + End If + + File.WriteAllText(filePath, layoutHeader) + Exit Select + + Case LatestLayoutType.Listing_Item_Html + + Dim layoutItem As String + + If (_layoutMode = LayoutModeType.Simple) Then + If (settings.Contains(ArticleConstants.SETTING_HTML_BODY)) Then + layoutItem = settings(ArticleConstants.SETTING_HTML_BODY).ToString() + Else + layoutItem = ArticleConstants.DEFAULT_HTML_BODY + End If + Else + If (settings.Contains(ArticleConstants.SETTING_HTML_BODY_ADVANCED)) Then + layoutItem = settings(ArticleConstants.SETTING_HTML_BODY_ADVANCED).ToString() + Else + layoutItem = ArticleConstants.DEFAULT_HTML_BODY_ADVANCED + End If + End If + + If Not (Directory.Exists(folderPath)) Then + Directory.CreateDirectory(folderPath) + End If + + File.WriteAllText(filePath, layoutItem) + Exit Select + + Case LatestLayoutType.Listing_Footer_Html + + Dim layoutFooter As String + + If (_layoutMode = LayoutModeType.Simple) Then + If (settings.Contains(ArticleConstants.SETTING_HTML_FOOTER)) Then + layoutFooter = settings(ArticleConstants.SETTING_HTML_FOOTER).ToString() + Else + layoutFooter = ArticleConstants.DEFAULT_HTML_FOOTER + End If + Else + If (settings.Contains(ArticleConstants.SETTING_HTML_FOOTER_ADVANCED)) Then + layoutFooter = settings(ArticleConstants.SETTING_HTML_FOOTER_ADVANCED).ToString() + Else + layoutFooter = ArticleConstants.DEFAULT_HTML_FOOTER_ADVANCED + End If + End If + + If Not (Directory.Exists(folderPath)) Then + Directory.CreateDirectory(folderPath) + End If + + File.WriteAllText(filePath, layoutFooter) + Exit Select + + Case LatestLayoutType.Listing_Empty_Html + + Dim noArticles As String = ArticleConstants.SETTING_HTML_NO_ARTICLES + If (settings.Contains(ArticleConstants.SETTING_HTML_NO_ARTICLES)) Then + noArticles = settings(ArticleConstants.SETTING_HTML_NO_ARTICLES).ToString() + End If + noArticles = "
" & noArticles & "
" + + If Not (Directory.Exists(folderPath)) Then + Directory.CreateDirectory(folderPath) + End If + + File.WriteAllText(filePath, noArticles) + Exit Select + + End Select + + End If + + objLayout.Template = File.ReadAllText(filePath) + objLayout.Tokens = objLayout.Template.Split(delimiter) + + DataCache.SetCache(cacheKey, objLayout, New CacheDependency(filePath)) + + End If + + Return objLayout + + End Function + + Public Sub UpdateLayout(ByVal type As LatestLayoutType, ByVal moduleID As Integer, ByVal content As String) + + Dim folderPath As String = HttpContext.Current.Server.MapPath("~\DesktopModules\DnnForge - LatestArticles\Templates\" & moduleID.ToString()) + Dim filePath As String = HttpContext.Current.Server.MapPath("~\DesktopModules\DnnForge - LatestArticles\Templates\" & moduleID.ToString() & "\" & type.ToString().Replace("_", ".")) + + If Not (Directory.Exists(folderPath)) Then + Directory.CreateDirectory(folderPath) + End If + + File.WriteAllText(filePath, content) + + Dim cacheKey As String = "LatestArticles-" & moduleID.ToString() & "-" & type.ToString() + DataCache.RemoveCache(cacheKey) + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Components/Layout/LatestLayoutType.vb b/Components/Layout/LatestLayoutType.vb new file mode 100755 index 0000000..6b576d9 --- /dev/null +++ b/Components/Layout/LatestLayoutType.vb @@ -0,0 +1,18 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Public Enum LatestLayoutType + + Listing_Header_Html + Listing_Item_Html + Listing_Footer_Html + Listing_Empty_Html + + End Enum + +End Namespace diff --git a/Components/Layout/LayoutController.vb b/Components/Layout/LayoutController.vb new file mode 100755 index 0000000..504f4f5 --- /dev/null +++ b/Components/Layout/LayoutController.vb @@ -0,0 +1,4683 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System.IO +Imports System.Text.RegularExpressions +Imports System.Web +Imports System.Web.UI +Imports System.Web.UI.WebControls +Imports Ventrian.NewsArticles.Components.Common + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Users +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Services.Localization +Imports DotNetNuke.Security +Imports DotNetNuke.Entities.Profile +Imports DotNetNuke.Common.Lists +Imports DotNetNuke.Entities.Portals +Imports Ventrian.NewsArticles.Components.CustomFields + +Imports Ventrian.NewsArticles.Base +Imports DotNetNuke.Web.Client.ClientResourceManagement +Imports DotNetNuke.Web.Client +Imports DotNetNuke.Services.Cache + +Namespace Ventrian.NewsArticles + + Public Class LayoutController + +#Region " Constructors " + + Public Sub New(ByVal portalSettings As PortalSettings, ByVal articleSettings As ArticleSettings, ByVal objModule As ModuleInfo, ByVal objPage As Page) + + _portalSettings = portalSettings + _articleSettings = articleSettings + _articleModule = objModule + _page = objPage + + End Sub + + Public Sub New(ByVal moduleContext As NewsArticleModuleBase) + + _portalSettings = moduleContext.PortalSettings + _articleSettings = moduleContext.ArticleSettings + _articleModule = moduleContext.ModuleContext.Configuration + _page = moduleContext.Page + + End Sub + + Public Sub New(ByVal moduleContext As NewsArticleModuleBase, ByVal pageId As Integer) + + _portalSettings = moduleContext.PortalSettings + _articleSettings = moduleContext.ArticleSettings + _articleModule = moduleContext.ModuleContext.Configuration + _page = moduleContext.Page + _pageId = pageId + + End Sub + +#End Region + +#Region " Private Members " + + Private ReadOnly _portalSettings As PortalSettings + Private ReadOnly _articleSettings As ArticleSettings + Private ReadOnly _articleModule As ModuleInfo + Private ReadOnly _page As Page + + Private _pageId As Integer = Null.NullInteger + Private _tab As DotNetNuke.Entities.Tabs.TabInfo + + Private _objPages As ArrayList + Private _objRelatedArticles As List(Of ArticleInfo) + + Dim _author As UserInfo + + Dim _includeCategory As Boolean = False + + Dim _profileProperties As ProfilePropertyDefinitionCollection + +#End Region + +#Region " Private Properties " + + Private ReadOnly Property PortalSettings() As PortalSettings + Get + Return _portalSettings + End Get + End Property + + Private ReadOnly Property ArticleSettings() As ArticleSettings + Get + Return _articleSettings + End Get + End Property + + Private ReadOnly Property ArticleModule() As ModuleInfo + Get + Return _articleModule + End Get + End Property + + Private ReadOnly Property Page() As Page + Get + Return _page + End Get + End Property + + Private ReadOnly Property Pages(ByVal articleId As Integer) As ArrayList + Get + If (_objPages Is Nothing) Then + Dim objPageController As New PageController + _objPages = objPageController.GetPageList(articleId) + End If + Return _objPages + End Get + End Property + + Private ReadOnly Property Server() As HttpServerUtility + Get + Return _page.Server + End Get + End Property + + Private ReadOnly Property Request() As HttpRequest + Get + Return _page.Request + End Get + End Property + + Private ReadOnly Property UserId() As Integer + Get + Return UserController.GetCurrentUserInfo().UserID + End Get + End Property + + Private ReadOnly Property Tab() As DotNetNuke.Entities.Tabs.TabInfo + Get + If (_tab Is Nothing) Then + Dim objTabController As New DotNetNuke.Entities.Tabs.TabController() + _tab = objTabController.GetTab(ArticleModule.TabID, PortalSettings.PortalId, False) + End If + + Return _tab + End Get + End Property + + Private ReadOnly Property IsEditable() As Boolean + Get + If (Permissions.ModulePermissionController.CanEditModuleContent(ArticleModule)) Then + Return True + End If + Return False + End Get + End Property + +#End Region + +#Region " Public Properties " + + + Public Property IncludeCategory() As Boolean + Get + Return _includeCategory + End Get + Set(ByVal value As Boolean) + _includeCategory = value + End Set + End Property + +#End Region + +#Region " Private Methods " + + Private Function Author(ByVal authorID As Integer) As UserInfo + + If (authorID = Null.NullInteger) Then + Return Nothing + End If + + If (_author Is Nothing) Then + _author = UserController.GetUserById(PortalSettings.PortalId, authorID) + Else + If (_author.UserID = authorID) Then + Return _author + Else + _author = UserController.GetUserById(PortalSettings.PortalId, authorID) + End If + End If + + Return _author + + End Function + + Public Function BBCode(ByVal strTextToReplace As String) As String + + '//Define regex + Dim regExp As Regex + + '//Regex for URL tag without anchor + regExp = New Regex("\[url\]([^\]]+)\[\/url\]", RegexOptions.IgnoreCase) + Dim m As Match = regExp.Match(strTextToReplace) + Do While m.Success + strTextToReplace = strTextToReplace.Replace(m.Value, "" & m.Groups(1).Value & "") + m = m.NextMatch() + Loop + + '//Regex for URL with anchor + regExp = New Regex("\[url=([^\]]+)\]([^\]]+)\[\/url\]", RegexOptions.IgnoreCase) + m = regExp.Match(strTextToReplace) + Do While m.Success + strTextToReplace = strTextToReplace.Replace(m.Value, "" & m.Groups(2).Value & "") + m = m.NextMatch() + Loop + + '//Quote text + regExp = New Regex("\[quote\](.+?)\[\/quote\]", RegexOptions.IgnoreCase) + strTextToReplace = regExp.Replace(strTextToReplace, "$1") + + '//Bold text + regExp = New Regex("\[b\](.+?)\[\/b\]", RegexOptions.IgnoreCase) + strTextToReplace = regExp.Replace(strTextToReplace, "$1") + + '//Italic text + regExp = New Regex("\[i\](.+?)\[\/i\]", RegexOptions.IgnoreCase) + strTextToReplace = regExp.Replace(strTextToReplace, "$1") + + '//Underline text + regExp = New Regex("\[u\](.+?)\[\/u\]", RegexOptions.IgnoreCase) + strTextToReplace = regExp.Replace(strTextToReplace, "$1") + + Return strTextToReplace + + End Function + + ' utility function to convert a byte array into a hex string + Private Function ByteArrayToString(ByVal arrInput() As Byte) As String + + Dim strOutput As New System.Text.StringBuilder(arrInput.Length) + + For i As Integer = 0 To arrInput.Length - 1 + strOutput.Append(arrInput(i).ToString("X2")) + Next + + Return strOutput.ToString().ToLower + + End Function + + Protected Function EncodeComment(ByVal objComment As CommentInfo) As String + + If (objComment.Type = 0) Then + Dim body As String = objComment.Comment + Return BBCode(body) + Else + Return objComment.Comment + End If + + End Function + + ' Returns string with binary notation of b bytes, + ' rounded to 2 decimal places , eg + ' 123="123 Bytes", 2345="2.29 KB", + ' 1234567="1.18 MB", etc + ' b : double : numeric to convert + Function Numeric2Bytes(ByVal b As Double) As String + Dim bSize(8) As String + Dim i As Integer + + bSize(0) = "Bytes" + bSize(1) = "KB" 'Kilobytes + bSize(2) = "MB" 'Megabytes + bSize(3) = "GB" 'Gigabytes + bSize(4) = "TB" 'Terabytes + bSize(5) = "PB" 'Petabytes + bSize(6) = "EB" 'Exabytes + bSize(7) = "ZB" 'Zettabytes + bSize(8) = "YB" 'Yottabytes + + b = CDbl(b) ' Make sure var is a Double (not just + ' variant) + For i = UBound(bSize) To 0 Step -1 + If b >= (1024 ^ i) Then + Numeric2Bytes = ThreeNonZeroDigits(b / (1024 ^ _ + i)) & " " & bSize(i) + Return Numeric2Bytes + End If + Next + + Return "" + End Function + + ' Return the value formatted to include at most three + ' non-zero digits and at most two digits after the + ' decimal point. Examples: + ' 1 + ' 123 + ' 12.3 + ' 1.23 + ' 0.12 + Private Function ThreeNonZeroDigits(ByVal value As Double) _ + As String + If value >= 100 Then + ' No digits after the decimal. + Return Format$(CInt(value)) + ElseIf value >= 10 Then + ' One digit after the decimal. + Return Format$(value, "0.0") + Else + ' Two digits after the decimal. + Return Format$(value, "0.00") + End If + End Function + + Private Function FormatImageUrl(ByVal imageUrl As String) As String + + If (imageUrl.ToLower().StartsWith("http://") Or imageUrl.ToLower().StartsWith("https://")) Then + Return imageUrl + Else + If (imageUrl.ToLower().StartsWith("fileid=")) Then + Dim objFileController As DotNetNuke.Services.FileSystem.FileController = New DotNetNuke.Services.FileSystem.FileController + Dim objFile As DotNetNuke.Services.FileSystem.FileInfo = objFileController.GetFileById(Convert.ToInt32(UrlUtils.GetParameterValue(imageUrl)), PortalSettings.PortalId) + If Not (objFile Is Nothing) Then + If (objFile.StorageLocation = 1) Then + ' Secure Url + Dim url As String = LinkClick(imageUrl, ArticleModule.TabID, ArticleModule.ModuleID) + + If (HttpContext.Current.Request.Url.Port = 80) Then + Return AddHTTP(HttpContext.Current.Request.Url.Host & url) + Else + Return AddHTTP(HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & url) + End If + Else + If (HttpContext.Current.Request.Url.Port = 80) Then + Return AddHTTP(HttpContext.Current.Request.Url.Host & PortalSettings.HomeDirectory & objFile.Folder & objFile.FileName) + Else + Return AddHTTP(HttpContext.Current.Request.Url.Host & ":" & HttpContext.Current.Request.Url.Port.ToString() & PortalSettings.HomeDirectory & objFile.Folder & objFile.FileName) + End If + End If + End If + End If + End If + + Return "" + + End Function + + Public Function GetArticleResource(ByVal key As String) As String + + Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/" & Localization.LocalResourceDirectory & "/ViewArticle.ascx.resx" + Return Localization.GetString(key, path) + + End Function + + Private Function GetFieldValue(ByVal objCustomField As CustomFieldInfo, ByVal objArticle As ArticleInfo, ByVal showCaption As Boolean) As String + + Dim value As String = objArticle.CustomList(objCustomField.CustomFieldID).ToString() + If (objCustomField.FieldType = CustomFieldType.RichTextBox) Then + value = Server.HtmlDecode(objArticle.CustomList(objCustomField.CustomFieldID).ToString()) + + Else + If (objCustomField.FieldType = CustomFieldType.MultiCheckBox) Then + value = objArticle.CustomList(objCustomField.CustomFieldID).ToString().Replace("|", ", ") + End If + If (objCustomField.FieldType = CustomFieldType.MultiLineTextBox) Then + value = objArticle.CustomList(objCustomField.CustomFieldID).ToString().Replace(vbCrLf, "
") + End If + If (value <> "" And objCustomField.ValidationType = CustomFieldValidationType.Date) Then + Try + value = DateTime.Parse(value).ToShortDateString() + Catch + value = objArticle.CustomList(objCustomField.CustomFieldID).ToString() + End Try + End If + + If (value <> "" And objCustomField.ValidationType = CustomFieldValidationType.Currency) Then + Try + Dim culture As String = "en-US" + + Dim portalFormat As System.Globalization.CultureInfo = New System.Globalization.CultureInfo(culture) + Dim format As String = "{0:C2}" + value = String.Format(portalFormat.NumberFormat, format, Double.Parse(value)) + + Catch + value = objArticle.CustomList(objCustomField.CustomFieldID).ToString() + End Try + End If + End If + + If (showCaption) Then + value = "" & objCustomField.Caption & ": " & value + End If + + Return value + + End Function + + Private Function GetRelatedArticles(ByVal objArticle As ArticleInfo, ByVal count As Integer) As List(Of ArticleInfo) + + If (_objRelatedArticles IsNot Nothing) Then + Return _objRelatedArticles + End If + + Dim matchAllCategories As Boolean = False + If (ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAll Or ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAllTagsAny) Then + matchAllCategories = True + End If + + Dim matchAllTags As Boolean = False + If (ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAnyTagsAll Or ArticleSettings.RelatedMode = RelatedType.MatchTagsAll) Then + matchAllTags = True + End If + + Dim objArticleController As New ArticleController() + + Dim categoriesArray() As Integer = Nothing + If (ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAll Or ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAllTagsAny Or ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAny Or ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAnyTagsAll Or ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAnyTagsAny) Then + Dim categories As ArrayList = objArticleController.GetArticleCategories(objArticle.ArticleID) + Dim categoriesRelated As New List(Of Integer) + For Each objCategory As CategoryInfo In categories + categoriesRelated.Add(objCategory.CategoryID) + Next + If (categories.Count = 0) Then + categoriesRelated.Add(-1) + End If + categoriesArray = categoriesRelated.ToArray() + End If + + Dim tagsArray() As Integer = Nothing + If (ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAllTagsAny Or ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAnyTagsAll Or ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAnyTagsAny Or ArticleSettings.RelatedMode = RelatedType.MatchTagsAll Or ArticleSettings.RelatedMode = RelatedType.MatchTagsAny) Then + Dim tagsRelated As New List(Of Integer) + If (objArticle.Tags <> "") Then + Dim objTagController As New TagController() + For Each tag As String In objArticle.Tags.Split(","c) + Dim objTag As TagInfo = objTagController.Get(objArticle.ModuleID, tag.ToLower().Trim()) + If (objTag IsNot Nothing) Then + tagsRelated.Add(objTag.TagID) + End If + Next + End If + If (tagsRelated.Count = 0) Then + tagsRelated.Add(-1) + End If + tagsArray = tagsRelated.ToArray() + End If + + _objRelatedArticles = objArticleController.GetArticleList(objArticle.ModuleID, DateTime.Now, Null.NullDate, categoriesArray, matchAllCategories, Nothing, (count + 1), 1, (count + 1), ArticleSettings.SortBy, ArticleSettings.SortDirection, True, False, Null.NullString, Null.NullInteger, ArticleSettings.ShowPending, True, False, False, False, False, Null.NullString, tagsArray, matchAllTags, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, Nothing) + + Dim positionToRemove As Integer = Null.NullInteger + + Dim i As Integer = 0 + For Each objRelatedArticle As ArticleInfo In _objRelatedArticles + If (objArticle.ArticleID = objRelatedArticle.ArticleID) Then + positionToRemove = i + End If + i = i + 1 + Next + + If (positionToRemove <> Null.NullInteger) Then + _objRelatedArticles.RemoveAt(positionToRemove) + End If + + If (_objRelatedArticles.Count = (count + 1)) Then + _objRelatedArticles.RemoveAt(count) + End If + + Return _objRelatedArticles + + End Function + + Private Function GetRatingImage(ByVal objArticle As ArticleInfo) As String + + If (objArticle.Rating = Null.NullDouble) Then + Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-0-0.gif") + Else + + Select Case RoundToUnit(objArticle.Rating, 0.5, False) + + Case 1 + Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-1-0.gif") + + Case 1.5 + Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-1-5.gif") + + Case 2 + Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-2-0.gif") + + Case 2.5 + Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-2-5.gif") + + Case 3 + Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-3-0.gif") + + Case 3.5 + Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-3-5.gif") + + Case 4 + Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-4-0.gif") + + Case 4.5 + Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-4-5.gif") + + Case 5 + Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-5-0.gif") + + End Select + + Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-0-0.gif") + + End If + + End Function + + Public Function GetSharedResource(ByVal key As String) As String + + Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/" & Localization.LocalResourceDirectory & "/" & Localization.LocalSharedResourceFile + Return Localization.GetString(key, path) + + End Function + + ' calculate the MD5 hash of a given string + ' the string is first converted to a byte array + Public Function MD5CalcString(ByVal strData As String) As String + + Dim objMD5 As New System.Security.Cryptography.MD5CryptoServiceProvider + Dim arrData() As Byte + Dim arrHash() As Byte + + ' first convert the string to bytes (using UTF8 encoding for unicode characters) + arrData = Text.Encoding.UTF8.GetBytes(strData) + + ' hash contents of this byte array + arrHash = objMD5.ComputeHash(arrData) + + ' thanks objects + objMD5 = Nothing + + ' return formatted hash + Return ByteArrayToString(arrHash) + + End Function + + Private Function ProcessPostTokens(ByVal content As String, ByVal objArticle As ArticleInfo, ByRef generator As System.Random, ByVal objArticleSettings As ArticleSettings) As String + + If (objArticleSettings.ProcessPostTokens = False) Then + Return content + End If + + Dim delimStr As String = "[]" + Dim delimiter As Char() = delimStr.ToCharArray() + + Dim layoutArray As String() = content.Split(delimiter) + Dim formattedContent As String = "" + + For iPtr As Integer = 0 To layoutArray.Length - 1 Step 2 + + formattedContent += layoutArray(iPtr).ToString() + + If iPtr < layoutArray.Length - 1 Then + Select Case layoutArray(iPtr + 1) + Case Else + If (layoutArray(iPtr + 1).ToUpper().StartsWith("ARTICLELINK:")) Then + If (IsNumeric(layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12))) Then + Dim articleID As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12)) + + Dim objArticleController As New ArticleController + Dim objArticleTarget As ArticleInfo = objArticleController.GetArticle(articleID) + + If (objArticleTarget IsNot Nothing) Then + Dim link As String = Common.GetArticleLink(objArticleTarget, Tab, ArticleSettings, False) + formattedContent += "" & objArticleTarget.Title & "" + End If + End If + Exit Select + End If + + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("IMAGETHUMBRANDOM:")) Then + + If (objArticle.ImageCount > 0) Then + + Dim objImageController As New ImageController + Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString) + If (objImages.Count > 0) Then + + Dim randomImage As ImageInfo = objImages(generator.Next(0, objImages.Count - 1)) + + Dim val As String = layoutArray(iPtr + 1).Substring(17, layoutArray(iPtr + 1).Length - 17) + If (val.IndexOf(":"c) = -1) Then + Dim length As Integer = Convert.ToInt32(val) + + Dim objImage As New Image + objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(randomImage.Folder & randomImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1") + objImage.EnableViewState = False + objImage.AlternateText = objArticle.Title + + formattedContent += RenderControlAsString(objImage) + Else + + Dim arr() As String = val.Split(":"c) + + If (arr.Length = 2) Then + Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0)) + Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1)) + + Dim objImage As New Image + objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(randomImage.Folder & randomImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1") + objImage.EnableViewState = False + objImage.AlternateText = objArticle.Title + + formattedContent += RenderControlAsString(objImage) + End If + End If + + End If + + End If + Exit Select + End If + + formattedContent += "[" & layoutArray(iPtr + 1) & "]" + End Select + End If + + Next + + Return formattedContent + + End Function + + Private ReadOnly Property ProfileProperties() As ProfilePropertyDefinitionCollection + Get + If (_profileProperties Is Nothing) Then + _profileProperties = ProfileController.GetPropertyDefinitionsByPortal(PortalSettings.PortalId) + End If + Return _profileProperties + End Get + End Property + + Private Function RenderControlAsString(ByVal objControl As Control) As String + + Dim sb As New StringBuilder + Dim tw As New StringWriter(sb) + Dim hw As New HtmlTextWriter(tw) + + objControl.RenderControl(hw) + + Return sb.ToString() + + End Function + + Private Function RoundToUnit(ByVal d As Double, ByVal unit As Double, ByVal roundDown As Boolean) As Double + + If (roundDown) Then + Return Math.Round(Math.Round((d / unit) - 0.5, 0) * unit, 2) + Else + Return Math.Round(Math.Round((d / unit) + 0.5, 0) * unit, 2) + End If + + End Function + + Private Function StripHtml(ByVal html As String) As String + + Dim pattern As String = "<(.|\n)*?>" + Return Regex.Replace(html, pattern, String.Empty) + + End Function + +#End Region + + + Public Shared Function GetLayout(ByVal moduleContext As NewsArticleModuleBase, ByVal type As LayoutType) As LayoutInfo + + Return GetLayout(moduleContext.ArticleSettings, moduleContext.ModuleConfiguration, moduleContext.Page, type) + + End Function + + Public Shared Function GetLayout(ByVal articleSettings As ArticleSettings, ByVal articleModule As ModuleInfo, ByVal page As Page, ByVal type As LayoutType) As LayoutInfo + + Dim cacheKey As String = "NewsArticles-" & articleModule.TabModuleID.ToString() & type.ToString() + Dim objLayout As LayoutInfo = CType(DataCache.GetCache(cacheKey), LayoutInfo) + + If (objLayout Is Nothing) Then + + Const delimStr As String = "[]" + Dim delimiter As Char() = delimStr.ToCharArray() + + objLayout = New LayoutInfo + Dim path As String = page.MapPath("~\DesktopModules\DnnForge - NewsArticles\Templates\" & articleSettings.Template & "\" & type.ToString().Replace("_", ".")) + + If (File.Exists(path) = False) Then + ' Need to find a default... + path = page.MapPath("~\DesktopModules\DnnForge - NewsArticles\Templates\" & ArticleConstants.DEFAULT_TEMPLATE & "\" & type.ToString().Replace("_", ".")) + End If + + objLayout.Template = File.ReadAllText(path) + objLayout.Tokens = objLayout.Template.Split(delimiter) + + DataCache.SetCache(cacheKey, objLayout, New DNNCacheDependency(path)) + + End If + + Return objLayout + + End Function + + Public Shared Sub ClearCache(ByVal moduleContext As NewsArticleModuleBase) + + For Each type As String In System.Enum.GetNames(GetType(LayoutType)) + Dim cacheKey As String = "NewsArticles-" & moduleContext.TabModuleId.ToString() & type.ToString() + DataCache.RemoveCache(cacheKey) + Next + + End Sub + +#Region " Public Methods " + + Public Function GetLayoutObject(ByVal templateData As String) As LayoutInfo + + Dim delimStr As String = "[]" + Dim delimiter As Char() = delimStr.ToCharArray() + Dim objLayout As New LayoutInfo + + objLayout.Template = templateData + objLayout.Tokens = objLayout.Template.Split(delimiter) + + Return objLayout + + End Function + + Public Function GetStylesheet(ByVal template As String) As String + + Dim value As String = "" + + Dim path As String = ArticleUtilities.MapPath("~\DnnForge - NewsArticles\Templates\" & template & "\Template.css") + + If (File.Exists(path) = False) Then + ' Need to find a default... + End If + + File.ReadAllText(path) + + Return value + + End Function + + Public Sub UpdateStylesheet(ByVal template As String, ByVal text As String) + + Dim path As String = ArticleUtilities.MapPath("~\DnnForge - NewsArticles\Templates\" & template & "\Template.css") + File.WriteAllText(path, text) + + End Sub + + Public Sub UpdateLayout(ByVal template As String, ByVal type As LayoutType, ByVal text As String) + + Dim path As String = ArticleUtilities.MapPath("~\DnnForge - NewsArticles\Templates\" & template & "\" & type.ToString().Replace("_", ".")) + File.WriteAllText(path, text) + + End Sub + + Public Sub LoadStyleSheet(ByVal template As String) + + ClientResourceManager.RegisterStyleSheet(Page, ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Templates/" & template & "/Template.css"), FileOrder.Css.ModuleCss) + + End Sub + + Public Function ProcessImages(ByVal html As String) As String + + If (html.ToLower().Contains("src=""images/") Or html.ToLower().Contains("src=""~/images/")) Then + html = html.Replace("src=""images/", "src=""" & ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Templates/" & ArticleSettings.Template & "/Images/")) + html = html.Replace("src=""Images/", "src=""" & ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Templates/" & ArticleSettings.Template & "/Images/")) + html = html.Replace("src=""~/images/", "src=""" & ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images") & "/") + html = html.Replace("src=""~/Images/", "src=""" & ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images") & "/") + End If + + Return html + + End Function + +#Region " Process Article Item " + + + Public Sub ProcessHeaderFooter(ByRef objPlaceHolder As ControlCollection, ByVal layoutArray As String(), ByVal objArticle As ArticleInfo) + + For iPtr As Integer = 0 To layoutArray.Length - 1 Step 2 + objPlaceHolder.Add(New LiteralControl(ProcessImages(layoutArray(iPtr).ToString()))) + Next + + End Sub + + Private articleItemIndex As Integer = 0 + Public Sub ProcessArticleItem(ByRef objPlaceHolder As ControlCollection, ByVal layoutArray As String(), ByVal objArticle As ArticleInfo) + + articleItemIndex = articleItemIndex + 1 + _objRelatedArticles = Nothing + + Static Generator As System.Random = New System.Random() + + For iPtr As Integer = 0 To layoutArray.Length - 1 Step 2 + + objPlaceHolder.Add(New LiteralControl(ProcessImages(layoutArray(iPtr).ToString()))) + + If iPtr < layoutArray.Length - 1 Then + Select Case layoutArray(iPtr + 1) + + Case "APPROVERDISPLAYNAME" + If (objArticle.Approver(PortalSettings.PortalId) IsNot Nothing) Then + Dim objLiteral As New Literal + objLiteral.Text = objArticle.Approver(PortalSettings.PortalId).DisplayName + objPlaceHolder.Add(objLiteral) + End If + + Case "APPROVERFIRSTNAME" + If (objArticle.Approver(PortalSettings.PortalId) IsNot Nothing) Then + Dim objLiteral As New Literal + objLiteral.Text = objArticle.Approver(PortalSettings.PortalId).FirstName + objPlaceHolder.Add(objLiteral) + End If + + Case "APPROVERLASTNAME" + If (objArticle.Approver(PortalSettings.PortalId) IsNot Nothing) Then + Dim objLiteral As New Literal + objLiteral.Text = objArticle.Approver(PortalSettings.PortalId).LastName + objPlaceHolder.Add(objLiteral) + End If + + Case "APPROVERUSERNAME" + If (objArticle.Approver(PortalSettings.PortalId) IsNot Nothing) Then + Dim objLiteral As New Literal + objLiteral.Text = objArticle.Approver(PortalSettings.PortalId).Username + objPlaceHolder.Add(objLiteral) + End If + + Case "ARTICLEID" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.ArticleID.ToString() + objPlaceHolder.Add(objLiteral) + + Case "ARTICLELINK" + Dim objLiteral As New Literal + Dim pageID As Integer = Null.NullInteger + If (ArticleSettings.AlwaysShowPageID) Then + If (Pages(objArticle.ArticleID).Count > 0) Then + pageID = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID + End If + End If + objLiteral.Text = Common.GetArticleLink(objArticle, Tab, ArticleSettings, IncludeCategory, pageID) + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "AUTHOR" + Dim objLiteral As New Literal + Select Case ArticleSettings.DisplayMode + Case DisplayType.FirstName + objLiteral.Text = objArticle.AuthorFirstName + Exit Select + Case DisplayType.LastName + objLiteral.Text = objArticle.AuthorLastName + Exit Select + Case DisplayType.UserName + objLiteral.Text = objArticle.AuthorUserName + Exit Select + Case DisplayType.FullName + objLiteral.Text = objArticle.AuthorDisplayName + Exit Select + Case Else + objLiteral.Text = objArticle.AuthorUserName + Exit Select + End Select + objPlaceHolder.Add(objLiteral) + + Case "AUTHORDISPLAYNAME" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.AuthorDisplayName + objPlaceHolder.Add(objLiteral) + + Case "AUTHOREMAIL" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.AuthorEmail.ToString() + objPlaceHolder.Add(objLiteral) + + Case "AUTHORFIRSTNAME" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.AuthorFirstName + objPlaceHolder.Add(objLiteral) + + Case "AUTHORFULLNAME" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.AuthorFullName + objPlaceHolder.Add(objLiteral) + + Case "AUTHORID" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.AuthorID.ToString() + objPlaceHolder.Add(objLiteral) + + Case "AUTHORLASTNAME" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.AuthorLastName + objPlaceHolder.Add(objLiteral) + + Case "AUTHORLINK" + Dim objLiteral As New Literal + objLiteral.Text = Common.GetAuthorLink(ArticleModule.TabID, ArticleModule.ModuleID, objArticle.AuthorID, objArticle.AuthorUserName, ArticleSettings.LaunchLinks, ArticleSettings) + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "AUTHORUSERNAME" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.AuthorUserName.ToString() + objPlaceHolder.Add(objLiteral) + + Case "CATEGORIES" + Dim objLiteral As New Literal + + Dim objArticleCategories As ArrayList = CType(DataCache.GetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString()), ArrayList) + If (objArticleCategories Is Nothing) Then + Dim objArticleController As New ArticleController + objArticleCategories = objArticleController.GetArticleCategories(objArticle.ArticleID) + For Each objCategory As CategoryInfo In objArticleCategories + If (objCategory.InheritSecurity) Then + If (objLiteral.Text <> "") Then + objLiteral.Text = objLiteral.Text & ", " & objCategory.Name & "" + Else + objLiteral.Text = " " & objCategory.Name & "" + End If + Else + If (ArticleSettings.Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + If (PortalSecurity.IsInRoles(ArticleSettings.Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString())) Then + If (objLiteral.Text <> "") Then + objLiteral.Text = objLiteral.Text & ", " & objCategory.Name & "" + Else + objLiteral.Text = " " & objCategory.Name & "" + End If + End If + End If + End If + Next + DataCache.SetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString(), objArticleCategories) + Else + For Each objCategory As CategoryInfo In objArticleCategories + If (objCategory.InheritSecurity) Then + If (objLiteral.Text <> "") Then + objLiteral.Text = objLiteral.Text & ", " & objCategory.Name & "" + Else + objLiteral.Text = " " & objCategory.Name & "" + End If + Else + + If (ArticleSettings.Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + If (PortalSecurity.IsInRoles(ArticleSettings.Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString())) Then + If (objLiteral.Text <> "") Then + objLiteral.Text = objLiteral.Text & ", " & objCategory.Name & "" + Else + objLiteral.Text = " " & objCategory.Name & "" + End If + End If + End If + End If + Next + End If + objPlaceHolder.Add(objLiteral) + + Case "CATEGORIESNOLINK" + Dim objLiteral As New Literal + Dim objArticleCategories As ArrayList = CType(DataCache.GetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString()), ArrayList) + If (objArticleCategories Is Nothing) Then + Dim objArticleController As New ArticleController + objArticleCategories = (objArticleController.GetArticleCategories(objArticle.ArticleID)) + For Each objCategory As CategoryInfo In objArticleCategories + If (objCategory.InheritSecurity) Then + If (objLiteral.Text <> "") Then + objLiteral.Text = objLiteral.Text & ", " & objCategory.Name + Else + objLiteral.Text = objCategory.Name + End If + Else + If (ArticleSettings.Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + If (PortalSecurity.IsInRoles(ArticleSettings.Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString())) Then + + If (objLiteral.Text <> "") Then + objLiteral.Text = objLiteral.Text & ", " & objCategory.Name + Else + objLiteral.Text = objCategory.Name + End If + End If + End If + End If + Next + DataCache.SetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE_NO_LINK & objArticle.ArticleID.ToString(), objArticleCategories) + Else + For Each objCategory As CategoryInfo In objArticleCategories + If (objCategory.InheritSecurity) Then + If (objLiteral.Text <> "") Then + objLiteral.Text = objLiteral.Text & ", " & objCategory.Name + Else + objLiteral.Text = objCategory.Name + End If + Else + If (ArticleSettings.Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + If (PortalSecurity.IsInRoles(ArticleSettings.Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString())) Then + If (objLiteral.Text <> "") Then + objLiteral.Text = objLiteral.Text & ", " & objCategory.Name + Else + objLiteral.Text = objCategory.Name + End If + End If + End If + End If + Next + End If + objPlaceHolder.Add(objLiteral) + + Case "COMMENTCOUNT" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.CommentCount.ToString() + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "COMMENTLINK" + Dim objLiteral As New Literal + objLiteral.Text = Common.GetArticleLink(objArticle, Tab, ArticleSettings, IncludeCategory) & "#Comments" + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "COMMENTRSS" + Dim objLiteral As New Literal + objLiteral.Text = AddHTTP(Request.Url.Host & ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/RssComments.aspx?TabID=" & ArticleModule.TabID.ToString() & "&ModuleID=" & ArticleModule.ModuleID.ToString() & "&ArticleID=" & objArticle.ArticleID.ToString()).Replace(" ", "%20")) + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "COMMENTS" + commentItemIndex = 0 + + Dim phComments As New PlaceHolder + Dim objLayoutCommentItem As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Comment_Item_Html) + + Dim direction As SortDirection = SortDirection.Ascending + If (ArticleSettings.SortDirectionComments = 1) Then + direction = SortDirection.Descending + End If + Dim objCommentController As New CommentController + Dim objComments As List(Of CommentInfo) = objCommentController.GetCommentList(objArticle.ModuleID, objArticle.ArticleID, True, direction, Null.NullInteger) + + For Each objComment As CommentInfo In objComments + ProcessComment(phComments.Controls, objArticle, objComment, objLayoutCommentItem.Tokens) + Next + + objPlaceHolder.Add(phComments) + + Case "CREATEDATE" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.CreatedDate.ToString("D") + objPlaceHolder.Add(objLiteral) + + Case "CREATETIME" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.CreatedDate.ToString("t") + objPlaceHolder.Add(objLiteral) + + Case "CURRENTPAGE" + Dim objLiteral As New Literal + If (objArticle.PageCount <= 1) Then + objLiteral.Text = "1" + Else + Dim pageID As Integer = Null.NullInteger + If (Request("PageID") <> "" AndAlso IsNumeric(Request("PageID"))) Then + pageID = Convert.ToInt32(Request("PageID")) + End If + If (pageID = Null.NullInteger) Then + pageID = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID + End If + For i As Integer = 0 To Pages(objArticle.ArticleID).Count - 1 + Dim objPage As PageInfo = CType(Pages(objArticle.ArticleID)(i), PageInfo) + If (pageID = objPage.PageID) Then + objLiteral.Text = (i + 1).ToString() + Exit For + End If + Next + If (objLiteral.Text = Null.NullString) Then + objLiteral.Text = "1" + End If + End If + objPlaceHolder.Add(objLiteral) + + Case "CUSTOMFIELDS" + Dim objCustomFieldController As New CustomFieldController() + Dim objCustomFields As ArrayList = objCustomFieldController.List(objArticle.ModuleID) + Dim i As Integer = 0 + For Each objCustomField As CustomFieldInfo In objCustomFields + If (objCustomField.IsVisible = True) Then + Dim objLiteral As New Literal + objLiteral.Text = GetFieldValue(objCustomField, objArticle, True) & "
" + If (objLiteral.Text <> "") Then + objPlaceHolder.Add(objLiteral) + End If + i = i + 1 + End If + Next + + Case "DETAILS" + Dim objLiteral As New Literal + If (objArticle.PageCount > 0) Then + Dim pageID As Integer = Null.NullInteger + If (IsNumeric(Request("PageID"))) Then + pageID = Convert.ToInt32(Request("PageID")) + End If + If (pageID = Null.NullInteger) Then + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings) + Else + Dim pageController As New PageController + Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID) + For Each objPage As PageInfo In pageList + If (objPage.PageID = pageID) Then + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objPage.PageText), objArticle, Generator, ArticleSettings) + Exit For + End If + Next + If (objLiteral.Text = Null.NullString) Then + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings) + End If + End If + End If + objPlaceHolder.Add(objLiteral) + + Case "DETAILSDATA" + Dim objLiteral As New Literal + If (objArticle.PageCount > 0) Then + Dim pageID As Integer = Null.NullInteger + If (IsNumeric(Request("PageID"))) Then + pageID = Convert.ToInt32(Request("PageID")) + End If + If (pageID = Null.NullInteger) Then + objLiteral.Text = "" + Else + Dim pageController As New PageController + Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID) + For Each objPage As PageInfo In pageList + If (objPage.PageID = pageID) Then + objLiteral.Text = "" + Exit For + End If + Next + If (objLiteral.Text = Null.NullString) Then + objLiteral.Text = "" + End If + End If + End If + objPlaceHolder.Add(objLiteral) + + Case "EDIT" + If IsEditable OrElse (ArticleSettings.IsApprover) OrElse (objArticle.AuthorID = UserId And ArticleSettings.IsAutoApprover) Then + Dim objHyperLink As New HyperLink + objHyperLink.NavigateUrl = Common.GetModuleLink(ArticleModule.TabID, ArticleModule.ModuleID, "SubmitNews", ArticleSettings, "ArticleID=" & objArticle.ArticleID.ToString(), "ReturnUrl=" & Server.UrlEncode(Request.RawUrl)) + objHyperLink.ImageUrl = "~/images/edit.gif" + objHyperLink.ToolTip = "Click to edit" + objHyperLink.EnableViewState = False + objPlaceHolder.Add(objHyperLink) + End If + + Case "FILECOUNT" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.FileCount.ToString() + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "FILELINK" + If (objArticle.FileCount > 0) Then + Dim objFiles As List(Of FileInfo) = FileProvider.Instance().GetFiles(objArticle.ArticleID) + + If (objFiles.Count > 0) Then + Dim objLiteral As New Literal + objLiteral.Text = CType(objFiles(0), FileInfo).Link + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + End If + + End If + + Case "FILES" + ' File Count Check + If (objArticle.FileCount > 0) Then + ' Dim objFileController As New FileController + Dim objFiles As List(Of FileInfo) = FileProvider.Instance().GetFiles(objArticle.ArticleID) + + If (objFiles.Count > 0) Then + Dim objLayoutFileHeader As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.File_Header_Html) + Dim objLayoutFileItem As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.File_Item_Html) + Dim objLayoutFileFooter As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.File_Footer_Html) + + ProcessHeaderFooter(objPlaceHolder, objLayoutFileHeader.Tokens, objArticle) + For Each objFile As FileInfo In objFiles + ProcessFile(objPlaceHolder, objArticle, objFile, objLayoutFileItem.Tokens) + Next + ProcessHeaderFooter(objPlaceHolder, objLayoutFileFooter.Tokens, objArticle) + End If + End If + + Case "GRAVATARURL" + If (objArticle.AuthorEmail <> "") Then + Dim objLiteral As New Literal + If Request.IsSecureConnection Then + objLiteral.Text = AddHTTP("secure.gravatar.com/avatar/" & MD5CalcString(objArticle.AuthorEmail.ToLower())) + Else + objLiteral.Text = AddHTTP("www.gravatar.com/avatar/" & MD5CalcString(objArticle.AuthorEmail.ToLower())) + End If + objPlaceHolder.Add(objLiteral) + End If + + Case "HASAUTHOR" + If (objArticle.AuthorID = Null.NullInteger) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASAUTHOR") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASAUTHOR" + ' Do Nothing + + Case "HASNOAUTHOR" + If (objArticle.AuthorID <> Null.NullInteger) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASNOAUTHOR") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASNOAUTHOR" + ' Do Nothing + + Case "HASCATEGORIES" + Dim objLiteral As New Literal + If (DataCache.GetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString()) Is Nothing) Then + Dim objArticleController As New ArticleController + Dim objArticleCategories As ArrayList = objArticleController.GetArticleCategories(objArticle.ArticleID) + For Each objCategory As CategoryInfo In objArticleCategories + If (objLiteral.Text <> "") Then + objLiteral.Text = objLiteral.Text & ", " & objCategory.Name & "" + Else + objLiteral.Text = " " & objCategory.Name & "" + End If + Next + DataCache.SetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString(), objArticleCategories) + Else + Dim objArticleCategories As ArrayList = CType(DataCache.GetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString()), ArrayList) + For Each objCategory As CategoryInfo In objArticleCategories + If (objLiteral.Text <> "") Then + objLiteral.Text = objLiteral.Text & ", " & objCategory.Name & "" + Else + objLiteral.Text = " " & objCategory.Name & "" + End If + Next + End If + If (objLiteral.Text = "") Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASCATEGORIES") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASCATEGORIES" + ' Do Nothing + + Case "HASCOMMENTS" + If (objArticle.CommentCount = 0) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASCOMMENTS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASCOMMENTS" + ' Do Nothing + + Case "HASCOMMENTSENABLED" + If (ArticleSettings.IsCommentsEnabled = False) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASCOMMENTSENABLED") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASCOMMENTSENABLED" + ' Do Nothing + + Case "HASCUSTOMFIELDS" + Dim objCustomFieldController As New CustomFieldController() + Dim objCustomFields As ArrayList = objCustomFieldController.List(objArticle.ModuleID) + + If (objCustomFields.Count = 0) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASCUSTOMFIELDS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASCUSTOMFIELDS" + ' Do Nothing + + Case "HASDETAILS" + Dim objLiteral As New Literal + objLiteral.Text = "" + If (objArticle.PageCount > 0) Then + Dim pageID As Integer = Null.NullInteger + If (IsNumeric(Request("PageID"))) Then + pageID = Convert.ToInt32(Request("PageID")) + End If + If (pageID = Null.NullInteger) Then + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings) + Else + Dim pageController As New PageController + Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID) + For Each objPage As PageInfo In pageList + If (objPage.PageID = pageID) Then + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objPage.PageText), objArticle, Generator, ArticleSettings) + Exit For + End If + Next + If (objLiteral.Text = Null.NullString) Then + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings) + End If + End If + End If + + If (objLiteral.Text.Replace("

 

", "").Trim() = "") Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASDETAILS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASDETAILS" + ' Do Nothing + + Case "HASNODETAILS" + Dim objLiteral As New Literal + objLiteral.Text = "" + If (objArticle.PageCount > 0) Then + Dim pageId As Integer = Null.NullInteger + If (IsNumeric(Request("PageID"))) Then + pageId = Convert.ToInt32(Request("PageID")) + End If + If (pageId = Null.NullInteger) Then + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings) + Else + Dim pageController As New PageController + Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID) + For Each objPage As PageInfo In pageList + If (objPage.PageID = pageId) Then + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objPage.PageText), objArticle, Generator, ArticleSettings) + Exit For + End If + Next + If (objLiteral.Text = Null.NullString) Then + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings) + End If + End If + End If + + If (objLiteral.Text.Replace("

 

", "").Trim() <> "") Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASNODETAILS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASNODETAILS" + ' Do Nothing + + Case "HASFILES" + If (objArticle.FileCount = 0) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASFILES") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASFILES" + ' Do Nothing + + Case "HASIMAGE" + If (objArticle.ImageUrl = "" And objArticle.ImageCount = 0) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASIMAGE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASIMAGE" + ' Do Nothing + + Case "HASIMAGES" + If (objArticle.ImageCount = 0) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASIMAGES") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASIMAGES" + ' Do Nothing + + Case "HASLINK" + If (objArticle.Url = Null.NullString()) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASLINK") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASLINK" + ' Do Nothing + + Case "HASMOREDETAIL" + If (objArticle.Url = Null.NullString() And StripHtml(objArticle.Summary.Trim()) = "") Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASMOREDETAIL") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASMOREDETAIL" + ' Do Nothing + + Case "HASMULTIPLEIMAGES" + If (objArticle.ImageCount <= 1) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASMULTIPLEIMAGES") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASMULTIPLEIMAGES" + ' Do Nothing + + Case "HASMULTIPLEPAGES" + If (objArticle.PageCount <= 1) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASMULTIPLEPAGES") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASMULTIPLEPAGES" + ' Do Nothing + + Case "HASNEXTPAGE" + If (Pages(objArticle.ArticleID).Count <= 1) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASNEXTPAGE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + Else + If (_pageId = Null.NullInteger) Then + _pageId = Pages(objArticle.ArticleID)(0).PageID + End If + If (_pageId = Pages(objArticle.ArticleID)(Pages(objArticle.ArticleID).Count - 1).PageID) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASNEXTPAGE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + Case "/HASNEXTPAGE" + ' Do Nothing + + Case "HASNOCOMMENTS" + If (objArticle.CommentCount > 0) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASNOCOMMENTS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASNOCOMMENTS" + ' Do Nothing + + Case "HASNOFILES" + If (objArticle.FileCount > 0) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASNOFILES") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASNOFILES" + ' Do Nothing + + Case "HASNOIMAGE" + If (objArticle.ImageUrl <> "" Or objArticle.ImageCount > 0) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASNOIMAGE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASNOIMAGE" + ' Do Nothing + + Case "HASNOIMAGES" + If (objArticle.ImageCount > 0) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASNOIMAGES") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASNOIMAGES" + ' Do Nothing + + Case "HASNOLINK" + If (objArticle.Url <> Null.NullString()) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASNOLINK") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASNOLINK" + ' Do Nothing + + Case "HASPREVPAGE" + If (objArticle.PageCount <= 1) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASPREVPAGE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + Else + If (_pageId = Null.NullInteger) Then + _pageId = Pages(objArticle.ArticleID)(0).PageID + End If + If (_pageId = Pages(objArticle.ArticleID)(0).PageID) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASPREVPAGE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + Case "/HASPREVPAGE" + ' Do Nothing + + Case "HASRATING" + If (ArticleSettings.EnableRatings = False OrElse objArticle.RatingCount = 0) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASRATING") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASRATING" + ' Do Nothing + + Case "HASRATINGSENABLED" + If (ArticleSettings.EnableRatings = False) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASRATINGSENABLED") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASRATINGSENABLED" + ' Do Nothing + + Case "HASRELATED" + Dim objRelatedArticles As List(Of ArticleInfo) = GetRelatedArticles(objArticle, 5) + If (objRelatedArticles.Count = 0) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASRELATED") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASRELATED" + ' Do Nothing + + Case "HASSUMMARY" + If (StripHtml(objArticle.Summary.Trim()) = "") Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASSUMMARY") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASSUMMARY" + ' Do Nothing + + Case "HASNOSUMMARY" + If (StripHtml(objArticle.Summary.Trim()) <> "") Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASNOSUMMARY") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASNOSUMMARY" + ' Do Nothing + + Case "HASTAGS" + If (objArticle.Tags = "") Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASTAGS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASTAGS" + ' Do Nothing + + Case "HASNOTAGS" + If (objArticle.Tags <> "") Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/HASNOTAGS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASNOTAGS" + ' Do Nothing + + Case "IMAGE" + If (objArticle.ImageUrl <> "") Then + Dim objImage As New Image + objImage.ImageUrl = FormatImageUrl(objArticle.ImageUrl) + objImage.EnableViewState = False + objImage.AlternateText = objArticle.Title + objPlaceHolder.Add(objImage) + Else + If (objArticle.ImageCount > 0) Then + Dim objImageController As New ImageController + Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString()) + + If (objImages.Count > 0) Then + Dim objImage As New Image + objImage.ImageUrl = PortalSettings.HomeDirectory & objImages(0).Folder & objImages(0).FileName + objImage.EnableViewState = False + objImage.AlternateText = objArticle.Title + objPlaceHolder.Add(objImage) + End If + + End If + End If + + Case "IMAGECOUNT" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.ImageCount.ToString() + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "IMAGELINK" + If (objArticle.ImageUrl <> "") Then + Dim objLiteral As New Literal + objLiteral.Text = FormatImageUrl(objArticle.ImageUrl) + objPlaceHolder.Add(objLiteral) + Else + Dim objImageController As New ImageController + Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString()) + + If (objImages.Count > 0) Then + Dim objLiteral As New Literal + objLiteral.Text = PortalSettings.HomeDirectory & objImages(0).Folder & objImages(0).FileName + objPlaceHolder.Add(objLiteral) + End If + End If + + Case "IMAGES" + + ' Image Count Check + If (objArticle.ImageCount > 0) Then + imageIndex = 0 + + Dim objImageController As New ImageController + Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString()) + + If (objImages.Count > 0) Then + Dim objLayoutImageHeader As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Image_Header_Html) + Dim objLayoutImageItem As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Image_Item_Html) + Dim objLayoutImageFooter As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Image_Footer_Html) + + ProcessHeaderFooter(objPlaceHolder, objLayoutImageHeader.Tokens, objArticle) + For Each objImage As ImageInfo In objImages + ProcessImage(objPlaceHolder, objArticle, objImage, objLayoutImageItem.Tokens) + Next + ProcessHeaderFooter(objPlaceHolder, objLayoutImageFooter.Tokens, objArticle) + End If + + 'Dim script As String = "" _ + '& "" & vbCrLf + + 'Dim objScript As New Literal + 'objScript.Text = script + 'objPlaceHolder.AddAt(0, objScript) + End If + + Case "ISAUTHOR" + Dim isAuthor As Boolean = False + + If (Request.IsAuthenticated) Then + Dim objUser As UserInfo = UserController.GetCurrentUserInfo() + If (objUser IsNot Nothing) Then + If (objUser.UserID = objArticle.AuthorID) Then + isAuthor = True + End If + End If + End If + + If (isAuthor = False) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISAUTHOR") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISAUTHOR" + ' Do Nothing + + Case "ISANONYMOUS" + If (Request.IsAuthenticated) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISANONYMOUS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISANONYMOUS" + ' Do Nothing + + Case "ISDRAFT" + If (objArticle.Status <> StatusType.Draft) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISDRAFT") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISDRAFT" + ' Do Nothing + + Case "ISFEATURED" + If (objArticle.IsFeatured = False) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISFEATURED") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISFEATURED" + ' Do Nothing + + Case "ISNOTFEATURED" + If (objArticle.IsFeatured) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISNOTFEATURED") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISNOTFEATURED" + ' Do Nothing + + Case "ISFIRST" + If (articleItemIndex > 1) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISFIRST") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISFIRST" + ' Do Nothing + + Case "ISFIRST2" + If (articleItemIndex > 1 Or (Request("currentpage") <> "" And Request("currentpage") <> "1")) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISFIRST2") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISFIRST2" + ' Do Nothing + + Case "ISNOTFIRST" + If (articleItemIndex = 1) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISNOTFIRST") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISNOTFIRST" + ' Do Nothing + + Case "ISNOTFIRST2" + If (articleItemIndex = 1 And (Request("currentpage") = "" Or Request("currentpage") = "1")) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISNOTFIRST2") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISNOTFIRST2" + ' Do Nothing + + Case "ISSECOND" + If (articleItemIndex <> 2) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISSECOND") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISSECOND" + ' Do Nothing + + Case "ISNOTSECOND" + If (articleItemIndex = 2) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISNOTSECOND") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISNOTSECOND" + ' Do Nothing + + Case "ISNOTANONYMOUS" + If (Request.IsAuthenticated = False) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISNOTANONYMOUS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISNOTANONYMOUS" + ' Do Nothing + + Case "ISNOTSECURE" + If (objArticle.IsSecure) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISNOTSECURE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISNOTSECURE" + ' Do Nothing + + Case "ISPUBLISHED" + If (objArticle.Status <> StatusType.Published) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISPUBLISHED") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISPUBLISHED" + ' Do Nothing + + Case "ISRATEABLE" + If (ArticleSettings.IsRateable = False) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISRATEABLE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISRATEABLE" + ' Do Nothing + + Case "ISRSSITEM" + If (objArticle.RssGuid = Null.NullString) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISRSSITEM") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISRSSITEM" + ' Do Nothing + + Case "ISNOTRSSITEM" + If (objArticle.RssGuid <> Null.NullString) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISNOTRSSITEM") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISNOTRSSITEM" + ' Do Nothing + + Case "ISSECURE" + If (objArticle.IsSecure = False) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISSECURE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISSECURE" + ' Do Nothing + + Case "ISSYNDICATIONENABLED" + If (ArticleSettings.IsSyndicationEnabled = False) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISSYNDICATIONENABLED") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISSYNDICATIONENABLED" + ' Do Nothing + + Case "ITEMINDEX" + Dim objLiteral As New Literal + objLiteral.Text = articleItemIndex.ToString() + objPlaceHolder.Add(objLiteral) + + Case "LASTUPDATEDATE" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.LastUpdate.ToString("D") + objPlaceHolder.Add(objLiteral) + + Case "LASTUPDATEEMAIL" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.LastUpdateEmail.ToString() + objPlaceHolder.Add(objLiteral) + + Case "LASTUPDATEFIRSTNAME" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.LastUpdateFirstName.ToString() + objPlaceHolder.Add(objLiteral) + + Case "LASTUPDATELASTNAME" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.LastUpdateLastName.ToString() + objPlaceHolder.Add(objLiteral) + + Case "LASTUPDATEUSERNAME" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.LastUpdateUserName.ToString() + objPlaceHolder.Add(objLiteral) + + Case "LASTUPDATEFULLNAME" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.LastUpdateFullName.ToString() + objPlaceHolder.Add(objLiteral) + + Case "LASTUPDATEID" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.LastUpdateID.ToString() + objPlaceHolder.Add(objLiteral) + + Case "LINK" + Dim objLiteral As New Literal + If objArticle.Url = "" Then + Dim pageID As Integer = Null.NullInteger + If (ArticleSettings.AlwaysShowPageID) Then + If (Pages(objArticle.ArticleID).Count > 0) Then + pageID = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID + End If + End If + objLiteral.Text = Common.GetArticleLink(objArticle, Tab, ArticleSettings, IncludeCategory, pageID) + Else + objLiteral.Text = Globals.LinkClick(objArticle.Url, Tab.TabID, objArticle.ModuleID, False) + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "LINKNEXT" + Dim objLink As New HyperLink + objLink.CssClass = "CommandButton" + If (Pages(objArticle.ArticleID).Count <= 1) Then + objLink.Enabled = False + Else + If (_pageId = Null.NullInteger) Then + _pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID + End If + If (_pageId = CType(Pages(objArticle.ArticleID)(Pages(objArticle.ArticleID).Count - 1), PageInfo).PageID) Then + objLink.Enabled = False + Else + objLink.Enabled = True + End If + End If + If (objLink.Enabled = True) Then + If (_pageId = Null.NullInteger) Then + _pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID + End If + For i As Integer = 0 To Pages(objArticle.ArticleID).Count - 1 + Dim objPage As PageInfo = CType(Pages(objArticle.ArticleID)(i), PageInfo) + If (_pageId = objPage.PageID) Then + objLink.NavigateUrl = Common.GetArticleLink(objArticle, Tab, ArticleSettings, IncludeCategory, "PageID=" + CType(Pages(objArticle.ArticleID)(i + 1), PageInfo).PageID.ToString()) + End If + Next + End If + objLink.Text = GetSharedResource("NextPage") + objPlaceHolder.Add(objLink) + + Case "LINKPREVIOUS" + Dim objLink As New HyperLink + objLink.CssClass = "CommandButton" + If (Pages(objArticle.ArticleID).Count <= 1) Then + objLink.Enabled = False + Else + If (_pageId = Null.NullInteger) Then + _pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID + End If + If (_pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID) Then + objLink.Enabled = False + Else + objLink.Enabled = True + End If + End If + If (objLink.Enabled = True) Then + For i As Integer = 0 To Pages(objArticle.ArticleID).Count - 1 + Dim objPage As PageInfo = CType(Pages(objArticle.ArticleID)(i), PageInfo) + If (_pageId = objPage.PageID) Then + If (CType(Pages(objArticle.ArticleID)(i - 1), PageInfo).PageID.ToString() = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID.ToString()) Then + objLink.NavigateUrl = Common.GetArticleLink(objArticle, Tab, ArticleSettings, IncludeCategory) + Else + objLink.NavigateUrl = Common.GetArticleLink(objArticle, Tab, ArticleSettings, IncludeCategory, "PageID=" + CType(Pages(objArticle.ArticleID)(i - 1), PageInfo).PageID.ToString()) + End If + Exit For + End If + Next + End If + objLink.Text = GetSharedResource("PreviousPage") + objPlaceHolder.Add(objLink) + + Case "LINKTARGET" + If (objArticle.Url <> "") Then + Dim objLiteral As New Literal + If (objArticle.IsNewWindow) Then + objLiteral.Text = "_blank" + Else + objLiteral.Text = "_self" + End If + objPlaceHolder.Add(objLiteral) + End If + + Case "MODULEID" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.ModuleID.ToString() + objPlaceHolder.Add(objLiteral) + + Case "PAGECOUNT" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.PageCount.ToString() + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "PAGETEXT" + Dim objLiteral As New Literal + If (objArticle.PageCount > 0) Then + Dim pageID As Integer = Null.NullInteger + If (IsNumeric(Request("PageID"))) Then + pageID = Convert.ToInt32(Request("PageID")) + End If + If (pageID = Null.NullInteger) Then + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings) + Else + Dim pageController As New PageController + Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID) + For Each objPage As PageInfo In pageList + If (objPage.PageID = pageID) Then + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objPage.PageText), objArticle, Generator, ArticleSettings) + Exit For + End If + Next + If (objLiteral.Text = Null.NullString) Then + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings) + End If + End If + Else + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Summary), objArticle, Generator, ArticleSettings) + End If + objPlaceHolder.Add(objLiteral) + + Case "PAGETITLE" + Dim objLiteral As New Literal + If (objArticle.PageCount > 0) Then + Dim pageController As New PageController + Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID) + Dim pageID As Integer = Null.NullInteger + If (IsNumeric(Request("PageID"))) Then + pageID = Convert.ToInt32(Request("PageID")) + End If + If (pageID = Null.NullInteger) Then + objLiteral.Text = CType(pageList(0), PageInfo).Title + Else + For Each objPage As PageInfo In pageList + If (objPage.PageID = pageID) Then + objLiteral.Text = objPage.Title + Exit For + End If + Next + If (objLiteral.Text = Null.NullString) Then + objLiteral.Text = CType(pageList(0), PageInfo).Title + End If + End If + Else + objLiteral.Text = objArticle.Title + End If + objPlaceHolder.Add(objLiteral) + + Case "PAGETITLENEXT" + Dim objLiteral As New Literal + If (Pages(objArticle.ArticleID).Count <= 1) Then + objLiteral.Visible = False + Else + If (_pageId = Null.NullInteger) Then + _pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID + End If + If (_pageId = CType(Pages(objArticle.ArticleID)(Pages(objArticle.ArticleID).Count - 1), PageInfo).PageID) Then + objLiteral.Visible = False + Else + objLiteral.Visible = True + End If + End If + If (objLiteral.Visible = True) Then + If (_pageId = Null.NullInteger) Then + _pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID + End If + For i As Integer = 0 To Pages(objArticle.ArticleID).Count - 1 + Dim objPage As PageInfo = CType(Pages(objArticle.ArticleID)(i), PageInfo) + If (_pageId = objPage.PageID) Then + objLiteral.Text = CType(Pages(objArticle.ArticleID)(i + 1), PageInfo).Title + End If + Next + End If + If (objLiteral.Visible = True And objLiteral.Text <> "") Then + objPlaceHolder.Add(objLiteral) + End If + + Case "PAGETITLEPREV" + Dim objLiteral As New Literal + If (Pages(objArticle.ArticleID).Count <= 1) Then + objLiteral.Visible = False + Else + If (_pageId = Null.NullInteger) Then + _pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID + End If + If (_pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID) Then + objLiteral.Visible = False + Else + objLiteral.Visible = True + End If + End If + If (objLiteral.Visible = True) Then + For i As Integer = 0 To Pages(objArticle.ArticleID).Count - 1 + Dim objPage As PageInfo = CType(Pages(objArticle.ArticleID)(i), PageInfo) + If (_pageId = objPage.PageID) Then + If (CType(Pages(objArticle.ArticleID)(i - 1), PageInfo).PageID.ToString() = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID.ToString()) Then + objLiteral.Text = objArticle.Title + Else + objLiteral.Text = CType(Pages(objArticle.ArticleID)(i - 1), PageInfo).Title + End If + Exit For + End If + Next + End If + If (objLiteral.Visible And objLiteral.Text <> "") Then + objPlaceHolder.Add(objLiteral) + End If + + + Case "PAGES" + Dim drpPages As New DropDownList + Dim pageController As New PageController + Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID) + drpPages.Attributes.Add("onChange", "window.location.href=this.options[this.selectedIndex].value;") + drpPages.CssClass = "Normal" + Dim pageID As Integer = Null.NullInteger + If (IsNumeric(Request("PageID"))) Then + pageID = Convert.ToInt32(Request("PageID")) + End If + For Each objPage As PageInfo In pageList + Dim item As New ListItem + + item.Value = Common.GetModuleLink(ArticleModule.TabID, ArticleModule.ModuleID, "ArticleView", ArticleSettings, "ArticleID=" & objArticle.ArticleID.ToString(), "PageID=" + objPage.PageID.ToString()) + item.Text = objPage.Title + + If (objPage.PageID = pageID) Then + item.Selected = True + End If + drpPages.Items.Add(item) + Next + If (drpPages.Items.Count > 1) Then + objPlaceHolder.Add(drpPages) + End If + + Case "PAGER" + + Dim pageController As New PageController + Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID) + + Dim pageID As Integer = Null.NullInteger + If (IsNumeric(Request("PageID"))) Then + pageID = Convert.ToInt32(Request("PageID")) + End If + + Dim pager As String = "" _ + & "" _ + & "" _ + & "" + + Dim pageNo As Integer = 1 + + Dim y As Integer = 1 + For Each objPage As PageInfo In pageList + If (objPage.PageID = pageID) Then + pageNo = y + Exit For + End If + y = y + 1 + Next + + pager = pager & "" _ + & "" _ + & "" _ + & "" _ + & "
" & GetSharedResource("Page") & " " & pageNo.ToString() & " " & GetSharedResource("Of") & " " & pageList.Count.ToString() & "" + + If (pageList.Count > 1) Then + If (pageNo = 1) Then + pager = pager & "" & GetSharedResource("First") & "  " + Else + pager = pager & "" & GetSharedResource("First") & "  " + End If + Else + pager = pager & "" & GetSharedResource("First") & "  " + End If + + If (pageList.Count > 1) Then + If (pageNo = 1) Then + pager = pager & "" & GetSharedResource("Previous") & "  " + Else + Dim x As Integer = 0 + For Each objPage As PageInfo In pageList + If (objPage.PageID = pageID) Then + pager = pager & "" & GetSharedResource("Previous") & "  " + Exit For + End If + x = x + 1 + Next + End If + Else + pager = pager & "" & GetSharedResource("Previous") & "  " + End If + + Dim i As Integer = 1 + For Each objPage As PageInfo In pageList + If (objPage.PageID = pageID Or (pageID = Null.NullInteger And i = 1)) Then + pager = pager & "" & i.ToString() & "  " + Else + pager = pager & "" & i.ToString() & "  " + End If + i = i + 1 + Next + + If (pageList.Count > 1) Then + If (pageID <> Null.NullInteger) Then + If (CType(pageList(pageList.Count - 1), PageInfo).PageID = pageID) Then + pager = pager & "" & GetSharedResource("Next") & "  " + Else + Dim x As Integer = 0 + For Each objPage As PageInfo In pageList + If (objPage.PageID = pageID) Then + pager = pager & "" & GetSharedResource("Next") & "  " + Exit For + End If + x = x + 1 + Next + End If + Else + pager = pager & "" & GetSharedResource("Next") & "  " + End If + Else + pager = pager & "" & GetSharedResource("Next") & "  " + End If + + If (pageList.Count > 1) Then + If (CType(pageList(pageList.Count - 1), PageInfo).PageID = pageID) Then + pager = pager & "" & GetSharedResource("Last") & "  " + Else + pager = pager & "" & GetSharedResource("Last") & "  " + End If + Else + pager = pager & "" & GetSharedResource("Last") & "  " + End If + + pager = pager & "" _ + & "
" + + Dim objLiteral As New Literal + objLiteral.Text = pager + objPlaceHolder.Add(objLiteral) + + Case "PAGESLIST" + Dim pages As String = "" + Dim pageController As New PageController + Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID) + Dim pageID As Integer = Null.NullInteger + If (IsNumeric(Request("PageID"))) Then + pageID = Convert.ToInt32(Request("PageID")) + End If + + pages = "
    " + For Each objPage As PageInfo In pageList + pages = pages & "
  • " & objPage.Title & "
  • " + Next + pages = pages & "
" + + If (pageList.Count > 1) Then + Dim objLiteral As New Literal + objLiteral.Text = pages + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + End If + + Case "PAGESLIST2" + Dim pages As String = "" + Dim pageController As New PageController + Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID) + Dim pageID As Integer = Null.NullInteger + If (IsNumeric(Request("PageID"))) Then + pageID = Convert.ToInt32(Request("PageID")) + End If + + pages = "
    " + Dim isFirst As Boolean = True + For Each objPage As PageInfo In pageList + If (pageID = objPage.PageID Or (pageID = Null.NullInteger And isFirst)) Then + pages = pages & "
  • " & objPage.Title & "
  • " + Else + pages = pages & "
  • " & objPage.Title & "
  • " + End If + isFirst = False + Next + pages = pages & "
" + + If (pageList.Count > 1) Then + Dim objLiteral As New Literal + objLiteral.Text = pages + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + End If + + Case "PORTALROOT" + Dim objLiteral As New Literal + objLiteral.Text = PortalSettings.HomeDirectory + objPlaceHolder.Add(objLiteral) + + Case "POSTCOMMENT" + If (ArticleSettings.IsCommentsEnabled) Then + Dim objControl As Control = Page.LoadControl("~/DesktopModules/DnnForge - NewsArticles/Controls/PostComment.ascx") + CType(objControl, NewsArticleControlBase).ArticleID = objArticle.ArticleID + objPlaceHolder.Add(objControl) + End If + + Case "POSTRATING" + Dim objControl As Control = Page.LoadControl("~/DesktopModules/DnnForge - NewsArticles/Controls/PostRating.ascx") + objPlaceHolder.Add(objControl) + + Case "PRINT" + Dim objHyperLink As New HyperLink + If (_pageId <> Null.NullInteger) Then + objHyperLink.NavigateUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Print.aspx?tabid=" & ArticleModule.TabID.ToString() & "&tabmoduleid=" & ArticleModule.TabModuleID.ToString() & "&articleId=" & objArticle.ArticleID.ToString() & "&moduleId=" & objArticle.ModuleID.ToString() & "&PortalID=" & PortalSettings.PortalId.ToString() & "&PageID=" & _pageId.ToString()) + Else + objHyperLink.NavigateUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Print.aspx?tabid=" & ArticleModule.TabID.ToString() & "&tabmoduleid=" & ArticleModule.TabModuleID.ToString() & "&articleId=" & objArticle.ArticleID.ToString() & "&moduleId=" & objArticle.ModuleID.ToString() & "&PortalID=" & PortalSettings.PortalId.ToString()) + End If + objHyperLink.ImageUrl = "~/images/print.gif" + objHyperLink.ToolTip = GetArticleResource("ClickPrint") + objHyperLink.EnableViewState = False + objHyperLink.Target = "_blank" + objHyperLink.Attributes.Add("rel", "nofollow") + objPlaceHolder.Add(objHyperLink) + + Case "PRINTLINK" + Dim objLiteral As New Literal + If (_pageId <> Null.NullInteger) Then + objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Print.aspx?tabid=" & ArticleModule.TabID.ToString() & "&tabmoduleid=" & ArticleModule.TabModuleID.ToString() & "&articleId=" & objArticle.ArticleID.ToString() & "&moduleId=" & objArticle.ModuleID.ToString() & "&PortalID=" & PortalSettings.PortalId.ToString() & "&PageID=" & _pageId.ToString()) + Else + objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Print.aspx?tabid=" & ArticleModule.TabID.ToString() & "&tabmoduleid=" & ArticleModule.TabModuleID.ToString() & "&articleId=" & objArticle.ArticleID.ToString() & "&moduleId=" & objArticle.ModuleID.ToString() & "&PortalID=" & PortalSettings.PortalId.ToString()) + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "PUBLISHDATE" + Dim objLiteral As New Literal + If (objArticle.StartDate = Null.NullDate) Then + objLiteral.Text = objArticle.CreatedDate.ToString("D") + Else + objLiteral.Text = objArticle.StartDate.ToString("D") + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "PUBLISHSTARTDATE" + Dim objLiteral As New Literal + If (objArticle.StartDate = Null.NullDate) Then + objLiteral.Text = objArticle.CreatedDate.ToString("D") + Else + objLiteral.Text = objArticle.StartDate.ToString("D") + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "PUBLISHTIME" + Dim objLiteral As New Literal + If (objArticle.StartDate = Null.NullDate) Then + objLiteral.Text = objArticle.CreatedDate.ToString("t") + Else + objLiteral.Text = objArticle.StartDate.ToString("t") + End If + objLiteral.EnableViewState = False + + Case "PUBLISHSTARTTIME" + Dim objLiteral As New Literal + If (objArticle.StartDate = Null.NullDate) Then + objLiteral.Text = objArticle.CreatedDate.ToString("t") + Else + objLiteral.Text = objArticle.StartDate.ToString("t") + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "PUBLISHENDDATE" + Dim objLiteral As New Literal + If (objArticle.EndDate = Null.NullDate) Then + objLiteral.Text = "" + Else + objLiteral.Text = objArticle.EndDate.ToString("D") + End If + objPlaceHolder.Add(objLiteral) + + Case "PUBLISHENDTIME" + Dim objLiteral As New Literal + If (objArticle.EndDate = Null.NullDate) Then + objLiteral.Text = "" + Else + objLiteral.Text = objArticle.EndDate.ToString("t") + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "RATING" + Dim objImage As New Image + objImage.ImageUrl = GetRatingImage(objArticle) + objImage.EnableViewState = False + objImage.ToolTip = "Article Rating" + objImage.AlternateText = "Article Rating" + objPlaceHolder.Add(objImage) + + Case "RATINGCOUNT" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.RatingCount.ToString() + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "RATINGDETAIL" + If (objArticle.Rating <> Null.NullDouble) Then + Dim objLiteral As New Literal + objLiteral.Text = objArticle.Rating.ToString("R1") + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + End If + + Case "RELATED" + If (ArticleSettings.RelatedMode <> RelatedType.None) Then + Dim phRelated As New PlaceHolder + + Dim objArticles As List(Of ArticleInfo) = GetRelatedArticles(objArticle, 5) + + If (objArticles.Count > 0) Then + Dim _objLayoutRelatedHeader As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Related_Header_Html) + Dim _objLayoutRelatedItem As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Related_Item_Html) + Dim _objLayoutRelatedFooter As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Related_Footer_Html) + + ProcessArticleItem(phRelated.Controls, _objLayoutRelatedHeader.Tokens, objArticle) + For Each objRelatedArticle As ArticleInfo In objArticles + ProcessArticleItem(phRelated.Controls, _objLayoutRelatedItem.Tokens, objRelatedArticle) + Next + ProcessArticleItem(phRelated.Controls, _objLayoutRelatedFooter.Tokens, objArticle) + + objPlaceHolder.Add(phRelated) + End If + End If + + Case "SITEROOT" + Dim objLiteral As New Literal + objLiteral.Text = ArticleUtilities.ResolveUrl("~/") + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "SITETITLE" + Dim objLiteral As New Literal + objLiteral.Text = PortalSettings.PortalName + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "SHORTLINK" + If (objArticle.ShortUrl <> "") Then + Dim objLiteral As New Literal + objLiteral.Text = objArticle.ShortUrl + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Else + If (ArticleSettings.TwitterBitLyAPIKey <> "" And ArticleSettings.TwitterBitLyLogin <> "") Then + Dim link As String = Common.GetArticleLink(objArticle, Tab, ArticleSettings, False) + Dim b As New bitly(ArticleSettings.TwitterBitLyLogin, ArticleSettings.TwitterBitLyAPIKey) + Dim shortUrl As String = b.Shorten(link) + + If (shortUrl <> "") Then + Dim objLiteral As New Literal + objLiteral.Text = shortUrl + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + objArticle.ShortUrl = shortUrl + Dim objArticleController As New ArticleController() + objArticleController.UpdateArticle(objArticle) + End If + End If + End If + + Case "SUMMARY" + Dim objLiteral As New Literal + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Summary), objArticle, Generator, ArticleSettings) + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "TABID" + Dim objLiteral As New Literal + objLiteral.Text = ArticleModule.TabID.ToString() + objPlaceHolder.Add(objLiteral) + + Case "TABTITLE" + Dim objLiteral As New Literal + If (PortalSettings.ActiveTab.Title.Length = 0) Then + objLiteral.Text = PortalSettings.ActiveTab.TabName + Else + objLiteral.Text = PortalSettings.ActiveTab.Title + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "TAGS" + If (objArticle.Tags.Trim() <> "") Then + Dim objLiteral As New Literal + For Each tag As String In objArticle.Tags.Split(","c) + If (objLiteral.Text = "") Then + objLiteral.Text = "" + tag + "" + Else + objLiteral.Text = objLiteral.Text + ", " + "" + tag + "" + End If + Next + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + End If + + Case "TAGSNOLINK" + If (objArticle.Tags.Trim() <> "") Then + Dim objLiteral As New Literal + For Each tag As String In objArticle.Tags.Split(","c) + If (objLiteral.Text = "") Then + objLiteral.Text = tag + Else + objLiteral.Text = objLiteral.Text + ", " + tag + End If + Next + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + End If + + Case "TEMPLATEPATH" + Dim objLiteral As New Literal + objLiteral.Text = ArticleUtilities.ResolveUrl("~/DnnForge - NewsArticles/Templates/" & ArticleSettings.Template & "/") + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "TITLE" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.Title + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "TITLESAFEJS" + If (objArticle.Title <> "") Then + Dim objLiteral As New Literal + objLiteral.Text = objArticle.Title.Replace("""", "") + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + End If + + Case "TITLEURLENCODED" + Dim objLiteral As New Literal + objLiteral.Text = Server.UrlEncode(objArticle.Title) + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "TWITTERNAME" + Dim objLiteral As New Literal + objLiteral.Text = ArticleSettings.TwitterName + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "UPDATEDATE" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.LastUpdate.ToString("D") + objPlaceHolder.Add(objLiteral) + + Case "UPDATETIME" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.LastUpdate.ToString("t") + objPlaceHolder.Add(objLiteral) + + Case "VIEWCOUNT" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.NumberOfViews.ToString() + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case Else + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("AUTHOR:")) Then + If Author(objArticle.AuthorID) IsNot Nothing Then + ' token to be processed + Dim field As String = layoutArray(iPtr + 1).Substring(7, layoutArray(iPtr + 1).Length - 7).ToLower().Trim() + + 'Gets the DNN profile property named like the token (field) + Dim profilePropertyFound As Boolean = False + Dim profilePropertyDataType As String = String.Empty + Dim profilePropertyName As String = String.Empty + Dim profilePropertyValue As String = String.Empty + + For Each objProfilePropertyDefinition As ProfilePropertyDefinition In ProfileProperties + If (objProfilePropertyDefinition.PropertyName.ToLower().Trim() = field) Then + + 'Gets the dnn profile property's datatype + Dim objListController As New ListController + Dim definitionEntry As ListEntryInfo = objListController.GetListEntryInfo(objProfilePropertyDefinition.DataType) + If Not definitionEntry Is Nothing Then + profilePropertyDataType = definitionEntry.Value + Else + profilePropertyDataType = "Unknown" + End If + + 'Gets the dnn profile property's name and current value for the given user (Agent = AuthorID) + profilePropertyName = objProfilePropertyDefinition.PropertyName + profilePropertyValue = Author(objArticle.AuthorID).Profile.GetPropertyValue(profilePropertyName) + + profilePropertyFound = True + + End If + Next + + If profilePropertyFound Then + + Select Case profilePropertyDataType.ToLower() + Case "truefalse" + Dim objTrueFalse As New CheckBox + If profilePropertyValue = String.Empty Then + objTrueFalse.Checked = False + Else + objTrueFalse.Checked = CType(profilePropertyValue, Boolean) + End If + objTrueFalse.Enabled = False + objTrueFalse.EnableViewState = False + objPlaceHolder.Add(objTrueFalse) + + Case "richtext" + Dim objLiteral As New Literal + If profilePropertyValue = String.Empty Then + objLiteral.Text = String.Empty + Else + objLiteral.Text = Server.HtmlDecode(profilePropertyValue) + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "list" + Dim objLiteral As New Literal + objLiteral.Text = profilePropertyValue + Dim objListController As New ListController + Dim objListEntryInfoCollection As ListEntryInfoCollection = objListController.GetListEntryInfoCollection(profilePropertyName) + For Each objListEntryInfo As ListEntryInfo In objListEntryInfoCollection + If objListEntryInfo.Value = profilePropertyValue Then + objLiteral.Text = objListEntryInfo.Text + Exit For + End If + Next + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case Else + Dim objLiteral As New Literal + If profilePropertyValue = String.Empty Then + objLiteral.Text = String.Empty + Else + If profilePropertyName.ToLower() = "website" Then + Dim url As String = profilePropertyValue + If url.ToLower.StartsWith("http://") Then + url = url.Substring(7) ' removes the "http://" + End If + objLiteral.Text = url + Else + objLiteral.Text = profilePropertyValue + End If + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + End Select 'profilePropertyDataType + + End If ' DNN Profile property processing + End If + Exit Select + End If ' "AUTHOR:" token + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("CAPTION:")) Then + + Dim objCustomFieldController As New CustomFieldController + Dim objCustomFields As ArrayList = objCustomFieldController.List(objArticle.ModuleID) + + Dim field As String = layoutArray(iPtr + 1).Substring(8, layoutArray(iPtr + 1).Length - 8) + + Dim i As Integer = 0 + For Each objCustomField As CustomFieldInfo In objCustomFields + If (objCustomField.Name.ToLower() = field.ToLower()) Then + If (objArticle.CustomList.Contains(objCustomField.CustomFieldID)) Then + Dim objLiteral As New Literal + objLiteral.Text = objCustomField.Caption + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + i = i + 1 + End If + End If + Next + + Exit Select + + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("CATEGORIESSUB:")) Then + Dim values As String = layoutArray(iPtr + 1).Substring(14, layoutArray(iPtr + 1).Length - 14) + + Dim splitValues As String() = values.Split(":"c) + + If (splitValues.Length = 2) Then + + Dim category As String = splitValues(0) + Dim number As String = splitValues(1) + + If (IsNumeric(number)) Then + If (Convert.ToInt32(number) > 0) Then + + ' Find category + + Dim objCategoryController As New CategoryController + Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(ArticleModule.ModuleID, Null.NullInteger) + + Dim categoryID As Integer = Null.NullInteger + For Each objCategory As CategoryInfo In objCategories + + If (objCategory.Name.ToLower() = category.ToLower()) Then + categoryID = objCategory.CategoryID + Exit For + End If + + Next + + If (categoryID <> Null.NullInteger) Then + + Dim objCategoriesSelected As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(ArticleModule.ModuleID, categoryID, Nothing, Null.NullInteger, Convert.ToInt32(number), False, CategorySortType.Name) + + Dim objArticleCategories As ArrayList = CType(DataCache.GetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString()), ArrayList) + If (objArticleCategories Is Nothing) Then + Dim objArticleController As New ArticleController + objArticleCategories = objArticleController.GetArticleCategories(objArticle.ArticleID) + DataCache.SetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString(), objArticleCategories) + End If + + + Dim objLiteral As New Literal + For Each objCategory As CategoryInfo In objArticleCategories + + For Each objCategorySel As CategoryInfo In objCategoriesSelected + If (objCategory.CategoryID = objCategorySel.CategoryID) Then + If (objLiteral.Text <> "") Then + objLiteral.Text = objLiteral.Text & ", " & objCategory.Name & "" + Else + objLiteral.Text = " " & objCategory.Name & "" + End If + End If + Next + + Next + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Exit Select + + End If + End If + + End If + + End If + + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("CREATEDATE:")) Then + Dim formatExpression As String = layoutArray(iPtr + 1).Substring(11, layoutArray(iPtr + 1).Length - 11) + + Dim objLiteral As New Literal + + Try + If (objArticle.CreatedDate = Null.NullDate) Then + objLiteral.Text = "" + Else + objLiteral.Text = objArticle.CreatedDate.ToString(formatExpression) + End If + Catch + If (objArticle.CreatedDate = Null.NullDate) Then + objLiteral.Text = "" + Else + objLiteral.Text = objArticle.CreatedDate.ToString("D") + End If + End Try + + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("CREATEDATELESSTHAN:")) Then + Dim length As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(19, layoutArray(iPtr + 1).Length - 19)) + + If (objArticle.CreatedDate < DateTime.Now.AddDays(length * -1)) Then + Dim endVal As String = layoutArray(iPtr + 1).ToUpper() + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = ("/" & endVal)) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/CREATEDATELESSTHAN:")) Then + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("CUSTOM:")) Then + Dim field As String = layoutArray(iPtr + 1).Substring(7, layoutArray(iPtr + 1).Length - 7).ToLower() + + Dim customFieldID As Integer = Null.NullInteger + Dim objCustomFieldSelected As New CustomFieldInfo + Dim isLink As Boolean = False + + Dim objCustomFieldController As New CustomFieldController + Dim objCustomFields As ArrayList = objCustomFieldController.List(objArticle.ModuleID) + + Dim maxLength As Integer = Null.NullInteger + If (field.IndexOf(":"c) <> -1) Then + Try + maxLength = Convert.ToInt32(field.Split(":"c)(1)) + Catch + maxLength = Null.NullInteger + End Try + field = field.Split(":"c)(0) + End If + If (customFieldID = Null.NullInteger) Then + For Each objCustomField As CustomFieldInfo In objCustomFields + If (objCustomField.Name.ToLower() = field.ToLower()) Then + customFieldID = objCustomField.CustomFieldID + objCustomFieldSelected = objCustomField + End If + Next + End If + + If (customFieldID <> Null.NullInteger) Then + + Dim i As Integer = 0 + If (objArticle.CustomList.Contains(customFieldID)) Then + Dim objLiteral As New Literal + Dim fieldValue As String = GetFieldValue(objCustomFieldSelected, objArticle, False) + If (maxLength <> Null.NullInteger) Then + If (fieldValue.Length > maxLength) Then + fieldValue = fieldValue.Substring(0, maxLength) + End If + End If + objLiteral.Text = fieldValue.TrimStart("#"c) + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + i = i + 1 + End If + End If + Exit Select + End If + + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("DETAILS:")) Then + Dim length As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(8, layoutArray(iPtr + 1).Length - 8)) + + Dim objLiteral As New Literal + If (StripHtml(Server.HtmlDecode(objArticle.Body)).TrimStart().Length > length) Then + objLiteral.Text = ProcessPostTokens(Left(StripHtml(Server.HtmlDecode(objArticle.Body)).TrimStart(), length), objArticle, Generator, ArticleSettings) & "..." + Else + objLiteral.Text = ProcessPostTokens(Left(StripHtml(Server.HtmlDecode(objArticle.Body)).TrimStart(), length), objArticle, Generator, ArticleSettings) + End If + + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("EXPRESSION:")) Then + + Dim objCustomFieldController As New CustomFieldController + Dim objCustomFields As ArrayList = objCustomFieldController.List(objArticle.ModuleID) + + Dim field As String = layoutArray(iPtr + 1).Substring(11, layoutArray(iPtr + 1).Length - 11) + + Dim params As String() = field.Split(":"c) + + If (params.Length <> 3) Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + Exit Select + End If + + Dim customField As String = params(0) + Dim customExpression As String = params(1) + Dim customValue As String = params(2) + + Dim fieldValue As String = "" + + For Each objCustomField As CustomFieldInfo In objCustomFields + If (objCustomField.Name.ToLower() = customField.ToLower()) Then + If (objArticle.CustomList.Contains(objCustomField.CustomFieldID)) Then + fieldValue = GetFieldValue(objCustomField, objArticle, False) + End If + End If + Next + + Dim isValid As Boolean = False + Select Case customExpression + Case "=" + If (customValue.ToLower() = fieldValue.ToLower()) Then + isValid = True + End If + Exit Select + + Case "!=" + If (customValue.ToLower() <> fieldValue.ToLower()) Then + isValid = True + End If + Exit Select + + Case "<" + If (IsNumeric(customValue) AndAlso IsNumeric(fieldValue)) Then + If (Convert.ToInt32(fieldValue) < Convert.ToInt32(customValue)) Then + isValid = True + End If + End If + Exit Select + + Case "<=" + If (IsNumeric(customValue) AndAlso IsNumeric(fieldValue)) Then + If (Convert.ToInt32(fieldValue) <= Convert.ToInt32(customValue)) Then + isValid = True + End If + End If + Exit Select + + Case ">" + If (IsNumeric(customValue) AndAlso IsNumeric(fieldValue)) Then + If (Convert.ToInt32(fieldValue) > Convert.ToInt32(customValue)) Then + isValid = True + End If + End If + Exit Select + + Case ">=" + If (IsNumeric(customValue) AndAlso IsNumeric(fieldValue)) Then + If (Convert.ToInt32(fieldValue) >= Convert.ToInt32(customValue)) Then + isValid = True + End If + End If + Exit Select + + End Select + + If (isValid = False) Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Exit Select + + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/EXPRESSION:")) Then + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("HASIMAGES:")) Then + + Dim field As String = layoutArray(iPtr + 1).Substring(10, layoutArray(iPtr + 1).Length - 10) + + If (IsNumeric(field)) Then + + If (objArticle.ImageCount < Convert.ToInt32(field)) Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + End If + + Exit Select + + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/HASIMAGES:")) Then + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("HASMOREDETAIL:")) Then + Dim length As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(14, layoutArray(iPtr + 1).Length - 14)) + Dim endToken As String = "/" & layoutArray(iPtr + 1) + + If (objArticle.Url = Null.NullString() And StripHtml(objArticle.Summary.Trim()) = "" And StripHtml(Server.HtmlDecode(objArticle.Body)).TrimStart().Length <= length) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/HASMOREDETAIL:")) Then + ' Do Nothing + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("HASNOVALUE:")) Then + + Dim objCustomFieldController As New CustomFieldController + Dim objCustomFields As ArrayList = objCustomFieldController.List(objArticle.ModuleID) + + Dim field As String = layoutArray(iPtr + 1).Substring(11, layoutArray(iPtr + 1).Length - 11) + + For Each objCustomField As CustomFieldInfo In objCustomFields + If (objCustomField.Name.ToLower() = field.ToLower()) Then + If (objArticle.CustomList.Contains(objCustomField.CustomFieldID)) Then + Dim fieldValue As String = GetFieldValue(objCustomField, objArticle, False) + If (fieldValue.Trim() <> "") Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + End If + Next + + Exit Select + + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/HASNOVALUE:")) Then + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("HASVALUE:")) Then + + Dim objCustomFieldController As New CustomFieldController + Dim objCustomFields As ArrayList = objCustomFieldController.List(objArticle.ModuleID) + + Dim field As String = layoutArray(iPtr + 1).Substring(9, layoutArray(iPtr + 1).Length - 9) + + For Each objCustomField As CustomFieldInfo In objCustomFields + If (objCustomField.Name.ToLower() = field.ToLower()) Then + If (objArticle.CustomList.Contains(objCustomField.CustomFieldID)) Then + Dim fieldValue As String = GetFieldValue(objCustomField, objArticle, False) + If (fieldValue.Trim() = "") Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + End If + Next + + Exit Select + + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/HASVALUE:")) Then + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("HASAUTHORVALUE:")) Then + + Dim field As String = layoutArray(iPtr + 1).Substring(15, layoutArray(iPtr + 1).Length - 15).ToLower().Trim() + + 'Gets the DNN profile property named like the token (field) + Dim profilePropertyName As String = String.Empty + Dim profilePropertyValue As String = String.Empty + + For Each objProfilePropertyDefinition As ProfilePropertyDefinition In ProfileProperties + If (objProfilePropertyDefinition.PropertyName.ToLower().Trim() = field) Then + + 'Gets the dnn profile property's datatype + Dim objListController As New ListController + Dim definitionEntry As ListEntryInfo = objListController.GetListEntryInfo(objProfilePropertyDefinition.DataType) + If Not definitionEntry Is Nothing Then + Else + End If + + 'Gets the dnn profile property's name and current value for the given user (Agent = AuthorID) + profilePropertyName = objProfilePropertyDefinition.PropertyName + If (Author(objArticle.AuthorID) IsNot Nothing) Then + profilePropertyValue = Author(objArticle.AuthorID).Profile.GetPropertyValue(profilePropertyName) + Exit For + End If + + End If + Next + + If (profilePropertyValue = "") Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Exit Select + + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/HASAUTHORVALUE:")) Then + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("IMAGE:")) Then + If (objArticle.ImageCount > 0) Then + Dim val As String = layoutArray(iPtr + 1).Substring(6, layoutArray(iPtr + 1).Length - 6) + + If (IsNumeric(val)) Then + Dim objImageController As New ImageController + Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString()) + + If (objImages.Count > 0) Then + Dim count As Integer = 1 + For Each objChildImage As ImageInfo In objImages + If (count = Convert.ToInt32(val)) Then + Dim objImage As New Image + objImage.ImageUrl = PortalSettings.HomeDirectory & objChildImage.Folder & objChildImage.FileName + objImage.EnableViewState = False + objImage.AlternateText = objArticle.Title + objPlaceHolder.Add(objImage) + End If + count = count + 1 + Next + End If + End If + End If + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("IMAGETHUMB:")) Then + + If (objArticle.ImageUrl <> "") Then + Dim objImage As New Image + objImage.ImageUrl = objArticle.ImageUrl + objImage.EnableViewState = False + objImage.AlternateText = objArticle.Title + objPlaceHolder.Add(objImage) + Else + If (objArticle.ImageCount > 0) Then + + Dim objImageController As New ImageController + Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString) + If (objImages.Count > 0) Then + + Dim val As String = layoutArray(iPtr + 1).Substring(11, layoutArray(iPtr + 1).Length - 11) + If (val.IndexOf(":"c) = -1) Then + Dim length As Integer = Convert.ToInt32(val) + + Dim objImage As New Image + If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then + objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1") + Else + objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1") + End If + objImage.EnableViewState = False + objImage.AlternateText = objArticle.Title + objPlaceHolder.Add(objImage) + Else + + Dim arr() As String = val.Split(":"c) + + If (arr.Length = 2) Then + Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0)) + Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1)) + + Dim objImage As New Image + If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then + objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1") + Else + objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1") + End If + objImage.EnableViewState = False + objImage.AlternateText = objArticle.Title + objPlaceHolder.Add(objImage) + Else + If (arr.Length = 3) Then + Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0)) + Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1)) + Dim item As Integer = Convert.ToInt32(val.Split(":"c)(2)) + + If (objImages.Count > 0) Then + Dim count As Integer = 1 + For Each objChildImage As ImageInfo In objImages + If (count = item) Then + Dim objImage As New Image + If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then + objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objChildImage.Folder & objChildImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1") + Else + objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objChildImage.Folder & objChildImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1") + End If + objImage.EnableViewState = False + objImage.AlternateText = objArticle.Title + objPlaceHolder.Add(objImage) + End If + count = count + 1 + Next + End If + + End If + End If + End If + + End If + + End If + End If + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("IMAGETHUMBLINK:")) Then + + If (objArticle.ImageUrl <> "") Then + Dim objImage As New Image + objImage.ImageUrl = objArticle.ImageUrl + objImage.EnableViewState = False + objImage.AlternateText = objArticle.Title + objPlaceHolder.Add(objImage) + Else + If (objArticle.ImageCount > 0) Then + + Dim objImageController As New ImageController + Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString) + + If (objImages.Count > 0) Then + + Dim val As String = layoutArray(iPtr + 1).Substring(15, layoutArray(iPtr + 1).Length - 15) + If (val.IndexOf(":"c) = -1) Then + Dim length As Integer = Convert.ToInt32(val) + + Dim objLiteral As New Literal + If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then + objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1") + Else + objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1") + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Else + Dim arr() As String = val.Split(":"c) + + If (arr.Length = 2) Then + Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0)) + Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1)) + + Dim objLiteral As New Literal + If (objArticle.ImageUrl.ToLower().StartsWith("http://") Or objArticle.ImageUrl.ToLower().StartsWith("https://")) Then + objLiteral.Text = objArticle.ImageUrl + Else + If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then + objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1") + Else + objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1") + End If + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Else + If (arr.Length = 3) Then + Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0)) + Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1)) + Dim item As Integer = Convert.ToInt32(val.Split(":"c)(2)) + + If (objImages.Count > 0) Then + Dim count As Integer = 1 + For Each objChildImage As ImageInfo In objImages + If (count = item) Then + Dim objLiteral As New Literal + If (objArticle.ImageUrl.ToLower().StartsWith("http://") Or objArticle.ImageUrl.ToLower().StartsWith("https://")) Then + objLiteral.Text = objArticle.ImageUrl + Else + If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then + objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objChildImage.Folder & objChildImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1") + Else + objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objChildImage.Folder & objChildImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1") + End If + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + End If + count = count + 1 + Next + End If + + End If + End If + + End If + End If + End If + End If + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("IMAGETHUMBRANDOM:")) Then + + If (objArticle.ImageCount > 0) Then + + Dim objImageController As New ImageController + Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString) + If (objImages.Count > 0) Then + + Dim randomImage As ImageInfo = objImages(Generator.Next(0, objImages.Count - 1)) + + Dim val As String = layoutArray(iPtr + 1).Substring(17, layoutArray(iPtr + 1).Length - 17) + If (val.IndexOf(":"c) = -1) Then + Dim length As Integer = Convert.ToInt32(val) + + Dim objImage As New Image + If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then + objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(randomImage.Folder & randomImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1") + Else + objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(randomImage.Folder & randomImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1") + End If + objImage.EnableViewState = False + objImage.AlternateText = objArticle.Title + objPlaceHolder.Add(objImage) + Else + + Dim arr() As String = val.Split(":"c) + + If (arr.Length = 2) Then + Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0)) + Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1)) + + Dim objImage As New Image + If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then + objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(randomImage.Folder & randomImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1") + Else + objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(randomImage.Folder & randomImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1") + End If + objImage.EnableViewState = False + objImage.AlternateText = objArticle.Title + objPlaceHolder.Add(objImage) + End If + End If + + End If + + End If + Exit Select + End If + + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("ISINROLE:")) Then + Dim field As String = layoutArray(iPtr + 1).Substring(9, layoutArray(iPtr + 1).Length - 9) + If (PortalSecurity.IsInRole(field) = False) Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/ISINROLE:")) Then + ' Do Nothing + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("ISITEMINDEX:")) Then + Dim field As String = layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12) + Try + If (Convert.ToInt32(field) <> articleItemIndex) Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Catch + End Try + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/ISITEMINDEX:")) Then + ' Do Nothing + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("ISPAGE:")) Then + Dim page As String = layoutArray(iPtr + 1).Substring(7, layoutArray(iPtr + 1).Length - 7) + If (IsNumeric(page)) Then + If (Convert.ToInt32(page) = 1) Then + If (Request("PageID") <> "") Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Else + Dim objPageController As New PageController() + Dim objPages As ArrayList = objPageController.GetPageList(objArticle.ArticleID) + + Dim found As Boolean = False + If (Request("PageID") <> "") Then + Dim pageNumber As Integer = 1 + For Each objPage As PageInfo In objPages + If (Convert.ToInt32(page) = pageNumber) Then + If (Request("PageID") = objPage.PageID.ToString()) Then + found = True + End If + Exit For + End If + pageNumber = pageNumber + 1 + Next + End If + + If (found = False) Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + End If + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/ISPAGE:")) Then + ' Do Nothing + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("ISNOTPAGE:")) Then + Dim page As String = layoutArray(iPtr + 1).Substring(10, layoutArray(iPtr + 1).Length - 10) + If (IsNumeric(page)) Then + If (Convert.ToInt32(page) = 1) Then + If (Request("PageID") = "") Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Else + Dim objPageController As New PageController() + Dim objPages As ArrayList = objPageController.GetPageList(objArticle.ArticleID) + + Dim found As Boolean = False + If (Request("PageID") <> "") Then + Dim pageNumber As Integer = 1 + For Each objPage As PageInfo In objPages + If (Convert.ToInt32(page) = pageNumber) Then + If (Request("PageID") = objPage.PageID.ToString()) Then + found = True + End If + Exit For + End If + pageNumber = pageNumber + 1 + Next + End If + + If (found = True) Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + End If + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/ISNOTPAGE:")) Then + ' Do Nothing + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("HASCATEGORY:")) Then + Dim category As String = layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12) + + Dim objArticleCategories As ArrayList = CType(DataCache.GetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString()), ArrayList) + If (objArticleCategories Is Nothing) Then + Dim objArticleController As New ArticleController + objArticleCategories = objArticleController.GetArticleCategories(objArticle.ArticleID) + DataCache.SetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString(), objArticleCategories) + End If + + Dim found As Boolean = False + If (category <> "") Then + For Each objCategory As CategoryInfo In objArticleCategories + If (category.ToLower() = objCategory.Name.ToLower()) Then + found = True + End If + Next + End If + + If (found = False) Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/HASCATEGORY:")) Then + ' Do Nothing + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("HASTAG:")) Then + + Dim tagSelected As String = layoutArray(iPtr + 1).Substring(7, layoutArray(iPtr + 1).Length - 7) + + Dim found As Boolean = False + If (objArticle.Tags.Trim() <> "") Then + For Each tag As String In objArticle.Tags.Split(","c) + If (tag.ToLower() = tagSelected.ToLower()) Then + found = True + End If + Next + End If + + If (found = False) Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/HASTAG:")) Then + ' Do Nothing + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("ISLOCALE:")) Then + Dim field As String = layoutArray(iPtr + 1).Substring(9, layoutArray(iPtr + 1).Length - 9) + + If (CType(Page, DotNetNuke.Framework.PageBase).PageCulture.Name.ToLower() <> field.ToLower()) Then + Dim endToken As String = "/" & layoutArray(iPtr + 1) + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/ISLOCALE:")) Then + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("PAGE:")) Then + If (IsNumeric(layoutArray(iPtr + 1).Substring(5, layoutArray(iPtr + 1).Length - 5))) Then + Dim pageNumber As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(5, layoutArray(iPtr + 1).Length - 5)) + + Dim objLiteral As New Literal + If (pageNumber > 0) Then + Dim pageController As New PageController + Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID) + + If (pageList.Count >= pageNumber) Then + objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(CType(pageList(pageNumber - 1), PageInfo).PageText), objArticle, Generator, ArticleSettings) + End If + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Exit Select + End If + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("PUBLISHENDDATE:")) Then + Dim formatExpression As String = layoutArray(iPtr + 1).Substring(15, layoutArray(iPtr + 1).Length - 15) + + Dim objLiteral As New Literal + + Try + If (objArticle.EndDate = Null.NullDate) Then + objLiteral.Text = "" + Else + objLiteral.Text = objArticle.EndDate.ToString(formatExpression) + End If + Catch + If (objArticle.EndDate = Null.NullDate) Then + objLiteral.Text = "" + Else + objLiteral.Text = objArticle.EndDate.ToString("D") + End If + End Try + + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("PUBLISHDATE:")) Then + Dim formatExpression As String = layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12) + + Dim objLiteral As New Literal + + Try + If (objArticle.StartDate = Null.NullDate) Then + objLiteral.Text = objArticle.CreatedDate.ToString(formatExpression) + Else + objLiteral.Text = objArticle.StartDate.ToString(formatExpression) + End If + Catch + If (objArticle.StartDate = Null.NullDate) Then + objLiteral.Text = objArticle.CreatedDate.ToString("D") + Else + objLiteral.Text = objArticle.StartDate.ToString("D") + End If + End Try + + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("PUBLISHSTARTDATE:")) Then + Dim formatExpression As String = layoutArray(iPtr + 1).Substring(17, layoutArray(iPtr + 1).Length - 17) + + Dim objLiteral As New Literal + + Try + If (objArticle.StartDate = Null.NullDate) Then + objLiteral.Text = objArticle.CreatedDate.ToString(formatExpression) + Else + objLiteral.Text = objArticle.StartDate.ToString(formatExpression) + End If + Catch + If (objArticle.StartDate = Null.NullDate) Then + objLiteral.Text = objArticle.CreatedDate.ToString("D") + Else + objLiteral.Text = objArticle.StartDate.ToString("D") + End If + End Try + + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("QUERYSTRING:")) Then + Dim variable As String = layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12) + + Dim objLiteral As New Literal + objLiteral.Text = Request.QueryString(variable) + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("RELATED:")) Then + _objRelatedArticles = Nothing + If (IsNumeric(layoutArray(iPtr + 1).Substring(8, layoutArray(iPtr + 1).Length - 8))) Then + Dim count As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(8, layoutArray(iPtr + 1).Length - 8)) + If (count > 0) Then + If (ArticleSettings.RelatedMode <> RelatedType.None) Then + Dim phRelated As New PlaceHolder + Dim objArticles As List(Of ArticleInfo) = GetRelatedArticles(objArticle, count) + If (objArticles.Count > 0) Then + Dim _objLayoutRelatedHeader As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Related_Header_Html) + Dim _objLayoutRelatedItem As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Related_Item_Html) + Dim _objLayoutRelatedFooter As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Related_Footer_Html) + + ProcessArticleItem(phRelated.Controls, _objLayoutRelatedHeader.Tokens, objArticle) + For Each objRelatedArticle As ArticleInfo In objArticles + ProcessArticleItem(phRelated.Controls, _objLayoutRelatedItem.Tokens, objRelatedArticle) + Next + ProcessArticleItem(phRelated.Controls, _objLayoutRelatedFooter.Tokens, objArticle) + + objPlaceHolder.Add(phRelated) + End If + End If + End If + End If + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("SUMMARY:")) Then + Dim summary As String = objArticle.Summary + If (IsNumeric(layoutArray(iPtr + 1).Substring(8, layoutArray(iPtr + 1).Length - 8))) Then + Dim length As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(8, layoutArray(iPtr + 1).Length - 8)) + If (StripHtml(Server.HtmlDecode(objArticle.Summary)).TrimStart().Length > length) Then + summary = ProcessPostTokens(Left(StripHtml(Server.HtmlDecode(objArticle.Summary)).TrimStart(), length), objArticle, Generator, ArticleSettings) & "..." + Else + summary = ProcessPostTokens(Left(StripHtml(Server.HtmlDecode(objArticle.Summary)).TrimStart(), length), objArticle, Generator, ArticleSettings) + End If + End If + + Dim objLiteral As New Literal + objLiteral.Text = summary + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("TITLE:")) Then + Dim title As String = objArticle.Title + If (IsNumeric(layoutArray(iPtr + 1).Substring(6, layoutArray(iPtr + 1).Length - 6))) Then + Dim length As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(6, layoutArray(iPtr + 1).Length - 6)) + If (objArticle.Title.Length > length) Then + title = Left(objArticle.Title, length) & "..." + Else + title = Left(objArticle.Title, length) + End If + End If + + Dim objLiteral As New Literal + objLiteral.Text = title + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("UPDATEDATE:")) Then + Dim formatExpression As String = layoutArray(iPtr + 1).Substring(11, layoutArray(iPtr + 1).Length - 11) + + Dim objLiteral As New Literal + + Try + If (objArticle.CreatedDate = Null.NullDate) Then + objLiteral.Text = "" + Else + objLiteral.Text = objArticle.LastUpdate.ToString(formatExpression) + End If + Catch + If (objArticle.CreatedDate = Null.NullDate) Then + objLiteral.Text = "" + Else + objLiteral.Text = objArticle.LastUpdate.ToString("D") + End If + End Try + + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("UPDATEDATELESSTHAN:")) Then + Dim length As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(19, layoutArray(iPtr + 1).Length - 19)) + + If (objArticle.LastUpdate < DateTime.Now.AddDays(length * -1)) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/UPDATEDATELESSTHAN") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Exit Select + End If + + If (layoutArray(iPtr + 1).ToUpper().StartsWith("/UPDATEDATELESSTHAN:")) Then + Exit Select + End If + + Dim objLiteralOther As New Literal + objLiteralOther.Text = "[" & layoutArray(iPtr + 1) & "]" + objLiteralOther.EnableViewState = False + objPlaceHolder.Add(objLiteralOther) + + End Select + End If + + Next + + End Sub + +#End Region + +#Region " Process Comment Item " + + Dim commentItemIndex As Integer = 0 + Public Sub ProcessComment(ByRef objPlaceHolder As ControlCollection, ByVal objArticle As ArticleInfo, ByVal objComment As CommentInfo, ByVal templateArray As String()) + + commentItemIndex = commentItemIndex + 1 + Dim isAnonymous As Boolean = Null.IsNull(objComment.UserID) + + For iPtr As Integer = 0 To templateArray.Length - 1 Step 2 + + objPlaceHolder.Add(New LiteralControl(ProcessImages(templateArray(iPtr).ToString()))) + + If iPtr < templateArray.Length - 1 Then + Select Case templateArray(iPtr + 1) + Case "ANONYMOUSURL" + Dim objLiteral As New Literal + objLiteral.Text = AddHTTP(objComment.AnonymousURL) + objPlaceHolder.Add(objLiteral) + Case "ARTICLETITLE" + Dim objLiteral As New Literal + objLiteral.Text = objArticle.Title + objPlaceHolder.Add(objLiteral) + Case "AUTHOREMAIL" + Dim objLiteral As New Literal + If (objComment.UserID = Null.NullInteger) Then + objLiteral.Text = objComment.AnonymousEmail.ToString() + Else + objLiteral.Text = objComment.AuthorEmail.ToString() + End If + objPlaceHolder.Add(objLiteral) + Case "AUTHOR" + Dim objLiteral As New Literal + Select Case ArticleSettings.DisplayMode + Case DisplayType.FirstName + If (isAnonymous) Then + If (objComment.AnonymousName <> "") Then + objLiteral.Text = objComment.AnonymousName + Else + objLiteral.Text = GetArticleResource("AnonymousFirstName") + End If + Else + objLiteral.Text = objComment.AuthorFirstName + End If + Exit Select + Case DisplayType.LastName + If (isAnonymous) Then + If (objComment.AnonymousName <> "") Then + objLiteral.Text = objComment.AnonymousName + Else + objLiteral.Text = GetArticleResource("AnonymousLastName") + End If + Else + objLiteral.Text = objComment.AuthorLastName + End If + Exit Select + Case DisplayType.UserName + If (isAnonymous) Then + If (objComment.AnonymousName <> "") Then + objLiteral.Text = objComment.AnonymousName + Else + objLiteral.Text = GetArticleResource("AnonymousUserName") + End If + Else + objLiteral.Text = objComment.AuthorUserName + End If + Exit Select + Case DisplayType.FullName + If (isAnonymous) Then + If (objComment.AnonymousName <> "") Then + objLiteral.Text = objComment.AnonymousName + Else + objLiteral.Text = GetArticleResource("AnonymousFullName") + End If + Else + objLiteral.Text = objComment.AuthorDisplayName + End If + Exit Select + Case Else + If (isAnonymous) Then + If (objComment.AnonymousName <> "") Then + objLiteral.Text = objComment.AnonymousName + Else + objLiteral.Text = GetArticleResource("AnonymousUserName") + End If + Else + objLiteral.Text = objComment.AuthorUserName + End If + Exit Select + End Select + objPlaceHolder.Add(objLiteral) + Case "AUTHORID" + Dim objLiteral As New Literal + objLiteral.Text = objComment.UserID.ToString() + objPlaceHolder.Add(objLiteral) + Case "AUTHORUSERNAME" + Dim objLiteral As New Literal + If (objComment.UserID = Null.NullInteger) Then + If (objComment.AnonymousName <> "") Then + objLiteral.Text = objComment.AnonymousName + Else + objLiteral.Text = GetArticleResource("AnonymousUserName") + End If + Else + objLiteral.Text = objComment.AuthorUserName.ToString() + End If + objPlaceHolder.Add(objLiteral) + Case "AUTHORDISPLAYNAME" + Dim objLiteral As New Literal + If (objComment.UserID = Null.NullInteger) Then + If (objComment.AnonymousName <> "") Then + objLiteral.Text = objComment.AnonymousName + Else + objLiteral.Text = GetArticleResource("AnonymousFullName") + End If + Else + objLiteral.Text = objComment.AuthorDisplayName.ToString() + End If + objPlaceHolder.Add(objLiteral) + Case "AUTHORFIRSTNAME" + Dim objLiteral As New Literal + If (objComment.UserID = Null.NullInteger) Then + If (objComment.AnonymousName <> "") Then + objLiteral.Text = objComment.AnonymousName + Else + objLiteral.Text = GetArticleResource("AnonymousFirstName") + End If + Else + objLiteral.Text = objComment.AuthorFirstName.ToString() + End If + objPlaceHolder.Add(objLiteral) + Case "AUTHORLASTNAME" + Dim objLiteral As New Literal + If (objComment.UserID = Null.NullInteger) Then + If (objComment.AnonymousName <> "") Then + objLiteral.Text = objComment.AnonymousName + Else + objLiteral.Text = GetArticleResource("AnonymousLastName") + End If + Else + objLiteral.Text = objComment.AuthorLastName.ToString() + End If + objPlaceHolder.Add(objLiteral) + Case "AUTHORFULLNAME" + Dim objLiteral As New Literal + If (objComment.UserID = Null.NullInteger) Then + If (objComment.AnonymousName <> "") Then + objLiteral.Text = objComment.AnonymousName + Else + objLiteral.Text = GetArticleResource("AnonymousFullName") + End If + Else + objLiteral.Text = objComment.AuthorFirstName.ToString() & " " & objComment.AuthorLastName.ToString() + End If + objPlaceHolder.Add(objLiteral) + Case "COMMENTID" + Dim objLiteral As New Literal + objLiteral.Text = objComment.CommentID.ToString() + objPlaceHolder.Add(objLiteral) + Case "COMMENT" + Dim objLiteral As New Literal + objLiteral.Text = ProcessPostTokens(EncodeComment(objComment), objArticle, Nothing, ArticleSettings) + objPlaceHolder.Add(objLiteral) + Case "COMMENTLINK" + Dim objLiteral As New Literal + objLiteral.Text = Common.GetArticleLink(objArticle, Tab, ArticleSettings, IncludeCategory) & "#Comments" + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Case "CREATEDATE" + Dim objLiteral As New Literal + objLiteral.Text = objComment.CreatedDate.ToString("D") + objPlaceHolder.Add(objLiteral) + Case "CREATETIME" + Dim objLiteral As New Literal + objLiteral.Text = objComment.CreatedDate.ToString("t") + objPlaceHolder.Add(objLiteral) + Case "DELETE" + If (ArticleSettings.IsAdmin() Or ArticleSettings.IsApprover() Or (UserId = objArticle.AuthorID And objArticle.AuthorID <> Null.NullInteger)) Then + Dim cmdDelete As New LinkButton + cmdDelete.CssClass = "CommandButton" + cmdDelete.Text = GetArticleResource("Delete") + cmdDelete.Attributes.Add("onClick", "javascript:return confirm('Are You Sure You Wish To Delete This Item ?');") + cmdDelete.CommandArgument = objComment.CommentID.ToString() + cmdDelete.CommandName = "DeleteComment" + Dim objHandler As New System.Web.UI.WebControls.CommandEventHandler(AddressOf Comment_Command) + AddHandler cmdDelete.Command, objHandler + objPlaceHolder.Add(cmdDelete) + End If + Case "EDIT" + If (ArticleSettings.IsAdmin() Or ArticleSettings.IsApprover() Or (UserId = objArticle.AuthorID And objArticle.AuthorID <> Null.NullInteger)) Then + Dim objHyperLink As New HyperLink + objHyperLink.CssClass = "CommandButton" + objHyperLink.Text = GetArticleResource("Edit") + objHyperLink.NavigateUrl = Common.GetModuleLink(ArticleModule.TabID, ArticleModule.ModuleID, "EditComment", ArticleSettings, "CommentID=" & objComment.CommentID.ToString(), "ReturnUrl=" & Server.UrlEncode(Request.RawUrl)) + objHyperLink.EnableViewState = False + objPlaceHolder.Add(objHyperLink) + End If + Case "GRAVATARURL" + Dim objLiteral As New Literal + If Request.IsSecureConnection Then + If (objComment.UserID = Null.NullInteger) Then + objLiteral.Text = AddHTTP("secure.gravatar.com/avatar/" & MD5CalcString(objComment.AnonymousEmail.ToLower())) + Else + objLiteral.Text = AddHTTP("secure.gravatar.com/avatar/" & MD5CalcString(objComment.AuthorEmail.ToLower())) + End If + Else + If (objComment.UserID = Null.NullInteger) Then + objLiteral.Text = AddHTTP("www.gravatar.com/avatar/" & MD5CalcString(objComment.AnonymousEmail.ToLower())) + Else + objLiteral.Text = AddHTTP("www.gravatar.com/avatar/" & MD5CalcString(objComment.AuthorEmail.ToLower())) + End If + End If + objPlaceHolder.Add(objLiteral) + Case "HASANONYMOUSURL" + If (objComment.AnonymousURL = "") Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/HASANONYMOUSURL") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Case "/HASANONYMOUSURL" + ' Do Nothing + Case "IPADDRESS" + Dim objLiteral As New Literal + objLiteral.Text = objComment.RemoteAddress + objPlaceHolder.Add(objLiteral) + Case "ISANONYMOUS" + If (objComment.UserID <> -1) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISANONYMOUS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Case "/ISANONYMOUS" + ' Do Nothing + Case "ISNOTANONYMOUS" + If (objComment.UserID = -1) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISNOTANONYMOUS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Case "/ISNOTANONYMOUS" + ' Do Nothing + Case "ISCOMMENT" + If (objComment.Type <> 0) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISCOMMENT") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Case "/ISCOMMENT" + ' Do Nothing + Case "ISPINGBACK" + If (objComment.Type <> 2) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISPINGBACK") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Case "/ISTRACKBACK" + ' Do Nothing + Case "ISTRACKBACK" + If (objComment.Type <> 1) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISTRACKBACK") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Case "/ISTRACKBACK" + ' Do Nothing + Case "ISAUTHOR" + If (objComment.UserID = Null.NullInteger Or (objComment.UserID <> objArticle.AuthorID)) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISAUTHOR") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Case "/ISAUTHOR" + ' Do Nothing + Case "ITEMINDEX" + Dim objLiteral As New Literal + objLiteral.Text = Me.commentItemIndex.ToString() + objPlaceHolder.Add(objLiteral) + Case "MODULEID" + Dim objLiteral As New Literal + objLiteral.Text = ArticleModule.ModuleID + objPlaceHolder.Add(objLiteral) + Case "PINGBACKURL" + Dim objLiteral As New Literal + objLiteral.Text = objComment.TrackbackUrl + objPlaceHolder.Add(objLiteral) + Case "TRACKBACKBLOGNAME" + Dim objLiteral As New Literal + objLiteral.Text = objComment.TrackbackBlogName + objPlaceHolder.Add(objLiteral) + Case "TRACKBACKEXCERPT" + Dim objLiteral As New Literal + objLiteral.Text = objComment.TrackbackExcerpt + objPlaceHolder.Add(objLiteral) + Case "TRACKBACKTITLE" + Dim objLiteral As New Literal + objLiteral.Text = objComment.TrackbackTitle + objPlaceHolder.Add(objLiteral) + Case "TRACKBACKURL" + Dim objLiteral As New Literal + objLiteral.Text = objComment.TrackbackUrl + objPlaceHolder.Add(objLiteral) + + Case Else + If (templateArray(iPtr + 1).ToUpper().StartsWith("AUTHOR:")) Then + If Author(objComment.UserID) IsNot Nothing Then + ' token to be processed + Dim field As String = templateArray(iPtr + 1).Substring(7, templateArray(iPtr + 1).Length - 7).ToLower().Trim() + + 'Gets the DNN profile property named like the token (field) + Dim profilePropertyFound As Boolean = False + Dim profilePropertyDataType As String = String.Empty + Dim profilePropertyName As String = String.Empty + Dim profilePropertyValue As String = String.Empty + + For Each objProfilePropertyDefinition As ProfilePropertyDefinition In ProfileProperties + If (objProfilePropertyDefinition.PropertyName.ToLower().Trim() = field) Then + + 'Gets the dnn profile property's datatype + Dim objListController As New ListController + Dim definitionEntry As ListEntryInfo = objListController.GetListEntryInfo(objProfilePropertyDefinition.DataType) + If Not definitionEntry Is Nothing Then + profilePropertyDataType = definitionEntry.Value + Else + profilePropertyDataType = "Unknown" + End If + + 'Gets the dnn profile property's name and current value for the given user (Agent = AuthorID) + profilePropertyName = objProfilePropertyDefinition.PropertyName + profilePropertyValue = Author(objComment.UserID).Profile.GetPropertyValue(profilePropertyName) + + profilePropertyFound = True + + End If + Next + + If profilePropertyFound Then + + Select Case profilePropertyDataType.ToLower() + Case "truefalse" + Dim objTrueFalse As New CheckBox + If profilePropertyValue = String.Empty Then + objTrueFalse.Checked = False + Else + objTrueFalse.Checked = CType(profilePropertyValue, Boolean) + End If + objTrueFalse.Enabled = False + objTrueFalse.EnableViewState = False + objPlaceHolder.Add(objTrueFalse) + + Case "richtext" + Dim objLiteral As New Literal + If profilePropertyValue = String.Empty Then + objLiteral.Text = String.Empty + Else + objLiteral.Text = Page.Server.HtmlDecode(profilePropertyValue) + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "list" + Dim objLiteral As New Literal + objLiteral.Text = profilePropertyValue + Dim objListController As New ListController + Dim objListEntryInfoCollection As ListEntryInfoCollection = objListController.GetListEntryInfoCollection(profilePropertyName) + For Each objListEntryInfo As ListEntryInfo In objListEntryInfoCollection + If objListEntryInfo.Value = profilePropertyValue Then + objLiteral.Text = objListEntryInfo.Text + Exit For + End If + Next + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case Else + Dim objLiteral As New Literal + If profilePropertyValue = String.Empty Then + objLiteral.Text = String.Empty + Else + If profilePropertyName.ToLower() = "website" Then + Dim url As String = profilePropertyValue + If url.ToLower.StartsWith("http://") Then + url = url.Substring(7) ' removes the "http://" + End If + objLiteral.Text = url + Else + objLiteral.Text = profilePropertyValue + End If + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + End Select 'profilePropertyDataType + + End If ' DNN Profile property processing + End If + Exit Select + End If ' "AUTHOR:" token + + If (templateArray(iPtr + 1).ToUpper().StartsWith("CREATEDATE:")) Then + Dim formatExpression As String = templateArray(iPtr + 1).Substring(11, templateArray(iPtr + 1).Length - 11) + Dim objLiteral As New Literal + objLiteral.Text = objComment.CreatedDate.ToString(formatExpression) + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("COMMENT:")) Then + Dim count As String = templateArray(iPtr + 1).Substring(8, templateArray(iPtr + 1).Length - 8) + If (IsNumeric(count)) Then + Dim comment As String = objComment.Comment + If (StripHtml(objComment.Comment).TrimStart().Length > Convert.ToInt32(count)) Then + comment = Left(StripHtml(Server.HtmlDecode(objComment.Comment)).TrimStart(), Convert.ToInt32(count)) & "..." + End If + Dim objLiteral As New Literal + objLiteral.Text = comment + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + End If + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("ISINROLE:")) Then + Dim field As String = templateArray(iPtr + 1).Substring(9, templateArray(iPtr + 1).Length - 9) + If (PortalSecurity.IsInRole(field) = False) Then + Dim endToken As String = "/" & templateArray(iPtr + 1) + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + + End Select + End If + + Next + + End Sub + + Public Sub ProcessFile(ByRef objPlaceHolder As ControlCollection, ByVal objArticle As ArticleInfo, ByVal objFile As FileInfo, ByVal templateArray As String()) + + For iPtr As Integer = 0 To templateArray.Length - 1 Step 2 + + objPlaceHolder.Add(New LiteralControl(ProcessImages(templateArray(iPtr).ToString()))) + + If iPtr < templateArray.Length - 1 Then + Select Case templateArray(iPtr + 1) + + Case "ARTICLEID" + Dim objLiteral As New Literal + objLiteral.Text = objFile.ArticleID.ToString() + objPlaceHolder.Add(objLiteral) + + Case "FILEID" + Dim objLiteral As New Literal + objLiteral.Text = objFile.FileID.ToString() + objPlaceHolder.Add(objLiteral) + + Case "FILENAME" + Dim objLiteral As New Literal + objLiteral.Text = objFile.FileName.ToString() + objPlaceHolder.Add(objLiteral) + + Case "FILELINK" + Dim objLiteral As New Literal + objLiteral.Text = objFile.Link + objPlaceHolder.Add(objLiteral) + + Case "SIZE" + Dim objLiteral As New Literal + objLiteral.Text = Numeric2Bytes(objFile.Size) + objPlaceHolder.Add(objLiteral) + + Case "SORTORDER" + Dim objLiteral As New Literal + objLiteral.Text = objFile.SortOrder.ToString() + objPlaceHolder.Add(objLiteral) + + Case "TITLE" + Dim objLiteral As New Literal + objLiteral.Text = objFile.Title + objPlaceHolder.Add(objLiteral) + + Case Else + + If (templateArray(iPtr + 1).ToUpper().StartsWith("ISEXTENSION:")) Then + Dim field As String = templateArray(iPtr + 1).Substring(12, templateArray(iPtr + 1).Length - 12) + + If (objFile.FileName.ToUpper().EndsWith(field.ToUpper()) = False) Then + Dim endToken As String = "/" & templateArray(iPtr + 1) + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("ISNOTEXTENSION:")) Then + Dim field As String = templateArray(iPtr + 1).Substring(15, templateArray(iPtr + 1).Length - 15) + + If (objFile.FileName.ToUpper().EndsWith(field.ToUpper()) = True) Then + Dim endToken As String = "/" & templateArray(iPtr + 1) + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + + End Select + End If + + Next + + End Sub + + Private imageIndex As Integer = 0 + Public Sub ProcessImage(ByRef objPlaceHolder As ControlCollection, ByVal objArticle As ArticleInfo, ByVal objImage As ImageInfo, ByVal templateArray As String()) + + imageIndex = imageIndex + 1 + + For iPtr As Integer = 0 To templateArray.Length - 1 Step 2 + + objPlaceHolder.Add(New LiteralControl(ProcessImages(templateArray(iPtr).ToString()).Replace("{|", "[").Replace("|}", "]"))) + + If iPtr < templateArray.Length - 1 Then + Select Case templateArray(iPtr + 1) + + Case "ARTICLEID" + Dim objLiteral As New Literal + objLiteral.Text = objImage.ArticleID.ToString() + objPlaceHolder.Add(objLiteral) + + Case "DESCRIPTION" + Dim objLiteral As New Literal + objLiteral.Text = objImage.Description + objPlaceHolder.Add(objLiteral) + + Case "FILENAME" + Dim objLiteral As New Literal + objLiteral.Text = objImage.FileName.ToString() + objPlaceHolder.Add(objLiteral) + + Case "HEIGHT" + Dim objLiteral As New Literal + objLiteral.Text = objImage.Height.ToString() + objPlaceHolder.Add(objLiteral) + + Case "IMAGEID" + Dim objLiteral As New Literal + objLiteral.Text = objImage.ImageID.ToString() + objPlaceHolder.Add(objLiteral) + + Case "IMAGELINK" + Dim objLiteral As New Literal + objLiteral.Text = PortalSettings.HomeDirectory & objImage.Folder & objImage.FileName + objPlaceHolder.Add(objLiteral) + + Case "ITEMINDEX" + Dim objLiteral As New Literal + objLiteral.Text = imageIndex.ToString() + objPlaceHolder.Add(objLiteral) + + Case "SIZE" + Dim objLiteral As New Literal + objLiteral.Text = objImage.Size.ToString() + objPlaceHolder.Add(objLiteral) + + Case "SORTORDER" + Dim objLiteral As New Literal + objLiteral.Text = objImage.SortOrder.ToString() + objPlaceHolder.Add(objLiteral) + + Case "TITLE" + Dim objLiteral As New Literal + objLiteral.Text = objImage.Title + objPlaceHolder.Add(objLiteral) + + Case "WIDTH" + Dim objLiteral As New Literal + objLiteral.Text = objImage.Width.ToString() + objPlaceHolder.Add(objLiteral) + + Case Else + + If (templateArray(iPtr + 1).ToUpper().StartsWith("IMAGETHUMB:")) Then + Dim val As String = templateArray(iPtr + 1).Substring(11, templateArray(iPtr + 1).Length - 11) + If (val.IndexOf(":"c) <> -1) Then + Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0)) + Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1)) + + Dim objImageItem As New Image + If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then + objImageItem.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImage.Folder & objImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1") + Else + objImageItem.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & width.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImage.Folder & objImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1") + End If + objImageItem.EnableViewState = False + objImageItem.AlternateText = objArticle.Title + objPlaceHolder.Add(objImageItem) + End If + Exit Select + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("ISITEMINDEX:")) Then + Dim field As String = templateArray(iPtr + 1).Substring(12, templateArray(iPtr + 1).Length - 12) + If (field <> imageIndex.ToString()) Then + Dim endToken As String = "/" & templateArray(iPtr + 1) + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Exit Select + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("/ISITEMINDEX:")) Then + Exit Select + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("ISNOTITEMINDEX:")) Then + Dim field As String = templateArray(iPtr + 1).Substring(15, templateArray(iPtr + 1).Length - 15) + If (field = imageIndex.ToString()) Then + Dim endToken As String = "/" & templateArray(iPtr + 1) + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + Exit Select + End If + + + If (templateArray(iPtr + 1).ToUpper().StartsWith("/ISNOTITEMINDEX:")) Then + Exit Select + End If + + Dim objLiteralOther As New Literal + objLiteralOther.Text = "[" & templateArray(iPtr + 1) & "]" + objLiteralOther.EnableViewState = False + objPlaceHolder.Add(objLiteralOther) + + End Select + End If + + Next + + End Sub + +#End Region + +#End Region + +#Region " Event Handlers " + + Private Sub Comment_Command(ByVal sender As Object, ByVal e As CommandEventArgs) + + Select Case e.CommandName.ToLower() + + Case "deletecomment" + Dim objArticleController As New ArticleController() + Dim objArticle As ArticleInfo = objArticleController.GetArticle(Convert.ToInt32(Request("ArticleID"))) + + If (objArticle IsNot Nothing) Then + Dim objCommentController As New CommentController + objCommentController.DeleteComment(Convert.ToInt32(e.CommandArgument), objArticle.ArticleID) + End If + + HttpContext.Current.Response.Redirect(Request.RawUrl, True) + + End Select + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Components/Layout/LayoutInfo.vb b/Components/Layout/LayoutInfo.vb new file mode 100755 index 0000000..066ec5b --- /dev/null +++ b/Components/Layout/LayoutInfo.vb @@ -0,0 +1,43 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Public Class LayoutInfo + +#Region " Private Members " + + Dim _template As String + Dim _tokens As String() + +#End Region + +#Region " Public Properties " + + Public Property Template() As String + Get + Return _template + End Get + Set(ByVal Value As String) + _template = Value + End Set + End Property + + + Public Property Tokens() As String() + Get + Return _tokens + End Get + Set(ByVal Value As String()) + _tokens = Value + End Set + End Property + +#End Region + + End Class + +End Namespace diff --git a/Components/Layout/LayoutType.vb b/Components/Layout/LayoutType.vb new file mode 100755 index 0000000..b6414c8 --- /dev/null +++ b/Components/Layout/LayoutType.vb @@ -0,0 +1,62 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Public Enum LayoutType + + Category_Html + Category_Child_Html + + Comment_Item_Html + + Handout_Cover_Html + Handout_Header_Html + Handout_Item_Html + Handout_Footer_Html + Handout_End_Html + + File_Header_Html + File_Item_Html + File_Footer_Html + + Image_Header_Html + Image_Item_Html + Image_Footer_Html + + Listing_Header_Html + Listing_Item_Html + Listing_Featured_Html + Listing_Footer_Html + Listing_Empty_Html + + Menu_Item_Html + + Print_Header_Html + Print_Item_Html + Print_Footer_Html + + Related_Header_Html + Related_Item_Html + Related_Footer_Html + + Rss_Header_Html + Rss_Item_Html + Rss_Footer_Html + + Rss_Comment_Header_Html + Rss_Comment_Item_Html + Rss_Comment_Footer_Html + + View_Item_Html + View_Title_Html + View_Description_Html + View_Keyword_Html + View_PageHeader_Html + + End Enum + +End Namespace diff --git a/Components/Layout/TokenProcessor.vb b/Components/Layout/TokenProcessor.vb new file mode 100755 index 0000000..6330cfe --- /dev/null +++ b/Components/Layout/TokenProcessor.vb @@ -0,0 +1,372 @@ + + +Imports System.Web.UI +Imports System.Web.UI.WebControls +Imports Ventrian.NewsArticles.Components.Common + +Imports DotNetNuke +Imports DotNetNuke.Common +Imports DotNetNuke.Entities.Portals +Imports DotNetNuke.Services.Localization + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Public Class TokenProcessor + +#Region " Private Methods " + + Private Shared Function GetModuleLink(ByVal key As String, ByVal moduleContext As NewsArticleModuleBase) As String + Return Common.GetModuleLink(moduleContext.TabId, moduleContext.ModuleId, key, moduleContext.ArticleSettings) + End Function + +#End Region + +#Region " Process Menu " + + Public Shared Sub ProcessMenu(ByRef placeHolder As ControlCollection, ByRef moduleContext As NewsArticleModuleBase, ByVal selectedMenu As MenuOptionType) + + Dim objLayoutController As New LayoutController(moduleContext) + Dim objLayout As LayoutInfo = LayoutController.GetLayout(moduleContext, LayoutType.Menu_Item_Html) + + For iPtr As Integer = 0 To objLayout.Tokens.Length - 1 Step 2 + + placeHolder.Add(New LiteralControl(objLayoutController.ProcessImages(objLayout.Tokens(iPtr).ToString()))) + + If iPtr < objLayout.Tokens.Length - 1 Then + ProcessMenuItem(objLayout.Tokens(iPtr + 1), placeHolder, objLayoutController, moduleContext, iPtr, objLayout.Tokens, selectedMenu) + End If + + Next + + End Sub + + Public Shared Sub ProcessMenuItem(ByVal token As String, ByRef objPlaceHolder As ControlCollection, ByVal objLayoutController As LayoutController, ByVal moduleContext As NewsArticleModuleBase, ByRef iPtr As Integer, ByVal templateArray As String(), ByVal selectedMenu As MenuOptionType) + + 'Dim path As String = objPage.TemplateSourceDirectory & "/DesktopModules/DnnForge - NewsArticles/" & Localization.LocalResourceDirectory & "/" & Localization.LocalSharedResourceFile + 'path = "~" & path.Substring(path.IndexOf("/DesktopModules/"), path.Length - path.IndexOf("/DesktopModules/")) + + Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/" & Localization.LocalResourceDirectory & "/" & Localization.LocalSharedResourceFile + + Select Case token + + Case "ADMINLINK" + Dim objLiteral As New Literal + + Dim parameters As New List(Of String) + parameters.Add("mid=" & moduleContext.ModuleId) + + If (moduleContext.ArticleSettings.AuthorUserIDFilter) Then + If (moduleContext.ArticleSettings.AuthorUserIDParam <> "") Then + If (HttpContext.Current.Request(moduleContext.ArticleSettings.AuthorUserIDParam) <> "") Then + parameters.Add(moduleContext.ArticleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(moduleContext.ArticleSettings.AuthorUserIDParam)) + End If + End If + End If + + If (moduleContext.ArticleSettings.AuthorUsernameFilter) Then + If (moduleContext.ArticleSettings.AuthorUsernameParam <> "") Then + If (HttpContext.Current.Request(moduleContext.ArticleSettings.AuthorUsernameParam) <> "") Then + parameters.Add(moduleContext.ArticleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(moduleContext.ArticleSettings.AuthorUsernameParam)) + End If + End If + End If + + objLiteral.Text = NavigateURL(moduleContext.TabId, "AdminOptions", parameters.ToArray()) + objPlaceHolder.Add(objLiteral) + + Case "ARCHIVESLINK" + Dim objLiteral As New Literal + objLiteral.Text = GetModuleLink("Archives", moduleContext) + objPlaceHolder.Add(objLiteral) + + Case "APPROVEARTICLESLINK" + Dim objLiteral As New Literal + objLiteral.Text = GetModuleLink("ApproveArticles", moduleContext) + objPlaceHolder.Add(objLiteral) + + Case "APPROVECOMMENTSLINK" + Dim objLiteral As New Literal + objLiteral.Text = GetModuleLink("ApproveComments", moduleContext) + objPlaceHolder.Add(objLiteral) + + Case "CATEGORIESLINK" + Dim objLiteral As New Literal + objLiteral.Text = GetModuleLink("Archives", moduleContext) + objPlaceHolder.Add(objLiteral) + + Case "CURRENTARTICLESLINK" + Dim objLiteral As New Literal + objLiteral.Text = GetModuleLink("", moduleContext) + objPlaceHolder.Add(objLiteral) + + Case "HASCOMMENTSENABLED" + If (moduleContext.ArticleSettings.IsCommentsEnabled = False Or moduleContext.ArticleSettings.IsCommentModerationEnabled = False) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/HASCOMMENTSENABLED") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASCOMMENTSENABLED" + ' Do Nothing + + Case "ISADMIN" + If (moduleContext.ArticleSettings.IsAdmin = False) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISADMIN") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISADMIN" + ' Do Nothing + + Case "ISAPPROVER" + If (moduleContext.ArticleSettings.IsApprover = False) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISAPPROVER") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISAPPROVER" + ' Do Nothing + + Case "ISSELECTEDADMIN" + If (selectedMenu <> MenuOptionType.AdminOptions) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISSELECTEDADMIN") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISSELECTEDADMIN" + ' Do Nothing + + Case "ISSELECTEDAPPROVEARTICLES" + If (selectedMenu <> MenuOptionType.ApproveArticles) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISSELECTEDAPPROVEARTICLES") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISSELECTEDAPPROVEARTICLES" + ' Do Nothing + + Case "ISSELECTEDAPPROVECOMMENTS" + If (selectedMenu <> MenuOptionType.ApproveComments) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISSELECTEDAPPROVECOMMENTS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISSELECTEDAPPROVECOMMENTS" + ' Do Nothing + + Case "ISSELECTEDCATEGORIES" + If (selectedMenu <> MenuOptionType.Categories) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISSELECTEDCATEGORIES") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISSELECTEDCATEGORIES" + ' Do Nothing + + Case "ISSELECTEDCURRENTARTICLES" + If (selectedMenu <> MenuOptionType.CurrentArticles) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISSELECTEDCURRENTARTICLES") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISSELECTEDCURRENTARTICLES" + ' Do Nothing + + Case "ISSELECTEDMYARTICLES" + If (selectedMenu <> MenuOptionType.MyArticles) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISSELECTEDMYARTICLES") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISSELECTEDMYARTICLES" + ' Do Nothing + + Case "ISSELECTEDSEARCH" + If (selectedMenu <> MenuOptionType.Search) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISSELECTEDSEARCH") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISSELECTEDSEARCH" + ' Do Nothing + + Case "ISSELECTEDSYNDICATION" + If (selectedMenu <> MenuOptionType.Syndication) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISSELECTEDSYNDICATION") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISSELECTEDSYNDICATION" + ' Do Nothing + + Case "ISSELECTEDSUBMITARTICLE" + If (selectedMenu <> MenuOptionType.SubmitArticle) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISSELECTEDSUBMITARTICLE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISSELECTEDSUBMITARTICLE" + ' Do Nothing + + Case "ISSYNDICATIONENABLED" + If (moduleContext.ArticleSettings.IsSyndicationEnabled = False) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISSYNDICATIONENABLED") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISSYNDICATIONENABLED" + ' Do Nothing + + Case "ISSUBMITTER" + If (moduleContext.ArticleSettings.IsSubmitter = False) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/ISSUBMITTER") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISSUBMITTER" + ' Do Nothing + + Case "MYARTICLESLINK" + Dim objLiteral As New Literal + objLiteral.Text = GetModuleLink("MyArticles", moduleContext) + objPlaceHolder.Add(objLiteral) + + Case "RSSLATESTLINK" + Dim objLiteral As New Literal + Dim authorIDParam As String = "" + If (moduleContext.ArticleSettings.AuthorUserIDFilter) Then + If (moduleContext.ArticleSettings.AuthorUserIDParam <> "") Then + If (HttpContext.Current.Request(moduleContext.ArticleSettings.AuthorUserIDParam) <> "") Then + authorIDParam = "&AuthorID=" & HttpContext.Current.Request(moduleContext.ArticleSettings.AuthorUserIDParam) + End If + End If + End If + + If (moduleContext.ArticleSettings.AuthorUsernameFilter) Then + If (moduleContext.ArticleSettings.AuthorUsernameParam <> "") Then + If (HttpContext.Current.Request(moduleContext.ArticleSettings.AuthorUsernameParam) <> "") Then + Try + Dim objUser As Entities.Users.UserInfo = Entities.Users.UserController.GetUserByName(PortalController.GetCurrentPortalSettings().PortalId, HttpContext.Current.Request.QueryString(moduleContext.ArticleSettings.AuthorUsernameParam)) + If (objUser IsNot Nothing) Then + authorIDParam = "&AuthorID=" & objUser.UserID.ToString() + End If + Catch + End Try + End If + End If + End If + objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge%20-%20NewsArticles/Rss.aspx") & "?TabID=" & moduleContext.TabId & "&ModuleID=" & moduleContext.ModuleId & "&MaxCount=25" & authorIDParam + objPlaceHolder.Add(objLiteral) + + Case "SEARCHLINK" + Dim objLiteral As New Literal + objLiteral.Text = GetModuleLink("Search", moduleContext) + objPlaceHolder.Add(objLiteral) + + Case "SUBMITARTICLELINK" + Dim objLiteral As New Literal + If (moduleContext.ArticleSettings.LaunchLinks) Then + objLiteral.Text = GetModuleLink("Edit", moduleContext) + Else + objLiteral.Text = GetModuleLink("SubmitNews", moduleContext) + End If + objPlaceHolder.Add(objLiteral) + + Case "SYNDICATIONLINK" + Dim objLiteral As New Literal + objLiteral.Text = GetModuleLink("Syndication", moduleContext) + objPlaceHolder.Add(objLiteral) + + Case Else + Dim isRendered As Boolean = False + + If (templateArray(iPtr + 1).ToUpper().StartsWith("RESX:")) Then + Dim key As String = templateArray(iPtr + 1).Substring(5, templateArray(iPtr + 1).Length - 5) + Dim objLiteral As New Literal + Try + objLiteral.Text = Localization.GetString(key & ".Text", path) + If (objLiteral.Text = "") Then + objLiteral.Text = templateArray(iPtr + 1).Substring(5, templateArray(iPtr + 1).Length - 5) + End If + Catch + objLiteral.Text = templateArray(iPtr + 1).Substring(5, templateArray(iPtr + 1).Length - 5) + End Try + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + isRendered = True + End If + + If (isRendered = False) Then + Dim objLiteralOther As New Literal + objLiteralOther.Text = "[" & templateArray(iPtr + 1) & "]" + objLiteralOther.EnableViewState = False + objPlaceHolder.Add(objLiteralOther) + End If + + End Select + + End Sub + + +#End Region + + End Class + +End Namespace diff --git a/Components/LayoutModeType.vb b/Components/LayoutModeType.vb new file mode 100755 index 0000000..80e7385 --- /dev/null +++ b/Components/LayoutModeType.vb @@ -0,0 +1,16 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Public Enum LayoutModeType + + Simple + Advanced + + End Enum + +End Namespace diff --git a/Components/LinkFilterType.vb b/Components/LinkFilterType.vb new file mode 100755 index 0000000..cd7d710 --- /dev/null +++ b/Components/LinkFilterType.vb @@ -0,0 +1,23 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Enum LinkFilterType + + None + Url + Page + + End Enum + +End Namespace diff --git a/Components/MatchOperator.vb b/Components/MatchOperator.vb new file mode 100755 index 0000000..be9f9b4 --- /dev/null +++ b/Components/MatchOperator.vb @@ -0,0 +1,22 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Enum MatchOperatorType + + MatchAny + MatchAll + + End Enum + +End Namespace diff --git a/Components/MenuOptionType.vb b/Components/MenuOptionType.vb new file mode 100755 index 0000000..55505c2 --- /dev/null +++ b/Components/MenuOptionType.vb @@ -0,0 +1,29 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Enum MenuOptionType + + CurrentArticles + Categories + Search + Syndication + MyArticles + SubmitArticle + ApproveArticles + ApproveComments + AdminOptions + + End Enum + +End Namespace diff --git a/Components/MirrorArticleController.vb b/Components/MirrorArticleController.vb new file mode 100755 index 0000000..fc5fcd0 --- /dev/null +++ b/Components/MirrorArticleController.vb @@ -0,0 +1,41 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Data + +Imports DotNetNuke +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Class MirrorArticleController + +#Region " Public Methods " + + Public Sub AddMirrorArticle(ByVal objMirrorArticle As MirrorArticleInfo) + + DataProvider.Instance().AddMirrorArticle(objMirrorArticle.ArticleID, objMirrorArticle.LinkedArticleID, objMirrorArticle.LinkedPortalID, objMirrorArticle.AutoUpdate) + + End Sub + + Public Function GetMirrorArticle(ByVal articleID As Integer) As MirrorArticleInfo + + Return CType(CBO.FillObject(DataProvider.Instance().GetMirrorArticle(articleID), GetType(MirrorArticleInfo)), MirrorArticleInfo) + + End Function + + Public Function GetMirrorArticleList(ByVal linkedArticleID As Integer) As ArrayList + + Return CBO.FillCollection(DataProvider.Instance().GetMirrorArticleList(linkedArticleID), GetType(MirrorArticleInfo)) + + End Function + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Components/MirrorArticleInfo.vb b/Components/MirrorArticleInfo.vb new file mode 100755 index 0000000..3a647b1 --- /dev/null +++ b/Components/MirrorArticleInfo.vb @@ -0,0 +1,102 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Data + +Imports DotNetNuke +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Portals + +Namespace Ventrian.NewsArticles + + Public Class MirrorArticleInfo + +#Region " Private Methods " + + ' local property declarations + Dim _articleID As Integer + Dim _linkedArticleID As Integer + Dim _linkedPortalID As Integer + Dim _autoUpdate As Boolean + Dim _portalName As String = "" + Dim _portalID As Integer + +#End Region + +#Region " Public Properties " + + Public Property ArticleID() As Integer + Get + Return _articleID + End Get + Set(ByVal Value As Integer) + _articleID = Value + End Set + End Property + + Public Property PortalID() As Integer + Get + Return _portalID + End Get + Set(ByVal Value As Integer) + _portalID = Value + End Set + End Property + + Public Property LinkedArticleID() As Integer + Get + Return _linkedArticleID + End Get + Set(ByVal Value As Integer) + _linkedArticleID = Value + End Set + End Property + + Public Property LinkedPortalID() As Integer + Get + Return _linkedPortalID + End Get + Set(ByVal Value As Integer) + _linkedPortalID = Value + End Set + End Property + + Public Property AutoUpdate() As Boolean + Get + Return _autoUpdate + End Get + Set(ByVal Value As Boolean) + _autoUpdate = Value + End Set + End Property + + Public ReadOnly Property PortalName() As String + Get + If (_portalName = "") Then + Dim objPortalController As New PortalController() + Dim objPortal As PortalInfo = objPortalController.GetPortal(LinkedPortalID) + + If (objPortal IsNot Nothing) Then + _portalName = objPortal.PortalName + + Dim o As New PortalAliasController + Dim portalAliases As ArrayList = o.GetPortalAliasArrayByPortalID(_linkedPortalID) + + If (portalAliases.Count > 0) Then + _portalName = DotNetNuke.Common.AddHTTP(CType(portalAliases(0), PortalAliasInfo).HTTPAlias) + End If + End If + End If + Return _portalName + End Get + End Property + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Components/RatingController.vb b/Components/RatingController.vb new file mode 100755 index 0000000..621344c --- /dev/null +++ b/Components/RatingController.vb @@ -0,0 +1,103 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Data +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Framework + +Namespace Ventrian.NewsArticles + + Public Class RatingController + +#Region " Static Methods " + + Public Shared Sub ClearCache(ByVal moduleID As Integer) + + Dim itemsToRemove As New List(Of String)() + + Dim enumerator As IDictionaryEnumerator = HttpContext.Current.Cache.GetEnumerator() + While enumerator.MoveNext() + If enumerator.Key.ToString().ToLower().StartsWith("ventrian-newsarticles-rating-" & moduleID.ToString()) Then + itemsToRemove.Add(enumerator.Key.ToString()) + End If + End While + + For Each itemToRemove As String In itemsToRemove + DataCache.RemoveCache(itemToRemove.Replace("DNN_", "")) + Next + + End Sub + +#End Region + +#Region " Public Methods " + + Public Function Add(ByVal objRating As RatingInfo, ByVal moduleID As Integer) As Integer + + Dim ratingID As Integer = CType(DataProvider.Instance().AddRating(objRating.ArticleID, objRating.UserID, objRating.CreatedDate, objRating.Rating), Integer) + + ArticleController.ClearArticleCache(objRating.ArticleID) + + Dim cacheKey As String = "ventrian-newsarticles-rating-" & moduleID.ToString() & "-aid-" & objRating.ArticleID.ToString() & "-" & objRating.UserID.ToString() + DataCache.RemoveCache(cacheKey) + + Return ratingID + + End Function + + Public Function [Get](ByVal articleID As Integer, ByVal userID As Integer, ByVal moduleID As Integer) As RatingInfo + + Dim cacheKey As String = "ventrian-newsarticles-rating-" & moduleID.ToString() & "-aid-" & articleID.ToString() & "-" & userID.ToString() + + Dim objRating As RatingInfo = CType(DataCache.GetCache(cacheKey), RatingInfo) + + If (objRating Is Nothing) Then + objRating = CType(CBO.FillObject(DataProvider.Instance().GetRating(articleID, userID), GetType(RatingInfo)), RatingInfo) + If (objRating IsNot Nothing) Then + DataCache.SetCache(cacheKey, objRating) + Else + objRating = New RatingInfo() + objRating.RatingID = Null.NullInteger + DataCache.SetCache(cacheKey, objRating) + End If + End If + + Return objRating + + End Function + + Public Function [GetByID](ByVal ratingID As Integer, ByVal articleID As Integer, ByVal moduleID As Integer) As RatingInfo + + Dim cacheKey As String = "ventrian-newsarticles-rating-" & moduleID.ToString() & "-id-" & ratingID.ToString() + + Dim objRating As RatingInfo = CType(DataCache.GetCache(cacheKey), RatingInfo) + + If (objRating Is Nothing) Then + objRating = CType(CBO.FillObject(DataProvider.Instance().GetRatingByID(ratingID), GetType(RatingInfo)), RatingInfo) + DataCache.SetCache(cacheKey, objRating) + End If + + Return objRating + + End Function + + Public Sub Delete(ByVal ratingID As Integer, ByVal articleID As Integer, ByVal moduleID As Integer) + + DataProvider.Instance().DeleteRating(ratingID) + + ArticleController.ClearArticleCache(articleID) + + Dim cacheKey As String = "ventrian-newsarticles-rating-" & moduleID.ToString() & "-id-" & ratingID.ToString() + DataCache.RemoveCache(cacheKey) + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Components/RatingInfo.vb b/Components/RatingInfo.vb new file mode 100755 index 0000000..64ac867 --- /dev/null +++ b/Components/RatingInfo.vb @@ -0,0 +1,72 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Public Class RatingInfo + +#Region " Private Members " + + Dim _ratingID As Integer + Dim _articleID As Integer + Dim _userID As Integer + Dim _createdDate As DateTime + Dim _rating As Double + +#End Region + +#Region " Public Properties " + + Public Property RatingID() As Integer + Get + Return _ratingID + End Get + Set(ByVal Value As Integer) + _ratingID = Value + End Set + End Property + + Public Property ArticleID() As Integer + Get + Return _articleID + End Get + Set(ByVal Value As Integer) + _articleID = Value + End Set + End Property + + Public Property UserID() As Integer + Get + Return _userID + End Get + Set(ByVal Value As Integer) + _userID = Value + End Set + End Property + + Public Property CreatedDate() As DateTime + Get + Return _createdDate + End Get + Set(ByVal Value As DateTime) + _createdDate = Value + End Set + End Property + + Public Property Rating() As Double + Get + Return _rating + End Get + Set(ByVal Value As Double) + _rating = Value + End Set + End Property + +#End Region + + End Class + +End Namespace diff --git a/Components/RelatedType.vb b/Components/RelatedType.vb new file mode 100755 index 0000000..3fbba3f --- /dev/null +++ b/Components/RelatedType.vb @@ -0,0 +1,28 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Enum RelatedType + + None + MatchCategoriesAny + MatchCategoriesAll + MatchTagsAny + MatchTagsAll + MatchCategoriesAnyTagsAny + MatchCategoriesAllTagsAny + MatchCategoriesAnyTagsAll + + End Enum + +End Namespace diff --git a/Components/Social/Journal.vb b/Components/Social/Journal.vb new file mode 100755 index 0000000..d5a5232 --- /dev/null +++ b/Components/Social/Journal.vb @@ -0,0 +1,94 @@ +Imports DotNetNuke.Services.Journal + +Namespace Ventrian.NewsArticles.Components.Social + + Public Class Journal + + Public Const ContentTypeName As String = "Ventrian_Article_" + +#Region "Internal Methods" + + Friend Sub AddArticleToJournal(ByVal objArticle As ArticleInfo, ByVal portalId As Integer, ByVal tabId As Integer, ByVal journalUserId As Integer, ByVal journalGroupID As Integer, ByVal url As String) + Dim objectKey As String = "Ventrian_Article_" + objArticle.ArticleID.ToString() + "_" + journalGroupID.ToString() + Dim ji As JournalItem = JournalController.Instance.GetJournalItemByKey(portalId, objectKey) + + If Not ji Is Nothing Then + JournalController.Instance.DeleteJournalItemByKey(portalId, objectKey) + End If + + ji = New JournalItem + + ji.PortalId = portalId + ji.ProfileId = journalUserId + ji.UserId = journalUserId + ji.ContentItemId = objArticle.ArticleID + ji.Title = objArticle.Title + ji.ItemData = New ItemData() + ji.ItemData.Url = url + ji.Summary = objArticle.Summary + ji.Body = Nothing + ji.JournalTypeId = 15 + ji.ObjectKey = objectKey + ji.SecuritySet = "E," + ji.SocialGroupId = journalGroupID + + JournalController.Instance.SaveJournalItem(ji, tabId) + End Sub + + Friend Sub AddCommentToJournal(ByVal objArticle As ArticleInfo, ByVal objComment As CommentInfo, ByVal portalId As Integer, ByVal tabId As Integer, ByVal journalUserId As Integer, ByVal url As String) + Dim objectKey As String = "Ventrian_Article_Comment_" + objArticle.ArticleID.ToString() + ":" + objComment.CommentID.ToString() + Dim ji As JournalItem = JournalController.Instance.GetJournalItemByKey(portalId, objectKey) + + If Not ji Is Nothing Then + JournalController.Instance.DeleteJournalItemByKey(portalId, objectKey) + End If + + ji = New JournalItem + + ji.PortalId = portalId + ji.ProfileId = journalUserId + ji.UserId = journalUserId + ji.ContentItemId = objComment.CommentID + ji.Title = objArticle.Title + ji.ItemData = New ItemData() + ji.ItemData.Url = url + ji.Summary = objComment.Comment + ji.Body = Nothing + ji.JournalTypeId = 18 + ji.ObjectKey = objectKey + ji.SecuritySet = "E," + + JournalController.Instance.SaveJournalItem(ji, tabId) + End Sub + + Friend Sub AddRatingToJournal(ByVal objArticle As ArticleInfo, ByVal objRating As RatingInfo, ByVal portalId As Integer, ByVal tabId As Integer, ByVal journalUserId As Integer, ByVal url As String) + Dim objectKey As String = "Ventrian_Article_Rating_" + objArticle.ArticleID.ToString() + ":" + objRating.RatingID.ToString() + Dim ji As JournalItem = JournalController.Instance.GetJournalItemByKey(portalId, objectKey) + + If Not ji Is Nothing Then + JournalController.Instance.DeleteJournalItemByKey(portalId, objectKey) + End If + + ji = New JournalItem + + ji.PortalId = portalId + ji.ProfileId = journalUserId + ji.UserId = journalUserId + ji.ContentItemId = objRating.RatingID + ji.Title = objArticle.Title + ji.ItemData = New ItemData() + ji.ItemData.Url = url + ji.Summary = objRating.Rating.ToString() + ji.Body = Nothing + ji.JournalTypeId = 17 + ji.ObjectKey = objectKey + ji.SecuritySet = "E," + + JournalController.Instance.SaveJournalItem(ji, tabId) + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Components/StatusType.vb b/Components/StatusType.vb new file mode 100755 index 0000000..c21717d --- /dev/null +++ b/Components/StatusType.vb @@ -0,0 +1,23 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Enum StatusType + + Draft + AwaitingApproval + Published + + End Enum + +End Namespace diff --git a/Components/SyndicationEnclosureType.vb b/Components/SyndicationEnclosureType.vb new file mode 100755 index 0000000..1df6df1 --- /dev/null +++ b/Components/SyndicationEnclosureType.vb @@ -0,0 +1,22 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Enum SyndicationEnclosureType + + Attachment + Image + + End Enum + +End Namespace diff --git a/Components/SyndicationLinkType.vb b/Components/SyndicationLinkType.vb new file mode 100755 index 0000000..d871667 --- /dev/null +++ b/Components/SyndicationLinkType.vb @@ -0,0 +1,22 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Enum SyndicationLinkType + + Article + Attachment + + End Enum + +End Namespace diff --git a/Components/TagController.vb b/Components/TagController.vb new file mode 100755 index 0000000..6a7c587 --- /dev/null +++ b/Components/TagController.vb @@ -0,0 +1,112 @@ +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Class TagController + +#Region " Private Methods " + + Private Sub RemoveCache(ByVal tagID As Integer) + + Dim objTag As TagInfo = [Get](tagID) + + If Not (objTag Is Nothing) Then + RemoveCache(objTag.ModuleID, objTag.TagID.ToString()) + End If + + End Sub + + Private Sub RemoveCache(ByVal moduleID As Integer, ByVal nameLowered As String) + + If Not (DataCache.GetCache("Tag-" & moduleID.ToString() & "-" & nameLowered) Is Nothing) Then + DataCache.RemoveCache("Tag-" & moduleID.ToString() & "-" & nameLowered) + End If + + End Sub + +#End Region + +#Region " Public Methods " + + Public Function [Get](ByVal tagID As Integer) As TagInfo + + Return CType(CBO.FillObject(DataProvider.Instance().GetTag(tagID), GetType(TagInfo)), TagInfo) + + End Function + + Public Function [Get](ByVal moduleID As Integer, ByVal nameLowered As String) As TagInfo + + Dim objTag As TagInfo = CType(DataCache.GetCache("Tag-" & moduleID.ToString() & "-" & nameLowered), TagInfo) + + If (objTag Is Nothing) Then + objTag = CType(CBO.FillObject(DataProvider.Instance().GetTagByName(moduleID, nameLowered), GetType(TagInfo)), TagInfo) + If Not (objTag Is Nothing) Then + DataCache.SetCache("Tag-" & moduleID.ToString() & "-" & nameLowered, objTag) + End If + End If + + Return objTag + + End Function + + Public Function List(ByVal moduleID As Integer, ByVal maxCount As Integer) As ArrayList + + Return CBO.FillCollection(DataProvider.Instance().ListTag(moduleID, maxCount), GetType(TagInfo)) + + End Function + + Public Function Add(ByVal objTag As TagInfo) As Integer + + Return CType(DataProvider.Instance().AddTag(objTag.ModuleID, objTag.Name, objTag.NameLowered), Integer) + + End Function + + Public Sub Update(ByVal objTag As TagInfo) + + RemoveCache(objTag.ModuleID, objTag.NameLowered) + DataProvider.Instance().UpdateTag(objTag.TagID, objTag.ModuleID, objTag.Name, objTag.NameLowered, objTag.Usages) + + End Sub + + Public Sub Delete(ByVal tagID As Integer) + + RemoveCache(tagID) + DataProvider.Instance().DeleteTag(tagID) + + End Sub + + Public Sub DeleteArticleTag(ByVal articleID As Integer) + + Dim objArticleController As New ArticleController() + Dim objArticle As ArticleInfo = objArticleController.GetArticle(articleID) + + If Not (objArticle Is Nothing) Then + If (objArticle.Tags.Trim() <> "") Then + For Each tag As String In objArticle.Tags.Split(","c) + RemoveCache(objArticle.ModuleID, tag.ToLower()) + Next + End If + End If + DataProvider.Instance().DeleteArticleTag(articleID) + + End Sub + + Public Sub DeleteArticleTagByTag(ByVal tagID As Integer) + + RemoveCache(tagID) + DataProvider.Instance().DeleteArticleTag(tagID) + + End Sub + + Public Sub Add(ByVal articleID As Integer, ByVal tagID As Integer) + + RemoveCache(tagID) + DataProvider.Instance().AddArticleTag(articleID, tagID) + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Components/TagInfo.vb b/Components/TagInfo.vb new file mode 100755 index 0000000..108b877 --- /dev/null +++ b/Components/TagInfo.vb @@ -0,0 +1,93 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Namespace Ventrian.NewsArticles + + Public Class TagInfo + Implements IComparable + +#Region " Private Members " + + Dim _tagID As Integer + Dim _moduleID As Integer + Dim _name As String + Dim _nameLowered As String + Dim _usages As Integer + +#End Region + +#Region " Public Properties " + + Public Property TagID() As Integer + Get + Return _tagID + End Get + Set(ByVal Value As Integer) + _tagID = Value + End Set + End Property + + Public Property ModuleID() As Integer + Get + Return _moduleID + End Get + Set(ByVal Value As Integer) + _moduleID = Value + End Set + End Property + + Public Property Name() As String + Get + Return _name + End Get + Set(ByVal Value As String) + _name = Value + End Set + End Property + + Public Property NameLowered() As String + Get + Return _nameLowered + End Get + Set(ByVal Value As String) + _nameLowered = Value + End Set + End Property + + Public Property Usages() As Integer + Get + Return _usages + End Get + Set(ByVal Value As Integer) + _usages = Value + End Set + End Property + +#End Region + +#Region " Optional Interfaces " + + Public Function CompareTo(ByVal obj As Object) As Integer _ + Implements System.IComparable.CompareTo + + If Not TypeOf obj Is TagInfo Then + Throw New Exception("Object is not TagInfo") + End If + + Dim Compare As TagInfo = CType(obj, TagInfo) + Dim result As Integer = Me.Name.CompareTo(Compare.Name) + + If result = 0 Then + result = Me.Name.CompareTo(Compare.Name) + End If + Return result + End Function + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Components/TemplateConstants.vb b/Components/TemplateConstants.vb new file mode 100755 index 0000000..501653a --- /dev/null +++ b/Components/TemplateConstants.vb @@ -0,0 +1,36 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System + +Namespace Ventrian.NewsArticles + + Public Class TemplateConstants + +#Region " Constants " + + ' Listing Settings + Public Const LISTING_ITEM As String = "Listing.Item" + Public Const LISTING_FEATURED As String = "Listing.Featured" + Public Const LISTING_HEADER As String = "Listing.Header" + Public Const LISTING_FOOTER As String = "Listing.Footer" + + Public Const VIEW_HEADER As String = "View.Header" + Public Const VIEW_FOOTER As String = "View.Footer" + Public Const VIEW_ITEM As String = "View.Item" + + Public Const COMMENT_ITEM As String = "Comment.Item" + Public Const COMMENT_HEADER As String = "Comment.Header" + Public Const COMMENT_FOOTER As String = "Comment.Footer" + + Public Const MENU_ITEM As String = "Menu.Item" + +#End Region + + End Class + +End Namespace + diff --git a/Components/TemplateController.vb b/Components/TemplateController.vb new file mode 100755 index 0000000..965d82a --- /dev/null +++ b/Components/TemplateController.vb @@ -0,0 +1,80 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.IO +Imports System.Web.Caching +Imports System.Xml + +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Portals + +Namespace Ventrian.NewsArticles + + Public Class TemplateController + +#Region " Public Methods " + + Public Function GetTemplate(ByVal name As String, ByVal portalSettings As PortalSettings, ByVal template As String, ByVal tabModuleID As Integer) As TemplateInfo + ' Me.MapPath("Templates/" & Template & "/") + ' Dim pathToTemplate As String = articleModuleBase.TemplatePath + + Dim pathToTemplate As String = portalSettings.HomeDirectoryMapPath & "DnnForge - News Articles\Templates\Templates\" & template & "\" + + Dim cacheKey As String = tabModuleID.ToString() & name + Dim cacheKeyXml As String = tabModuleID.ToString() & name & ".xml" + + Dim objTemplate As TemplateInfo = CType(DataCache.GetCache(cacheKey), TemplateInfo) + Dim objTemplateXml As TemplateInfo = CType(DataCache.GetCache(cacheKeyXml), TemplateInfo) + + If (objTemplate Is Nothing Or objTemplateXml Is Nothing) Then + Dim delimStr As String = "[]" + Dim delimiter As Char() = delimStr.ToCharArray() + + objTemplate = New TemplateInfo + + Dim path As String = pathToTemplate & name & ".html" + Dim pathXml As String = pathToTemplate & name & ".xml" + + If (System.IO.File.Exists(path) = False) Then + ' path = articleModuleBase.MapPath("Templates/Default/") & name & ".html" + path = pathToTemplate & "Standard\" & name & ".html" + End If + + Dim sr As System.IO.StreamReader = New System.IO.StreamReader(path) + Try + objTemplate.Template = sr.ReadToEnd() + Catch + objTemplate.Template = "
ERROR: UNABLE TO READ '" & name & "' TEMPLATE:" + Finally + If Not sr Is Nothing Then sr.Close() + End Try + + Dim doc As New XmlDocument + Try + doc.Load(pathXml) + Catch + ' Do Nothing + Finally + objTemplate.Xml = doc + End Try + + objTemplate.Tokens = objTemplate.Template.Split(delimiter) + + DataCache.SetCache(cacheKey, objTemplate, New CacheDependency(path)) + DataCache.SetCache(cacheKeyXml, objTemplate, New CacheDependency(pathXml)) + End If + + Return objTemplate + + End Function + +#End Region + + End Class + +End Namespace + diff --git a/Components/TemplateInfo.vb b/Components/TemplateInfo.vb new file mode 100755 index 0000000..b0a595a --- /dev/null +++ b/Components/TemplateInfo.vb @@ -0,0 +1,53 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System.Xml + +Namespace Ventrian.NewsArticles + + Public Class TemplateInfo + +#Region "Private Members" + Dim _template As String + Dim _tokens As String() + Dim _xml As XmlDocument +#End Region + +#Region "Public Properties" + + Public Property Template() As String + Get + Return _template + End Get + Set(ByVal Value As String) + _template = Value + End Set + End Property + + + Public Property Tokens() As String() + Get + Return _tokens + End Get + Set(ByVal Value As String()) + _tokens = Value + End Set + End Property + + Public Property Xml() As XmlDocument + Get + Return _xml + End Get + Set(ByVal Value As XmlDocument) + _xml = Value + End Set + End Property + +#End Region + + End Class + +End Namespace diff --git a/Components/ThumbnailType.vb b/Components/ThumbnailType.vb new file mode 100755 index 0000000..3c2a75d --- /dev/null +++ b/Components/ThumbnailType.vb @@ -0,0 +1,20 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2011 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Namespace Ventrian.NewsArticles + + Public Enum ThumbnailType + + Proportion + Square + + End Enum + +End Namespace diff --git a/Components/TitleReplacementType.vb b/Components/TitleReplacementType.vb new file mode 100755 index 0000000..8c48441 --- /dev/null +++ b/Components/TitleReplacementType.vb @@ -0,0 +1,22 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Enum TitleReplacementType + + Dash = 0 + Underscore = 1 + + End Enum + +End Namespace diff --git a/Components/Tracking/Notification.vb b/Components/Tracking/Notification.vb new file mode 100755 index 0000000..f0b5813 --- /dev/null +++ b/Components/Tracking/Notification.vb @@ -0,0 +1,44 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common.Utilities + +Imports System.Threading + +Namespace Ventrian.NewsArticles.Tracking + + Public Class Notification + + Dim t As Thread + + Public Sub NotifyExternalSites(ByVal objArticle As ArticleInfo, ByVal articleLink As String, ByVal portalTitle As String) + + Dim objNotification As New NotificationJob + objNotification.Article = objArticle + objNotification.ArticleLink = articleLink + objNotification.PortalTitle = portalTitle + + Dim t As New Thread(AddressOf objNotification.NotifyLinkedSites) + t.IsBackground = True + t.Start() + + End Sub + + Public Sub NotifyWeblogs(ByVal articleLink As String, ByVal portalTitle As String) + + Dim objPing As New PingJob + Dim t As New Thread(AddressOf objPing.NotifyWeblogs) + objPing.ArticleLink = articleLink + objPing.PortalTitle = portalTitle + t.IsBackground = True + t.Start() + + End Sub + + + End Class + +End Namespace diff --git a/Components/Tracking/NotificationJob.vb b/Components/Tracking/NotificationJob.vb new file mode 100755 index 0000000..4a26e4f --- /dev/null +++ b/Components/Tracking/NotificationJob.vb @@ -0,0 +1,58 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System.Collections.Specialized + +Namespace Ventrian.NewsArticles.Tracking + + Public Class NotificationJob + + Public Article As ArticleInfo + Public ArticleLink As String + Public PortalTitle As String + + Public Sub NotifyLinkedSites() + + Try + + Dim links As New StringCollection + TrackHelper.BuildLinks(Article.Summary, links) + TrackHelper.BuildLinks(Article.Body, links) + + For Each link As String In links + + Try + + Dim pageText As String = TrackHelper.GetPageText(link) + + If Not (pageText Is Nothing) Then + Dim success As Boolean = False + + Dim objTrackBackProxy As New TrackBackProxy + success = objTrackBackProxy.TrackBackPing(pageText, link, Article.Title, ArticleLink, PortalTitle, "") + + If (success = False) Then + ' objEventLog.AddLog("Ping Exception", "Trackback failed ->" & link, DotNetNuke.Common.Globals.GetPortalSettings(), -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT) + + Dim objPingBackProxy As New PingBackProxy + objPingBackProxy.Ping(pageText, ArticleLink, link) + End If + + End If + + Catch + End Try + + Next + + Catch + End Try + + End Sub + + End Class + +End Namespace diff --git a/Components/Tracking/PingBackProxy.resx b/Components/Tracking/PingBackProxy.resx new file mode 100755 index 0000000..dd0ea4d --- /dev/null +++ b/Components/Tracking/PingBackProxy.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Components/Tracking/PingBackProxy.vb b/Components/Tracking/PingBackProxy.vb new file mode 100755 index 0000000..51ed920 --- /dev/null +++ b/Components/Tracking/PingBackProxy.vb @@ -0,0 +1,82 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Text.RegularExpressions + +Imports CookComputing.XmlRpc + +Namespace Ventrian.NewsArticles.Tracking + + Public Class PingBackProxy + Inherits XmlRpcClientProtocol + +#Region " Private Members " + + Dim _errorMessage As String + +#End Region + +#Region " Private Properties " + + Private Property ErrorMessage() As String + Get + Return _errorMessage + End Get + Set(ByVal Value As String) + _errorMessage = Value + End Set + End Property + +#End Region + +#Region " Public Methods " + + Public Function Ping(ByVal pageText As String, ByVal sourceURI As String, ByVal targetURI As String) As Boolean + Dim pingbackURL As String = GetPingBackURL(pageText, targetURI, sourceURI) + If Not pingbackURL Is Nothing Then + Me.Url = pingbackURL + Try + Notifiy(sourceURI, targetURI) + Return True + Catch ex As Exception + ErrorMessage = "Error: " + ex.Message + End Try + End If + Return False + + End Function + + _ + Public Sub Notifiy(ByVal sourceURI As String, ByVal targetURI As String) + + Invoke("Notifiy", New Object() {sourceURI, targetURI}) + + End Sub + +#End Region + +#Region " Private Methods " + + Private Function GetPingBackURL(ByVal pageText As String, ByVal url As String, ByVal PostUrl As String) As String + If Not Regex.IsMatch(pageText, PostUrl, RegexOptions.IgnoreCase Or RegexOptions.Singleline) Then + If Not pageText Is Nothing Then + Dim pat As String = "" + Dim reg As Regex = New Regex(pat, RegexOptions.IgnoreCase Or RegexOptions.Singleline) + Dim m As Match = reg.Match(pageText) + If m.Success Then + Return m.Result("$1") + End If + End If + End If + Return Nothing + End Function + +#End Region + + End Class + +End Namespace diff --git a/Components/Tracking/PingJob.vb b/Components/Tracking/PingJob.vb new file mode 100755 index 0000000..90a711d --- /dev/null +++ b/Components/Tracking/PingJob.vb @@ -0,0 +1,34 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System.Collections.Specialized + +Namespace Ventrian.NewsArticles.Tracking + + Public Class PingJob + + Public ArticleLink As String + Public PortalTitle As String + + Public Sub NotifyWeblogs() + + Try + + Dim objPing As New PingProxy + objPing.Ping(PortalTitle, ArticleLink) + + Catch + ' Anything can happen here, so just swallow exception + Finally + Threading.Thread.CurrentThread.Abort() + End Try + + + End Sub + + End Class + +End Namespace diff --git a/Components/Tracking/PingProxy.resx b/Components/Tracking/PingProxy.resx new file mode 100755 index 0000000..dd0ea4d --- /dev/null +++ b/Components/Tracking/PingProxy.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Components/Tracking/PingProxy.vb b/Components/Tracking/PingProxy.vb new file mode 100755 index 0000000..804c1e5 --- /dev/null +++ b/Components/Tracking/PingProxy.vb @@ -0,0 +1,39 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Text.RegularExpressions + +Imports CookComputing.XmlRpc + +Namespace Ventrian.NewsArticles.Tracking + + Public Class PingProxy + Inherits XmlRpcClientProtocol + +#Region " Public Methods " + + Public Function Ping(ByVal WeblogName As String, ByVal WeblogURL As String) As WeblogsUpdateResponse + Dim proxy As IWebLogsUpdate = CType(XmlRpcProxyGen.Create(GetType(IWebLogsUpdate)), IWebLogsUpdate) + Return proxy.Ping(WeblogName, WeblogURL) + End Function + + Structure WeblogsUpdateResponse + Public flerror As Boolean + Public message As String + End Structure + + _ + Public Interface IWebLogsUpdate + _ + Function Ping(ByVal WeblogName As String, ByVal WeblogURL As String) As WeblogsUpdateResponse + End Interface + +#End Region + + End Class + +End Namespace diff --git a/Components/Tracking/TrackBackProxy.vb b/Components/Tracking/TrackBackProxy.vb new file mode 100755 index 0000000..aaa1b91 --- /dev/null +++ b/Components/Tracking/TrackBackProxy.vb @@ -0,0 +1,114 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System.IO +Imports System.Net +Imports System.Text.RegularExpressions + +Namespace Ventrian.NewsArticles.Tracking + + Public Class TrackBackProxy + +#Region " Public Methods " + + Public Function TrackBackPing(ByVal pageText As String, ByVal url As String, ByVal title As String, ByVal link As String, ByVal blogname As String, ByVal description As String) As Boolean + + Dim objLogController As New DotNetNuke.Services.Log.EventLog.EventLogController + Dim objEventLog As New DotNetNuke.Services.Log.EventLog.EventLogController + + ' objEventLog.AddLog("Ping Exception", "Ping with a Return URL of ->" & link, DotNetNuke.Common.Globals.GetPortalSettings(), -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT) + + Dim trackBackItem As String = GetTrackBackText(pageText, url, link) + + If Not trackBackItem Is Nothing Then + + If Not trackBackItem.ToLower().StartsWith("http://") Then + trackBackItem = "http://" + trackBackItem + End If + + Dim parameters As String = "title=" + HtmlEncode(title) + "&url=" + HtmlEncode(link) + "&blog_name=" + HtmlEncode(blogname) + "&excerpt=" + HtmlEncode(description) + SendPing(trackBackItem, parameters) + + Else + + ' objEventLog.AddLog("Ping Exception", "Pinging ->" & link & " -> Trackback Text not found on this page!", DotNetNuke.Common.Globals.GetPortalSettings(), -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT) + + End If + + Return True + + End Function + +#End Region + +#Region " Private Methods " + + Private Function GetTrackBackText(ByVal pageText As String, ByVal url As String, ByVal PostUrl As String) As String + If Not Regex.IsMatch(pageText, PostUrl, RegexOptions.IgnoreCase Or RegexOptions.Singleline) Then + + Dim sPattern As String = "]*?>()?" + Dim r As Regex = New Regex(sPattern, RegexOptions.IgnoreCase) + Dim m As Match + + m = r.Match(pageText) + While (m.Success) + If m.Groups.ToString().Length > 0 Then + + Dim text As String = m.Groups(0).ToString() + If text.IndexOf(url) > 0 Then + Dim tbPattern As String = "trackback:ping=\""([^\""]+)\""" + Dim reg As Regex = New Regex(tbPattern, RegexOptions.IgnoreCase) + Dim m2 As Match = reg.Match(text) + If m2.Success Then + Return m2.Result("$1") + End If + + Return text + End If + End If + m = m.NextMatch + End While + End If + + Return Nothing + + End Function + + Private Function HtmlEncode(ByVal text As String) As String + + Return System.Web.HttpUtility.HtmlEncode(text) + + End Function + + Private Sub SendPing(ByVal trackBackItem As String, ByVal parameters As String) + + Dim myWriter As StreamWriter = Nothing + + Dim request As HttpWebRequest = CType(HttpWebRequest.Create(trackBackItem), HttpWebRequest) + If Not (request Is Nothing) Then + request.UserAgent = "My User Agent String" + request.Referer = "http://www.smcculloch.net/" + request.Timeout = 60000 + End If + + request.Method = "POST" + request.ContentLength = parameters.Length + request.ContentType = "application/x-www-form-urlencoded" + request.KeepAlive = False + + ' Try + myWriter = New StreamWriter(request.GetRequestStream()) + myWriter.Write(parameters) + 'Finally + myWriter.Close() + ' End Try + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Components/Tracking/TrackHelper.vb b/Components/Tracking/TrackHelper.vb new file mode 100755 index 0000000..21df027 --- /dev/null +++ b/Components/Tracking/TrackHelper.vb @@ -0,0 +1,61 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Collections.Specialized +Imports System.IO +Imports System.Net +Imports System.Text +Imports System.Text.RegularExpressions + +Namespace Ventrian.NewsArticles.Tracking + + Public Class TrackHelper + + Public Shared Function BuildLinks(ByVal text As String, ByRef links As StringCollection) As StringCollection + + Dim pattern As String = "(?:[hH][rR][eE][fF]\s*=)(?:[\s""""']*)(?!#|[Mm]ailto|[lL]ocation.|[jJ]avascript|.*css|.*this\.)(.*?)(?:[\s>""""'])" + + Dim r As New Regex(pattern, RegexOptions.IgnoreCase) + + Dim m As Match = r.Match(Common.HtmlDecode(text)) + Dim link As String = "" + While (m.Success) + If (m.Groups.ToString().Length > 0) Then + link = m.Groups(1).ToString() + If (links.Contains(link) = False) Then + links.Add(link) + End If + End If + m = m.NextMatch + End While + + Return links + + End Function + + Public Shared Function GetPageText(ByVal inURL As String) As String + + Dim req As WebRequest = WebRequest.Create(inURL) + Dim wreq As HttpWebRequest = CType(req, HttpWebRequest) + If Not (wreq Is Nothing) Then + wreq.UserAgent = "My User Agent String" + wreq.Referer = "http://www.wwwcoder.com/" + wreq.Timeout = 60000 + End If + Dim response As HttpWebResponse = CType(wreq.GetResponse, HttpWebResponse) + Dim s As Stream = response.GetResponseStream + Dim enc As String = response.ContentEncoding.Trim + If enc = "" Then enc = "us-ascii" + Dim encode As Encoding = System.Text.Encoding.GetEncoding(enc) + Dim sr As StreamReader = New StreamReader(s, encode) + Return sr.ReadToEnd + + End Function + + End Class + +End Namespace diff --git a/Components/Types/AuthorSelectType.vb b/Components/Types/AuthorSelectType.vb new file mode 100755 index 0000000..60b1371 --- /dev/null +++ b/Components/Types/AuthorSelectType.vb @@ -0,0 +1,22 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles.Components.Types + + Public Enum AuthorSelectType + + ByDropdown + ByUsername + + End Enum + +End Namespace diff --git a/Components/Types/MenuPositionType.vb b/Components/Types/MenuPositionType.vb new file mode 100755 index 0000000..dca144a --- /dev/null +++ b/Components/Types/MenuPositionType.vb @@ -0,0 +1,22 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles.Components.Types + + Public Enum MenuPositionType + + Top + Bottom + + End Enum + +End Namespace diff --git a/Components/Types/TextEditorModeType.vb b/Components/Types/TextEditorModeType.vb new file mode 100755 index 0000000..11f430f --- /dev/null +++ b/Components/Types/TextEditorModeType.vb @@ -0,0 +1,22 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles.Components.Types + + Public Enum TextEditorModeType + + Basic + Rich + + End Enum + +End Namespace diff --git a/Components/Types/UrlModeType.vb b/Components/Types/UrlModeType.vb new file mode 100755 index 0000000..b2f0347 --- /dev/null +++ b/Components/Types/UrlModeType.vb @@ -0,0 +1,22 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Configuration +Imports System.Data + +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles.Components.Types + + Public Enum UrlModeType + + Classic + Shorterned + + End Enum + +End Namespace diff --git a/Components/UserTime.vb b/Components/UserTime.vb new file mode 100755 index 0000000..f03ba72 --- /dev/null +++ b/Components/UserTime.vb @@ -0,0 +1,91 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Data +Imports System.web + +Imports DotNetNuke +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Portals +Imports DotNetNuke.Entities.Users + +Namespace Ventrian.NewsArticles + + Public Class UserTime1 + + Public Sub New() + + End Sub + + Public Function ConvertToUserTime(ByVal dt As DateTime, ByVal ClientTimeZone As Double) As DateTime + + Dim _portalSettings As PortalSettings = PortalController.GetCurrentPortalSettings + + Return dt.AddMinutes(ClientTimeZone) + + End Function + + Public Function ConvertToServerTime(ByVal dt As DateTime, ByVal ClientTimeZone As Double) As DateTime + + Dim _portalSettings As PortalSettings = PortalController.GetCurrentPortalSettings + + Return dt.AddMinutes(ClientTimeZone * -1) + + + End Function + + Public ReadOnly Property ClientToServerTimeZoneFactor(ByVal serverTimeZoneOffet As Integer) As Double + + Get + + Dim objUserInfo As UserInfo = UserController.GetCurrentUserInfo + Return FromClientToServerFactor(objUserInfo.Profile.TimeZone, serverTimeZoneOffet) + + End Get + + End Property + + Public ReadOnly Property PortalToServerTimeZoneFactor(ByVal serverTimeZoneOffet As Integer) As Double + + Get + + Dim _portalSettings As PortalSettings = PortalController.GetCurrentPortalSettings + Return FromClientToServerFactor(_portalSettings.TimeZoneOffset, serverTimeZoneOffet) + + End Get + + End Property + + + Public ReadOnly Property ServerToClientTimeZoneFactor() As Double + + Get + + Dim objUser As UserInfo = UserController.GetCurrentUserInfo() + Dim _portalSettings As PortalSettings = PortalController.GetCurrentPortalSettings + Return FromServerToClientFactor(objUser.Profile.TimeZone, _portalSettings.TimeZoneOffset) + + End Get + + End Property + + Private Function FromClientToServerFactor(ByVal Client As Double, ByVal Server As Double) As Double + + Return Client - Server + + End Function + + Private Function FromServerToClientFactor(ByVal Client As Double, ByVal Server As Double) As Double + + Return Server - Client + + End Function + + End Class + +End Namespace + diff --git a/Components/Utility/LocalizationUtil.vb b/Components/Utility/LocalizationUtil.vb new file mode 100755 index 0000000..5f47a1e --- /dev/null +++ b/Components/Utility/LocalizationUtil.vb @@ -0,0 +1,140 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2008 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System.IO +Imports System.Xml + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Portals +Imports DotNetNuke.Services.Localization + +Namespace Ventrian.NewsArticles.Components.Utility + + Public Class LocalizationUtil + +#Region " Private Members " + + Private Shared _strUseLanguageInUrlDefault As String = Null.NullString + +#End Region + +#Region " Public Methods " + + Private Shared Function GetHostSettingAsBoolean(ByVal key As String, ByVal defaultValue As Boolean) As Boolean + Dim retValue As Boolean = defaultValue + Try + Dim setting As String = DotNetNuke.Entities.Host.HostSettings.GetHostSetting(key) + If String.IsNullOrEmpty(setting) = False Then + retValue = (setting.ToUpperInvariant().StartsWith("Y") OrElse setting.ToUpperInvariant = "TRUE") + End If + Catch ex As Exception + 'we just want to trap the error as we may not be installed so there will be no Settings + End Try + Return retValue + End Function + + Private Shared Function GetPortalSettingAsBoolean(ByVal portalID As Integer, ByVal key As String, ByVal defaultValue As Boolean) As Boolean + Dim retValue As Boolean = defaultValue + Try + Dim setting As String = DotNetNuke.Entities.Portals.PortalSettings.GetSiteSetting(portalID, key) + If String.IsNullOrEmpty(setting) = False Then + retValue = (setting.ToUpperInvariant().StartsWith("Y") OrElse setting.ToUpperInvariant = "TRUE") + End If + Catch ex As Exception + 'we just want to trap the error as we may not be installed so there will be no Settings + End Try + Return retValue + End Function + + Public Shared Function UseLanguageInUrl() As Boolean + + Dim hostSetting As String = DotNetNuke.Entities.Host.HostSettings.GetHostSetting("EnableUrlLanguage") + If (hostSetting <> "") Then + Return GetHostSettingAsBoolean("EnableUrlLanguage", True) + End If + + Dim objSettings As PortalSettings = PortalController.GetCurrentPortalSettings() + Dim portalSetting As String = DotNetNuke.Entities.Portals.PortalSettings.GetSiteSetting(objSettings.PortalId, "EnableUrlLanguage") + If (portalSetting <> "") Then + Return GetPortalSettingAsBoolean(objSettings.PortalId, "EnableUrlLanguage", True) + End If + + If (File.Exists(HttpContext.Current.Server.MapPath(Localization.ApplicationResourceDirectory + "/Locales.xml")) = False) Then + Return GetHostSettingAsBoolean("EnableUrlLanguage", True) + End If + + Dim cacheKey As String = "" + Dim objPortalSettings As PortalSettings = PortalController.GetCurrentPortalSettings() + Dim useLanguage As Boolean = False + + ' check default host setting + If String.IsNullOrEmpty(_strUseLanguageInUrlDefault) Then + Dim xmldoc As New XmlDocument + Dim languageInUrl As XmlNode + + xmldoc.Load(HttpContext.Current.Server.MapPath(Localization.ApplicationResourceDirectory + "/Locales.xml")) + languageInUrl = xmldoc.SelectSingleNode("//root/languageInUrl") + If Not languageInUrl Is Nothing Then + _strUseLanguageInUrlDefault = languageInUrl.Attributes("enabled").InnerText + Else + Try + Dim version As Integer = Convert.ToInt32(PortalController.GetCurrentPortalSettings().Version.Replace(".", "")) + If (version >= 490) Then + _strUseLanguageInUrlDefault = "true" + Else + _strUseLanguageInUrlDefault = "false" + End If + Catch + _strUseLanguageInUrlDefault = "false" + End Try + End If + End If + useLanguage = Boolean.Parse(_strUseLanguageInUrlDefault) + + ' check current portal setting + Dim FilePath As String = HttpContext.Current.Server.MapPath(Localization.ApplicationResourceDirectory + "/Locales.Portal-" + objPortalSettings.PortalId.ToString + ".xml") + If File.Exists(FilePath) Then + cacheKey = "dotnetnuke-uselanguageinurl" & objPortalSettings.PortalId.ToString + Try + Dim o As Object = DataCache.GetCache(cacheKey) + If o Is Nothing Then + Dim xmlLocales As New XmlDocument + Dim bXmlLoaded As Boolean = False + + xmlLocales.Load(FilePath) + bXmlLoaded = True + + Dim d As New XmlDocument + d.Load(FilePath) + + If bXmlLoaded AndAlso Not xmlLocales.SelectSingleNode("//locales/languageInUrl") Is Nothing Then + useLanguage = Boolean.Parse(xmlLocales.SelectSingleNode("//locales/languageInUrl").Attributes("enabled").InnerText) + End If + If Globals.PerformanceSetting <> Globals.PerformanceSettings.NoCaching Then + Dim dp As New CacheDependency(FilePath) + DataCache.SetCache(cacheKey, useLanguage, dp) + End If + Else + useLanguage = CType(o, Boolean) + End If + Catch ex As Exception + End Try + + Return useLanguage + Else + Return useLanguage + End If + + End Function + +#End Region + + End Class + +End Namespace + + diff --git a/Components/Validators/CheckBoxListValidator.vb b/Components/Validators/CheckBoxListValidator.vb new file mode 100755 index 0000000..1d5adfd --- /dev/null +++ b/Components/Validators/CheckBoxListValidator.vb @@ -0,0 +1,114 @@ +Imports System.Web +Imports System +Imports System.ComponentModel +Imports System.Collections.Generic +Imports System.IO +Imports System.Text +Imports System.Web.UI +Imports System.Web.UI.WebControls +Imports System.Xml + +Namespace Ventrian.NewsArticles.Components.Validators + Public Class CheckBoxListValidator + Inherits BaseValidator + _ + Public Property MinimumNumberOfSelectedCheckBoxes() As Integer + Get + Dim o As Object = ViewState("MinimumNumberOfSelectedCheckBoxes") + If o Is Nothing Then + Return 1 + Else + Return CInt(o) + End If + End Get + Set(ByVal value As Integer) + ViewState("MinimumNumberOfSelectedCheckBoxes") = value + End Set + End Property + + Private _ctrlToValidate As CheckBoxList = Nothing + Protected ReadOnly Property CheckBoxListToValidate() As CheckBoxList + Get + If _ctrlToValidate Is Nothing Then + _ctrlToValidate = TryCast(FindControl(Me.ControlToValidate), CheckBoxList) + End If + + Return _ctrlToValidate + End Get + End Property + + Protected Overloads Overrides Function ControlPropertiesValid() As Boolean + ' Make sure ControlToValidate is set + If Me.ControlToValidate.Length = 0 Then + Throw New HttpException(String.Format("The ControlToValidate property of '{0}' cannot be blank.", Me.ID)) + End If + + ' Ensure that the control being validated is a CheckBoxList + If CheckBoxListToValidate Is Nothing Then + Throw New HttpException(String.Format("The CheckBoxListValidator can only validate controls of type CheckBoxList.")) + End If + + ' ... and that it has at least MinimumNumberOfSelectedCheckBoxes ListItems + 'If CheckBoxListToValidate.Items.Count < MinimumNumberOfSelectedCheckBoxes Then + ' Throw New HttpException(String.Format("MinimumNumberOfSelectedCheckBoxes must be set to a value greater than or equal to the number of ListItems; MinimumNumberOfSelectedCheckBoxes is set to {0}, but there are only {1} ListItems in '{2}'", MinimumNumberOfSelectedCheckBoxes, CheckBoxListToValidate.Items.Count, CheckBoxListToValidate.ID)) + 'End If + + Return True + ' if we reach here, everything checks out + End Function + + Protected Overloads Overrides Function EvaluateIsValid() As Boolean + ' Make sure that the CheckBoxList has at least MinimumNumberOfSelectedCheckBoxes ListItems selected + Dim selectedItemCount As Integer = 0 + For Each cb As ListItem In CheckBoxListToValidate.Items + If cb.Selected Then + selectedItemCount += 1 + End If + Next + + Return selectedItemCount >= MinimumNumberOfSelectedCheckBoxes + End Function + + Protected Overloads Overrides Sub AddAttributesToRender(ByVal writer As HtmlTextWriter) + MyBase.AddAttributesToRender(writer) + + ' Add the client-side code (if needed) + If Me.RenderUplevel Then + ' Indicate the mustBeChecked value and the client-side function to used for evaluation + ' Use AddAttribute if Helpers.EnableLegacyRendering is true; otherwise, use expando attributes + If EnableLegacyRendering() Then + writer.AddAttribute("evaluationfunction", "CheckBoxListValidatorEvaluateIsValid", False) + writer.AddAttribute("minimumNumberOfSelectedCheckBoxes", MinimumNumberOfSelectedCheckBoxes.ToString(), False) + Else + Me.Page.ClientScript.RegisterExpandoAttribute(Me.ClientID, "evaluationfunction", "CheckBoxListValidatorEvaluateIsValid", False) + Me.Page.ClientScript.RegisterExpandoAttribute(Me.ClientID, "minimumNumberOfSelectedCheckBoxes", MinimumNumberOfSelectedCheckBoxes.ToString(), False) + End If + End If + End Sub + + Protected Overloads Overrides Sub OnPreRender(ByVal e As EventArgs) + MyBase.OnPreRender(e) + + ' Register the client-side function using WebResource.axd (if needed) + ' see: http://aspnet.4guysfromrolla.com/articles/080906-1.aspx + If Me.RenderUplevel AndAlso Me.Page IsNot Nothing AndAlso Not Me.Page.ClientScript.IsClientScriptIncludeRegistered(Me.[GetType](), "VentrianValidators") Then + Me.Page.ClientScript.RegisterClientScriptInclude(Me.[GetType](), "VentrianValidators", Me.Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Includes/VentrianValidators.js")) + End If + End Sub + + Private Function EnableLegacyRendering() As Boolean + Dim result As Boolean + + Try + Dim webConfigFile As String = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "web.config") + Dim webConfigReader As New XmlTextReader(New StreamReader(webConfigFile)) + result = ((webConfigReader.ReadToFollowing("xhtmlConformance")) AndAlso (webConfigReader.GetAttribute("mode") = "Legacy")) + webConfigReader.Close() + Catch + result = False + End Try + Return result + End Function + + End Class +End Namespace diff --git a/Components/WatermarkPosition.vb b/Components/WatermarkPosition.vb new file mode 100755 index 0000000..ac974ab --- /dev/null +++ b/Components/WatermarkPosition.vb @@ -0,0 +1,14 @@ +Namespace Ventrian.NewsArticles + + Public Enum WatermarkPosition + + TopLeft + TopRight + BottomLeft + BottomRight + + End Enum + +End Namespace + + diff --git a/Components/WebControls/PagingControl.vb b/Components/WebControls/PagingControl.vb new file mode 100755 index 0000000..3228708 --- /dev/null +++ b/Components/WebControls/PagingControl.vb @@ -0,0 +1,391 @@ +' +' DotNetNuke® - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by DotNetNuke Corporation +' +' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +' documentation files (the "Software"), to deal in the Software without restriction, including without limitation +' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and +' to permit persons to whom the Software is furnished to do so, subject to the following conditions: +' +' The above copyright notice and this permission notice shall be included in all copies or substantial portions +' of the Software. +' +' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +' DEALINGS IN THE SOFTWARE. +' + +Imports System.ComponentModel +Imports System.Web.UI +Imports DotNetNuke +Imports DotNetNuke.Common + +Namespace Ventrian.NewsArticles.Components.WebControls + + ")> Public Class PagingControl + Inherits System.Web.UI.WebControls.WebControl + + Protected tablePageNumbers As System.Web.UI.WebControls.Table + Protected WithEvents PageNumbers As System.Web.UI.WebControls.Repeater + Protected cellDisplayStatus As System.Web.UI.WebControls.TableCell + Protected cellDisplayLinks As System.Web.UI.WebControls.TableCell + + Private TotalPages As Integer = -1 + + Private _TotalRecords As Integer + Private _PageSize As Integer + Private _CurrentPage As Integer + Private _QuerystringParams As String + Private _PageParam As String = "lapg" + Private _TabID As Integer + Private _CSSClassLinkActive As String + Private _CSSClassLinkInactive As String + Private _CSSClassPagingStatus As String + + Property TotalRecords() As Integer + Get + Return _TotalRecords + End Get + + Set(ByVal Value As Integer) + _TotalRecords = Value + End Set + End Property + Property PageSize() As Integer + Get + Return _PageSize + End Get + + Set(ByVal Value As Integer) + _PageSize = Value + End Set + End Property + Property CurrentPage() As Integer + Get + Return _CurrentPage + End Get + + Set(ByVal Value As Integer) + _CurrentPage = Value + End Set + End Property + Property QuerystringParams() As String + Get + Return _QuerystringParams + End Get + + Set(ByVal Value As String) + _QuerystringParams = Value + End Set + End Property + Property TabID() As Integer + Get + Return _TabID + End Get + + Set(ByVal Value As Integer) + _TabID = Value + End Set + End Property + Property PageParam() As String + Get + Return _PageParam + End Get + + Set(ByVal Value As String) + _PageParam = Value + End Set + End Property + Property CSSClassLinkActive() As String + Get + If _CSSClassLinkActive = "" Then + Return "CommandButton" + Else + Return _CSSClassLinkActive + End If + End Get + + Set(ByVal Value As String) + _CSSClassLinkActive = Value + End Set + End Property + Property CSSClassLinkInactive() As String + Get + If _CSSClassLinkInactive = "" Then + Return "NormalDisabled" + Else + Return _CSSClassLinkInactive + End If + End Get + + Set(ByVal Value As String) + _CSSClassLinkInactive = Value + End Set + End Property + Property CSSClassPagingStatus() As String + Get + If _CSSClassPagingStatus = "" Then + Return "Normal" + Else + Return _CSSClassPagingStatus + End If + End Get + + Set(ByVal Value As String) + _CSSClassPagingStatus = Value + End Set + End Property + + Protected Overrides Sub CreateChildControls() + tablePageNumbers = New System.Web.UI.WebControls.Table + cellDisplayStatus = New System.Web.UI.WebControls.TableCell + cellDisplayLinks = New System.Web.UI.WebControls.TableCell + cellDisplayStatus.CssClass = "Normal" + cellDisplayLinks.CssClass = "Normal" + + If Me.CssClass = "" Then + tablePageNumbers.CssClass = "PagingTable" + Else + tablePageNumbers.CssClass = Me.CssClass + End If + + Dim intRowIndex As Integer = tablePageNumbers.Rows.Add(New TableRow) + + PageNumbers = New Repeater + Dim I As New PageNumberLinkTemplate(Me) + PageNumbers.ItemTemplate = I + BindPageNumbers(TotalRecords, PageSize) + + cellDisplayStatus.HorizontalAlign = HorizontalAlign.Left + cellDisplayStatus.Width = New Unit("50%") + cellDisplayLinks.HorizontalAlign = HorizontalAlign.Right + cellDisplayLinks.Width = New Unit("50%") + Dim intTotalPages As Integer = TotalPages + If intTotalPages = 0 Then intTotalPages = 1 + + Dim str As String + str = String.Format(Services.Localization.Localization.GetString("Pages"), CurrentPage.ToString, intTotalPages.ToString) + Dim lit As New LiteralControl(str) + cellDisplayStatus.Controls.Add(lit) + + tablePageNumbers.Rows(intRowIndex).Cells.Add(cellDisplayStatus) + tablePageNumbers.Rows(intRowIndex).Cells.Add(cellDisplayLinks) + + End Sub + + Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter) + If PageNumbers Is Nothing Then + CreateChildControls() + End If + + Dim str As New System.Text.StringBuilder + + str.Append(GetFirstLink() + "   ") + str.Append(GetPreviousLink() + "   ") + Dim result As System.Text.StringBuilder = New System.Text.StringBuilder(1024) + PageNumbers.RenderControl(New HtmlTextWriter(New System.IO.StringWriter(result))) + str.Append(result.ToString()) + str.Append(GetNextLink() + "   ") + str.Append(GetLastLink() + "   ") + cellDisplayLinks.Controls.Add(New LiteralControl(str.ToString)) + + tablePageNumbers.RenderControl(output) + + End Sub + + + Private Sub BindPageNumbers(ByVal TotalRecords As Integer, ByVal RecordsPerPage As Integer) + Dim PageLinksPerPage As Integer = 10 + If TotalRecords / RecordsPerPage >= 1 Then + TotalPages = Convert.ToInt32(Math.Ceiling(CType(TotalRecords / RecordsPerPage, Double))) + Else + TotalPages = 0 + End If + + If TotalPages > 0 Then + Dim ht As New DataTable + ht.Columns.Add("PageNum") + Dim tmpRow As DataRow + + Dim LowNum As Integer = 1 + Dim HighNum As Integer = CType(TotalPages, Integer) + + Dim tmpNum As Double + tmpNum = CurrentPage - PageLinksPerPage / 2 + If tmpNum < 1 Then tmpNum = 1 + + If CurrentPage > (PageLinksPerPage / 2) Then + LowNum = CType(Math.Floor(tmpNum), Integer) + End If + + If CType(TotalPages, Integer) <= PageLinksPerPage Then + HighNum = CType(TotalPages, Integer) + Else + HighNum = LowNum + PageLinksPerPage - 1 + End If + + If HighNum > CType(TotalPages, Integer) Then + HighNum = CType(TotalPages, Integer) + If HighNum - LowNum < PageLinksPerPage Then + LowNum = HighNum - PageLinksPerPage + 1 + End If + End If + + If HighNum > CType(TotalPages, Integer) Then HighNum = CType(TotalPages, Integer) + If LowNum < 1 Then LowNum = 1 + + Dim i As Integer + For i = LowNum To HighNum + tmpRow = ht.NewRow + tmpRow("PageNum") = i + ht.Rows.Add(tmpRow) + Next + + PageNumbers.DataSource = ht + PageNumbers.DataBind() + End If + + End Sub + + Private Function CreateURL(ByVal CurrentPage As String) As String + + If QuerystringParams <> "" Then + If CurrentPage <> "" Then + Return Globals.NavigateURL(TabID, "", QuerystringParams, PageParam & "=" & CurrentPage) + Else + Return Globals.NavigateURL(TabID, "", QuerystringParams) + End If + Else + If CurrentPage <> "" Then + Return Globals.NavigateURL(TabID, "", PageParam & "=" & CurrentPage) + Else + Return Globals.NavigateURL(TabID) + End If + End If + + End Function + + ''' ----------------------------------------------------------------------------- + ''' + ''' GetLink returns the page number links for paging. + ''' + ''' + ''' + ''' + ''' [dancaron] 10/28/2004 Initial Version + ''' + ''' ----------------------------------------------------------------------------- + Private Function GetLink(ByVal PageNum As Integer) As String + If PageNum = CurrentPage Then + Return "[" + PageNum.ToString + "]" + Else + Return "" + PageNum.ToString + "" + End If + End Function + + ''' ----------------------------------------------------------------------------- + ''' + ''' GetPreviousLink returns the link for the Previous page for paging. + ''' + ''' + ''' + ''' + ''' [dancaron] 10/28/2004 Initial Version + ''' + ''' ----------------------------------------------------------------------------- + Private Function GetPreviousLink() As String + If CurrentPage > 1 AndAlso TotalPages > 0 Then + Return "" & Services.Localization.Localization.GetString("Previous", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & "" + Else + Return "" & Services.Localization.Localization.GetString("Previous", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & "" + End If + End Function + + ''' ----------------------------------------------------------------------------- + ''' + ''' GetNextLink returns the link for the Next Page for paging. + ''' + ''' + ''' + ''' + ''' [dancaron] 10/28/2004 Initial Version + ''' + ''' ----------------------------------------------------------------------------- + Private Function GetNextLink() As String + If CurrentPage <> TotalPages And TotalPages > 0 Then + Return "" & Services.Localization.Localization.GetString("Next", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & "" + Else + Return "" & Services.Localization.Localization.GetString("Next", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & "" + End If + End Function + + ''' ----------------------------------------------------------------------------- + ''' + ''' GetFirstLink returns the First Page link for paging. + ''' + ''' + ''' + ''' + ''' [dancaron] 10/28/2004 Initial Version + ''' + ''' ----------------------------------------------------------------------------- + Private Function GetFirstLink() As String + If CurrentPage > 1 AndAlso TotalPages > 0 Then + Return "" & Services.Localization.Localization.GetString("First", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & "" + Else + Return "" & Services.Localization.Localization.GetString("First", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & "" + End If + End Function + + ''' ----------------------------------------------------------------------------- + ''' + ''' GetLastLink returns the Last Page link for paging. + ''' + ''' + ''' + ''' + ''' [dancaron] 10/28/2004 Initial Version + ''' + ''' ----------------------------------------------------------------------------- + Private Function GetLastLink() As String + If CurrentPage <> TotalPages And TotalPages > 0 Then + Return "" & Services.Localization.Localization.GetString("Last", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & "" + Else + Return "" & Services.Localization.Localization.GetString("Last", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & "" + End If + End Function + + Public Class PageNumberLinkTemplate + Implements ITemplate + Shared itemcount As Integer = 0 + Private _PagingControl As PagingControl + + Sub New(ByVal ctlPagingControl As PagingControl) + _PagingControl = ctlPagingControl + End Sub + + Sub InstantiateIn(ByVal container As Control) _ + Implements ITemplate.InstantiateIn + + Dim l As New Literal + AddHandler l.DataBinding, AddressOf Me.BindData + container.Controls.Add(l) + End Sub + + Private Sub BindData(ByVal sender As Object, ByVal e As System.EventArgs) + Dim lc As Literal + lc = CType(sender, Literal) + Dim container As RepeaterItem + container = CType(lc.NamingContainer, RepeaterItem) + lc.Text = _PagingControl.GetLink(Convert.ToInt32(DataBinder.Eval(container.DataItem, "PageNum"))) + "  " + End Sub + + End Class + + End Class + + +End Namespace \ No newline at end of file diff --git a/Components/WebControls/RefreshControl.vb b/Components/WebControls/RefreshControl.vb new file mode 100755 index 0000000..f1187b1 --- /dev/null +++ b/Components/WebControls/RefreshControl.vb @@ -0,0 +1,9 @@ + +Namespace Ventrian.NewsArticles.Components.WebControls + + Public Class RefreshControl + Inherits System.Web.UI.WebControls.LinkButton + + End Class + +End Namespace diff --git a/Controls/Listing.ascx b/Controls/Listing.ascx new file mode 100755 index 0000000..6069232 --- /dev/null +++ b/Controls/Listing.ascx @@ -0,0 +1,6 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Listing.ascx.vb" Inherits="Ventrian.NewsArticles.Controls.Listing" %> + + + + + \ No newline at end of file diff --git a/Controls/Listing.ascx.designer.vb b/Controls/Listing.ascx.designer.vb new file mode 100755 index 0000000..0b1313b --- /dev/null +++ b/Controls/Listing.ascx.designer.vb @@ -0,0 +1,35 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles.Controls + + Partial Public Class Listing + + ''' + '''rptListing control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents rptListing As Global.System.Web.UI.WebControls.Repeater + + ''' + '''phNoArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phNoArticles As Global.System.Web.UI.WebControls.PlaceHolder + End Class +End Namespace diff --git a/Controls/Listing.ascx.vb b/Controls/Listing.ascx.vb new file mode 100755 index 0000000..ee4af6a --- /dev/null +++ b/Controls/Listing.ascx.vb @@ -0,0 +1,1593 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.UI.WebControls +Imports Ventrian.NewsArticles.Components.CustomFields +Imports DotNetNuke.Security + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles.Controls + + Partial Public Class Listing + Inherits System.Web.UI.UserControl + +#Region " Private Members " + + Private _objLayoutController As LayoutController + + Private _objLayoutHeader As LayoutInfo + Private _objLayoutItem As LayoutInfo + Private _objLayoutFeatured As LayoutInfo + Private _objLayoutFooter As LayoutInfo + Private _objLayoutEmpty As LayoutInfo + + Private _articleList As List(Of ArticleInfo) + Private _articleCount As Integer + + Private _agedDate As DateTime + Private _author As Integer + Private _bindArticles As Boolean + Private _featuredOnly As Boolean + Private _filterCategories As Integer() + Private _includeCategory As Boolean + Private _matchCategories As MatchOperatorType + Private _maxArticles As Integer + Private _month As Integer + Private _notFeaturedOnly As Boolean + Private _notSecuredOnly As Boolean + Private _searchText As String + Private _securedOnly As Boolean + Private _showExpired As Boolean + Private _showMessage As Boolean + Private _showPending As Boolean + Private _sortBy As String + Private _sortDirection As String + Private _startDate As DateTime + Private _tag As String + Private _year As Integer + + Public IsIndexed As Boolean = True + + Private _customFieldID As Integer = Null.NullInteger + Private _customValue As String = Null.NullString + +#End Region + +#Region " Private Properties " + + Private ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase + Get + Return CType(Parent, NewsArticleModuleBase) + End Get + End Property + + Private ReadOnly Property ArticleSettings() As ArticleSettings + Get + Return ArticleModuleBase.ArticleSettings + End Get + End Property + + Private ReadOnly Property CurrentPage() As Integer + Get + If (Request("Page") = Null.NullString And Request("CurrentPage") = Null.NullString) Then + Return 1 + Else + IsIndexed = False + Try + If (Request("Page") <> Null.NullString) Then + Return Convert.ToInt32(Request("Page")) + Else + Return Convert.ToInt32(Request("CurrentPage")) + End If + Catch + Return 1 + End Try + End If + End Get + End Property + +#End Region + +#Region " Public Properties " + + Public Property AgedDate() As DateTime + Get + Return _agedDate + End Get + Set(ByVal Value As DateTime) + _agedDate = Value + End Set + End Property + + Public Property Author() As Integer + Get + Return _author + End Get + Set(ByVal Value As Integer) + _author = Value + End Set + End Property + + Public Property BindArticles() As Boolean + Get + Return _bindArticles + End Get + Set(ByVal Value As Boolean) + _bindArticles = Value + End Set + End Property + + Private ReadOnly Property DynamicAuthorID() As Integer + Get + Dim id As Integer = Null.NullInteger + If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + If (IsNumeric(Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()))) Then + id = Convert.ToInt32(Request("naauth-" & ArticleModuleBase.TabModuleId.ToString())) + End If + End If + + Return id + End Get + End Property + + Private ReadOnly Property DynamicAZ() As String + Get + Dim id As String = Null.NullString + If (Request("naaz-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + id = Request("naaz-" & ArticleModuleBase.TabModuleId.ToString()) + End If + Return id + End Get + End Property + + Private ReadOnly Property DynamicCategoryID() As Integer + Get + Dim id As Integer = Null.NullInteger + If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + If (IsNumeric(Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()))) Then + id = Convert.ToInt32(Request("nacat-" & ArticleModuleBase.TabModuleId.ToString())) + End If + End If + + Return id + End Get + End Property + + Private ReadOnly Property DynamicSortBy() As String + Get + Dim sort As String = "" + + If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + Select Case Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()).ToLower() + Case "publishdate" + sort = "StartDate" + Exit Select + Case "expirydate" + sort = "EndDate" + Exit Select + Case "lastupdate" + sort = "LastUpdate" + Exit Select + Case "rating" + sort = "Rating DESC, RatingCount" + Exit Select + Case "commentcount" + sort = "CommentCount" + Exit Select + Case "numberofviews" + sort = "NumberOfViews" + Exit Select + Case "random" + sort = "NewID()" + Exit Select + Case "title" + sort = "Title" + Exit Select + End Select + End If + + Return sort + End Get + End Property + + Private ReadOnly Property DynamicTime() As String + Get + Dim val As String = "" + + If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + val = Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) + End If + + Return val + End Get + End Property + + Public Property FeaturedOnly() As Boolean + Get + Return _featuredOnly + End Get + Set(ByVal Value As Boolean) + _featuredOnly = Value + End Set + End Property + + Public Property FilterCategories() As Integer() + Get + Return _filterCategories + End Get + Set(ByVal Value As Integer()) + _filterCategories = Value + End Set + End Property + + Public Property IncludeCategory() As Boolean + Get + Return _includeCategory + End Get + Set(ByVal Value As Boolean) + _includeCategory = Value + End Set + End Property + + Public Property MatchCategories() As MatchOperatorType + Get + Return _matchCategories + End Get + Set(ByVal Value As MatchOperatorType) + _matchCategories = Value + End Set + End Property + + Public Property MaxArticles() As Integer + Get + Return _maxArticles + End Get + Set(ByVal Value As Integer) + _maxArticles = Value + End Set + End Property + + Public Property Month() As Integer + Get + Return _month + End Get + Set(ByVal Value As Integer) + _month = Value + End Set + End Property + + Public Property NotFeaturedOnly() As Boolean + Get + Return _notFeaturedOnly + End Get + Set(ByVal Value As Boolean) + _notFeaturedOnly = Value + End Set + End Property + + Public Property NotSecuredOnly() As Boolean + Get + Return _notSecuredOnly + End Get + Set(ByVal Value As Boolean) + _notSecuredOnly = Value + End Set + End Property + + Public Property SearchText() As String + Get + Return _searchText + End Get + Set(ByVal Value As String) + _searchText = Value + End Set + End Property + + Public Property SecuredOnly() As Boolean + Get + Return _securedOnly + End Get + Set(ByVal Value As Boolean) + _securedOnly = Value + End Set + End Property + + Public Property ShowExpired() As Boolean + Get + Return _showExpired + End Get + Set(ByVal Value As Boolean) + _showExpired = Value + End Set + End Property + + Public Property ShowMessage() As Boolean + Get + Return _showMessage + End Get + Set(ByVal Value As Boolean) + _showMessage = Value + End Set + End Property + + Public Property ShowPending() As Boolean + Get + Return _showPending + End Get + Set(ByVal Value As Boolean) + _showPending = Value + End Set + End Property + + Public Property SortBy() As String + Get + Return _sortBy + End Get + Set(ByVal Value As String) + _sortBy = Value + End Set + End Property + + Public Property SortDirection() As String + Get + Return _sortDirection + End Get + Set(ByVal Value As String) + _sortDirection = Value + End Set + End Property + + Public Property StartDate() As DateTime + Get + Return _startDate + End Get + Set(ByVal Value As DateTime) + _startDate = Value + End Set + End Property + + Public Property Tag() As String + Get + Return _tag + End Get + Set(ByVal Value As String) + _tag = Value + End Set + End Property + + Public Property Year() As Integer + Get + Return _year + End Get + Set(ByVal Value As Integer) + _year = Value + End Set + End Property + +#End Region + +#Region " Private Methods " + + Public Sub BindListing() + + InitializeTemplate() + + If (_year <> Null.NullInteger AndAlso _month <> Null.NullInteger) Then + _agedDate = New DateTime(_year, _month, 1) + StartDate = AgedDate.AddMonths(1).AddSeconds(-1) + End If + + If (_year <> Null.NullInteger AndAlso _month = Null.NullInteger) Then + _agedDate = New DateTime(_year, 1, 1) + StartDate = AgedDate.AddYears(1).AddSeconds(-1) + End If + + Dim objTags() As Integer = Nothing + If (_tag <> Null.NullString) Then + Dim objTagController As New TagController() + Dim objTag As TagInfo = objTagController.Get(ArticleModuleBase.ModuleId, _tag.ToLower()) + If (objTag IsNot Nothing) Then + Dim tags As New List(Of Integer) + tags.Add(objTag.TagID) + objTags = tags.ToArray() + End If + End If + + If (FilterCategories IsNot Nothing AndAlso FilterCategories.Length = 1) Then + + Dim objCategoryController As New CategoryController + Dim objCategory As CategoryInfo = objCategoryController.GetCategory(FilterCategories(0), ArticleModuleBase.ModuleId) + + If Not (objCategory Is Nothing) Then + + If (objCategory.InheritSecurity = False) Then + If (ArticleModuleBase.Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + If (PortalSecurity.IsInRoles(ArticleModuleBase.Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString()) = False) Then + Response.Redirect(NavigateURL(ArticleModuleBase.TabId), True) + End If + End If + End If + + Dim objArticleController As New ArticleController + _articleList = objArticleController.GetArticleList(ArticleModuleBase.ModuleId, StartDate, _agedDate, FilterCategories, (MatchCategories = MatchOperatorType.MatchAll), Nothing, MaxArticles, CurrentPage, ArticleSettings.PageSize, SortBy, SortDirection, True, False, SearchText.Replace("'", "''"), Author, ShowPending, ShowExpired, FeaturedOnly, NotFeaturedOnly, SecuredOnly, NotSecuredOnly, Null.NullString, objTags, False, Null.NullString, _customFieldID, _customValue, Null.NullString, _articleCount) + + End If + Else + Dim objCategoryController As New CategoryController + Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(ArticleModuleBase.ModuleId, Null.NullInteger) + + Dim excludeCategoriesRestrictive As New List(Of Integer) + + For Each objCategory As CategoryInfo In objCategories + If (objCategory.InheritSecurity = False And objCategory.CategorySecurityType = CategorySecurityType.Restrict) Then + If (Request.IsAuthenticated) Then + If (ArticleModuleBase.Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + If (PortalSecurity.IsInRoles(ArticleModuleBase.Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString()) = False) Then + excludeCategoriesRestrictive.Add(objCategory.CategoryID) + End If + End If + Else + excludeCategoriesRestrictive.Add(objCategory.CategoryID) + End If + End If + Next + + Dim excludeCategories As New List(Of Integer) + + For Each objCategory As CategoryInfo In objCategories + If (objCategory.InheritSecurity = False And objCategory.CategorySecurityType = CategorySecurityType.Loose) Then + If (Request.IsAuthenticated) Then + If (ArticleModuleBase.Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + If (PortalSecurity.IsInRoles(ArticleModuleBase.Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString()) = False) Then + excludeCategories.Add(objCategory.CategoryID) + End If + End If + Else + excludeCategories.Add(objCategory.CategoryID) + End If + End If + Next + + Dim includeCategories As New List(Of Integer) + + If (excludeCategories.Count > 0) Then + + For Each objCategoryToInclude As CategoryInfo In objCategories + + Dim includeCategorySecurity As Boolean = True + + For Each exclCategory As Integer In excludeCategories + If (exclCategory = objCategoryToInclude.CategoryID) Then + includeCategorySecurity = False + End If + Next + + + If (FilterCategories IsNot Nothing) Then + If (FilterCategories.Length > 0) Then + Dim filter As Boolean = False + For Each cat As Integer In FilterCategories + If (cat = objCategoryToInclude.CategoryID) Then + filter = True + End If + Next + If (filter = False) Then + includeCategorySecurity = False + End If + End If + End If + + If (includeCategorySecurity) Then + includeCategories.Add(objCategoryToInclude.CategoryID) + End If + + Next + + If (includeCategories.Count > 0) Then + includeCategories.Add(-1) + End If + + FilterCategories = includeCategories.ToArray() + + End If + + Dim objArticleController As New ArticleController + _articleList = objArticleController.GetArticleList(ArticleModuleBase.ModuleId, StartDate, _agedDate, FilterCategories, (MatchCategories = MatchOperatorType.MatchAll), excludeCategoriesRestrictive.ToArray(), MaxArticles, CurrentPage, ArticleSettings.PageSize, SortBy, SortDirection, True, False, SearchText.Replace("'", "''"), Author, ShowPending, ShowExpired, FeaturedOnly, NotFeaturedOnly, SecuredOnly, NotSecuredOnly, Null.NullString, objTags, False, Null.NullString, _customFieldID, _customValue, Null.NullString, _articleCount) + End If + + + If (_articleList.Count = 0) Then + If (ShowMessage) Then + ProcessHeader(phNoArticles.Controls, _objLayoutEmpty.Tokens) + End If + Else + rptListing.DataSource = _articleList + rptListing.DataBind() + End If + + End Sub + + Private Function GetParams(ByVal addDynamicFields As Boolean) As String + + Dim params As String = "" + + If (Request("ctl") <> "") Then + If (Request("ctl").ToLower = "categoryview" OrElse Request("ctl").ToLower = "authorview" OrElse Request("ctl").ToLower = "archiveview" OrElse Request("ctl").ToLower() = "search") Then + params += "ctl=" & Request("ctl") & "&mid=" & ArticleModuleBase.ModuleId.ToString() + End If + End If + + If (Request("articleType") <> "") Then + If (Request("articleType").ToString().ToLower = "categoryview" OrElse Request("articleType").ToString().ToLower() = "authorview" OrElse Request("articleType").ToString().ToLower() = "archiveview" OrElse Request("articleType").ToString().ToLower() = "search" OrElse Request("articleType").ToString().ToLower() = "myarticles" OrElse Request("articleType").ToString().ToLower() = "tagview") Then + params += "articleType=" & Request("articleType") + End If + End If + + If (FilterCategories IsNot Nothing AndAlso FilterCategories.Length > 0) Then + If (FilterCategories IsNot ArticleSettings.FilterCategories) Then + params += "&CategoryID=" & FilterCategories(0) + End If + End If + + Dim authorSet As Boolean = False + If (ArticleSettings.AuthorUserIDFilter) Then + If (ArticleSettings.AuthorUserIDParam <> "") Then + If (HttpContext.Current.Request(ArticleSettings.AuthorUserIDParam) <> "") Then + params += "&" & ArticleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(ArticleSettings.AuthorUserIDParam) + authorSet = True + End If + End If + End If + + If (ArticleSettings.AuthorUsernameFilter) Then + If (ArticleSettings.AuthorUsernameParam <> "") Then + If (HttpContext.Current.Request(ArticleSettings.AuthorUsernameParam) <> "") Then + params += "&" & ArticleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(ArticleSettings.AuthorUsernameParam) + authorSet = True + End If + End If + End If + + If (authorSet = False) Then + If (Author <> ArticleSettings.Author) Then + params += "&AuthorID=" & Author.ToString() + End If + End If + + If (Year <> Null.NullInteger) Then + params += "&Year=" & Year.ToString() + End If + + If (Month <> Null.NullInteger) Then + params += "&Month=" & Month.ToString() + End If + + If (Tag <> Null.NullString) Then + params += "&Tag=" & Server.UrlEncode(Tag) + End If + + If (SearchText <> Null.NullString) Then + If (Request("naaz-" & ArticleModuleBase.TabModuleId.ToString()) = "") Then + params += "&Search=" & ArticleModuleBase.Server.UrlEncode(SearchText) + End If + End If + + If (addDynamicFields) Then + If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params += "&nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) + End If + If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params += "&naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) + End If + If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params += "&nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) + End If + If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params += "&nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) + End If + If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params += "&natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) + End If + If (Request("naaz-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params += "&naaz-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naaz-" & ArticleModuleBase.TabModuleId.ToString()) + End If + End If + + Return params + + End Function + + Private Sub InitializeTemplate() + + _objLayoutController = New LayoutController(ArticleModuleBase) + _objLayoutController.IncludeCategory = IncludeCategory + + _objLayoutHeader = LayoutController.GetLayout(ArticleModuleBase, LayoutType.Listing_Header_Html) + _objLayoutFeatured = LayoutController.GetLayout(ArticleModuleBase, LayoutType.Listing_Featured_Html) + _objLayoutItem = LayoutController.GetLayout(ArticleModuleBase, LayoutType.Listing_Item_Html) + _objLayoutFooter = LayoutController.GetLayout(ArticleModuleBase, LayoutType.Listing_Footer_Html) + _objLayoutEmpty = LayoutController.GetLayout(ArticleModuleBase, LayoutType.Listing_Empty_Html) + + If (_objLayoutFeatured.Template.Trim().Length = 0) Then + ' Featured Template Empty or does not exist, use standard item. + _objLayoutFeatured = _objLayoutItem + End If + + End Sub + + Private Sub InitSettings() + + _author = Null.NullInteger + + If (ArticleSettings.AuthorUserIDFilter) Then + _author = -100 + If (Request.QueryString(ArticleSettings.AuthorUserIDParam) <> "") Then + Try + _author = Convert.ToInt32(Request.QueryString(ArticleSettings.AuthorUserIDParam)) + Catch + End Try + End If + End If + + If (ArticleSettings.AuthorUsernameFilter) Then + _author = -100 + If (Request.QueryString(ArticleSettings.AuthorUsernameParam) <> "") Then + Try + Dim objUser As DotNetNuke.Entities.Users.UserInfo = DotNetNuke.Entities.Users.UserController.GetUserByName(ArticleModuleBase.PortalId, Request.QueryString(ArticleSettings.AuthorUsernameParam)) + If (objUser IsNot Nothing) Then + _author = objUser.UserID + End If + Catch + End Try + End If + End If + + If (ArticleSettings.AuthorLoggedInUserFilter) Then + _author = -100 + If (Request.IsAuthenticated) Then + _author = ArticleModuleBase.UserId + End If + End If + + If (ArticleSettings.Author <> Null.NullInteger) Then + _author = ArticleSettings.Author + End If + + If (DynamicAuthorID <> Null.NullInteger) Then + _author = DynamicAuthorID + End If + + _agedDate = Null.NullDate + _bindArticles = True + _featuredOnly = ArticleSettings.FeaturedOnly + If (ArticleSettings.FilterSingleCategory <> Null.NullInteger) Then + Dim cats As New List(Of Integer) + cats.Add(ArticleSettings.FilterSingleCategory) + _filterCategories = cats.ToArray() + Else + _filterCategories = ArticleSettings.FilterCategories + End If + If (DynamicCategoryID <> Null.NullInteger) Then + Dim cats As New List(Of Integer) + cats.Add(DynamicCategoryID) + _filterCategories = cats.ToArray() + End If + _includeCategory = False + _matchCategories = ArticleSettings.MatchCategories + _maxArticles = ArticleSettings.MaxArticles + _month = Null.NullInteger + _notFeaturedOnly = ArticleSettings.NotFeaturedOnly + _notSecuredOnly = ArticleSettings.NotSecuredOnly + _searchText = "" + If (DynamicAZ <> Null.NullString) Then + _searchText = DynamicAZ + End If + _securedOnly = ArticleSettings.SecuredOnly + _showExpired = False + _showMessage = True + _showPending = ArticleSettings.ShowPending + _sortBy = ArticleSettings.SortBy + If (ArticleSettings.BubbleFeatured) Then + _sortBy = "IsFeatured DESC, " & ArticleSettings.SortBy + End If + _sortDirection = ArticleSettings.SortDirection + _startDate = DateTime.Now.AddMinutes(1) + _tag = Null.NullString + _year = Null.NullInteger + + If (DynamicSortBy <> "") Then + _sortBy = DynamicSortBy + End If + + If (DynamicTime <> "") Then + If (DynamicTime.ToLower() = "today") Then + _startDate = DateTime.Now + _agedDate = DateTime.Today + End If + If (DynamicTime.ToLower() = "yesterday") Then + _startDate = DateTime.Today + _agedDate = DateTime.Today.AddDays(-1) + End If + If (DynamicTime.ToLower() = "threedays") Then + _startDate = DateTime.Now + _agedDate = DateTime.Today.AddDays(-3) + End If + If (DynamicTime.ToLower() = "sevendays") Then + _startDate = DateTime.Now + _agedDate = DateTime.Today.AddDays(-7) + End If + If (DynamicTime.ToLower() = "thirtydays") Then + _startDate = DateTime.Now + _agedDate = DateTime.Today.AddDays(-30) + End If + If (DynamicTime.ToLower() = "ninetydays") Then + _startDate = DateTime.Now + _agedDate = DateTime.Today.AddDays(-90) + End If + If (DynamicTime.ToLower() = "thisyear") Then + _startDate = DateTime.Now + _agedDate = DateTime.Today.AddYears(-1) + End If + End If + + If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + Dim val As String = Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) + If (val.Split("-"c).Length = 2) Then + If (IsNumeric(val.Split("-"c)(0))) Then + _customFieldID = Convert.ToInt32(val.Split("-"c)(0)) + _customValue = val.Split("-"c)(1) + End If + End If + End If + + End Sub + + Private Sub ProcessHeader(ByRef objPlaceHolder As ControlCollection, ByVal templateArray As String()) + + Dim pageCount As Integer = ((_articleCount - 1) \ ArticleSettings.PageSize) + 1 + + For iPtr As Integer = 0 To templateArray.Length - 1 Step 2 + + objPlaceHolder.Add(New LiteralControl(_objLayoutController.ProcessImages(templateArray(iPtr).ToString()))) + + If iPtr < templateArray.Length - 1 Then + Select Case templateArray(iPtr + 1) + + Case "AUTHOR" + Dim objAuthorController As New AuthorController() + Dim drpAuthor As New DropDownList + drpAuthor.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + drpAuthor.DataTextField = "DisplayName" + drpAuthor.DataValueField = "UserID" + drpAuthor.DataSource = objAuthorController.GetAuthorList(ArticleModuleBase.ModuleId) + drpAuthor.DataBind() + drpAuthor.Items.Insert(0, New ListItem(ArticleModuleBase.GetSharedResource("SelectAuthor.Text"), "-1")) + drpAuthor.AutoPostBack = True + If (DynamicAuthorID <> Null.NullInteger) Then + If (drpAuthor.Items.FindByValue(DynamicAuthorID.ToString()) IsNot Nothing) Then + drpAuthor.SelectedValue = DynamicAuthorID.ToString() + End If + End If + Dim objHandler As New System.EventHandler(AddressOf drpAuthor_SelectedIndexChanged) + AddHandler drpAuthor.SelectedIndexChanged, objHandler + objPlaceHolder.Add(drpAuthor) + + Case "AZ" + + Dim list As String = "" + For Each c As Char In "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray() + + Dim params As New List(Of String) + + Dim args As String = GetParams(False) + For Each arg As String In args.Split("&"c) + params.Add(arg) + Next + + If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nasort-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString())) + End If + + If (list = "") Then + If (Request("naaz-" & ArticleModuleBase.TabModuleId.ToString()) = c) Then + list = c + Else + Dim paramsCopy As List(Of String) = params + paramsCopy.Add("naaz-" & ArticleModuleBase.TabModuleId.ToString() & "=" & c) + list = "" & c & "" + End If + Else + If (Request("naaz-" & ArticleModuleBase.TabModuleId.ToString()) = c) Then + list = list & " " & c + Else + Dim paramsCopy As List(Of String) = params + paramsCopy.Add("naaz-" & ArticleModuleBase.TabModuleId.ToString() & "=" & c) + list = list & " " & "" & c & "" + End If + End If + Next + If (Request("naaz-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + list = list & " " & "" & "All" & "" + Else + list = list & " " & "All" + End If + + Dim objLiteral As New Literal() + objLiteral.Text = list + objPlaceHolder.Add(objLiteral) + + Case "CATEGORY" + Dim objCategoryController As New CategoryController() + Dim drpCategory As New DropDownList + drpCategory.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + drpCategory.DataTextField = "NameIndented" + drpCategory.DataValueField = "CategoryID" + drpCategory.DataSource = objCategoryController.GetCategoriesAll(ArticleModuleBase.ModuleId, Null.NullInteger, ArticleSettings.CategorySortType) + drpCategory.DataBind() + drpCategory.Items.Insert(0, New ListItem(ArticleModuleBase.GetSharedResource("SelectCategory.Text"), "-1")) + drpCategory.AutoPostBack = True + If (DynamicCategoryID <> Null.NullInteger) Then + If (drpCategory.Items.FindByValue(DynamicCategoryID.ToString()) IsNot Nothing) Then + drpCategory.SelectedValue = DynamicCategoryID.ToString() + End If + End If + Dim objHandler As New System.EventHandler(AddressOf drpCategory_SelectedIndexChanged) + AddHandler drpCategory.SelectedIndexChanged, objHandler + objPlaceHolder.Add(drpCategory) + + Case "CATEGORYFILTER" + If (_filterCategories IsNot Nothing) Then + Dim categories As String = "" + Dim objCategoryController As New CategoryController + For Each ID As Integer In _filterCategories + Dim objCategory As CategoryInfo = objCategoryController.GetCategory(ID, ArticleModuleBase.ModuleId) + If (objCategory IsNot Nothing) Then + If (categories = "") Then + categories = objCategory.Name + Else + categories = categories & " | " & objCategory.Name + End If + End If + Next + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + objLiteral.Text = categories + objPlaceHolder.Add(objLiteral) + End If + + Case "CATEGORYSELECTED" + If (Request("articleType") <> "" AndAlso Request("articleType").ToLower() <> "categoryview") Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/CATEGORYSELECTED") Then + Exit While + End If + iPtr = iPtr + 1 + End While + Else + If (Request("articleType") = "") Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/CATEGORYSELECTED") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + + Case "/CATEGORYSELECTED" + ' Do Nothing + + Case "CATEGORYNOTSELECTED" + If (Request("articleType") <> "" AndAlso Request("articleType").ToLower() = "categoryview") Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/CATEGORYNOTSELECTED") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/CATEGORYNOTSELECTED" + ' Do Nothing + + Case "CATEGORYNOTSELECTED2" + If (Request("articleType") <> "" AndAlso Request("articleType").ToLower() = "categoryview") Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/CATEGORYNOTSELECTED") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/CATEGORYNOTSELECTED2" + ' Do Nothing + + Case "CURRENTPAGE" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + objLiteral.Text = CurrentPage.ToString() + objPlaceHolder.Add(objLiteral) + + Case "HASMULTIPLEPAGES" + If (pageCount = 1) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/HASMULTIPLEPAGES") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASMULTIPLEPAGES" + ' Do Nothing + + Case "HASNEXTPAGE" + + If (CurrentPage = pageCount) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/HASNEXTPAGE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASNEXTPAGE" + ' Do Nothing + + Case "HASPREVPAGE" + If (CurrentPage = 1) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/HASPREVPAGE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASPREVPAGE" + ' Do Nothing + + Case "LINKNEXT" + Dim objLink As New HyperLink + objLink.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + objLink.CssClass = "CommandButton" + objLink.Enabled = (CurrentPage < pageCount) + objLink.NavigateUrl = NavigateURL(ArticleModuleBase.TabId, "", GetParams(True), "CurrentPage=" & (CurrentPage + 1).ToString()) + objLink.Text = ArticleModuleBase.GetSharedResource("NextPage.Text") + objPlaceHolder.Add(objLink) + + Case "LINKNEXTURL" + If (CurrentPage < pageCount) Then + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + objLiteral.Text = NavigateURL(ArticleModuleBase.TabId, "", GetParams(True), "CurrentPage=" & (CurrentPage + 1).ToString()) + objPlaceHolder.Add(objLiteral) + End If + + Case "LINKPREVIOUS" + Dim objLink As New HyperLink + objLink.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + objLink.CssClass = "CommandButton" + objLink.Enabled = (CurrentPage > 1) + objLink.NavigateUrl = NavigateURL(ArticleModuleBase.TabId, "", GetParams(True), "CurrentPage=" & (CurrentPage - 1).ToString()) + objLink.Text = ArticleModuleBase.GetSharedResource("PreviousPage.Text") + objPlaceHolder.Add(objLink) + + Case "LINKPREVIOUSURL" + If (CurrentPage > 1) Then + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + objLiteral.Text = NavigateURL(ArticleModuleBase.TabId, "", GetParams(True), "CurrentPage=" & (CurrentPage - 1).ToString()) + objPlaceHolder.Add(objLiteral) + End If + + Case "PAGECOUNT" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + objLiteral.Text = pageCount.ToString() + objPlaceHolder.Add(objLiteral) + + Case "PAGER" + Dim ctlPagingControl As New PagingControl + ctlPagingControl.Visible = True + ctlPagingControl.TotalRecords = _articleCount + ctlPagingControl.PageSize = ArticleSettings.PageSize + ctlPagingControl.CurrentPage = CurrentPage + ctlPagingControl.QuerystringParams = GetParams(True) + ctlPagingControl.TabID = ArticleModuleBase.TabId + ctlPagingControl.EnableViewState = False + objPlaceHolder.Add(ctlPagingControl) + + Case "PAGER2" + Dim objLiteral As New Literal + If (_articleCount > 0) Then + Dim pages As Integer = _articleCount / ArticleSettings.PageSize + objLiteral.Text = objLiteral.Text & "
    " + For i As Integer = 1 To pages + If (CurrentPage = i) Then + objLiteral.Text = objLiteral.Text & "
  • " & i.ToString() & "
  • " + Else + Dim params As String = GetParams(True) + If (i > 1) Then + params += "¤tpage=" & i.ToString() + End If + objLiteral.Text = objLiteral.Text & "
  • " & i.ToString() & "
  • " + End If + Next + objLiteral.Text = objLiteral.Text & "
" + objPlaceHolder.Add(objLiteral) + End If + + Case "SORT" + Dim drpSort As New DropDownList + drpSort.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("PublishDate.Text"), "PublishDate")) + drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("ExpiryDate.Text"), "ExpiryDate")) + drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("LastUpdate.Text"), "LastUpdate")) + drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("HighestRated.Text"), "Rating")) + drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("MostCommented.Text"), "CommentCount")) + drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("MostViewed.Text"), "NumberOfViews")) + drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("Random.Text"), "Random")) + drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("SortTitle.Text"), "Title")) + drpSort.AutoPostBack = True + + If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + If (drpSort.Items.FindByValue(Request("nasort-" & ArticleModuleBase.TabModuleId.ToString())) IsNot Nothing) Then + drpSort.SelectedValue = Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) + End If + Else + Dim sort As String = SortBy + + Select Case SortBy.ToLower() + Case "startdate" + sort = "PublishDate" + Exit Select + Case "enddate" + sort = "ExpiryDate" + Exit Select + Case "newid()" + sort = "random" + Exit Select + End Select + + If (drpSort.Items.FindByValue(sort) IsNot Nothing) Then + drpSort.SelectedValue = sort + End If + End If + + Dim objHandler As New System.EventHandler(AddressOf drpSort_SelectedIndexChanged) + AddHandler drpSort.SelectedIndexChanged, objHandler + objPlaceHolder.Add(drpSort) + + Case "TABID" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + objLiteral.Text = ArticleModuleBase.TabId.ToString() + objPlaceHolder.Add(objLiteral) + + Case "TIME" + Dim drpTime As New DropDownList + drpTime.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("Today.Text"), "Today")) + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("Yesterday.Text"), "Yesterday")) + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("ThreeDays.Text"), "ThreeDays")) + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("SevenDays.Text"), "SevenDays")) + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("ThirtyDays.Text"), "ThirtyDays")) + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("NinetyDays.Text"), "NinetyDays")) + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("ThisYear.Text"), "ThisYear")) + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("AllTime.Text"), "AllTime")) + drpTime.AutoPostBack = True + + If (DynamicTime <> "") Then + If (drpTime.Items.FindByValue(DynamicTime) IsNot Nothing) Then + drpTime.SelectedValue = DynamicTime + End If + Else + drpTime.SelectedValue = "AllTime" + End If + + Dim objHandler As New System.EventHandler(AddressOf drpTime_SelectedIndexChanged) + AddHandler drpTime.SelectedIndexChanged, objHandler + + objPlaceHolder.Add(drpTime) + + Case Else + + If (templateArray(iPtr + 1).ToUpper().StartsWith("CUSTOM:")) Then + Dim customField As String = templateArray(iPtr + 1).Substring(7, templateArray(iPtr + 1).Length - 7) + + Dim objCustomFieldController As New CustomFieldController() + Dim objCustomFields As ArrayList = objCustomFieldController.List(ArticleModuleBase.ModuleId) + + For Each objCustomField As CustomFieldInfo In objCustomFields + If (objCustomField.Name.ToLower() = customField.ToLower()) Then + If (objCustomField.FieldType = CustomFieldType.DropDownList) Then + Dim drpCustom As New DropDownList + drpCustom.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + + For Each val As String In objCustomField.FieldElements.Split("|"c) + drpCustom.Items.Add(val) + Next + + Dim sel As String = ArticleModuleBase.GetSharedResource("SelectCustom.Text") + If (sel.IndexOf("{0}") <> -1) Then + sel = sel.Replace("{0}", objCustomField.Caption) + End If + drpCustom.Items.Insert(0, New ListItem(sel, "-1")) + drpCustom.Attributes.Add("CustomFieldID", objCustomField.CustomFieldID.ToString()) + drpCustom.AutoPostBack = True + + If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + Dim val As String = Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) + If (val.Split("-"c).Length = 2) Then + If (val.Split("-"c)(0) = objCustomField.CustomFieldID.ToString()) Then + If (drpCustom.Items.FindByValue(val.Split("-"c)(1).ToString()) IsNot Nothing) Then + drpCustom.SelectedValue = val.Split("-"c)(1).ToString() + End If + End If + End If + End If + + Dim objHandler As New System.EventHandler(AddressOf drpCustom_SelectedIndexChanged) + AddHandler drpCustom.SelectedIndexChanged, objHandler + objPlaceHolder.Add(drpCustom) + + End If + Exit For + End If + Next + + Exit Select + + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("RESX:")) Then + Dim entry As String = templateArray(iPtr + 1).Substring(5, templateArray(iPtr + 1).Length - 5) + + If (entry <> "") Then + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + objLiteral.Text = ArticleModuleBase.GetSharedResource(entry) + objPlaceHolder.Add(objLiteral) + End If + + Exit Select + + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("SORT:")) Then + + Dim params As New List(Of String) + + Dim sortItem As String = templateArray(iPtr + 1).Substring(5, templateArray(iPtr + 1).Length - 5) + Dim sortValue As String = sortItem + + Select Case sortItem.ToLower() + Case "highestrated" + sortValue = "Rating" + Exit Select + Case "mostcommented" + sortValue = "CommentCount" + Exit Select + Case "mostviewed" + sortValue = "NumberOfViews" + Exit Select + Case "sorttitle" + sortValue = "Title" + Exit Select + End Select + + Dim sort As String = SortBy + + Select Case sort.ToLower() + Case "startdate" + sort = "PublishDate" + Exit Select + Case "enddate" + sort = "ExpiryDate" + Exit Select + Case "newid()" + sort = "random" + Exit Select + Case "rating desc, ratingcount" + sort = "rating" + Exit Select + End Select + + If (sortValue.ToLower() = sort.ToLower()) Then + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + objLiteral.Text = ArticleModuleBase.GetSharedResource(sortItem & ".Text") + objPlaceHolder.Add(objLiteral) + Else + Dim objLink As New HyperLink + objLink.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & sortValue) + If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString())) + End If + objLink.NavigateUrl = NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()) + objLink.Text = ArticleModuleBase.GetSharedResource(sortItem & ".Text") + objPlaceHolder.Add(objLink) + End If + Exit Select + + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("TIME:")) Then + + Dim timeItem As String = templateArray(iPtr + 1).Substring(5, templateArray(iPtr + 1).Length - 5) + + Dim drpTime As New DropDownList + drpTime.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString()) + + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("Today"), "Today")) + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("Yesterday"), "Yesterday")) + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("ThreeDays"), "ThreeDays")) + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("SevenDays"), "SevenDays")) + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("ThirtyDays"), "ThirtyDays")) + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("NinetyDays"), "NinetyDays")) + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("ThisYear"), "ThisYear")) + drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("AllTime"), "AllTime")) + drpTime.AutoPostBack = True + + If (DynamicTime <> "") Then + If (drpTime.Items.FindByValue(DynamicTime) IsNot Nothing) Then + drpTime.SelectedValue = DynamicTime + End If + Else + If (drpTime.Items.FindByValue(timeItem) IsNot Nothing) Then + Dim params As New List(Of String) + If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nasort-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString())) + End If + + params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & timeItem) + Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True) + Else + drpTime.SelectedValue = "AllTime" + End If + End If + + Dim objHandler As New System.EventHandler(AddressOf drpTime_SelectedIndexChanged) + AddHandler drpTime.SelectedIndexChanged, objHandler + objPlaceHolder.Add(drpTime) + Exit Select + End If + + TokenProcessor.ProcessMenuItem(templateArray(iPtr + 1), objPlaceHolder, _objLayoutController, ArticleModuleBase, iPtr, templateArray, MenuOptionType.CurrentArticles) + + End Select + End If + + Next + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Try + + InitSettings() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub Page_PreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + + Try + + If (BindArticles) Then + BindListing() + End If + ArticleModuleBase.LoadStyleSheet() + + If (IsIndexed = False) Then + ' no index but follow links + + Try + 'remove the existing MetaRobots entry + Page.Header.Controls.Remove(Page.Header.FindControl("MetaRobots")) + + 'build our own new entry + Dim mymetatag As New System.Web.UI.HtmlControls.HtmlMeta + mymetatag.Name = "robots" + mymetatag.Content = "NOINDEX, FOLLOW" + Page.Header.Controls.Add(mymetatag) + Catch ex As Exception + 'catch an exception if MetaRobots is not present + + End Try + + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub rptListing_OnItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptListing.ItemDataBound + + Try + + If (e.Item.ItemType = ListItemType.Header) Then + ProcessHeader(e.Item.Controls, _objLayoutHeader.Tokens) + End If + + If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then + + Dim objArticle As ArticleInfo = CType(e.Item.DataItem, ArticleInfo) + + If (objArticle.IsFeatured) Then + _objLayoutController.ProcessArticleItem(e.Item.Controls, _objLayoutFeatured.Tokens, objArticle) + Else + _objLayoutController.ProcessArticleItem(e.Item.Controls, _objLayoutItem.Tokens, objArticle) + End If + + End If + + If (e.Item.ItemType = ListItemType.Footer) Then + ProcessHeader(e.Item.Controls, _objLayoutFooter.Tokens) + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub drpAuthor_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) + + Dim params As New List(Of String) + + Dim args As String = GetParams(False) + For Each arg As String In args.Split("&"c) + params.Add(arg) + Next + + If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nasort-" & ArticleModuleBase.TabModuleId.ToString())) + End If + + Dim drpAuthor As DropDownList = CType(sender, DropDownList) + + If (drpAuthor IsNot Nothing) Then + If (drpAuthor.SelectedValue <> "-1") Then + params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & drpAuthor.SelectedValue) + If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString())) + End If + Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True) + Else + If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString())) + End If + Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True) + End If + End If + + End Sub + + Private Sub drpCategory_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) + + Dim params As New List(Of String) + + Dim args As String = GetParams(False) + For Each arg As String In args.Split("&"c) + params.Add(arg) + Next + + If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nasort-" & ArticleModuleBase.TabModuleId.ToString())) + End If + + Dim drpCategory As DropDownList = CType(sender, DropDownList) + + If (drpCategory IsNot Nothing) Then + If (drpCategory.SelectedValue <> "-1") Then + If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString())) + End If + params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & drpCategory.SelectedValue) + If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString())) + End If + Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True) + Else + If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString())) + End If + Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True) + End If + End If + + End Sub + + Private Sub drpCustom_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) + + Dim params As New List(Of String) + + Dim args As String = GetParams(False) + For Each arg As String In args.Split("&"c) + params.Add(arg) + Next + + If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nasort-" & ArticleModuleBase.TabModuleId.ToString())) + End If + + Dim drpCustom As DropDownList = CType(sender, DropDownList) + + If (drpCustom IsNot Nothing) Then + If (drpCustom.SelectedValue <> "-1") Then + params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & drpCustom.Attributes("CustomFieldID") & "-" & drpCustom.SelectedValue) + If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString())) + End If + Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True) + Else + If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString())) + End If + Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True) + End If + End If + + End Sub + + Private Sub drpSort_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) + + Dim params As New List(Of String) + + Dim args As String = GetParams(False) + For Each arg As String In args.Split("&"c) + params.Add(arg) + Next + + Dim drpSort As DropDownList = CType(sender, DropDownList) + + If (drpSort IsNot Nothing) Then + params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & drpSort.SelectedValue) + If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString())) + End If + Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True) + End If + + End Sub + + Private Sub drpTime_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) + + Dim params As New List(Of String) + + Dim args As String = GetParams(False) + For Each arg As String In args.Split("&"c) + params.Add(arg) + Next + + If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nasort-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString())) + End If + If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then + params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString())) + End If + + Dim drpTime As DropDownList = CType(sender, DropDownList) + + If (drpTime IsNot Nothing) Then + params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & drpTime.SelectedValue) + Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True) + End If + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Controls/PostComment.ascx b/Controls/PostComment.ascx new file mode 100755 index 0000000..8ff659c --- /dev/null +++ b/Controls/PostComment.ascx @@ -0,0 +1,40 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="PostComment.ascx.vb" Inherits="Ventrian.NewsArticles.Controls.PostComment" %> +<%@ Register TagPrefix="dnn" Assembly="DotNetNuke" Namespace="DotNetNuke.UI.WebControls"%> + +

+ + + +

+

+ + + + +

+

+ + +

+

+ + +

+ +

+ +

+

+ +

+
+ + + + + + diff --git a/Controls/PostComment.ascx.designer.vb b/Controls/PostComment.ascx.designer.vb new file mode 100755 index 0000000..cd621de --- /dev/null +++ b/Controls/PostComment.ascx.designer.vb @@ -0,0 +1,215 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles.Controls + + Partial Public Class PostComment + + ''' + '''phCommentForm control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phCommentForm As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''pName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pName As Global.System.Web.UI.HtmlControls.HtmlGenericControl + + ''' + '''txtName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtName As Global.System.Web.UI.WebControls.TextBox + + ''' + '''lblName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblName As Global.System.Web.UI.WebControls.Label + + ''' + '''valName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valName As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''pEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pEmail As Global.System.Web.UI.HtmlControls.HtmlGenericControl + + ''' + '''txtEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtEmail As Global.System.Web.UI.WebControls.TextBox + + ''' + '''lblEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblEmail As Global.System.Web.UI.WebControls.Label + + ''' + '''valEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valEmail As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''valEmailIsValid control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valEmailIsValid As Global.System.Web.UI.WebControls.RegularExpressionValidator + + ''' + '''pUrl control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pUrl As Global.System.Web.UI.HtmlControls.HtmlGenericControl + + ''' + '''txtURL control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtURL As Global.System.Web.UI.WebControls.TextBox + + ''' + '''lblUrl control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblUrl As Global.System.Web.UI.WebControls.Label + + ''' + '''txtComment control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtComment As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valComment control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valComment As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''ctlCaptcha control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ctlCaptcha As Global.DotNetNuke.UI.WebControls.CaptchaControl + + ''' + '''btnAddComment control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents btnAddComment As Global.System.Web.UI.WebControls.Button + + ''' + '''chkNotifyMe control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkNotifyMe As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''phCommentPosted control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phCommentPosted As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''lblRequiresApproval control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblRequiresApproval As Global.System.Web.UI.WebControls.Label + + ''' + '''phCommentAnonymous control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phCommentAnonymous As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''lblRequiresAccess control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblRequiresAccess As Global.System.Web.UI.WebControls.Label + End Class +End Namespace diff --git a/Controls/PostComment.ascx.vb b/Controls/PostComment.ascx.vb new file mode 100755 index 0000000..3bb13c5 --- /dev/null +++ b/Controls/PostComment.ascx.vb @@ -0,0 +1,518 @@ +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Security +Imports DotNetNuke.Services.Localization +Imports Joel.Net +Imports Ventrian.NewsArticles.Components.Social + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles.Controls + + Partial Public Class PostComment + Inherits NewsArticleControlBase + +#Region " Private Properties " + + Private ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase + Get + If (TypeOf Parent.Parent Is NewsArticleModuleBase) Then + Return CType(Parent.Parent, NewsArticleModuleBase) + Else + Return CType(Parent.Parent.Parent.Parent, NewsArticleModuleBase) + End If + End Get + End Property + + Private ReadOnly Property ArticleSettings() As ArticleSettings + Get + Return ArticleModuleBase.ArticleSettings + End Get + End Property + +#End Region + +#Region " Private Methods " + + Private Sub AssignLocalization() + + lblName.Text = GetResourceKey("Name") + valName.ErrorMessage = GetResourceKey("valName.ErrorMessage") + + If (ArticleSettings.CommentRequireName = False) Then + valName.Enabled = False + lblName.Text = GetResourceKey("NameNotRequired") + End If + + lblEmail.Text = GetResourceKey("Email") + valEmail.ErrorMessage = GetResourceKey("valEmail.ErrorMessage") + valEmailIsValid.ErrorMessage = GetResourceKey("valEmailIsValid.ErrorMessage") + + If (ArticleSettings.CommentRequireEmail = False) Then + valEmail.Enabled = False + valEmailIsValid.Enabled = False + lblEmail.Text = GetResourceKey("EmailNotRequired") + End If + + lblUrl.Text = GetResourceKey("Website") + + valComment.ErrorMessage = GetResourceKey("valComment.ErrorMessage") + ctlCaptcha.Text = GetResourceKey("ctlCaptcha.Text") + ctlCaptcha.ErrorMessage = GetResourceKey("ctlCaptcha.ErrorMessage") + + btnAddComment.Text = GetResourceKey("AddComment") + chkNotifyMe.Text = GetResourceKey("NotifyMe") + lblRequiresApproval.Text = GetResourceKey("RequiresApproval") + + lblRequiresAccess.Text = GetResourceKey("RequiresAccess") + + End Sub + + Private Sub CheckSecurity() + + If (ArticleSettings.IsCommentsAnonymous = False And Request.IsAuthenticated = False) Then + phCommentForm.Visible = False + phCommentAnonymous.Visible = True + End If + + End Sub + + Private Function FilterInput(ByVal stringToFilter As String) As String + + Dim objPortalSecurity As New PortalSecurity + + stringToFilter = objPortalSecurity.InputFilter(stringToFilter, PortalSecurity.FilterFlag.NoScripting) + + stringToFilter = Replace(stringToFilter, Chr(13), "") + stringToFilter = Replace(stringToFilter, ControlChars.Lf, "
") + + Return stringToFilter + + End Function + + Private Sub GetCookie() + + If (Request.IsAuthenticated = False) Then + Dim cookie As HttpCookie = Request.Cookies("comment") + + If (cookie IsNot Nothing) Then + txtName.Text = cookie.Values("name") + txtEmail.Text = cookie.Values("email") + txtURL.Text = cookie.Values("url") + End If + End If + + chkNotifyMe.Checked = ArticleSettings.NotifyDefault + + End Sub + + Public Function GetResourceKey(ByVal key As String) As String + + Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/" & Localization.LocalResourceDirectory & "/PostComment.ascx.resx" + Return DotNetNuke.Services.Localization.Localization.GetString(key, path) + + End Function + + Private Sub NotifyAuthor(ByVal objComment As CommentInfo, ByVal objArticle As ArticleInfo) + + Dim objEmailTemplateController As New EmailTemplateController + objEmailTemplateController.SendFormattedEmail(ArticleModuleBase.ModuleId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentNotification, ArticleSettings) + + End Sub + + Private Sub NotifyComments(ByVal objComment As CommentInfo, ByVal objArticle As ArticleInfo) + + Dim objEmailTemplateController As New EmailTemplateController + Dim objMailList As New Hashtable + + Dim objCommentController As New CommentController + Dim objComments As List(Of CommentInfo) = objCommentController.GetCommentList(ArticleModuleBase.ModuleId, ArticleID, True, SortDirection.Ascending, Null.NullInteger) + + For Each objNotifyComment As CommentInfo In objComments + If (objNotifyComment.CommentID <> objComment.CommentID And objNotifyComment.NotifyMe) Then + If (objNotifyComment.UserID = Null.NullInteger) Then + If (objNotifyComment.AnonymousEmail <> "") Then + If (objNotifyComment.AnonymousEmail <> objComment.AnonymousEmail) Then + If (objMailList.Contains(objNotifyComment.AnonymousEmail) = False) Then + objEmailTemplateController.SendFormattedEmail(ArticleModuleBase.ModuleId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentNotification, ArticleSettings, objNotifyComment.AnonymousEmail) + objMailList.Add(objNotifyComment.AnonymousEmail, objNotifyComment.AnonymousEmail) + End If + End If + End If + Else + If (objNotifyComment.AuthorEmail <> "") Then + If (objNotifyComment.UserID <> objComment.UserID) Then + If (objMailList.Contains(objNotifyComment.AuthorEmail.ToString()) = False) Then + objEmailTemplateController.SendFormattedEmail(ArticleModuleBase.ModuleId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentNotification, ArticleSettings, objNotifyComment.AuthorEmail) + objMailList.Add(objNotifyComment.AuthorEmail, objNotifyComment.AuthorEmail) + End If + End If + End If + End If + + End If + Next + + End Sub + + Private Sub SetCookie() + + If (Request.IsAuthenticated = False) Then + Dim objCookie As New HttpCookie("comment") + + objCookie.Expires = DateTime.Now.AddMonths(24) + objCookie.Values.Add("name", txtName.Text) + objCookie.Values.Add("email", txtEmail.Text) + objCookie.Values.Add("url", txtURL.Text) + + Response.Cookies.Add(objCookie) + End If + + End Sub + + Private Sub SetVisibility() + + pName.Visible = Not Request.IsAuthenticated + pEmail.Visible = Not Request.IsAuthenticated + pUrl.Visible = Not Request.IsAuthenticated + ctlCaptcha.Visible = (ArticleSettings.UseCaptcha And Request.IsAuthenticated = False) + + If (Request.IsAuthenticated = False) Then + pUrl.Visible = Not ArticleSettings.IsCommentWebsiteHidden + End If + + End Sub + +#End Region + +#Region " Event Handlers " + + Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init + + If Not (TypeOf Parent.Parent Is NewsArticleModuleBase Or TypeOf Parent.Parent.Parent.Parent Is NewsArticleModuleBase) Then + Visible = False + Return + End If + + CheckSecurity() + AssignLocalization() + SetVisibility() + + valName.ValidationGroup = "PostComment-" & ArticleID.ToString() + valEmail.ValidationGroup = "PostComment-" & ArticleID.ToString() + valEmailIsValid.ValidationGroup = "PostComment-" & ArticleID.ToString() + valComment.ValidationGroup = "PostComment-" & ArticleID.ToString() + btnAddComment.ValidationGroup = "PostComment-" & ArticleID.ToString() + + If (Page.IsPostBack = False) Then + GetCookie() + End If + + End Sub + + Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender + + If (HttpContext.Current.Items.Contains("IgnoreCaptcha")) Then + ctlCaptcha.ErrorMessage = "" + End If + + End Sub + + Protected Sub btnAddComment_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAddComment.Click + + If (Page.IsValid) Then + If (ArticleSettings.UseCaptcha And Request.IsAuthenticated = False) Then + If (ctlCaptcha.IsValid = False) Then + txtComment.Focus() + Return + End If + End If + + Dim objController As New ArticleController + Dim objArticle As ArticleInfo = objController.GetArticle(ArticleID) + + Dim objCommentController As New CommentController + Dim objComments As List(Of CommentInfo) = objCommentController.GetCommentList(ArticleModuleBase.ModuleId, ArticleID, True, SortDirection.Ascending, Null.NullInteger) + + For Each objArticleComment As CommentInfo In objComments + If (objArticleComment.CreatedDate > DateTime.Now.AddMinutes(-1)) Then + Dim id As Integer = Null.NullInteger + If (Request.IsAuthenticated) Then + id = ArticleModuleBase.UserId + End If + If (objArticleComment.Comment = FilterInput(txtComment.Text) And objArticleComment.UserID = id) Then + ' Existing Comment just posted - so ignore redirect. + If (Request("articleType") <> "ArticleView") Then + Response.Redirect(Request.RawUrl & "#Comment" & objArticleComment.CommentID.ToString(), True) + Else + Response.Redirect(Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False) & "#Comment" & objArticleComment.CommentID.ToString(), True) + End If + Return + End If + End If + Next + + objComments = objCommentController.GetCommentList(ArticleModuleBase.ModuleId, ArticleID, False, SortDirection.Ascending, Null.NullInteger) + + For Each objArticleComment As CommentInfo In objComments + If (objArticleComment.CreatedDate > DateTime.Now.AddMinutes(-1)) Then + Dim id As Integer = Null.NullInteger + If (Request.IsAuthenticated) Then + id = ArticleModuleBase.UserId + End If + If (objArticleComment.Comment = FilterInput(txtComment.Text) And objArticleComment.UserID = id) Then + ' Existing Comment just posted - so ignore redirect. + If (Request("articleType") <> "ArticleView") Then + Response.Redirect(Request.RawUrl & "#Comment" & objArticleComment.CommentID.ToString(), True) + Else + Response.Redirect(Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False) & "#Comment" & objArticleComment.CommentID.ToString(), True) + End If + Return + End If + End If + Next + + Dim objComment As New CommentInfo + objComment.ArticleID = ArticleID + objComment.CreatedDate = DateTime.Now + If (Request.IsAuthenticated) Then + objComment.UserID = ArticleModuleBase.UserId + Else + objComment.UserID = Null.NullInteger + objComment.AnonymousName = txtName.Text + objComment.AnonymousEmail = txtEmail.Text + objComment.AnonymousURL = txtURL.Text + SetCookie() + End If + objComment.Comment = FilterInput(txtComment.Text) + objComment.RemoteAddress = Request.UserHostAddress + objComment.NotifyMe = chkNotifyMe.Checked + objComment.Type = 0 + + If (ArticleSettings.IsApprover Or ArticleSettings.IsAutoApproverComment) Then + objComment.IsApproved = True + objComment.ApprovedBy = ArticleModuleBase.UserId + Else + If (ArticleSettings.CommentModeration) Then + objComment.IsApproved = False + objComment.ApprovedBy = Null.NullInteger + Else + objComment.IsApproved = True + objComment.ApprovedBy = Null.NullInteger + End If + End If + + ' Akismet + If (ArticleSettings.CommentAkismetKey <> "") Then + Dim api As New Akismet(ArticleSettings.CommentAkismetKey, DotNetNuke.Common.Globals.NavigateURL(CType(Parent.Parent, DotNetNuke.Entities.Modules.PortalModuleBase).TabId), "Test/1.0") + If (api.VerifyKey()) Then + Dim comment As New AkismetComment() + + comment.Blog = DotNetNuke.Common.Globals.NavigateURL(CType(Parent.Parent, DotNetNuke.Entities.Modules.PortalModuleBase).TabId) + comment.UserIp = objComment.RemoteAddress + comment.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" + comment.CommentContent = objComment.Comment + comment.CommentType = "comment" + + If (Request.IsAuthenticated) Then + comment.CommentAuthor = CType(Parent.Parent, DotNetNuke.Entities.Modules.PortalModuleBase).UserInfo.DisplayName + comment.CommentAuthorEmail = CType(Parent.Parent, DotNetNuke.Entities.Modules.PortalModuleBase).UserInfo.Email + comment.CommentAuthorUrl = "" + Else + comment.CommentAuthor = objComment.AnonymousName + comment.CommentAuthorEmail = objComment.AnonymousEmail + comment.CommentAuthorUrl = objComment.AnonymousURL + End If + + If (api.CommentCheck(comment)) Then + txtComment.Focus() + Return + End If + End If + End If + + objComment.CommentID = objCommentController.AddComment(objComment) + + ' Re-init for user details. + objComment = objCommentController.GetComment(objComment.CommentID) + + If Not (objArticle Is Nothing) Then + + ' Notifications + If (objComment.IsApproved) Then + If (ArticleSettings.NotifyAuthorOnComment) Then + NotifyAuthor(objComment, objArticle) + End If + NotifyComments(objComment, objArticle) + + If (ArticleSettings.NotifyEmailOnComment <> "") Then + Dim objEmailTemplateController As New EmailTemplateController + For Each email As String In ArticleSettings.NotifyEmailOnComment.Split(Convert.ToChar(";")) + If (email <> "") Then + objEmailTemplateController.SendFormattedEmail(ArticleModuleBase.ModuleId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentNotification, ArticleSettings, email) + End If + Next + End If + + If (ArticleSettings.EnableActiveSocialFeed And Request.IsAuthenticated) Then + If (ArticleSettings.ActiveSocialCommentKey <> "") Then + If IO.File.Exists(HttpContext.Current.Server.MapPath("~/bin/active.modules.social.dll")) Then + Dim ai As Object = Nothing + Dim asm As System.Reflection.Assembly + Dim ac As Object = Nothing + Try + asm = System.Reflection.Assembly.Load("Active.Modules.Social") + ac = asm.CreateInstance("Active.Modules.Social.API.Journal") + If Not ac Is Nothing Then + ac.AddProfileItem(New Guid(ArticleSettings.ActiveSocialCommentKey), objComment.UserID, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle.Title, objComment.Comment, objComment.Comment, 1, "") + End If + Catch ex As Exception + End Try + End If + End If + End If + + If (Request.IsAuthenticated) Then + If (ArticleSettings.JournalIntegration) Then + Dim objJournal As New Journal + objJournal.AddCommentToJournal(objArticle, objComment, ArticleModuleBase.PortalId, ArticleModuleBase.TabId, ArticleModuleBase.UserId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False)) + End If + End If + + If (ArticleSettings.EnableSmartThinkerStoryFeed And Request.IsAuthenticated) Then + Dim objStoryFeed As New wsStoryFeed.StoryFeedWS + objStoryFeed.Url = DotNetNuke.Common.Globals.AddHTTP(Request.ServerVariables("HTTP_HOST") & Me.ResolveUrl("~/DesktopModules/Smart-Thinker%20-%20UserProfile/StoryFeed.asmx")) + + Dim val As String = ArticleModuleBase.GetSharedResource("StoryFeed-AddComment") + + Dim delimStr As String = "[]" + Dim delimiter As Char() = delimStr.ToCharArray() + Dim layoutArray As String() = val.Split(delimiter) + + Dim valResult As String = "" + + For iPtr As Integer = 0 To layoutArray.Length - 1 Step 2 + + valResult = valResult & layoutArray(iPtr) + + If iPtr < layoutArray.Length - 1 Then + Select Case layoutArray(iPtr + 1) + + Case "ARTICLEID" + valResult = valResult & objComment.ArticleID.ToString() + + Case "AUTHORID" + valResult = valResult & objComment.UserID.ToString() + + Case "AUTHOR" + If (objComment.UserID = Null.NullInteger) Then + valResult = valResult & objComment.AnonymousName + Else + valResult = valResult & objComment.AuthorDisplayName + End If + + Case "ARTICLELINK" + valResult = valResult & Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False) + + Case "ARTICLETITLE" + valResult = valResult & objArticle.Title + + Case "ISANONYMOUS" + If (objComment.UserID <> Null.NullInteger) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISANONYMOUS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISANONYMOUS" + ' Do Nothing + + Case "ISNOTANONYMOUS" + If (objComment.UserID <> Null.NullInteger) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISNOTANONYMOUS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISNOTANONYMOUS" + ' Do Nothing + + End Select + End If + Next + + Try + objStoryFeed.AddAction(81, objComment.CommentID, valResult, objComment.UserID, "VE6457624576460436531768") + Catch + End Try + + End If + Else + + If (ArticleSettings.NotifyApproverForCommentApproval) Then + + ' Notify Approvers + Dim objEmailTemplateController As New EmailTemplateController + Dim emails As String = objEmailTemplateController.GetApproverDistributionList(ArticleModuleBase.ModuleId) + + For Each email As String In emails.Split(Convert.ToChar(";")) + If (email <> "") Then + Try + objEmailTemplateController.SendFormattedEmail(ArticleModuleBase.ModuleId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentRequiringApproval, ArticleSettings, email) + Catch + End Try + End If + Next + + End If + + If (ArticleSettings.NotifyEmailForCommentApproval <> "") Then + + Dim objEmailTemplateController As New EmailTemplateController + + For Each email As String In ArticleSettings.NotifyEmailForCommentApproval.Split(Convert.ToChar(";")) + If (email <> "") Then + Try + objEmailTemplateController.SendFormattedEmail(ArticleModuleBase.ModuleId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentRequiringApproval, ArticleSettings, email) + Catch + End Try + End If + Next + + End If + + End If + + ' Redirect + If (objComment.IsApproved) Then + If (Request("articleType") <> "ArticleView") Then + Response.Redirect(Request.RawUrl & "#Comment" & objComment.CommentID.ToString(), True) + Else + Response.Redirect(Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False) & "#Comment" & objComment.CommentID.ToString(), True) + End If + Else + phCommentForm.Visible = False + phCommentPosted.Visible = True + End If + + Else + + ' Should never be here. + Response.Redirect(DotNetNuke.Common.NavigateURL(), True) + + End If + + End If + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Controls/PostRating.ascx b/Controls/PostRating.ascx new file mode 100755 index 0000000..85629c3 --- /dev/null +++ b/Controls/PostRating.ascx @@ -0,0 +1,9 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="PostRating.ascx.vb" Inherits="Ventrian.NewsArticles.Controls.PostRating" %> + + 1 + 2 + 3 + 4 + 5 + + diff --git a/Controls/PostRating.ascx.designer.vb b/Controls/PostRating.ascx.designer.vb new file mode 100755 index 0000000..7fdaeec --- /dev/null +++ b/Controls/PostRating.ascx.designer.vb @@ -0,0 +1,35 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles.Controls + + Partial Public Class PostRating + + ''' + '''lstRating control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstRating As Global.System.Web.UI.WebControls.RadioButtonList + + ''' + '''lblRatingSaved control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblRatingSaved As Global.System.Web.UI.WebControls.Label + End Class +End Namespace diff --git a/Controls/PostRating.ascx.vb b/Controls/PostRating.ascx.vb new file mode 100755 index 0000000..b74666f --- /dev/null +++ b/Controls/PostRating.ascx.vb @@ -0,0 +1,248 @@ +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Localization +Imports DotNetNuke.Framework +Imports Ventrian.NewsArticles.Components.Social + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles.Controls + + Partial Public Class PostRating + Inherits System.Web.UI.UserControl + +#Region " Private Members " + + Private _articleID As Integer = Null.NullInteger + +#End Region + +#Region " Private Properties " + + Private ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase + Get + Return CType(Parent.Parent, NewsArticleModuleBase) + End Get + End Property + + Private ReadOnly Property ArticleSettings() As ArticleSettings + Get + Return ArticleModuleBase.ArticleSettings + End Get + End Property + +#End Region + +#Region " Private Methods " + + Private Sub AssignLocalization() + + lblRatingSaved.Text = GetResourceKey("RatingSaved") + + End Sub + + Public Function GetResourceKey(ByVal key As String) As String + + Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/" & Localization.LocalResourceDirectory & "/PostRating.ascx.resx" + Return DotNetNuke.Services.Localization.Localization.GetString(key, path) + + End Function + + Private Sub ReadQueryString() + + If (ArticleSettings.UrlModeType = Components.Types.UrlModeType.Shorterned) Then + Try + If (IsNumeric(Request(ArticleSettings.ShortenedID))) Then + _articleID = Convert.ToInt32(Request(ArticleSettings.ShortenedID)) + End If + Catch + End Try + End If + + If (IsNumeric(Request("ArticleID"))) Then + _articleID = Convert.ToInt32(Request("ArticleID")) + End If + + End Sub + +#End Region + +#Region " Event Handlers " + + Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + + If Not (TypeOf Parent.Parent Is NewsArticleModuleBase) Then + Visible = False + Return + End If + + ReadQueryString() + AssignLocalization() + + If (ArticleSettings.IsRateable = False) Then + Me.Visible = False + Return + End If + + If (IsPostBack = False) Then + + Dim objRatingController As New RatingController + If (Request.IsAuthenticated) Then + Dim objRating As RatingInfo = objRatingController.Get(_articleID, ArticleModuleBase.UserId, ArticleModuleBase.ModuleId) + + If Not (objRating Is Nothing) Then + If (objRating.RatingID <> Null.NullInteger) Then + If Not (lstRating.Items.FindByValue(Convert.ToDouble(objRating.Rating).ToString()) Is Nothing) Then + lstRating.SelectedValue = Convert.ToDouble(objRating.Rating).ToString() + End If + End If + End If + Else + Dim cookie As HttpCookie = Request.Cookies("ArticleRating" & _articleID.ToString()) + If Not (cookie Is Nothing) Then + Dim objRating As RatingInfo = objRatingController.GetByID(Convert.ToInt32(cookie.Value), _articleID, ArticleModuleBase.ModuleId) + + If Not (objRating Is Nothing) Then + If Not (lstRating.Items.FindByValue(Convert.ToDouble(objRating.Rating).ToString()) Is Nothing) Then + lstRating.SelectedValue = Convert.ToDouble(objRating.Rating).ToString() + End If + End If + End If + End If + + End If + + End Sub + + Protected Sub lstRating_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles lstRating.SelectedIndexChanged + + If (Request.IsAuthenticated) Then + + Dim objRatingController As New RatingController + + Dim objRatingExists As RatingInfo = objRatingController.Get(_articleID, ArticleModuleBase.UserId, ArticleModuleBase.ModuleId) + + If (objRatingExists.RatingID <> Null.NullInteger) Then + objRatingController.Delete(objRatingExists.RatingID, _articleID, ArticleModuleBase.ModuleId) + End If + + Dim objRating As New RatingInfo + + objRating.ArticleID = _articleID + objRating.CreatedDate = DateTime.Now + objRating.Rating = Convert.ToDouble(lstRating.SelectedValue) + objRating.UserID = ArticleModuleBase.UserId + + objRating.RatingID = objRatingController.Add(objRating, ArticleModuleBase.ModuleId) + + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(_articleID) + + If (ArticleSettings.EnableActiveSocialFeed And Request.IsAuthenticated) Then + If (ArticleSettings.ActiveSocialRateKey <> "") Then + If IO.File.Exists(HttpContext.Current.Server.MapPath("~/bin/active.modules.social.dll")) Then + Dim ai As Object = Nothing + Dim asm As System.Reflection.Assembly + Dim ac As Object = Nothing + Try + asm = System.Reflection.Assembly.Load("Active.Modules.Social") + ac = asm.CreateInstance("Active.Modules.Social.API.Journal") + If Not ac Is Nothing Then + ac.AddProfileItem(New Guid(ArticleSettings.ActiveSocialRateKey), objRating.UserID, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle.Title, objRating.Rating.ToString(), objRating.Rating.ToString(), 1, "") + End If + Catch ex As Exception + End Try + End If + End If + End If + + If (ArticleSettings.JournalIntegration) Then + Dim objJournal As New Journal + objJournal.AddRatingToJournal(objArticle, objRating, ArticleModuleBase.PortalId, ArticleModuleBase.TabId, ArticleModuleBase.UserId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False)) + End If + + If (ArticleSettings.EnableSmartThinkerStoryFeed) Then + Dim objStoryFeed As New wsStoryFeed.StoryFeedWS + objStoryFeed.Url = DotNetNuke.Common.Globals.AddHTTP(Request.ServerVariables("HTTP_HOST") & Me.ResolveUrl("~/DesktopModules/Smart-Thinker%20-%20UserProfile/StoryFeed.asmx")) + + Dim val As String = ArticleModuleBase.GetSharedResource("StoryFeed-AddRating") + + Dim delimStr As String = "[]" + Dim delimiter As Char() = delimStr.ToCharArray() + Dim layoutArray As String() = val.Split(delimiter) + + Dim valResult As String = "" + + For iPtr As Integer = 0 To layoutArray.Length - 1 Step 2 + + valResult = valResult & layoutArray(iPtr) + + If iPtr < layoutArray.Length - 1 Then + Select Case layoutArray(iPtr + 1) + + Case "ARTICLEID" + valResult = valResult & objRating.ArticleID.ToString() + + Case "AUTHORID" + valResult = valResult & objRating.UserID.ToString() + + Case "AUTHOR" + valResult = valResult & ArticleModuleBase.UserInfo.DisplayName + + Case "ARTICLELINK" + valResult = valResult & Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False) + + Case "ARTICLETITLE" + valResult = valResult & objArticle.Title + + End Select + End If + Next + + Try + objStoryFeed.AddAction(82, objRating.RatingID, valResult, objRating.UserID, "VE6457624576460436531768") + Catch + End Try + End If + + Else + + Dim objRatingController As New RatingController + Dim objRating As New RatingInfo + Dim cookie As HttpCookie = Request.Cookies("ArticleRating" & _articleID.ToString()) + If Not (cookie Is Nothing) Then + objRating = objRatingController.GetByID(Convert.ToInt32(cookie.Value), _articleID, ArticleModuleBase.ModuleId) + If Not (objRating Is Nothing) Then + If (objRating.ArticleID <> Null.NullInteger) Then + objRatingController.Delete(objRating.RatingID, _articleID, ArticleModuleBase.ModuleId) + End If + End If + End If + + objRating = New RatingInfo + + objRating.ArticleID = _articleID + objRating.CreatedDate = DateTime.Now + objRating.Rating = Convert.ToDouble(lstRating.SelectedValue) + objRating.UserID = -1 + + Dim ratingID As Integer = objRatingController.Add(objRating, ArticleModuleBase.ModuleId) + + cookie = New HttpCookie("ArticleRating" & _articleID.ToString()) + cookie.Value = ratingID.ToString() + cookie.Expires = DateTime.Now.AddDays(7) + Context.Response.Cookies.Add(cookie) + + End If + + lblRatingSaved.Visible = True + + HttpContext.Current.Items.Add("IgnoreCaptcha", "True") + Response.Redirect(Request.RawUrl, True) + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Controls/SWFUploader.ashx b/Controls/SWFUploader.ashx new file mode 100755 index 0000000..55489a2 --- /dev/null +++ b/Controls/SWFUploader.ashx @@ -0,0 +1 @@ +<%@ WebHandler Language="VB" CodeBehind="SWFUploader.ashx.vb" Class="Ventrian.NewsArticles.Controls.SWFUploader" %> diff --git a/Controls/SWFUploader.ashx.vb b/Controls/SWFUploader.ashx.vb new file mode 100755 index 0000000..30dfb36 --- /dev/null +++ b/Controls/SWFUploader.ashx.vb @@ -0,0 +1,415 @@ +Imports System.Web +Imports System.Web.Services + +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Entities.Portals +Imports DotNetNuke.Entities.Users +Imports DotNetNuke.Security.Roles +Imports DotNetNuke.Services.FileSystem +Imports System.IO +Imports System.Drawing +Imports System.Drawing.Drawing2D +Imports System.Drawing.Imaging + +Namespace Ventrian.NewsArticles.Controls + + Public Class SWFUploader + Implements System.Web.IHttpHandler + +#Region " Private Members " + + Private _articleID As Integer = Null.NullInteger + Private _moduleID As Integer = Null.NullInteger + Private _tabID As Integer = Null.NullInteger + Private _tabModuleID As Integer = Null.NullInteger + Private _portalID As Integer = Null.NullInteger + Private _ticket As String = Null.NullString + Private _userID As Integer = Null.NullInteger + Private _imageGuid As String = Null.NullString + + Private _articleSettings As Ventrian.NewsArticles.ArticleSettings + Private _settings As Hashtable + Private _context As HttpContext + +#End Region + +#Region " Private Properties " + + Private ReadOnly Property ArticleSettings() As Ventrian.NewsArticles.ArticleSettings + Get + If _articleSettings Is Nothing Then + Dim objModuleController As New ModuleController + Dim objModule As ModuleInfo = objModuleController.GetModule(_moduleID, _tabID) + + _articleSettings = New Ventrian.NewsArticles.ArticleSettings(Settings, PortalController.GetCurrentPortalSettings(), objModule) + End If + Return _articleSettings + End Get + End Property + + Private ReadOnly Property Settings() As Hashtable + Get + If _settings Is Nothing Then + Dim objModuleController As New ModuleController + _settings = objModuleController.GetModuleSettings(_moduleID) + _settings = GetTabModuleSettings(_tabModuleID, _settings) + End If + Return _settings + End Get + End Property + +#End Region + +#Region " Private Methods " + + Private Sub AuthenticateUserFromTicket() + + If (_ticket <> "") Then + + Dim ticket As FormsAuthenticationTicket = FormsAuthentication.Decrypt(_ticket) + Dim fi As FormsIdentity = New FormsIdentity(ticket) + + Dim roles As String() = Nothing + HttpContext.Current.User = New System.Security.Principal.GenericPrincipal(fi, roles) + + Dim objUser As UserInfo = UserController.GetUserByName(_portalID, HttpContext.Current.User.Identity.Name) + + If Not (objUser Is Nothing) Then + _userID = objUser.UserID + HttpContext.Current.Items("UserInfo") = objUser + + Dim objRoleController As New RoleController + roles = objRoleController.GetRolesByUser(_userID, _portalID) + + Dim strPortalRoles As String = Join(roles, New Char() {";"c}) + _context.Items.Add("UserRoles", ";" + strPortalRoles + ";") + End If + + End If + + End Sub + + Private Function GetTabModuleSettings(ByVal TabModuleId As Integer, ByVal settings As Hashtable) As Hashtable + + Dim dr As IDataReader = DotNetNuke.Data.DataProvider.Instance().GetTabModuleSettings(TabModuleId) + + While dr.Read() + + If Not dr.IsDBNull(1) Then + settings(dr.GetString(0)) = dr.GetString(1) + Else + settings(dr.GetString(0)) = "" + End If + + End While + + dr.Close() + + Return settings + + End Function + + Private Sub ReadQueryString() + + If (_context.Request("ModuleID") <> "") Then + _moduleID = Convert.ToInt32(_context.Request("ModuleID")) + End If + + If (_context.Request("PortalID") <> "") Then + _portalID = Convert.ToInt32(_context.Request("PortalID")) + End If + + If (_context.Request("ArticleID") <> "") Then + _articleID = Convert.ToInt32(_context.Request("ArticleID")) + End If + + If (_context.Request("TabModuleID") <> "") Then + _tabModuleID = Convert.ToInt32(_context.Request("TabModuleID")) + End If + + If (_context.Request("TabID") <> "") Then + _tabID = Convert.ToInt32(_context.Request("TabID")) + End If + + If (_context.Request("Ticket") <> "") Then + _ticket = _context.Request("Ticket") + End If + + If (_articleID = Null.NullInteger) Then + If (_context.Request("ArticleGuid") <> "") Then + _imageGuid = _context.Request("ArticleGuid") + End If + End If + + End Sub + +#End Region + +#Region " Interface Methods " + + Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest + + _context = context + context.Response.ContentType = "text/plain" + + ReadQueryString() + AuthenticateUserFromTicket() + + If (_context.Request.IsAuthenticated = False) Then + _context.Response.Write("-2") + _context.Response.End() + End If + + Dim objImageController As New ImageController() + Dim objFile As HttpPostedFile = _context.Request.Files("Filedata") + + If Not (objFile Is Nothing) Then + + Dim objPortalController As New PortalController() + If (objPortalController.HasSpaceAvailable(_portalID, objFile.ContentLength) = False) Then + _context.Response.Write("-1") + _context.Response.End() + End If + + Dim username As String = _context.User.Identity.Name + + Dim objImage As New ImageInfo + + objImage.ArticleID = _articleID + If (_articleID = Null.NullInteger) Then + objImage.ImageGuid = _imageGuid + End If + objImage.FileName = objFile.FileName + + If (objFile.FileName.ToLower().EndsWith(".jpg")) Then + objImage.ContentType = "image/jpeg" + End If + + If (objFile.FileName.ToLower().EndsWith(".gif")) Then + objImage.ContentType = "image/gif" + End If + + If (objFile.FileName.ToLower().EndsWith(".png")) Then + objImage.ContentType = "image/png" + End If + + Dim maxWidth As Integer = ArticleSettings.MaxImageWidth + Dim maxHeight As Integer = ArticleSettings.MaxImageHeight + + Dim photo As Drawing.Image = Drawing.Image.FromStream(objFile.InputStream) + + objImage.Width = photo.Width + objImage.Height = photo.Height + + If (objImage.Width > maxWidth) Then + objImage.Width = maxWidth + objImage.Height = Convert.ToInt32(objImage.Height / (photo.Width / maxWidth)) + End If + + If (objImage.Height > maxHeight) Then + objImage.Height = maxHeight + objImage.Width = Convert.ToInt32(photo.Width / (photo.Height / maxHeight)) + End If + + objImage.SortOrder = 0 + + Dim imagesList As List(Of ImageInfo) = objImageController.GetImageList(_articleID, _imageGuid) + + If (imagesList.Count > 0) Then + objImage.SortOrder = CType(imagesList(imagesList.Count - 1), ImageInfo).SortOrder + 1 + End If + + Dim objPortalSettings As PortalSettings = PortalController.GetCurrentPortalSettings() + + Dim folder As String = "" + Dim folderID As Integer = Null.NullInteger + If (IsNumeric(context.Request.Form("FolderID"))) Then + folderID = Convert.ToInt32(context.Request.Form("FolderID")) + End If + + If (folderID <> Null.NullInteger) Then + Dim objFolderController As New FolderController + Dim objFolder As FolderInfo = objFolderController.GetFolderInfo(_portalID, folderID) + If (objFolder IsNot Nothing) Then + folder = objFolder.FolderPath + End If + End If + + objImage.Folder = folder + + Select Case objImage.ContentType.ToLower() + Case "image/jpeg" + objImage.Extension = "jpg" + Exit Select + Case "image/gif" + objImage.Extension = "gif" + Exit Select + Case "image/png" + objImage.Extension = "png" + Exit Select + End Select + + objImage.Title = objFile.FileName.Replace("." & objImage.Extension, "") + + Dim filePath As String = objPortalSettings.HomeDirectoryMapPath & folder.Replace("/", "\") + + If Not (Directory.Exists(filePath)) Then + Directory.CreateDirectory(filePath) + End If + + If (File.Exists(filePath & objImage.FileName)) Then + For i As Integer = 1 To 100 + If (File.Exists(filePath & i.ToString() & "_" & objImage.FileName) = False) Then + objImage.FileName = i.ToString() & "_" & objImage.FileName + Exit For + End If + Next + End If + + objImage.Size = objFile.ContentLength + If ((photo.Width < maxWidth And photo.Height < maxHeight) Or (ArticleSettings.ResizeImages = False)) Then + objFile.SaveAs(filePath & objImage.FileName) + Else + Dim bmp As New Bitmap(objImage.Width, objImage.Height) + Dim g As Graphics = Graphics.FromImage(DirectCast(bmp, Drawing.Image)) + + g.InterpolationMode = InterpolationMode.HighQualityBicubic + g.SmoothingMode = SmoothingMode.HighQuality + g.PixelOffsetMode = PixelOffsetMode.HighQuality + g.CompositingQuality = CompositingQuality.HighQuality + + g.DrawImage(photo, 0, 0, objImage.Width, objImage.Height) + + If (ArticleSettings.WatermarkEnabled And ArticleSettings.WatermarkText <> "") Then + Dim crSize As SizeF = New SizeF + Dim brushColor As Brush = Brushes.Yellow + Dim fnt As Font = New Font("Verdana", 11, FontStyle.Bold) + Dim strDirection As StringFormat = New StringFormat + + strDirection.Alignment = StringAlignment.Center + crSize = g.MeasureString(ArticleSettings.WatermarkText, fnt) + + Dim yPixelsFromBottom As Integer = Convert.ToInt32(Convert.ToDouble(objImage.Height) * 0.05) + Dim yPosFromBottom As Single = Convert.ToSingle((objImage.Height - yPixelsFromBottom) - (crSize.Height / 2)) + Dim xCenterOfImage As Single = Convert.ToSingle((objImage.Width / 2)) + + g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias + + Dim semiTransBrush2 As SolidBrush = New SolidBrush(Color.FromArgb(153, 0, 0, 0)) + g.DrawString(ArticleSettings.WatermarkText, fnt, semiTransBrush2, New PointF(xCenterOfImage + 1, yPosFromBottom + 1), strDirection) + + Dim semiTransBrush As SolidBrush = New SolidBrush(Color.FromArgb(153, 255, 255, 255)) + g.DrawString(ArticleSettings.WatermarkText, fnt, semiTransBrush, New PointF(xCenterOfImage, yPosFromBottom), strDirection) + End If + + If (ArticleSettings.WatermarkEnabled And ArticleSettings.WatermarkImage <> "") Then + Dim watermark As String = objPortalSettings.HomeDirectoryMapPath & ArticleSettings.WatermarkImage + If (File.Exists(watermark)) Then + Dim imgWatermark As Image = New Bitmap(watermark) + Dim wmWidth As Integer = imgWatermark.Width + Dim wmHeight As Integer = imgWatermark.Height + + Dim objImageAttributes As New ImageAttributes() + Dim objColorMap As New ColorMap() + objColorMap.OldColor = Color.FromArgb(255, 0, 255, 0) + objColorMap.NewColor = Color.FromArgb(0, 0, 0, 0) + Dim remapTable As ColorMap() = {objColorMap} + objImageAttributes.SetRemapTable(remapTable, ColorAdjustType.Bitmap) + + Dim colorMatrixElements As Single()() = {New Single() {1.0F, 0.0F, 0.0F, 0.0F, 0.0F}, New Single() {0.0F, 1.0F, 0.0F, 0.0F, 0.0F}, New Single() {0.0F, 0.0F, 1.0F, 0.0F, 0.0F}, New Single() {0.0F, 0.0F, 0.0F, 0.3F, 0.0F}, New Single() {0.0F, 0.0F, 0.0F, 0.0F, 1.0F}} + Dim wmColorMatrix As New ColorMatrix(colorMatrixElements) + objImageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.[Default], ColorAdjustType.Bitmap) + + Dim xPosOfWm As Integer = ((objImage.Width - wmWidth) - 10) + Dim yPosOfWm As Integer = 10 + + Select Case ArticleSettings.WatermarkPosition + Case WatermarkPosition.TopLeft + xPosOfWm = 10 + yPosOfWm = 10 + Exit Select + + Case WatermarkPosition.TopRight + xPosOfWm = ((objImage.Width - wmWidth) - 10) + yPosOfWm = 10 + Exit Select + + Case WatermarkPosition.BottomLeft + xPosOfWm = 10 + yPosOfWm = ((objImage.Height - wmHeight) - 10) + + Case WatermarkPosition.BottomRight + xPosOfWm = ((objImage.Width - wmWidth) - 10) + yPosOfWm = ((objImage.Height - wmHeight) - 10) + End Select + + g.DrawImage(imgWatermark, New Rectangle(xPosOfWm, yPosOfWm, wmWidth, wmHeight), 0, 0, wmWidth, wmHeight, _ + GraphicsUnit.Pixel, objImageAttributes) + imgWatermark.Dispose() + End If + End If + + photo.Dispose() + + Select Case objFile.ContentType.ToLower() + Case "image/jpeg" + Dim info As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders() + Dim encoderParameters As New EncoderParameters(1) + encoderParameters.Param(0) = New EncoderParameter(Encoder.Quality, 100L) + bmp.Save(filePath & objImage.FileName, info(1), encoderParameters) + + Case "image/gif" + 'Dim quantizer As New ImageQuantization.OctreeQuantizer(255, 8) + 'Dim bmpQuantized As Bitmap = quantizer.Quantize(bmp) + 'bmpQuantized.Save(filePath & objPhoto.Filename, ImageFormat.Gif) + ' Not working in medium trust. + bmp.Save(filePath & objImage.FileName, ImageFormat.Gif) + + Case Else + 'Shouldn't get to here because of validators. + Dim info As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders() + Dim encoderParameters As New EncoderParameters(1) + encoderParameters.Param(0) = New EncoderParameter(Encoder.Quality, 100L) + bmp.Save(filePath & objImage.FileName, info(1), encoderParameters) + End Select + + bmp.Dispose() + + If (File.Exists(filePath & objImage.FileName)) Then + Dim fi As New IO.FileInfo(filePath & objImage.FileName) + If (fi IsNot Nothing) Then + objImage.Size = Convert.ToInt32(fi.Length) + End If + End If + End If + + objImage.ImageID = objImageController.Add(objImage) + + If (_articleID <> Null.NullInteger) Then + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(_articleID) + If (objArticle IsNot Nothing) Then + objArticle.ImageCount = objArticle.ImageCount + 1 + objArticleController.UpdateArticle(objArticle) + End If + End If + + End If + + _context.Response.Write("0") + _context.Response.End() + + End Sub + + ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable + Get + Return False + End Get + End Property + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Controls/SWFUploaderFiles.ashx b/Controls/SWFUploaderFiles.ashx new file mode 100755 index 0000000..962213f --- /dev/null +++ b/Controls/SWFUploaderFiles.ashx @@ -0,0 +1 @@ +<%@ WebHandler Language="VB" CodeBehind="SWFUploaderFiles.ashx.vb" Class="Ventrian.NewsArticles.Controls.SWFUploaderFiles" %> diff --git a/Controls/SWFUploaderFiles.ashx.vb b/Controls/SWFUploaderFiles.ashx.vb new file mode 100755 index 0000000..0443e62 --- /dev/null +++ b/Controls/SWFUploaderFiles.ashx.vb @@ -0,0 +1,281 @@ +Imports System.Web +Imports System.Web.Services + +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Entities.Portals +Imports DotNetNuke.Entities.Users +Imports DotNetNuke.Security.Roles +Imports DotNetNuke.Services.FileSystem +Imports System.IO +Imports System.Drawing +Imports System.Drawing.Drawing2D +Imports System.Drawing.Imaging + +Namespace Ventrian.NewsArticles.Controls + + Public Class SWFUploaderFiles + Implements System.Web.IHttpHandler + +#Region " Private Members " + + Private _articleID As Integer = Null.NullInteger + Private _moduleID As Integer = Null.NullInteger + Private _tabID As Integer = Null.NullInteger + Private _tabModuleID As Integer = Null.NullInteger + Private _portalID As Integer = Null.NullInteger + Private _ticket As String = Null.NullString + Private _userID As Integer = Null.NullInteger + Private _fileGuid As String = Null.NullString + + Private _articleSettings As Ventrian.NewsArticles.ArticleSettings + Private _settings As Hashtable + Private _context As HttpContext + +#End Region + +#Region " Private Properties " + + Private ReadOnly Property ArticleSettings() As Ventrian.NewsArticles.ArticleSettings + Get + If _articleSettings Is Nothing Then + Dim objModuleController As New ModuleController + Dim objModule As ModuleInfo = objModuleController.GetModule(_moduleID, _tabID) + + _articleSettings = New Ventrian.NewsArticles.ArticleSettings(Settings, PortalController.GetCurrentPortalSettings(), objModule) + End If + Return _articleSettings + End Get + End Property + + Private ReadOnly Property Settings() As Hashtable + Get + If _settings Is Nothing Then + Dim objModuleController As New ModuleController + _settings = objModuleController.GetModuleSettings(_moduleID) + _settings = GetTabModuleSettings(_tabModuleID, _settings) + End If + Return _settings + End Get + End Property + +#End Region + +#Region " Private Methods " + + Private Sub AuthenticateUserFromTicket() + + If (_ticket <> "") Then + + Dim ticket As FormsAuthenticationTicket = FormsAuthentication.Decrypt(_ticket) + Dim fi As FormsIdentity = New FormsIdentity(ticket) + + Dim roles As String() = Nothing + HttpContext.Current.User = New System.Security.Principal.GenericPrincipal(fi, roles) + + Dim objUser As UserInfo = UserController.GetUserByName(_portalID, HttpContext.Current.User.Identity.Name) + + If Not (objUser Is Nothing) Then + _userID = objUser.UserID + HttpContext.Current.Items("UserInfo") = objUser + + Dim objRoleController As New RoleController + roles = objRoleController.GetRolesByUser(_userID, _portalID) + + Dim strPortalRoles As String = Join(roles, New Char() {";"c}) + _context.Items.Add("UserRoles", ";" + strPortalRoles + ";") + End If + + End If + + End Sub + + Private Function GetTabModuleSettings(ByVal TabModuleId As Integer, ByVal settings As Hashtable) As Hashtable + + Dim dr As IDataReader = DotNetNuke.Data.DataProvider.Instance().GetTabModuleSettings(TabModuleId) + + While dr.Read() + + If Not dr.IsDBNull(1) Then + settings(dr.GetString(0)) = dr.GetString(1) + Else + settings(dr.GetString(0)) = "" + End If + + End While + + dr.Close() + + Return settings + + End Function + + Private Sub ReadQueryString() + + If (_context.Request("ModuleID") <> "") Then + _moduleID = Convert.ToInt32(_context.Request("ModuleID")) + End If + + If (_context.Request("PortalID") <> "") Then + _portalID = Convert.ToInt32(_context.Request("PortalID")) + End If + + If (_context.Request("ArticleID") <> "") Then + _articleID = Convert.ToInt32(_context.Request("ArticleID")) + End If + + If (_context.Request("TabModuleID") <> "") Then + _tabModuleID = Convert.ToInt32(_context.Request("TabModuleID")) + End If + + If (_context.Request("TabID") <> "") Then + _tabID = Convert.ToInt32(_context.Request("TabID")) + End If + + If (_context.Request("Ticket") <> "") Then + _ticket = _context.Request("Ticket") + End If + + If (_articleID = Null.NullInteger) Then + If (_context.Request("ArticleGuid") <> "") Then + _fileGuid = _context.Request("ArticleGuid") + End If + End If + + End Sub + +#End Region + +#Region " Interface Methods " + + Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest + + _context = context + context.Response.ContentType = "text/plain" + + ReadQueryString() + AuthenticateUserFromTicket() + + If (_context.Request.IsAuthenticated = False) Then + _context.Response.Write("-2") + _context.Response.End() + End If + + Dim objFileController As New FileController + + Dim objFilePosted As HttpPostedFile = _context.Request.Files("Filedata") + + If Not (objFilePosted Is Nothing) Then + + Dim objPortalController As New PortalController() + If (objPortalController.HasSpaceAvailable(_portalID, objFilePosted.ContentLength) = False) Then + _context.Response.Write("-1") + _context.Response.End() + End If + + Dim username As String = _context.User.Identity.Name + + If (_articleID <> Null.NullInteger) Then + FileProvider.Instance().AddFile(_articleID, _moduleID, objFilePosted) + Else + FileProvider.Instance().AddFile(_fileGuid, _moduleID, objFilePosted) + End If + + 'Dim objFile As New FileInfo + + 'objFile.ArticleID = _articleID + 'If (_articleID = Null.NullInteger) Then + ' objFile.FileGuid = _fileGuid + 'End If + 'objFile.FileName = objFilePosted.FileName + 'objFile.SortOrder = 0 + + 'Dim filesList As List(Of FileInfo) = objFileController.GetFileList(_articleID, _fileGuid) + + 'If (filesList.Count > 0) Then + ' objFile.SortOrder = CType(filesList(filesList.Count - 1), FileInfo).SortOrder + 1 + 'End If + + 'Dim objPortalSettings As PortalSettings = PortalController.GetCurrentPortalSettings() + + 'Dim folder As String = "" + 'If (ArticleSettings.DefaultFilesFolder <> Null.NullInteger) Then + ' Dim objFolderController As New FolderController + ' Dim objFolder As FolderInfo = objFolderController.GetFolderInfo(_portalID, ArticleSettings.DefaultFilesFolder) + ' If (objFolder IsNot Nothing) Then + ' folder = objFolder.FolderPath + ' End If + 'End If + + 'objFile.Folder = folder + 'objFile.ContentType = objFilePosted.ContentType + + 'If (objFile.FileName.Split("."c).Length > 0) Then + ' objFile.Extension = objFile.FileName.Split("."c)(objFile.FileName.Split("."c).Length - 1) + + ' If (objFile.Extension.ToLower() = "jpg") Then + ' objFile.ContentType = "image/jpeg" + ' End If + ' If (objFile.Extension.ToLower() = "gif") Then + ' objFile.ContentType = "image/gif" + ' End If + ' If (objFile.Extension.ToLower() = "txt") Then + ' objFile.ContentType = "text/plain" + ' End If + ' If (objFile.Extension.ToLower() = "html") Then + ' objFile.ContentType = "text/html" + ' End If + ' If (objFile.Extension.ToLower() = "mp3") Then + ' objFile.ContentType = "audio/mpeg" + ' End If + + 'End If + 'objFile.Title = objFile.FileName.Replace("." & objFile.Extension, "") + + 'Dim filePath As String = objPortalSettings.HomeDirectoryMapPath & folder.Replace("/", "\") + + 'If Not (Directory.Exists(filePath)) Then + ' Directory.CreateDirectory(filePath) + 'End If + + 'If (File.Exists(filePath & objFile.FileName)) Then + ' For i As Integer = 1 To 100 + ' If (File.Exists(filePath & i.ToString() & "_" & objFile.FileName) = False) Then + ' objFile.FileName = i.ToString() & "_" & objFile.FileName + ' Exit For + ' End If + ' Next + 'End If + + 'objFile.Size = objFilePosted.ContentLength + 'objFilePosted.SaveAs(filePath & objFile.FileName) + + 'objFile.FileID = objFileController.Add(objFile) + + 'If (_articleID <> Null.NullInteger) Then + ' Dim objArticleController As New ArticleController + ' Dim objArticle As ArticleInfo = objArticleController.GetArticle(_articleID) + ' If (objArticle IsNot Nothing) Then + ' objArticle.FileCount = objArticle.FileCount + 1 + ' objArticleController.UpdateArticle(objArticle) + ' End If + 'End If + + End If + + _context.Response.Write("0") + _context.Response.End() + + End Sub + + ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable + Get + Return False + End Get + End Property + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Controls/UploadFiles.ascx b/Controls/UploadFiles.ascx new file mode 100755 index 0000000..1a36b8f --- /dev/null +++ b/Controls/UploadFiles.ascx @@ -0,0 +1,183 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="UploadFiles.ascx.vb" Inherits="Ventrian.NewsArticles.Controls.UploadFiles" %> +<%@ Register TagPrefix="Ventrian" Assembly="Ventrian.NewsArticles" Namespace="Ventrian.NewsArticles.Components.WebControls" %> + +<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="URL" Src="~/controls/URLControl.ascx" %> + + +
+ + + + + + + + + +
+
+ + + + + + +
+ + + + + + + + + +
 
+ +
+
+ +
+
+
+
+
+ + + + + +
+ + + + + +

 
+
+
+
+ + + + + +
+ + + + + <%#DataBinder.Eval(Container.DataItem, "Title")%> + +
+ + + + +
+ + + <%#DataBinder.Eval(Container.DataItem, "Title")%> + +
+ +
+ + +
+
+
+
+
+
+ + + diff --git a/Controls/UploadFiles.ascx.designer.vb b/Controls/UploadFiles.ascx.designer.vb new file mode 100755 index 0000000..57b9571 --- /dev/null +++ b/Controls/UploadFiles.ascx.designer.vb @@ -0,0 +1,233 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles.Controls + + Partial Public Class UploadFiles + + ''' + '''litModuleID control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents litModuleID As Global.System.Web.UI.WebControls.Literal + + ''' + '''litTabModuleID control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents litTabModuleID As Global.System.Web.UI.WebControls.Literal + + ''' + '''litTicketID control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents litTicketID As Global.System.Web.UI.WebControls.Literal + + ''' + '''litArticleGuid control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents litArticleGuid As Global.System.Web.UI.WebControls.Literal + + ''' + '''lblSelectFiles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblSelectFiles As Global.System.Web.UI.WebControls.Label + + ''' + '''dshFiles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshFiles As DotNetNuke.UI.UserControls.SectionHeadControl + + ''' + '''tblFiles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblFiles As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblFilesHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblFilesHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''phFiles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phFiles As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''trUpload control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trUpload As Global.System.Web.UI.HtmlControls.HtmlTableCell + + ''' + '''dshUploadFiles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshUploadFiles As DotNetNuke.UI.UserControls.SectionHeadControl + + ''' + '''tblUploadFiles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblUploadFiles As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plFolder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plFolder As Global.System.Web.UI.UserControl + + ''' + '''drpUploadFilesFolder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpUploadFilesFolder As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''trExisting control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trExisting As Global.System.Web.UI.HtmlControls.HtmlTableCell + + ''' + '''dshExistingFiles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshExistingFiles As DotNetNuke.UI.UserControls.SectionHeadControl + + ''' + '''tblExistingFiles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblExistingFiles As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''ctlFile control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ctlFile As DotNetNuke.UI.UserControls.UrlControl + + ''' + '''cmdAddExistingFile control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdAddExistingFile As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''dshSelectedFiles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshSelectedFiles As DotNetNuke.UI.UserControls.SectionHeadControl + + ''' + '''tblSelectedFiles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblSelectedFiles As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''dlFiles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dlFiles As Global.System.Web.UI.WebControls.DataList + + ''' + '''lblNoFiles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblNoFiles As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdRefreshFiles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdRefreshFiles As Global.Ventrian.NewsArticles.Components.WebControls.RefreshControl + End Class +End Namespace diff --git a/Controls/UploadFiles.ascx.vb b/Controls/UploadFiles.ascx.vb new file mode 100755 index 0000000..515c067 --- /dev/null +++ b/Controls/UploadFiles.ascx.vb @@ -0,0 +1,508 @@ +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.FileSystem +Imports DotNetNuke.Security + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles.Controls + + Partial Public Class UploadFiles + Inherits NewsArticleControlBase + +#Region " Private Members " + + Private _articleID As Integer = Null.NullInteger + + Private _filesInit As Boolean = False + Private _objFiles As List(Of FileInfo) + +#End Region + +#Region " Private Properties " + + Private ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase + Get + Return CType(Parent.Parent.Parent.Parent.Parent, NewsArticleModuleBase) + End Get + End Property + + Private ReadOnly Property ArticleSettings() As ArticleSettings + Get + Return ArticleModuleBase.ArticleSettings + End Get + End Property + +#End Region + +#Region " Public Properties " + + Public Property ArticleGuid() As Integer + Get + If (_articleID = Null.NullInteger) Then + If (litArticleGuid.Text = Null.NullString) Then + litArticleGuid.Text = (GetRandom(1, 100000) * -1).ToString() + End If + Return Convert.ToInt32(litArticleGuid.Text) + End If + Return _articleID + End Get + Set(ByVal value As Integer) + litArticleGuid.Text = value + End Set + End Property + + Public ReadOnly Property AttachedFiles() As List(Of FileInfo) + Get + + If (_filesInit = False) Then + '_objFiles = objFileController.GetFileList(_articleID, ArticleGuid) + If (_articleID = Null.NullInteger) Then + _objFiles = FileProvider.Instance().GetFiles(ArticleGuid) + Else + _objFiles = FileProvider.Instance().GetFiles(_articleID) + End If + _filesInit = True + End If + + Return _objFiles + + End Get + End Property + +#End Region + +#Region " Private Methods " + + Private Sub BindFiles() + + dlFiles.DataSource = AttachedFiles + dlFiles.DataBind() + + dlFiles.Visible = (dlFiles.Items.Count > 0) + lblNoFiles.Visible = (dlFiles.Items.Count = 0) + + End Sub + + Private Sub BindFolders() + + Dim ReadRoles As String = Null.NullString + Dim WriteRoles As String = Null.NullString + + drpUploadFilesFolder.Items.Clear() + + Dim folders As ArrayList = FileSystemUtils.GetFolders(ArticleModuleBase.PortalId) + For Each folder As FolderInfo In folders + Dim FolderItem As New ListItem() + If folder.FolderPath = Null.NullString Then + FolderItem.Text = ArticleModuleBase.GetSharedResource("Root") + ReadRoles = FileSystemUtils.GetRoles("", ArticleModuleBase.PortalId, "READ") + WriteRoles = FileSystemUtils.GetRoles("", ArticleModuleBase.PortalId, "WRITE") + Else + FolderItem.Text = folder.FolderPath + ReadRoles = FileSystemUtils.GetRoles(FolderItem.Text, ArticleModuleBase.PortalId, "READ") + WriteRoles = FileSystemUtils.GetRoles(FolderItem.Text, ArticleModuleBase.PortalId, "WRITE") + End If + FolderItem.Value = folder.FolderID + + If PortalSecurity.IsInRoles(ReadRoles) OrElse PortalSecurity.IsInRoles(WriteRoles) Then + drpUploadFilesFolder.Items.Add(FolderItem) + End If + Next + + If (drpUploadFilesFolder.Items.FindByValue(ArticleSettings.DefaultFilesFolder.ToString()) IsNot Nothing) Then + drpUploadFilesFolder.SelectedValue = ArticleSettings.DefaultFilesFolder.ToString() + End If + + End Sub + + Protected Function GetArticleID() As String + + Return _articleID.ToString() + + End Function + + Protected Function GetMaximumFileSize() As String + + Return "20480" + + End Function + + Protected Function GetPostBackReference() As String + + Return Page.ClientScript.GetPostBackEventReference(cmdRefreshFiles, "Refresh") + + End Function + + Private Function GetRandom(ByVal Min As Integer, ByVal Max As Integer) As Integer + Dim Generator As System.Random = New System.Random() + Return Generator.Next(Min, Max) + End Function + + Public Function GetResourceKey(ByVal key As String) As String + + Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/App_LocalResources/UploadFiles.ascx.resx" + Return DotNetNuke.Services.Localization.Localization.GetString(key, path) + + End Function + + Protected Function GetUploadUrl() As String + + Dim link As String = Page.ResolveUrl("~/DesktopModules/DnnForge%20-%20NewsArticles/Controls/SWFUploaderFiles.ashx?PortalID=" & ArticleModuleBase.PortalId.ToString()) + + If (link.ToLower().StartsWith("http")) Then + Return link + Else + If (Request.Url.Port = 80) Then + Return DotNetNuke.Common.AddHTTP(Request.Url.Host & link) + Else + Return DotNetNuke.Common.AddHTTP(Request.Url.Host & ":" & Request.Url.Port.ToString() & link) + End If + End If + + End Function + + Private Sub ReadQueryString() + + If (ArticleSettings.UrlModeType = Components.Types.UrlModeType.Shorterned) Then + Try + If (IsNumeric(Request(ArticleSettings.ShortenedID))) Then + _articleID = Convert.ToInt32(Request(ArticleSettings.ShortenedID)) + End If + Catch + End Try + End If + + If (IsNumeric(Request("ArticleID"))) Then + _articleID = Convert.ToInt32(Request("ArticleID")) + End If + + End Sub + + Private Sub RegisterScripts() + + DotNetNuke.Framework.jQuery.RequestRegistration() + + 'If (HttpContext.Current.Items("jquery_registered") Is Nothing And HttpContext.Current.Items("jQueryRequested") Is Nothing) Then + ' If (HttpContext.Current.Items("PropertyAgent-jQuery-ScriptsRegistered") Is Nothing And HttpContext.Current.Items("SimpleGallery-ScriptsRegistered") Is Nothing And HttpContext.Current.Items("NewsArticles-ScriptsRegistered") Is Nothing) Then + ' Dim objCSS As System.Web.UI.Control = Page.FindControl("CSS") + + ' If Not (objCSS Is Nothing) Then + ' Dim litLink As New Literal + ' litLink.Text = "" & vbCrLf _ + ' & "" & vbCrLf + ' objCSS.Controls.Add(litLink) + ' End If + ' HttpContext.Current.Items.Add("NewsArticles-ScriptsRegistered", "true") + ' End If + 'End If + + End Sub + + Private Sub SetLocalization() + + dshFiles.Text = GetResourceKey("Files") + lblFilesHelp.Text = GetResourceKey("FilesHelp") + + dshExistingFiles.Text = GetResourceKey("SelectExisting") + dshUploadFiles.Text = GetResourceKey("UploadFiles") + dshSelectedFiles.Text = GetResourceKey("SelectedFiles") + + lblNoFiles.Text = GetResourceKey("NoFiles") + + cmdAddExistingFile.Text = GetResourceKey("cmdAddExistingFile") + + End Sub + +#End Region + +#Region " Public Methods " + + Public Sub UpdateFiles(ByVal articleID As Integer) + + For Each objFile As FileInfo In AttachedFiles + objFile.ArticleID = articleID + FileProvider.Instance().UpdateFile(objFile) + ' objFileController.Update(objFile) + Next + + End Sub + +#End Region + +#Region " Event Handlers " + + Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + + Try + + ReadQueryString() + SetLocalization() + + 'trUpload.Visible = ArticleSettings.EnableImagesUpload + 'trExisting.Visible = ArticleSettings.EnablePortalImages + + 'phFiles.Visible = (trUpload.Visible Or trExisting.Visible) + + If (ArticleSettings.IsFilesEnabled = False) Then + Me.Visible = False + Return + End If + + If (IsPostBack = False) Then + + lblSelectFiles.Text = GetResourceKey("SelectFiles") + litModuleID.Text = Me.ArticleModuleBase.ModuleId.ToString() + litTabModuleID.Text = Me.ArticleModuleBase.TabModuleId.ToString() + + If (Request.IsAuthenticated) Then + litTicketID.Text = Request.Cookies(System.Web.Security.FormsAuthentication.FormsCookieName()).Value + End If + litArticleGuid.Text = ArticleGuid.ToString() + + BindFolders() + BindFiles() + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender + + Try + + RegisterScripts() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub cmdRefreshPhotos_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdRefreshFiles.Click + + Try + + BindFiles() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + + Private Sub dlFiles_OnItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlFiles.ItemDataBound + + Try + + If (e.Item.ItemType = Web.UI.WebControls.ListItemType.Item Or e.Item.ItemType = Web.UI.WebControls.ListItemType.AlternatingItem) Then + + Dim objFile As FileInfo = CType(e.Item.DataItem, FileInfo) + + Dim btnEdit As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnEdit"), System.Web.UI.WebControls.ImageButton) + Dim btnDelete As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnDelete"), System.Web.UI.WebControls.ImageButton) + Dim btnUp As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnUp"), System.Web.UI.WebControls.ImageButton) + Dim btnDown As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnDown"), System.Web.UI.WebControls.ImageButton) + + If Not (btnDelete Is Nothing) Then + btnDelete.Attributes.Add("onClick", "javascript:return confirm('" & GetResourceKey("DeleteFile") & "');") + + If Not (objFile Is Nothing) Then + btnDelete.CommandArgument = objFile.FileID.ToString() + End If + + End If + + If Not (btnEdit Is Nothing) Then + + If Not (objFile Is Nothing) Then + btnEdit.CommandArgument = objFile.FileID.ToString() + End If + + End If + + If Not (btnUp Is Nothing And btnDown Is Nothing) Then + + If (objFile.FileID = CType(AttachedFiles(0), FileInfo).FileID) Then + btnUp.Visible = False + End If + + If (objFile.FileID = CType(AttachedFiles(AttachedFiles.Count - 1), FileInfo).FileID) Then + btnDown.Visible = False + End If + + btnUp.CommandArgument = objFile.FileID.ToString() + btnUp.CommandName = "Up" + btnUp.CausesValidation = False + + btnDown.CommandArgument = objFile.FileID.ToString() + btnDown.CommandName = "Down" + btnDown.CausesValidation = False + + End If + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub dlFiles_OnItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dlFiles.ItemCommand + + Try + + If (e.CommandName = "Delete") Then + + Dim objFile As FileInfo = FileProvider.Instance().GetFile(Convert.ToInt32(e.CommandArgument)) + + If Not (objFile Is Nothing) Then + 'Dim objPortalSettings As PortalSettings = PortalController.GetCurrentPortalSettings() + 'Dim filePath As String = objPortalSettings.HomeDirectoryMapPath & objFile.Folder & objFile.FileName + 'If (File.Exists(filePath)) Then + ' File.Delete(filePath) + 'End If + FileProvider.Instance().DeleteFile(_articleID, Convert.ToInt32(e.CommandArgument)) + ' objFileController.Delete(Convert.ToInt32(e.CommandArgument)) + End If + + End If + + If (e.CommandName = "Edit") Then + + dlFiles.EditItemIndex = e.Item.ItemIndex + + End If + + If (e.CommandName = "Up") Then + + Dim fileID As Integer = Convert.ToInt32(e.CommandArgument) + + For i As Integer = 0 To AttachedFiles.Count - 1 + Dim objFile As FileInfo = CType(AttachedFiles(i), FileInfo) + If (fileID = objFile.FileID) Then + + Dim objFileToSwap As FileInfo = CType(AttachedFiles(i - 1), FileInfo) + + Dim sortOrder As Integer = objFile.SortOrder + Dim sortOrderPrevious As Integer = objFileToSwap.SortOrder + + objFile.SortOrder = sortOrderPrevious + objFileToSwap.SortOrder = sortOrder + + FileProvider.Instance().UpdateFile(objFile) + FileProvider.Instance().UpdateFile(objFileToSwap) + + End If + Next + + End If + + If (e.CommandName = "Down") Then + + Dim fileID As Integer = Convert.ToInt32(e.CommandArgument) + + For i As Integer = 0 To AttachedFiles.Count - 1 + Dim objFile As FileInfo = CType(AttachedFiles(i), FileInfo) + If (fileID = objFile.FileID) Then + Dim objFileToSwap As FileInfo = CType(AttachedFiles(i + 1), FileInfo) + + Dim sortOrder As Integer = objFile.SortOrder + Dim sortOrderNext As Integer = objFileToSwap.SortOrder + + objFile.SortOrder = sortOrderNext + objFileToSwap.SortOrder = sortOrder + + FileProvider.Instance().UpdateFile(objFile) + FileProvider.Instance().UpdateFile(objFileToSwap) + End If + Next + + End If + + If (e.CommandName = "Cancel") Then + + dlFiles.EditItemIndex = -1 + + End If + + If (e.CommandName = "Update") Then + + Dim txtTitle As TextBox = CType(e.Item.FindControl("txtTitle"), TextBox) + + Dim objFile As FileInfo = FileProvider.Instance().GetFile(Convert.ToInt32(dlFiles.DataKeys(e.Item.ItemIndex))) + + If Not (objFile Is Nothing) Then + objFile.Title = txtTitle.Text + FileProvider.Instance().UpdateFile(objFile) + End If + + dlFiles.EditItemIndex = -1 + + End If + + _filesInit = False + BindFiles() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub cmdAddExistingFile_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdAddExistingFile.Click + + Try + + If (ctlFile.Url <> "") Then + If (ctlFile.Url.ToLower().StartsWith("fileid=")) Then + If (IsNumeric(ctlFile.Url.ToLower().Replace("fileid=", ""))) Then + Dim fileID As Integer = Convert.ToInt32(ctlFile.Url.ToLower().Replace("fileid=", "")) + Dim objDnnFileController As New DotNetNuke.Services.FileSystem.FileController + Dim objDnnFile As DotNetNuke.Services.FileSystem.FileInfo = objDnnFileController.GetFileById(fileID, ArticleModuleBase.PortalId) + If (objDnnFile IsNot Nothing) Then + + Dim objFileController As New FileController + + Dim objFile As New FileInfo + + objFile.ArticleID = _articleID + If (_articleID = Null.NullInteger) Then + objFile.ArticleID = ArticleGuid + End If + objFile.FileName = objDnnFile.FileName + objFile.ContentType = objDnnFile.ContentType + objFile.SortOrder = 0 + Dim filesList As List(Of FileInfo) = objFileController.GetFileList(_articleID, ArticleGuid) + If (filesList.Count > 0) Then + objFile.SortOrder = CType(filesList(filesList.Count - 1), FileInfo).SortOrder + 1 + End If + objFile.Folder = objDnnFile.Folder + objFile.Extension = objDnnFile.Extension + objFile.Size = objDnnFile.Size + objFile.Title = objFile.FileName.Replace("." & objFile.Extension, "") + + objFileController.Add(objFile) + BindFiles() + + End If + End If + End If + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Controls/UploadImages.ascx b/Controls/UploadImages.ascx new file mode 100755 index 0000000..109b0ea --- /dev/null +++ b/Controls/UploadImages.ascx @@ -0,0 +1,197 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="UploadImages.ascx.vb" Inherits="Ventrian.NewsArticles.Controls.UploadImages" %> +<%@ Register TagPrefix="Ventrian" Assembly="Ventrian.NewsArticles" Namespace="Ventrian.NewsArticles.Components.WebControls" %> + +<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="URL" Src="~/controls/URLControl.ascx" %> + + +
+ + + + + + + + + +
+
+ + + + + + +
+ + + + + + + + + +
 
+ +
+
+ +
+
+
+
+
+ + + + + +
+ + + + + +

 
+
+
+
+ + + + + +
+ + + + Photo
+ + <%#DataBinder.Eval(Container.DataItem, "Title")%> + +
+ + + + + + +
+ + Photo
+ +
+ +
+ + +
+
+
+
+
+ +
+ + + + + + +
+
+
+ + diff --git a/Controls/UploadImages.ascx.designer.vb b/Controls/UploadImages.ascx.designer.vb new file mode 100755 index 0000000..d3bcf32 --- /dev/null +++ b/Controls/UploadImages.ascx.designer.vb @@ -0,0 +1,277 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles.Controls + + Partial Public Class UploadImages + + ''' + '''litModuleID control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents litModuleID As Global.System.Web.UI.WebControls.Literal + + ''' + '''litTabModuleID control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents litTabModuleID As Global.System.Web.UI.WebControls.Literal + + ''' + '''litTicketID control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents litTicketID As Global.System.Web.UI.WebControls.Literal + + ''' + '''litArticleGuid control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents litArticleGuid As Global.System.Web.UI.WebControls.Literal + + ''' + '''lblSelectImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblSelectImages As Global.System.Web.UI.WebControls.Label + + ''' + '''dshImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshImages As DotNetNuke.UI.UserControls.SectionHeadControl + + ''' + '''tblImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblImages As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblImagesHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblImagesHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''phImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phImages As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''trUpload control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trUpload As Global.System.Web.UI.HtmlControls.HtmlTableCell + + ''' + '''dshUploadImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshUploadImages As DotNetNuke.UI.UserControls.SectionHeadControl + + ''' + '''tblUploadImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblUploadImages As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plFolder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plFolder As Global.System.Web.UI.UserControl + + ''' + '''drpUploadImageFolder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpUploadImageFolder As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''trExisting control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trExisting As Global.System.Web.UI.HtmlControls.HtmlTableCell + + ''' + '''dshExistingImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshExistingImages As DotNetNuke.UI.UserControls.SectionHeadControl + + ''' + '''tblExistingImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblExistingImages As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''ctlImage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ctlImage As DotNetNuke.UI.UserControls.UrlControl + ''' + '''cmdAddExistingImage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdAddExistingImage As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''dshSelectedImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshSelectedImages As DotNetNuke.UI.UserControls.SectionHeadControl + + ''' + '''tblSelectedImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblSelectedImages As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''dlImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dlImages As Global.System.Web.UI.WebControls.DataList + + ''' + '''lblNoImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblNoImages As Global.System.Web.UI.WebControls.Label + + ''' + '''phExternalImage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phExternalImage As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''dshExternalImage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshExternalImage As DotNetNuke.UI.UserControls.SectionHeadControl + + ''' + '''tblExternalImage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblExternalImage As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plImageUrl control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plImageUrl As Global.System.Web.UI.UserControl + + ''' + '''txtImageExternal control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtImageExternal As Global.System.Web.UI.WebControls.TextBox + + ''' + '''cmdRefreshPhotos control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdRefreshPhotos As Global.Ventrian.NewsArticles.Components.WebControls.RefreshControl + End Class +End Namespace diff --git a/Controls/UploadImages.ascx.vb b/Controls/UploadImages.ascx.vb new file mode 100755 index 0000000..223b4ae --- /dev/null +++ b/Controls/UploadImages.ascx.vb @@ -0,0 +1,606 @@ +Imports System.IO + +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Portals +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization +Imports DotNetNuke.Services.FileSystem +Imports DotNetNuke.Security + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles.Controls + + Partial Public Class UploadImages + Inherits NewsArticleControlBase + +#Region " Private Members " + + Private _articleID As Integer = Null.NullInteger + + Private _imagesInit As Boolean = False + Private _objImages As List(Of ImageInfo) + +#End Region + +#Region " Private Properties " + + Private ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase + Get + Return CType(Parent.Parent.Parent.Parent.Parent, NewsArticleModuleBase) + End Get + End Property + + Private ReadOnly Property ArticleSettings() As ArticleSettings + Get + Return ArticleModuleBase.ArticleSettings + End Get + End Property + +#End Region + +#Region " Public Properties " + + Public Property ArticleGuid() As String + Get + If (_articleID = Null.NullInteger) Then + If (litArticleGuid.Text = Null.NullString) Then + litArticleGuid.Text = Guid.NewGuid.ToString() + End If + End If + Return litArticleGuid.Text + End Get + Set(ByVal value As String) + litArticleGuid.Text = value + End Set + End Property + + Public ReadOnly Property AttachedImages() As List(Of ImageInfo) + Get + + If (_imagesInit = False) Then + Dim objImageController As New ImageController + _objImages = objImageController.GetImageList(_articleID, ArticleGuid) + _imagesInit = True + End If + + Return _objImages + + End Get + End Property + + Public Property ImageExternalUrl() As String + Get + Return txtImageExternal.Text + End Get + Set(ByVal value As String) + txtImageExternal.Text = value + End Set + End Property + +#End Region + +#Region " Private Methods " + + Private Sub BindFolders() + + Dim ReadRoles As String = Null.NullString + Dim WriteRoles As String = Null.NullString + + drpUploadImageFolder.Items.Clear() + + Dim folders As ArrayList = FileSystemUtils.GetFolders(ArticleModuleBase.PortalId) + For Each folder As FolderInfo In folders + Dim FolderItem As New ListItem() + If folder.FolderPath = Null.NullString Then + FolderItem.Text = ArticleModuleBase.GetSharedResource("Root") + ReadRoles = FileSystemUtils.GetRoles("", ArticleModuleBase.PortalId, "READ") + WriteRoles = FileSystemUtils.GetRoles("", ArticleModuleBase.PortalId, "WRITE") + Else + FolderItem.Text = folder.FolderPath + ReadRoles = FileSystemUtils.GetRoles(FolderItem.Text, ArticleModuleBase.PortalId, "READ") + WriteRoles = FileSystemUtils.GetRoles(FolderItem.Text, ArticleModuleBase.PortalId, "WRITE") + End If + FolderItem.Value = folder.FolderID + + If PortalSecurity.IsInRoles(ReadRoles) OrElse PortalSecurity.IsInRoles(WriteRoles) Then + drpUploadImageFolder.Items.Add(FolderItem) + End If + Next + + If (drpUploadImageFolder.Items.FindByValue(ArticleSettings.DefaultImagesFolder.ToString()) IsNot Nothing) Then + drpUploadImageFolder.SelectedValue = ArticleSettings.DefaultImagesFolder.ToString() + End If + + End Sub + + Private Sub BindImages() + + Dim objImageController As New ImageController() + + dlImages.DataSource = AttachedImages + dlImages.DataBind() + + dlImages.Visible = (dlImages.Items.Count > 0) + lblNoImages.Visible = (dlImages.Items.Count = 0) + + End Sub + + Protected Function GetArticleID() As String + + Return _articleID.ToString() + + End Function + + Protected Function GetImageUrl(ByVal objImage As ImageInfo) As String + + Dim thumbWidth As Integer = 150 + Dim thumbHeight As Integer = 150 + + Dim width As Integer + If (objImage.Width > thumbWidth) Then + width = thumbWidth + Else + width = objImage.Width + End If + + Dim height As Integer = Convert.ToInt32(objImage.Height / (objImage.Width / width)) + If (height > thumbHeight) Then + height = thumbHeight + width = Convert.ToInt32(objImage.Width / (objImage.Height / height)) + End If + + Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings() + + Return Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(settings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImage.Folder & objImage.FileName) & "&PortalID=" & settings.PortalId.ToString() & "&q=1") + + End Function + + Protected Function GetMaximumFileSize() As String + + Return "20480" + + End Function + + Protected Function GetPostBackReference() As String + + Return Page.ClientScript.GetPostBackEventReference(cmdRefreshPhotos, "Refresh") + + End Function + + Public Function GetResourceKey(ByVal key As String) As String + + Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/App_LocalResources/UploadImages.ascx.resx" + Return DotNetNuke.Services.Localization.Localization.GetString(key, path) + + End Function + + Protected Function GetUploadUrl() As String + + Dim link As String = Page.ResolveUrl("~/DesktopModules/DnnForge%20-%20NewsArticles/Controls/SWFUploader.ashx?PortalID=" & ArticleModuleBase.PortalId.ToString()) + + If (link.ToLower().StartsWith("http")) Then + Return link + Else + If (Request.Url.Port = 80) Then + Return DotNetNuke.Common.AddHTTP(Request.Url.Host & link) + Else + Return DotNetNuke.Common.AddHTTP(Request.Url.Host & ":" & Request.Url.Port.ToString() & link) + End If + End If + + End Function + + Private Sub ReadQueryString() + + If (ArticleSettings.UrlModeType = Components.Types.UrlModeType.Shorterned) Then + Try + If (IsNumeric(Request(ArticleSettings.ShortenedID))) Then + _articleID = Convert.ToInt32(Request(ArticleSettings.ShortenedID)) + End If + Catch + End Try + End If + + If (IsNumeric(Request("ArticleID"))) Then + _articleID = Convert.ToInt32(Request("ArticleID")) + End If + + End Sub + + Private Sub RegisterScripts() + + DotNetNuke.Framework.jQuery.RequestRegistration() + + 'If (HttpContext.Current.Items("jquery_registered") Is Nothing And HttpContext.Current.Items("jQueryRequested") Is Nothing) Then + ' If (HttpContext.Current.Items("PropertyAgent-jQuery-ScriptsRegistered") Is Nothing And HttpContext.Current.Items("SimpleGallery-ScriptsRegistered") Is Nothing And HttpContext.Current.Items("NewsArticles-ScriptsRegistered") Is Nothing) Then + ' Dim objCSS As System.Web.UI.Control = Page.FindControl("CSS") + + ' If Not (objCSS Is Nothing) Then + ' Dim litLink As New Literal + ' litLink.Text = "" & vbCrLf _ + ' & "" & vbCrLf + ' If (HttpContext.Current.Items("NewsArticles-ScriptsRegistered") IsNot Nothing) Then + ' objCSS.Controls.Add(litLink) + ' End If + ' End If + ' If (HttpContext.Current.Items("NewsArticles-ScriptsRegistered") IsNot Nothing) Then + ' HttpContext.Current.Items.Add("NewsArticles-ScriptsRegistered", "true") + ' End If + ' End If + 'End If + + End Sub + + Private Sub SetLocalization() + + dshImages.Text = GetResourceKey("Images") + lblImagesHelp.Text = GetResourceKey("ImagesHelp") + + dshExistingImages.Text = GetResourceKey("SelectExisting") + dshUploadImages.Text = GetResourceKey("UploadImages") + dshSelectedImages.Text = GetResourceKey("SelectedImages") + dshExternalImage.Text = GetResourceKey("ExternalImage") + + lblNoImages.Text = GetResourceKey("NoImages") + + End Sub + +#End Region + +#Region " Public Methods " + + Public Sub UpdateImages(ByVal articleID As Integer) + + Dim objImageController As New ImageController + For Each objImage As ImageInfo In AttachedImages + objImage.ArticleID = articleID + objImageController.Update(objImage) + Next + + End Sub + +#End Region + +#Region " Event Handlers " + + Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + + Try + + ReadQueryString() + SetLocalization() + + trUpload.Visible = ArticleSettings.EnableImagesUpload + trExisting.Visible = ArticleSettings.EnablePortalImages + + phImages.Visible = (trUpload.Visible Or trExisting.Visible) + + phExternalImage.Visible = ArticleSettings.EnableExternalImages + + If (ArticleSettings.IsImagesEnabled = False Or (trUpload.Visible = False And trExisting.Visible = False And phExternalImage.Visible = False)) Then + Me.Visible = False + Return + End If + + If (IsPostBack = False) Then + lblSelectImages.Text = GetResourceKey("SelectImages") + litModuleID.Text = Me.ArticleModuleBase.ModuleId.ToString() + litTabModuleID.Text = Me.ArticleModuleBase.TabModuleId.ToString() + + If (Request.IsAuthenticated) Then + litTicketID.Text = Request.Cookies(System.Web.Security.FormsAuthentication.FormsCookieName()).Value + End If + litArticleGuid.Text = ArticleGuid.ToString() + + BindFolders() + BindImages() + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender + + Try + + RegisterScripts() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub cmdRefreshPhotos_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdRefreshPhotos.Click + + Try + + BindImages() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + + Private Sub dlImages_OnItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlImages.ItemDataBound + + Try + + If (e.Item.ItemType = Web.UI.WebControls.ListItemType.Item Or e.Item.ItemType = Web.UI.WebControls.ListItemType.AlternatingItem) Then + + Dim objImage As ImageInfo = CType(e.Item.DataItem, ImageInfo) + + Dim btnEdit As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnEdit"), System.Web.UI.WebControls.ImageButton) + Dim btnDelete As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnDelete"), System.Web.UI.WebControls.ImageButton) + Dim btnTop As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnTop"), System.Web.UI.WebControls.ImageButton) + Dim btnUp As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnUp"), System.Web.UI.WebControls.ImageButton) + Dim btnDown As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnDown"), System.Web.UI.WebControls.ImageButton) + Dim btnBottom As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnBottom"), System.Web.UI.WebControls.ImageButton) + + If Not (btnDelete Is Nothing) Then + btnDelete.Attributes.Add("onClick", "javascript:return confirm('" & GetResourceKey("DeleteImage") & "');") + + If Not (objImage Is Nothing) Then + btnDelete.CommandArgument = objImage.ImageID.ToString() + End If + + End If + + If Not (btnEdit Is Nothing) Then + + If Not (objImage Is Nothing) Then + btnEdit.CommandArgument = objImage.ImageID.ToString() + End If + + End If + + If Not (btnUp Is Nothing And btnDown Is Nothing) Then + + If (objImage.ImageID = CType(AttachedImages(0), ImageInfo).ImageID) Then + btnUp.Visible = False + btnTop.Visible = False + End If + + If (objImage.ImageID = CType(AttachedImages(AttachedImages.Count - 1), ImageInfo).ImageID) Then + btnDown.Visible = False + btnBottom.Visible = False + End If + + btnTop.CommandArgument = objImage.ImageID.ToString() + btnTop.CommandName = "Top" + btnTop.CausesValidation = False + + btnUp.CommandArgument = objImage.ImageID.ToString() + btnUp.CommandName = "Up" + btnUp.CausesValidation = False + + btnDown.CommandArgument = objImage.ImageID.ToString() + btnDown.CommandName = "Down" + btnDown.CausesValidation = False + + btnBottom.CommandArgument = objImage.ImageID.ToString() + btnBottom.CommandName = "Bottom" + btnBottom.CausesValidation = False + + End If + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub dlImages_OnItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dlImages.ItemCommand + + Try + + Dim objImageController As New ImageController + + If (e.CommandName = "Delete") Then + + Dim objImage As ImageInfo = objImageController.Get(Convert.ToInt32(e.CommandArgument)) + + If Not (objImage Is Nothing) Then + objImageController.Delete(Convert.ToInt32(e.CommandArgument), _articleID, objImage.ImageGuid) + End If + + End If + + If (e.CommandName = "Edit") Then + + dlImages.EditItemIndex = e.Item.ItemIndex + + End If + + If (e.CommandName = "Top") Then + + Dim imageID As Integer = Convert.ToInt32(e.CommandArgument) + + Dim objImagesSorted As New List(Of ImageInfo) + + For i As Integer = 0 To AttachedImages.Count - 1 + Dim objImage As ImageInfo = CType(AttachedImages(i), ImageInfo) + If (imageID = objImage.ImageID) Then + objImagesSorted.Insert(0, objImage) + Else + objImagesSorted.Add(objImage) + End If + Next + + Dim sortOrder As Integer = 0 + For Each objImage As ImageInfo In objImagesSorted + objImage.SortOrder = sortOrder + objImageController.Update(objImage) + sortOrder = sortOrder + 1 + Next + + End If + + If (e.CommandName = "Up") Then + + Dim imageID As Integer = Convert.ToInt32(e.CommandArgument) + + For i As Integer = 0 To AttachedImages.Count - 1 + Dim objImage As ImageInfo = CType(AttachedImages(i), ImageInfo) + If (imageID = objImage.ImageID) Then + + Dim objImageToSwap As ImageInfo = CType(AttachedImages(i - 1), ImageInfo) + + Dim sortOrder As Integer = objImage.SortOrder + Dim sortOrderPrevious As Integer = objImageToSwap.SortOrder + + objImage.SortOrder = sortOrderPrevious + objImageToSwap.SortOrder = sortOrder + + objImageController.Update(objImage) + objImageController.Update(objImageToSwap) + + End If + Next + + End If + + If (e.CommandName = "Down") Then + + Dim imageID As Integer = Convert.ToInt32(e.CommandArgument) + + For i As Integer = 0 To AttachedImages.Count - 1 + Dim objImage As ImageInfo = CType(AttachedImages(i), ImageInfo) + If (imageID = objImage.ImageID) Then + Dim objImageToSwap As ImageInfo = CType(AttachedImages(i + 1), ImageInfo) + + Dim sortOrder As Integer = objImage.SortOrder + Dim sortOrderNext As Integer = objImageToSwap.SortOrder + + objImage.SortOrder = sortOrderNext + objImageToSwap.SortOrder = sortOrder + + objImageController.Update(objImage) + objImageController.Update(objImageToSwap) + End If + Next + + End If + + If (e.CommandName = "Bottom") Then + + Dim imageID As Integer = Convert.ToInt32(e.CommandArgument) + + Dim objImageEnd As ImageInfo = Nothing + Dim objImagesSorted As New List(Of ImageInfo) + + For i As Integer = 0 To AttachedImages.Count - 1 + Dim objImage As ImageInfo = CType(AttachedImages(i), ImageInfo) + If (imageID = objImage.ImageID) Then + objImageEnd = objImage + Else + objImagesSorted.Add(objImage) + End If + Next + + If (objImageEnd IsNot Nothing) Then + objImagesSorted.Add(objImageEnd) + + Dim sortOrder As Integer = 0 + For Each objImage As ImageInfo In objImagesSorted + objImage.SortOrder = sortOrder + objImageController.Update(objImage) + sortOrder = sortOrder + 1 + Next + End If + + End If + + If (e.CommandName = "Cancel") Then + + dlImages.EditItemIndex = -1 + + End If + + If (e.CommandName = "Update") Then + + Dim txtTitle As TextBox = CType(e.Item.FindControl("txtTitle"), TextBox) + Dim txtDescription As TextBox = CType(e.Item.FindControl("txtDescription"), TextBox) + + Dim objImage As ImageInfo = objImageController.Get(Convert.ToInt32(dlImages.DataKeys(e.Item.ItemIndex))) + + If Not (objImage Is Nothing) Then + objImage.Title = txtTitle.Text + objImage.Description = txtDescription.Text + objImageController.Update(objImage) + End If + + dlImages.EditItemIndex = -1 + + End If + + _imagesInit = False + BindImages() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub cmdAddExistingImage_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdAddExistingImage.Click + + Try + + If (ctlImage.Url <> "") Then + If (ctlImage.Url.ToLower().StartsWith("fileid=")) Then + If (IsNumeric(ctlImage.Url.ToLower().Replace("fileid=", ""))) Then + Dim fileID As Integer = Convert.ToInt32(ctlImage.Url.ToLower().Replace("fileid=", "")) + Dim objFileController As New DotNetNuke.Services.FileSystem.FileController + Dim objFile As DotNetNuke.Services.FileSystem.FileInfo = objFileController.GetFileById(fileID, ArticleModuleBase.PortalId) + If (objFile IsNot Nothing) Then + + Dim objImageController As New ImageController + Dim objImage As New ImageInfo + + objImage.ArticleID = _articleID + If (_articleID = Null.NullInteger) Then + objImage.ImageGuid = ArticleGuid + End If + objImage.FileName = objFile.FileName + objImage.ContentType = objFile.ContentType + objImage.Width = objFile.Width + objImage.Height = objFile.Height + objImage.SortOrder = 0 + Dim imagesList As List(Of ImageInfo) = objImageController.GetImageList(_articleID, ArticleGuid) + If (imagesList.Count > 0) Then + objImage.SortOrder = CType(imagesList(imagesList.Count - 1), ImageInfo).SortOrder + 1 + End If + objImage.Folder = objFile.Folder + objImage.Extension = objFile.Extension + objImage.Title = objFile.FileName.Replace("." & objImage.Extension, "") + objImage.Size = objFile.Size + objImage.Description = "" + + objImageController.Add(objImage) + BindImages() + + End If + End If + End If + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ImageHandler.ashx b/ImageHandler.ashx new file mode 100755 index 0000000..853aea5 --- /dev/null +++ b/ImageHandler.ashx @@ -0,0 +1 @@ +<%@ WebHandler Language="VB" CodeBehind="ImageHandler.ashx.vb" Class="Ventrian.NewsArticles.ImageHandler" %> diff --git a/ImageHandler.ashx.vb b/ImageHandler.ashx.vb new file mode 100755 index 0000000..713c9f8 --- /dev/null +++ b/ImageHandler.ashx.vb @@ -0,0 +1,264 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common.Utilities + +Imports System.Drawing +Imports System.Drawing.Drawing2d +Imports System.Drawing.Imaging +Imports System.Web +Imports System.Web.Services +Imports Ventrian.ImageResizer +Imports System.IO + +Namespace Ventrian.NewsArticles + + Public Class ImageHandler + Implements System.Web.IHttpHandler + +#Region " Private Members " + + Private _width As Integer = ArticleConstants.DEFAULT_THUMBNAIL_WIDTH + Private _height As Integer = ArticleConstants.DEFAULT_THUMBNAIL_HEIGHT + Private _homeDirectory As String = Null.NullString + Private _fileName As String = Null.NullString + Private _quality As Boolean = False + Private _cropped As Boolean = False + +#End Region + +#Region " Private Methods " + + Private Function GetPhotoHeight(ByVal objPhoto As Image) As Integer + + Dim width As Integer + If (objPhoto.Width > _width) Then + width = _width + Else + width = objPhoto.Width + End If + + Dim height As Integer = Convert.ToInt32(objPhoto.Height / (objPhoto.Width / width)) + If (height > _height) Then + height = _height + width = Convert.ToInt32(objPhoto.Width / (objPhoto.Height / height)) + End If + + Return height + + End Function + + Private Function GetPhotoWidth(ByVal objPhoto As Image) As Integer + + Dim width As Integer + + If (objPhoto.Width > _width) Then + width = _width + Else + width = objPhoto.Width + End If + + Dim height As Integer = Convert.ToInt32(objPhoto.Height / (objPhoto.Width / width)) + If (height > _height) Then + height = _height + width = Convert.ToInt32(objPhoto.Width / (objPhoto.Height / height)) + End If + + Return width + + End Function + + Private Sub ReadQueryString(ByVal context As HttpContext) + + If Not (context.Request("Width") Is Nothing) Then + If (IsNumeric(context.Request("Width"))) Then + _width = Convert.ToInt32(context.Request("Width")) + End If + End If + + If Not (context.Request("Height") Is Nothing) Then + If (IsNumeric(context.Request("Height"))) Then + _height = Convert.ToInt32(context.Request("Height")) + End If + End If + + If Not (context.Request("HomeDirectory") Is Nothing) Then + _homeDirectory = context.Server.UrlDecode(context.Request("HomeDirectory")) + End If + + If Not (context.Request("FileName") Is Nothing) Then + _fileName = context.Server.UrlDecode(context.Request("FileName")) + End If + + If Not (context.Request("Q") Is Nothing) Then + If (context.Request("Q") = "1") Then + _quality = True + End If + End If + + If Not (context.Request("S") Is Nothing) Then + If (context.Request("S") = "1") Then + _cropped = True + End If + End If + + End Sub + +#End Region + +#Region " Properties " + + Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable + Get + Return True + End Get + End Property + +#End Region + +#Region " Event Handlers " + + Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest + + ' Set up the response settings + context.Response.ContentType = "image/jpeg" + + ' Caching + context.Response.Cache.SetCacheability(HttpCacheability.Public) + context.Response.Cache.SetExpires(DateTime.Now.AddDays(30)) + context.Response.Cache.VaryByParams("FileName") = True + context.Response.Cache.VaryByParams("HomeDirectory") = True + context.Response.Cache.VaryByParams("Width") = True + context.Response.Cache.VaryByParams("Height") = True + context.Response.Cache.VaryByParams("s") = True + context.Response.Cache.AppendCacheExtension("max-age=86400") + + ReadQueryString(context) + + Dim path As String = "" + If _fileName = "placeholder-600.jpg" Then + path = "Images/placeholder-600.jpg" + Else + path = _homeDirectory & "/" & _fileName + End If + + context.Items.Add("httpcompress.attemptedinstall", "true") + + If Not (System.IO.File.Exists(context.Server.MapPath(path))) Then + path = path & ".resources" + If Not (System.IO.File.Exists(context.Server.MapPath(path))) Then + Return + End If + End If + + If (_cropped = False) Then + Dim photo As Image = Image.FromFile(context.Server.MapPath(path)) + + Dim width As Integer = GetPhotoWidth(photo) + Dim height As Integer = GetPhotoHeight(photo) + + photo.Dispose() + + _width = width + _height = height + + End If + + Dim objQueryString As New NameValueCollection() + + For Each key As String In context.Request.QueryString.Keys + Dim values() As String = context.Request.QueryString.GetValues(key) + For Each value As String In values + + If (key.ToLower() = "width" Or key.ToLower() = "height") Then + If (key.ToLower() = "width") Then + objQueryString.Add("maxwidth", _width.ToString()) + objQueryString.Add(key, _width.ToString()) + End If + If (key.ToLower() = "height") Then + objQueryString.Add("maxheight", _height.ToString()) + objQueryString.Add(key, _height.ToString()) + End If + Else + objQueryString.Add(key, value) + End If + Next + Next + + If (_cropped) Then + objQueryString.Add("crop", "auto") + End If + + Dim objImage As Bitmap = ImageManager.getBestInstance().BuildImage(context.Server.MapPath(path), objQueryString, New WatermarkSettings(objQueryString)) + If (path.ToLower().EndsWith("jpg")) Then + objImage.Save(context.Response.OutputStream, ImageFormat.Jpeg) + Else + If (path.ToLower().EndsWith("gif")) Then + context.Response.ContentType = "image/gif" + Dim ios As ImageOutputSettings = New ImageOutputSettings(ImageOutputSettings.GetImageFormatFromPhysicalPath(context.Server.MapPath(path)), objQueryString) + ios.SaveImage(context.Response.OutputStream, objImage) + Else + If (path.ToLower().EndsWith("png")) Then + Dim objMemoryStream As New MemoryStream() + context.Response.ContentType = "image/png" + objImage.Save(objMemoryStream, ImageFormat.Png) + objMemoryStream.WriteTo(context.Response.OutputStream) + Else + objImage.Save(context.Response.OutputStream, ImageFormat.Jpeg) + End If + End If + End If + + 'Dim photo As Image = Image.FromFile(context.Server.MapPath(path)) + + 'Dim width As Integer = GetPhotoWidth(photo) + 'Dim height As Integer = GetPhotoHeight(photo) + + 'Dim bmp As New Bitmap(width, height) + 'Dim g As Graphics = Graphics.FromImage(DirectCast(bmp, Image)) + + 'If (_quality) Then + ' g.InterpolationMode = InterpolationMode.HighQualityBicubic + ' g.SmoothingMode = SmoothingMode.HighQuality + ' g.PixelOffsetMode = PixelOffsetMode.HighQuality + ' g.CompositingQuality = CompositingQuality.HighQuality + 'End If + + 'g.FillRectangle(Brushes.White, 0, 0, width, height) + 'g.DrawImage(photo, 0, 0, width, height) + + 'photo.Dispose() + + 'If (_quality) Then + ' Dim info As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders() + ' Dim params As New EncoderParameters + ' params.Param(0) = New EncoderParameter(Encoder.Quality, 90L) + ' bmp.Save(context.Response.OutputStream, info(1), params) + ' bmp.Dispose() + 'Else + ' bmp.Save(context.Response.OutputStream, Imaging.ImageFormat.Jpeg) + 'End If + + End Sub + + Public Shared Function GetEncoderInfo(ByVal mimeType As String) As ImageCodecInfo + Dim codecs() As ImageCodecInfo = ImageCodecInfo.GetImageEncoders() + + Dim i As Integer + For i = 0 To codecs.Length - 1 Step i + 1 + If codecs(i).MimeType = mimeType Then + Return codecs(i) + End If + Next + + Return Nothing + End Function + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Images/Admin/Categories.gif b/Images/Admin/Categories.gif new file mode 100755 index 0000000..60269f4 Binary files /dev/null and b/Images/Admin/Categories.gif differ diff --git a/Images/Admin/MainOptions.gif b/Images/Admin/MainOptions.gif new file mode 100755 index 0000000..80f67c6 Binary files /dev/null and b/Images/Admin/MainOptions.gif differ diff --git a/Images/Admin/Templates.gif b/Images/Admin/Templates.gif new file mode 100755 index 0000000..3eab800 Binary files /dev/null and b/Images/Admin/Templates.gif differ diff --git a/Images/Includes/Handout.xml b/Images/Includes/Handout.xml new file mode 100755 index 0000000..f56407f --- /dev/null +++ b/Images/Includes/Handout.xml @@ -0,0 +1,15 @@ + + + PDF Handout Title + My Handout Description + +
+ Easy Freezy Vanilla Ice Cream + Detail +
+
+ Test Title 2 + Detail 2 +
+
+
\ No newline at end of file diff --git a/Images/Includes/Handout.xsd b/Images/Includes/Handout.xsd new file mode 100755 index 0000000..52d59bf --- /dev/null +++ b/Images/Includes/Handout.xsd @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Images/Includes/IIK.sps b/Images/Includes/IIK.sps new file mode 100755 index 0000000..51c6071 --- /dev/null +++ b/Images/Includes/IIK.sps @@ -0,0 +1 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + News Articles Latest + Allows you to display a list of the latest articles. + + + Scott McCulloch + Ventrian + www.ventrian.com + support@ventrian.com + + The license for this package is not currently included within the installation file, please check with the vendor for full license details. + This package has no Release Notes + + + + DnnForge - LatestArticles + DnnForge - LatestArticles + Ventrian.NewsArticles.LatestArticleController, Ventrian.NewsArticles + + + + DnnForge - LatestArticles + 0 + + + + DesktopModules/DnnForge - LatestArticles/LatestArticles.ascx + False + + View + + + False + 0 + + + Settings + DesktopModules/DnnForge - LatestArticles/LatestArticlesOptions.ascx + False + Latest Articles Options + Edit + + + False + 0 + + + + + + + + + DesktopModules/DnnForge - LatestArticles + + ResourcesLatestArticles.zip + + + + + + + News Articles Comments + Allows you to display a list of the latest comments. + + + Scott McCulloch + Ventrian + www.ventrian.com + support@ventrian.com + + The license for this package is not currently included within the installation file, please check with the vendor for full license details. + This package has no Release Notes + + + + DnnForge - LatestComments + DnnForge - LatestComments + + + + + DnnForge - LatestComments + 0 + + + + DesktopModules/DnnForge - LatestComments/LatestComments.ascx + False + + View + + + False + 0 + + + Settings + DesktopModules/DnnForge - LatestComments/LatestCommentsOptions.ascx + False + Latest Comments Options + Edit + + + False + 0 + + + + + + + + + DesktopModules/DnnForge - LatestComments + + ResourcesLatestComments.zip + + + + + + + News Articles Archives + Allows you to display a list of articles by month. + + + Scott McCulloch + Ventrian + www.ventrian.com + support@ventrian.com + + The license for this package is not currently included within the installation file, please check with the vendor for full license details. + This package has no Release Notes + + + + DnnForge - NewsArchives + DnnForge - NewsArchives + + + + + DnnForge - NewsArchives + 0 + + + + DesktopModules/DnnForge - NewsArchives/NewsArchives.ascx + False + + View + + + False + 0 + + + Settings + DesktopModules/DnnForge - NewsArchives/NewsArchivesOptions.ascx + False + News Archive Options + Edit + + + False + 0 + + + + + + + + + DesktopModules/DnnForge - NewsArchives + + ResourcesNewsArchives.zip + + + + + + + News Articles Search + Allows you to display a list of articles by month. + + + Scott McCulloch + Ventrian + www.ventrian.com + support@ventrian.com + + The license for this package is not currently included within the installation file, please check with the vendor for full license details. + This package has no Release Notes + + + + DnnForge - NewsSearch + DnnForge - NewsSearch + + + + + DnnForge - NewsSearch + 0 + + + + DesktopModules/DnnForge - NewsSearch/NewsSearch.ascx + False + + View + + + False + 0 + + + Settings + DesktopModules/DnnForge - NewsSearch/NewsSearchOptions.ascx + False + News Search Options + Edit + + + False + 0 + + + + + + + + + DesktopModules/DnnForge - NewsSearch + + ResourcesNewsSearch.zip + + + + + + + diff --git a/NewsSearch.ascx b/NewsSearch.ascx new file mode 100755 index 0000000..719b468 --- /dev/null +++ b/NewsSearch.ascx @@ -0,0 +1,11 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="NewsSearch.ascx.vb" Inherits="Ventrian.NewsArticles.NewsSearch" %> + + +
+ + + + +
+
diff --git a/NewsSearch.ascx.designer.vb b/NewsSearch.ascx.designer.vb new file mode 100755 index 0000000..b52716b --- /dev/null +++ b/NewsSearch.ascx.designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class NewsSearch + + ''' + '''lblNotConfigured control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblNotConfigured As Global.System.Web.UI.WebControls.Label + + ''' + '''phSearchForm control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phSearchForm As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''pnlSearch control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pnlSearch As Global.System.Web.UI.WebControls.Panel + + ''' + '''txtSearch control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtSearch As Global.System.Web.UI.WebControls.TextBox + + ''' + '''btnSearch control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents btnSearch As Global.System.Web.UI.WebControls.Button + End Class +End Namespace diff --git a/NewsSearch.ascx.vb b/NewsSearch.ascx.vb new file mode 100755 index 0000000..e7c5edf --- /dev/null +++ b/NewsSearch.ascx.vb @@ -0,0 +1,104 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2009 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class NewsSearch + Inherits NewsArticleModuleBase + +#Region " Constants " + + Private Const PARAM_SEARCH_ID As String = "Search" + +#End Region + +#Region " Private Members " + + Private _articleTabID As Integer = Null.NullInteger + Private _articleModuleID As Integer = Null.NullInteger + +#End Region + +#Region " Private Methods " + + Private Function FindSettings() As Boolean + + If (Settings.Contains(ArticleConstants.NEWS_SEARCH_TAB_ID)) Then + If (IsNumeric(Settings(ArticleConstants.NEWS_SEARCH_TAB_ID).ToString())) Then + _articleTabID = Convert.ToInt32(Settings(ArticleConstants.NEWS_SEARCH_TAB_ID).ToString()) + End If + End If + + If (Settings.Contains(ArticleConstants.NEWS_SEARCH_MODULE_ID)) Then + If (IsNumeric(Settings(ArticleConstants.NEWS_SEARCH_MODULE_ID).ToString())) Then + _articleModuleID = Convert.ToInt32(Settings(ArticleConstants.NEWS_SEARCH_MODULE_ID).ToString()) + If (_articleModuleID <> Null.NullInteger) Then + Return True + End If + End If + End If + + Return False + + End Function + + Private Sub ReadQueryString() + + If (Request(PARAM_SEARCH_ID) <> "") Then + txtSearch.Text = Server.UrlDecode(Request(PARAM_SEARCH_ID)) + End If + + End Sub + +#End Region + +#Region " Event Handlers " + + Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + + Try + If (IsPostBack = False) Then + ReadQueryString() + End If + + If (FindSettings()) Then + phSearchForm.Visible = True + lblNotConfigured.Visible = False + Else + lblNotConfigured.Visible = True + phSearchForm.Visible = False + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSearch.Click + + Try + + If (txtSearch.Text.Trim() <> "") Then + Response.Redirect(Common.GetModuleLink(_articleTabID, _articleModuleID, "Search", ArticleSettings, "Search=" & Server.UrlEncode(txtSearch.Text)), True) + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/NewsSearchOptions.ascx b/NewsSearchOptions.ascx new file mode 100755 index 0000000..147b704 --- /dev/null +++ b/NewsSearchOptions.ascx @@ -0,0 +1,11 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="NewsSearchOptions.ascx.vb" Inherits="Ventrian.NewsArticles.NewsSearchOptions" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> + + + + + +
+ +
\ No newline at end of file diff --git a/NewsSearchOptions.ascx.designer.vb b/NewsSearchOptions.ascx.designer.vb new file mode 100755 index 0000000..6e47193 --- /dev/null +++ b/NewsSearchOptions.ascx.designer.vb @@ -0,0 +1,35 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class NewsSearchOptions + + ''' + '''plModuleID control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plModuleID As Global.System.Web.UI.UserControl + + ''' + '''drpModuleID control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpModuleID As Global.System.Web.UI.WebControls.DropDownList + End Class +End Namespace diff --git a/NewsSearchOptions.ascx.vb b/NewsSearchOptions.ascx.vb new file mode 100755 index 0000000..d72d729 --- /dev/null +++ b/NewsSearchOptions.ascx.vb @@ -0,0 +1,109 @@ +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Entities.Tabs +Imports DotNetNuke.Security +Imports DotNetNuke.Services.Exceptions + +Namespace Ventrian.NewsArticles + + Partial Public Class NewsSearchOptions + Inherits ModuleSettingsBase + +#Region " Private Methods " + + Private Sub BindModules() + + Dim objDesktopModuleController As New DesktopModuleController + Dim objDesktopModuleInfo As DesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByModuleName("DnnForge - NewsArticles") + + If Not (objDesktopModuleInfo Is Nothing) Then + + Dim objTabController As New TabController() + Dim objTabs As ArrayList = objTabController.GetTabs(PortalId) + For Each objTab As DotNetNuke.Entities.Tabs.TabInfo In objTabs + If Not (objTab Is Nothing) Then + If (objTab.IsDeleted = False) Then + Dim objModules As New ModuleController + For Each pair As KeyValuePair(Of Integer, ModuleInfo) In objModules.GetTabModules(objTab.TabID) + Dim objModule As ModuleInfo = pair.Value + If (objModule.IsDeleted = False) Then + If (objModule.DesktopModuleID = objDesktopModuleInfo.DesktopModuleID) Then + If PortalSecurity.IsInRoles(objModule.AuthorizedEditRoles) = True And objModule.IsDeleted = False Then + Dim strPath As String = objTab.TabName + Dim objTabSelected As TabInfo = objTab + While objTabSelected.ParentId <> Null.NullInteger + objTabSelected = objTabController.GetTab(objTabSelected.ParentId, objTab.PortalID, False) + If (objTabSelected Is Nothing) Then + Exit While + End If + strPath = objTabSelected.TabName & " -> " & strPath + End While + + Dim objListItem As New ListItem + + objListItem.Value = objModule.TabID.ToString() & "-" & objModule.ModuleID.ToString() + objListItem.Text = strPath & " -> " & objModule.ModuleTitle + + drpModuleID.Items.Add(objListItem) + End If + End If + End If + Next + End If + End If + Next + + End If + + End Sub + +#End Region + +#Region " Base Method Implementations " + + Public Overrides Sub LoadSettings() + Try + + If (Page.IsPostBack = False) Then + + BindModules() + + If (Settings.Contains(ArticleConstants.NEWS_SEARCH_MODULE_ID) And Settings.Contains(ArticleConstants.NEWS_SEARCH_TAB_ID)) Then + If Not (drpModuleID.Items.FindByValue(Settings(ArticleConstants.NEWS_SEARCH_TAB_ID).ToString() & "-" & Settings(ArticleConstants.NEWS_SEARCH_MODULE_ID).ToString()) Is Nothing) Then + drpModuleID.SelectedValue = Settings(ArticleConstants.NEWS_SEARCH_TAB_ID).ToString() & "-" & Settings(ArticleConstants.NEWS_SEARCH_MODULE_ID).ToString() + End If + End If + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + End Sub + + Public Overrides Sub UpdateSettings() + Try + + Dim objModules As New ModuleController + + If (drpModuleID.Items.Count > 0) Then + + Dim values As String() = drpModuleID.SelectedValue.Split(Convert.ToChar("-")) + + If (values.Length = 2) Then + objModules.UpdateTabModuleSetting(Me.TabModuleId, ArticleConstants.NEWS_SEARCH_TAB_ID, values(0)) + objModules.UpdateTabModuleSetting(Me.TabModuleId, ArticleConstants.NEWS_SEARCH_MODULE_ID, values(1)) + End If + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Print.aspx b/Print.aspx new file mode 100755 index 0000000..00a5eb9 --- /dev/null +++ b/Print.aspx @@ -0,0 +1,11 @@ +<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Print.aspx.vb" Inherits="Ventrian.NewsArticles.Print" %> + + + + + +
+ + + + diff --git a/Print.aspx.designer.vb b/Print.aspx.designer.vb new file mode 100755 index 0000000..4a63a29 --- /dev/null +++ b/Print.aspx.designer.vb @@ -0,0 +1,44 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class Print + + ''' + '''CSS control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents CSS As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''Form1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Form1 As Global.System.Web.UI.HtmlControls.HtmlForm + + ''' + '''phArticle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phArticle As Global.System.Web.UI.WebControls.PlaceHolder + End Class +End Namespace diff --git a/Print.aspx.vb b/Print.aspx.vb new file mode 100755 index 0000000..785e46f --- /dev/null +++ b/Print.aspx.vb @@ -0,0 +1,312 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2005-2012 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System.IO + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Framework + + +Namespace Ventrian.NewsArticles + + Partial Public Class Print + Inherits PageBase + +#Region " Private Members " + + Private _articleID As Integer = Null.NullInteger + Private _moduleID As Integer = Null.NullInteger + Private _tabModuleID As Integer = Null.NullInteger + Private _tabID As Integer = Null.NullInteger + Private _pageID As Integer = Null.NullInteger + Private _portalID As Integer = Null.NullInteger + Private _template As String = Null.NullString + + Private _articleSettings As ArticleSettings + +#End Region + +#Region " Private Methods " + + Private Sub ReadQueryString() + + If Not (Request("ArticleID") Is Nothing) Then + _articleID = Convert.ToInt32(Request("ArticleID")) + End If + + If Not (Request("ModuleID") Is Nothing) Then + _moduleID = Convert.ToInt32(Request("ModuleID")) + End If + + If Not (Request("TabID") Is Nothing) Then + _tabID = Convert.ToInt32(Request("TabID")) + End If + + If Not (Request("TabModuleID") Is Nothing) Then + _tabModuleID = Convert.ToInt32(Request("TabModuleID")) + End If + + If Not (Request("PageID") Is Nothing) Then + _pageID = Convert.ToInt32(Request("PageID")) + End If + + If Not (Request("PortalID") Is Nothing) Then + _portalID = Convert.ToInt32(Request("PortalID")) + End If + + End Sub + + Private Sub ManageStyleSheets(ByVal PortalCSS As Boolean) + + ' initialize reference paths to load the cascading style sheets + Dim objCSS As Control = Me.FindControl("CSS") + Dim objLink As HtmlGenericControl + Dim ID As String + + Dim objCSSCache As Hashtable = CType(DataCache.GetCache("CSS"), Hashtable) + If objCSSCache Is Nothing Then + objCSSCache = New Hashtable + End If + + If Not objCSS Is Nothing Then + If PortalCSS = False Then + ' module style sheet + ID = CreateValidID("PropertyAgent") + objLink = New HtmlGenericControl("link") + objLink.ID = ID + objLink.Attributes("rel") = "stylesheet" + objLink.Attributes("type") = "text/css" + objLink.Attributes("href") = Me.ResolveUrl("module.css") + objCSS.Controls.Add(objLink) + + ' default style sheet ( required ) + ID = CreateValidID(DotNetNuke.Common.Globals.HostPath) + objLink = New HtmlGenericControl("link") + objLink.ID = ID + objLink.Attributes("rel") = "stylesheet" + objLink.Attributes("type") = "text/css" + objLink.Attributes("href") = DotNetNuke.Common.Globals.HostPath & "default.css" + objCSS.Controls.Add(objLink) + + ' skin package style sheet + ID = CreateValidID(PortalSettings.ActiveTab.SkinPath) + If objCSSCache.ContainsKey(ID) = False Then + If File.Exists(Server.MapPath(PortalSettings.ActiveTab.SkinPath) & "skin.css") Then + objCSSCache(ID) = PortalSettings.ActiveTab.SkinPath & "skin.css" + Else + objCSSCache(ID) = "" + End If + If Not DotNetNuke.Common.Globals.PerformanceSetting = DotNetNuke.Common.Globals.PerformanceSettings.NoCaching Then + DataCache.SetCache("CSS", objCSSCache) + End If + End If + If objCSSCache(ID).ToString <> "" Then + objLink = New HtmlGenericControl("link") + objLink.ID = ID + objLink.Attributes("rel") = "stylesheet" + objLink.Attributes("type") = "text/css" + objLink.Attributes("href") = objCSSCache(ID).ToString + objCSS.Controls.Add(objLink) + End If + + ' skin file style sheet + ID = CreateValidID(Replace(PortalSettings.ActiveTab.SkinSrc, ".ascx", ".css")) + If objCSSCache.ContainsKey(ID) = False Then + If File.Exists(Server.MapPath(Replace(PortalSettings.ActiveTab.SkinSrc, ".ascx", ".css"))) Then + objCSSCache(ID) = Replace(PortalSettings.ActiveTab.SkinSrc, ".ascx", ".css") + Else + objCSSCache(ID) = "" + End If + If Not DotNetNuke.Common.Globals.PerformanceSetting = DotNetNuke.Common.Globals.PerformanceSettings.NoCaching Then + DataCache.SetCache("CSS", objCSSCache) + End If + End If + If objCSSCache(ID).ToString <> "" Then + objLink = New HtmlGenericControl("link") + objLink.ID = ID + objLink.Attributes("rel") = "stylesheet" + objLink.Attributes("type") = "text/css" + objLink.Attributes("href") = objCSSCache(ID).ToString + objCSS.Controls.Add(objLink) + End If + Else + ' portal style sheet + ID = CreateValidID(PortalSettings.HomeDirectory) + objLink = New HtmlGenericControl("link") + objLink.ID = ID + objLink.Attributes("rel") = "stylesheet" + objLink.Attributes("type") = "text/css" + objLink.Attributes("href") = PortalSettings.HomeDirectory & "portal.css" + objCSS.Controls.Add(objLink) + End If + + End If + + End Sub + + Private Sub BindArticle() + + If (_articleID = Null.NullInteger) Then + Response.Redirect(NavigateURL(_tabID), True) + End If + + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(_articleID) + + If Not (objArticle Is Nothing) Then + + ' Check Article Security + If (objArticle.IsSecure) Then + If (ArticleSettings.IsSecureEnabled = False) Then + If (ArticleSettings.SecureUrl <> "") Then + Dim url As String = Request.Url.ToString().Replace(AddHTTP(Request.Url.Host), "") + If (ArticleSettings.SecureUrl.IndexOf("?") <> -1) Then + Response.Redirect(ArticleSettings.SecureUrl & "&returnurl=" & Server.UrlEncode(url), True) + Else + Response.Redirect(ArticleSettings.SecureUrl & "?returnurl=" & Server.UrlEncode(url), True) + End If + Else + Response.Redirect(NavigateURL(_tabID), True) + End If + End If + End If + + Dim objModuleController As New ModuleController + Dim objModule As ModuleInfo = objModuleController.GetModule(objArticle.ModuleID, _tabID) + + If Not (objModule Is Nothing) Then + If (DotNetNuke.Security.PortalSecurity.IsInRoles(objModule.AuthorizedViewRoles) = False) Then + Response.Redirect(NavigateURL(_tabID), True) + End If + + If (objModule.PortalID <> PortalSettings.PortalId) Then + Response.Redirect(NavigateURL(_tabID), True) + End If + End If + + Dim objLayoutController As New LayoutController(PortalSettings, ArticleSettings, objModule, Page) + + 'Dim objLayoutController As New LayoutController(PortalSettings, ArticleSettings, Page, False, _tabID, _moduleID, _tabModuleID, _portalID, _pageID, Null.NullInteger, "Articles-Print-" & _moduleID.ToString()) + Dim objLayoutItem As LayoutInfo = LayoutController.GetLayout(ArticleSettings, objModule, Page, LayoutType.Print_Item_Html) + objLayoutController.ProcessArticleItem(phArticle.Controls, objLayoutItem.Tokens, objArticle) + objLayoutController.LoadStyleSheet(ArticleSettings.Template) + + Dim objLayoutTitle As LayoutInfo = LayoutController.GetLayout(ArticleSettings, objModule, Page, LayoutType.View_Title_Html) + If (objLayoutTitle.Template <> "") Then + Dim phPageTitle As New PlaceHolder() + objLayoutController.ProcessArticleItem(phPageTitle.Controls, objLayoutTitle.Tokens, objArticle) + Me.Title = RenderControlToString(phPageTitle) + End If + + Dim objLayoutDescription As LayoutInfo = LayoutController.GetLayout(ArticleSettings, objModule, Page, LayoutType.View_Description_Html) + If (objLayoutDescription.Template <> "") Then + Dim phPageDescription As New PlaceHolder() + objLayoutController.ProcessArticleItem(phPageDescription.Controls, objLayoutDescription.Tokens, objArticle) + Dim meta As New HtmlMeta + meta.Name = "MetaDescription" + meta.Content = RenderControlToString(phPageDescription) + If (meta.Content <> "") Then + Me.Header.Controls.Add(meta) + End If + End If + + Dim objLayoutKeyword As LayoutInfo = LayoutController.GetLayout(ArticleSettings, objModule, Page, LayoutType.View_Keyword_Html) + If (objLayoutKeyword.Template <> "") Then + Dim phPageKeyword As New PlaceHolder() + objLayoutController.ProcessArticleItem(phPageKeyword.Controls, objLayoutKeyword.Tokens, objArticle) + + Dim meta As New HtmlMeta + meta.Name = "MetaKeywords" + meta.Content = RenderControlToString(phPageKeyword) + If (meta.Content <> "") Then + Me.Header.Controls.Add(meta) + End If + End If + + Else + + Response.Redirect(NavigateURL(), True) + + End If + + End Sub + + Protected Function GetSharedResource(ByVal key As String) As String + + Dim path As String = Me.TemplateSourceDirectory & "/" & DotNetNuke.Services.Localization.Localization.LocalResourceDirectory & "/" & DotNetNuke.Services.Localization.Localization.LocalSharedResourceFile + path = "~" & path.Substring(path.IndexOf("/DesktopModules/"), path.Length - path.IndexOf("/DesktopModules/")) + Return DotNetNuke.Services.Localization.Localization.GetString(key, path) + + End Function + + Private Function RenderControlToString(ByVal ctrl As Control) As String + + Dim sb As New StringBuilder() + Dim tw As New IO.StringWriter(sb) + Dim hw As New HtmlTextWriter(tw) + + ctrl.RenderControl(hw) + + Return sb.ToString() + + End Function + + Protected Function StripHtml(ByVal html As String) As String + + Dim pattern As String = "<(.|\n)*?>" + Return Regex.Replace(html, pattern, String.Empty) + + End Function + +#End Region + +#Region " Private Properties " + + Public ReadOnly Property BasePage() As DotNetNuke.Framework.CDefault + Get + Return CType(Me.Page, DotNetNuke.Framework.CDefault) + End Get + End Property + + Public ReadOnly Property ArticleSettings() As ArticleSettings + Get + If (_articleSettings Is Nothing) Then + Dim objModuleController As New ModuleController + Dim settings As Hashtable = objModuleController.GetModuleSettings(_moduleID) + 'Add TabModule Settings + settings = DotNetNuke.Entities.Portals.PortalSettings.GetTabModuleSettings(_tabModuleID, settings) + Dim objModule As ModuleInfo = objModuleController.GetModule(_moduleID, _tabID) + _articleSettings = New ArticleSettings(settings, Me.PortalSettings, objModule) + End If + Return _articleSettings + End Get + End Property + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Initialization(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + + ManageStyleSheets(False) + ManageStyleSheets(True) + ReadQueryString() + BindArticle() + + End Sub + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Providers/DataProvider/DataProvider.vb b/Providers/DataProvider/DataProvider.vb new file mode 100755 index 0000000..fb898fe --- /dev/null +++ b/Providers/DataProvider/DataProvider.vb @@ -0,0 +1,155 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System +Imports System.Web.Caching +Imports System.Reflection + +Imports DotNetNuke +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public MustInherit Class DataProvider + +#Region " Shared/Static Methods " + + ' singleton reference to the instantiated object + Private Shared objProvider As DataProvider = Nothing + + ' constructor + Shared Sub New() + CreateProvider() + End Sub + + ' dynamically create provider + Private Shared Sub CreateProvider() + objProvider = CType(Framework.Reflection.CreateObject("data", "Ventrian.NewsArticles", "Ventrian.NewsArticles"), DataProvider) + End Sub + + ' return the provider + Public Shared Shadows Function Instance() As DataProvider + Return objProvider + End Function + +#End Region + +#Region " Abstract methods " + + Public MustOverride Function GetArticleListByApproved(ByVal moduleID As Integer, ByVal isApproved As Boolean) As IDataReader + Public MustOverride Function GetArticleListBySearchCriteria(ByVal moduleID As Integer, ByVal currentDate As DateTime, ByVal agedDate As DateTime, ByVal categoryID As Integer(), ByVal matchAll As Boolean, ByVal categoryIDExclude As Integer(), ByVal maxCount As Integer, ByVal pageNumber As Integer, ByVal pageSize As Integer, ByVal sortBy As String, ByVal sortDirection As String, ByVal isApproved As Boolean, ByVal isDraft As Boolean, ByVal keywords As String, ByVal authorID As Integer, ByVal showPending As Boolean, ByVal showExpired As Boolean, ByVal showFeaturedOnly As Boolean, ByVal showNotFeaturedOnly As Boolean, ByVal showSecuredOnly As Boolean, ByVal showNotSecuredOnly As Boolean, ByVal articleIDs As String, ByVal tagID As Integer(), ByVal matchAllTag As Boolean, ByVal rssGuid As String, ByVal customFieldID As Integer, ByVal customValue As String, ByVal linkFilter As String) As IDataReader + Public MustOverride Function GetArticle(ByVal articleID As Integer) As IDataReader + Public MustOverride Function GetArticleCategories(ByVal articleID As Integer) As IDataReader + Public MustOverride Function GetNewsArchive(ByVal moduleID As Integer, ByVal categoryID As Integer(), ByVal categoryIDExclude As Integer(), ByVal authorID As Integer, ByVal groupBy As String, ByVal showPending As Boolean) As IDataReader + Public MustOverride Sub DeleteArticle(ByVal articleID As Integer) + Public MustOverride Sub DeleteArticleCategories(ByVal articleID As Integer) + Public MustOverride Function AddArticle(ByVal authorID As Integer, ByVal approverID As Integer, ByVal createdDate As DateTime, ByVal lastUpdate As DateTime, ByVal title As String, ByVal summary As String, ByVal isApproved As Boolean, ByVal numberOfViews As Integer, ByVal isDraft As Boolean, ByVal startDate As DateTime, ByVal endDate As DateTime, ByVal moduleID As Integer, ByVal imageUrl As String, ByVal isFeatured As Boolean, ByVal lastUpdateID As Integer, ByVal url As String, ByVal isSecure As Boolean, ByVal isNewWindow As Boolean, ByVal metaTitle As String, ByVal metaDescription As String, ByVal metaKeywords As String, ByVal pageHeadText As String, ByVal shortUrl As String, ByVal rssGuid As String) As Integer + Public MustOverride Sub AddArticleCategory(ByVal articleID As Integer, ByVal categoryID As Integer) + Public MustOverride Sub UpdateArticle(ByVal articleID As Integer, ByVal authorID As Integer, ByVal approverID As Integer, ByVal createdDate As DateTime, ByVal lastUpdate As DateTime, ByVal title As String, ByVal summary As String, ByVal isApproved As Boolean, ByVal numberOfViews As Integer, ByVal isDraft As Boolean, ByVal startDate As DateTime, ByVal endDate As DateTime, ByVal moduleID As Integer, ByVal imageUrl As String, ByVal isFeatured As Boolean, ByVal lastUpdateID As Integer, ByVal url As String, ByVal isSecure As Boolean, ByVal isNewWindow As Boolean, ByVal metaTitle As String, ByVal metaDescription As String, ByVal metaKeywords As String, ByVal pageHeadText As String, ByVal shortUrl As String, ByVal rssGuid As String) + Public MustOverride Sub UpdateArticleCount(ByVal articleID As Integer, ByVal numberOfViews As Integer) + + Public MustOverride Function SecureCheck(ByVal portalID As Integer, ByVal articleID As Integer, ByVal userID As Integer) As Boolean + + Public MustOverride Function GetAuthorList(ByVal moduleID As Integer) As IDataReader + Public MustOverride Function GetAuthorStatistics(ByVal moduleID As Integer, ByVal categoryID As Integer(), ByVal categoryIDExclude As Integer(), ByVal authorID As Integer, ByVal sortBy As String, ByVal showPending As Boolean) As IDataReader + + Public MustOverride Function GetCategoryList(ByVal moduleID As Integer, ByVal parentID As Integer) As IDataReader + Public MustOverride Function GetCategoryListAll(ByVal moduleID As Integer, ByVal authorID As Integer, ByVal showPending As Boolean, ByVal sortType As Integer) As IDataReader + Public MustOverride Function GetCategory(ByVal categoryID As Integer) As IDataReader + Public MustOverride Sub DeleteCategory(ByVal categoryID As Integer) + Public MustOverride Function AddCategory(ByVal moduleID As Integer, ByVal parentID As Integer, ByVal name As String, ByVal image As String, ByVal description As String, ByVal sortOrder As Integer, ByVal inheritSecurity As Boolean, ByVal categorySecurityType As Integer, ByVal metaTitle As String, ByVal metaDescription As String, ByVal metaKeywords As String) As Integer + Public MustOverride Sub UpdateCategory(ByVal categoryID As Integer, ByVal moduleID As Integer, ByVal parentID As Integer, ByVal name As String, ByVal image As String, ByVal description As String, ByVal sortOrder As Integer, ByVal inheritSecurity As Boolean, ByVal categorySecurityType As Integer, ByVal metaTitle As String, ByVal metaDescription As String, ByVal metaKeywords As String) + + Public MustOverride Function GetCommentList(ByVal moduleID As Integer, ByVal articleID As Integer, ByVal isApproved As Boolean, ByVal direction As SortDirection, ByVal maxCount As Integer) As IDataReader + Public MustOverride Function GetComment(ByVal commentID As Integer) As IDataReader + Public MustOverride Sub DeleteComment(ByVal commentID As Integer) + Public MustOverride Function AddComment(ByVal articleID As Integer, ByVal createdDate As DateTime, ByVal userID As Integer, ByVal comment As String, ByVal remoteAddress As String, ByVal type As Integer, ByVal trackbackUrl As String, ByVal trackbackTitle As String, ByVal trackbackBlogName As String, ByVal trackbackExcerpt As String, ByVal anonymousName As String, ByVal anonymousEmail As String, ByVal anonymousURL As String, ByVal notifyMe As Boolean, ByVal isApproved As Boolean, ByVal approvedBy As Integer) As Integer + Public MustOverride Sub UpdateComment(ByVal commentID As Integer, ByVal articleID As Integer, ByVal userID As Integer, ByVal comment As String, ByVal remoteAddress As String, ByVal type As Integer, ByVal trackbackUrl As String, ByVal trackbackTitle As String, ByVal trackbackBlogName As String, ByVal trackbackExcerpt As String, ByVal anonymousName As String, ByVal anonymousEmail As String, ByVal anonymousURL As String, ByVal notifyMe As Boolean, ByVal isApproved As Boolean, ByVal approvedBy As Integer) + + Public MustOverride Function GetCustomField(ByVal customFieldID As Integer) As IDataReader + Public MustOverride Function GetCustomFieldList(ByVal moduleID As Integer) As IDataReader + Public MustOverride Sub DeleteCustomField(ByVal commentID As Integer) + Public MustOverride Function AddCustomField(ByVal moduleID As Integer, ByVal name As String, ByVal fieldType As Integer, ByVal fieldElements As String, ByVal defaultValue As String, ByVal caption As String, ByVal captionHelp As String, ByVal isRequired As Boolean, ByVal isVisible As Boolean, ByVal sortOrder As Integer, ByVal validationType As Integer, ByVal length As Integer, ByVal regularExpression As String) As Integer + Public MustOverride Sub UpdateCustomField(ByVal customFieldID As Integer, ByVal moduleID As Integer, ByVal name As String, ByVal fieldType As Integer, ByVal fieldElements As String, ByVal defaultValue As String, ByVal caption As String, ByVal captionHelp As String, ByVal isRequired As Boolean, ByVal isVisible As Boolean, ByVal sortOrder As Integer, ByVal validationType As Integer, ByVal length As Integer, ByVal regularExpression As String) + + Public MustOverride Function GetCustomValueList(ByVal articleID As Integer) As IDataReader + Public MustOverride Function AddCustomValue(ByVal articleID As Integer, ByVal customFieldID As Integer, ByVal customValue As String) As Integer + Public MustOverride Sub UpdateCustomValue(ByVal customValueID As Integer, ByVal articleID As Integer, ByVal customFieldID As Integer, ByVal customValue As String) + Public MustOverride Sub DeleteCustomValue(ByVal articleID As Integer, ByVal customFieldID As Integer) + + Public MustOverride Function GetFeed(ByVal feedID As Integer) As IDataReader + Public MustOverride Function GetFeedList(ByVal moduleID As Integer, ByVal showActiveOnly As Boolean) As IDataReader + Public MustOverride Function AddFeed(ByVal moduleID As Integer, ByVal title As String, ByVal url As String, ByVal userID As Integer, ByVal autoFeature As Boolean, ByVal isActive As Boolean, ByVal dateMode As Integer, ByVal autoExpire As Integer, ByVal autoExpireUnit As Integer) As Integer + Public MustOverride Sub UpdateFeed(ByVal feedID As Integer, ByVal moduleID As Integer, ByVal title As String, ByVal url As String, ByVal userID As Integer, ByVal autoFeature As Boolean, ByVal isActive As Boolean, ByVal dateMode As Integer, ByVal autoExpire As Integer, ByVal autoExpireUnit As Integer) + Public MustOverride Sub DeleteFeed(ByVal feedID As Integer) + + Public MustOverride Function GetFeedCategoryList(ByVal feedID As Integer) As IDataReader + Public MustOverride Sub AddFeedCategory(ByVal feedID As Integer, ByVal categoryID As Integer) + Public MustOverride Sub DeleteFeedCategory(ByVal feedID As Integer) + + Public MustOverride Function GetFile(ByVal fileID As Integer) As IDataReader + Public MustOverride Function GetFileList(ByVal articleID As Integer, ByVal fileGuid As String) As IDataReader + Public MustOverride Function AddFile(ByVal articleID As Integer, ByVal title As String, ByVal fileName As String, ByVal extension As String, ByVal size As Integer, ByVal contentType As String, ByVal folder As String, ByVal sortOrder As Integer, ByVal fileGuid As String) As Integer + Public MustOverride Sub UpdateFile(ByVal fileID As Integer, ByVal articleID As Integer, ByVal title As String, ByVal fileName As String, ByVal extension As String, ByVal size As Integer, ByVal contentType As String, ByVal folder As String, ByVal sortOrder As Integer, ByVal fileGuid As String) + Public MustOverride Sub DeleteFile(ByVal fileID As Integer) + + Public MustOverride Function GetImage(ByVal imageID As Integer) As IDataReader + Public MustOverride Function GetImageList(ByVal articleID As Integer, ByVal imageGuid As String) As IDataReader + Public MustOverride Function AddImage(ByVal articleID As Integer, ByVal title As String, ByVal fileName As String, ByVal extension As String, ByVal size As Integer, ByVal width As Integer, ByVal height As Integer, ByVal contentType As String, ByVal folder As String, ByVal sortOrder As Integer, ByVal imageGuid As String, ByVal description As String) As Integer + Public MustOverride Sub UpdateImage(ByVal imageID As Integer, ByVal articleID As Integer, ByVal title As String, ByVal fileName As String, ByVal extension As String, ByVal size As Integer, ByVal width As Integer, ByVal height As Integer, ByVal contentType As String, ByVal folder As String, ByVal sortOrder As Integer, ByVal imageGuid As String, ByVal description As String) + Public MustOverride Sub DeleteImage(ByVal imageID As Integer) + + Public MustOverride Sub AddMirrorArticle(ByVal articleID As Integer, ByVal linkedArticleID As Integer, ByVal linkedPortalID As Integer, ByVal autoUpdate As Boolean) + Public MustOverride Function GetMirrorArticle(ByVal articleID As Integer) As IDataReader + Public MustOverride Function GetMirrorArticleList(ByVal linkedArticleID As Integer) As IDataReader + + Public MustOverride Function GetPageList(ByVal articleID As Integer) As IDataReader + Public MustOverride Function GetPage(ByVal pageID As Integer) As IDataReader + Public MustOverride Sub DeletePage(ByVal pageID As Integer) + Public MustOverride Function AddPage(ByVal articleID As Integer, ByVal title As String, ByVal pageText As String, ByVal sortOrder As Integer) As Integer + Public MustOverride Sub UpdatePage(ByVal pageID As Integer, ByVal articleID As Integer, ByVal title As String, ByVal pageText As String, ByVal sortOrder As Integer) + + Public MustOverride Function AddRating(ByVal articleID As Integer, ByVal userID As Integer, ByVal createdDate As DateTime, ByVal rating As Double) As Integer + Public MustOverride Function GetRating(ByVal articleID As Integer, ByVal userID As Integer) As IDataReader + Public MustOverride Function GetRatingByID(ByVal ratingID As Integer) As IDataReader + Public MustOverride Sub DeleteRating(ByVal ratingID As Integer) + + Public MustOverride Function AddHandout(ByVal moduleID As Integer, ByVal userID As Integer, ByVal name As String, ByVal description As String) As Integer + Public MustOverride Sub AddHandoutArticle(ByVal handoutID As Integer, ByVal articleID As Integer, ByVal sortOrder As Integer) + Public MustOverride Sub DeleteHandout(ByVal handoutID As Integer) + Public MustOverride Sub DeleteHandoutArticleList(ByVal handoutID As Integer) + Public MustOverride Function GetHandout(ByVal handoutID As Integer) As IDataReader + Public MustOverride Function GetHandoutList(ByVal userID As Integer) As IDataReader + Public MustOverride Function GetHandoutArticleList(ByVal handoutID As Integer) As IDataReader + Public MustOverride Sub UpdateHandout(ByVal handoutID As Integer, ByVal moduleID As Integer, ByVal userID As Integer, ByVal name As String, ByVal description As String) + + Public MustOverride Function GetTag(ByVal tagID As Integer) As IDataReader + Public MustOverride Function GetTagByName(ByVal moduleID As Integer, ByVal nameLowered As String) As IDataReader + Public MustOverride Function ListTag(ByVal moduleID As Integer, ByVal maxCount As Integer) As IDataReader + Public MustOverride Function AddTag(ByVal moduleID As Integer, ByVal name As String, ByVal nameLowered As String) As Integer + 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 DeleteArticleTag(ByVal articleID As Integer) + Public MustOverride Sub DeleteArticleTagByTag(ByVal tagID As Integer) + +#Region " EmailTemplate Methods " + + Public MustOverride Function GetEmailTemplate(ByVal templateID As Integer) As IDataReader + Public MustOverride Function GetEmailTemplateByName(ByVal moduleID As Integer, ByVal name As String) As IDataReader + Public MustOverride Function ListEmailTemplate(ByVal moduleID As Integer) As IDataReader + Public MustOverride Function AddEmailTemplate(ByVal moduleID As Integer, ByVal name As String, ByVal subject As String, ByVal template As String) As Integer + Public MustOverride Sub UpdateEmailTemplate(ByVal templateID As Integer, ByVal moduleID As Integer, ByVal name As String, ByVal subject As String, ByVal template As String) + Public MustOverride Sub DeleteEmailTemplate(ByVal templateID As Integer) + +#End Region + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Providers/DataProvider/SqlDataProvider/00.00.01.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.00.01.SqlDataProvider new file mode 100755 index 0000000..099e259 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.00.01.SqlDataProvider @@ -0,0 +1,442 @@ +if not exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article') and OBJECTPROPERTY(id, N'IsTable') = 1) +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [ArticleID] [int] IDENTITY (1, 1) NOT NULL , + [CategoryID] [int] NOT NULL , + [AuthorID] [int] NOT NULL , + [ApproverID] [int] NULL , + [CreatedDate] [datetime] NOT NULL , + [LastUpdate] [datetime] NOT NULL , + [Title] [nvarchar] (255) NOT NULL , + [Summary] [nvarchar] (4000) NOT NULL , + [IsApproved] [bit] NOT NULL , + [NumberOfViews] [int] NOT NULL +) ON [PRIMARY] +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category') and OBJECTPROPERTY(id, N'IsTable') = 1) +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ( + [CategoryID] [int] IDENTITY (1, 1) NOT NULL , + [ModuleID] [int] NOT NULL , + [Name] [nvarchar] (255) NOT NULL , + [Image] [nvarchar] (255) NULL +) ON [PRIMARY] +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment') and OBJECTPROPERTY(id, N'IsTable') = 1) +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ( + [CommentID] [int] IDENTITY (1, 1) NOT NULL , + [ArticleID] [int] NOT NULL , + [UserID] [int] NOT NULL , + [CreatedDate] [datetime] NOT NULL , + [Comment] [ntext] NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'PK_{objectQualifier}DnnForge_NewsArticles_Article') and OBJECTPROPERTY(id, N'IsPrimaryKey') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_Article] PRIMARY KEY CLUSTERED + ( + [ArticleID] + ) ON [PRIMARY] +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'DF_{objectQualifier}DnnForge_NewsArticles_Article_CreatedDate') and OBJECTPROPERTY(id, N'IsConstraint') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + CONSTRAINT [DF_{objectQualifier}DnnForge_NewsArticles_Article_CreatedDate] DEFAULT (getdate()) FOR [CreatedDate] +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'DF_{objectQualifier}DnnForge_NewsArticles_Article_LastUpdate') and OBJECTPROPERTY(id, N'IsConstraint') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + CONSTRAINT [DF_{objectQualifier}DnnForge_NewsArticles_Article_LastUpdate] DEFAULT (getdate()) FOR [LastUpdate] +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'DF_{objectQualifier}DnnForge_NewsArticles_Article_IsApproved') and OBJECTPROPERTY(id, N'IsConstraint') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + CONSTRAINT [DF_{objectQualifier}DnnForge_NewsArticles_Article_IsApproved] DEFAULT (0) FOR [IsApproved] +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'DF_{objectQualifier}DnnForge_NewsArticles_Article_NumberOfViews') and OBJECTPROPERTY(id, N'IsConstraint') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + CONSTRAINT [DF_{objectQualifier}DnnForge_NewsArticles_Article_NumberOfViews] DEFAULT (0) FOR [NumberOfViews] +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'PK_{objectQualifier}DnnForge_NewsArticles_Category') and OBJECTPROPERTY(id, N'IsPrimaryKey') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_Category] PRIMARY KEY CLUSTERED + ( + [CategoryID] + ) ON [PRIMARY] +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'PK_{objectQualifier}DnnForge_NewsArticles_Comment') and OBJECTPROPERTY(id, N'IsPrimaryKey') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_Comment] PRIMARY KEY CLUSTERED + ( + [CommentID] + ) ON [PRIMARY] +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'DF_{objectQualifier}DF_DnnForge_NewsArticles_Comment_CreatedDate') and OBJECTPROPERTY(id, N'IsConstraint') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ADD + CONSTRAINT [DF_{objectQualifier}DnnForge_NewsArticles_Comment_CreatedDate] DEFAULT (getdate()) FOR [CreatedDate] +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'FK_{objectQualifier}DnnForge_NewsArticles_Article_{objectQualifier}DnnForge_NewsArticles_Category') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + CONSTRAINT [FK_{objectQualifier}DnnForge_NewsArticles_Article_{objectQualifier}DnnForge_NewsArticles_Category] FOREIGN KEY + ( + [CategoryID] + ) REFERENCES {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ( + [CategoryID] + ) ON DELETE CASCADE +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'FK_{objectQualifier}DnnForge_NewsArticles_Article_{objectQualifier}Users') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + CONSTRAINT [FK_{objectQualifier}DnnForge_NewsArticles_Article_{objectQualifier}Users] FOREIGN KEY + ( + [AuthorID] + ) REFERENCES {databaseOwner}{objectQualifier}Users ( + [UserID] + ) ON DELETE CASCADE +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'FK_{objectQualifier}DnnForge_NewsArticles_Category_{objectQualifier}Modules') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ADD + CONSTRAINT [FK_{objectQualifier}DnnForge_NewsArticles_Category_{objectQualifier}Modules] FOREIGN KEY + ( + [ModuleID] + ) REFERENCES {databaseOwner}{objectQualifier}Modules ( + [ModuleID] + ) ON DELETE CASCADE +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'FK_{objectQualifier}DnnForge_NewsArticles_Comment_{objectQualifier}DnnForge_NewsArticles_Article') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ADD + CONSTRAINT [FK_{objectQualifier}DnnForge_NewsArticles_Comment_{objectQualifier}DnnForge_NewsArticles_Article] FOREIGN KEY + ( + [ArticleID] + ) REFERENCES {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [ArticleID] + ) ON DELETE CASCADE +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteArticle') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteArticle +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteCategory') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteCategory +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteComment') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteComment +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByApproved') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByApproved +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @CategoryID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary nvarchar(4000), + @IsApproved bit, + @NumberOfViews int +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [CategoryID], + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews] +) VALUES ( + @CategoryID, + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews +) + +select SCOPE_IDENTITY() +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory + @ModuleID int, + @Name nvarchar(255), + @Image nvarchar(255) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ( + [ModuleID], + [Name], + [Image] +) VALUES ( + @ModuleID, + @Name, + @Image +) + +select SCOPE_IDENTITY() +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment + @ArticleID int, + @UserID int, + @Comment ntext +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ( + [ArticleID], + [UserID], + [Comment] +) VALUES ( + @ArticleID, + @UserID, + @Comment +) + +select SCOPE_IDENTITY() +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteArticle + @ArticleID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +WHERE + [ArticleID] = @ArticleID + +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteCategory + @CategoryID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [CategoryID] = @CategoryID + +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteComment + @CommentID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment +WHERE + [CommentID] = @CommentID + +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList + @ModuleID int +AS +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved + @ModuleID int, + @IsApproved bit +AS +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor + @ModuleID int, + @AuthorID int +AS +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByApproved + @ModuleID int, + @AuthorID int, + @IsApproved bit +AS +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID int, + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255) +AS +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory + @CategoryID int +AS + +SELECT + [CategoryID], + [ModuleID], + [Name], + [Image] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [CategoryID] = @CategoryID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList + @ModuleID int +AS + +SELECT + [CategoryID], + [ModuleID], + [Name], + [Image] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [ModuleID] = @ModuleID + +ORDER BY Name +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment + @CommentID int +AS +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList + @ArticleID int +AS +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @CategoryID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary nvarchar(4000), + @IsApproved bit, + @NumberOfViews int +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [CategoryID] = @CategoryID, + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews +WHERE + [ArticleID] = @ArticleID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory + @CategoryID int, + @ModuleID int, + @Name nvarchar(255), + @Image nvarchar(255) +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category SET + [ModuleID] = @ModuleID, + [Name] = @Name, + [Image] = @Image +WHERE + [CategoryID] = @CategoryID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment + @CommentID int, + @ArticleID int, + @UserID int, + @Comment ntext +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment SET + [ArticleID] = @ArticleID, + [UserID] = @UserID, + [Comment] = @Comment +WHERE + [CommentID] = @CommentID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.00.02.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.00.02.SqlDataProvider new file mode 100755 index 0000000..9d37198 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.00.02.SqlDataProvider @@ -0,0 +1,271 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + Add [IsDraft] bit NOT NULL DEFAULT 0 +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page') and OBJECTPROPERTY(id, N'IsTable') = 1) +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page ( + [PageID] [int] IDENTITY (1, 1) NOT NULL , + [ArticleID] [int] NOT NULL , + [Title] [nvarchar] (255) NOT NULL , + [PageText] [ntext] NOT NULL , + [SortOrder] [int] NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'PK_{objectQualifier}DnnForge_NewsArticles_Page') and OBJECTPROPERTY(id, N'IsPrimaryKey') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_Page] PRIMARY KEY CLUSTERED + ( + [PageID] + ) ON [PRIMARY] +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'DF_{objectQualifier}DnnForge_NewsArticles_Page_SortOrder') and OBJECTPROPERTY(id, N'IsConstraint') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page ADD + CONSTRAINT [DF_{objectQualifier}DnnForge_NewsArticles_Page_SortOrder] DEFAULT (0) FOR [SortOrder] +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'FK_{objectQualifier}DnnForge_NewsArticles_Page_{objectQualifier}DnnForge_NewsArticles_Article') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page ADD + CONSTRAINT [FK_{objectQualifier}DnnForge_NewsArticles_Page_{objectQualifier}DnnForge_NewsArticles_Article] FOREIGN KEY + ( + [ArticleID] + ) REFERENCES {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [ArticleID] + ) ON DELETE CASCADE +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @CategoryID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary nvarchar(4000), + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [CategoryID], + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews], + [IsDraft] +) VALUES ( + @CategoryID, + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews, + @IsDraft +) + +select SCOPE_IDENTITY() +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddPage') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddPage +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddPage + @ArticleID int, + @Title nvarchar(255), + @PageText ntext, + @SortOrder int +AS + +declare @count int + +select @count = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where ArticleID = @ArticleID) + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page ( + [ArticleID], + [Title], + [PageText], + [SortOrder] +) VALUES ( + @ArticleID, + @Title, + @PageText, + @count +) + +select SCOPE_IDENTITY() +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeletePage') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeletePage +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeletePage + @PageID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page +WHERE + [PageID] = @PageID +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList + @ModuleID int +AS +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved + @ModuleID int, + @IsApproved bit +AS +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor + @ModuleID int, + @AuthorID int +AS +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByApproved') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByApproved +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus + @ModuleID int, + @AuthorID int, + @IsApproved bit, + @IsDraft bit +AS +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetPage') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetPage +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetPage + @PageID int +AS + +SELECT + [PageID], + [ArticleID], + [Title], + [PageText], + [SortOrder] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page +WHERE + [PageID] = @PageID +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetPageList') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetPageList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetPageList + @ArticleID int +AS + +SELECT + [PageID], + [ArticleID], + [Title], + [PageText], + [SortOrder] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page + +WHERE + [ArticleID] = @ArticleID + +ORDER BY + [SortOrder] ASC +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @CategoryID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary nvarchar(4000), + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [CategoryID] = @CategoryID, + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews, + [IsDraft] = @IsDraft +WHERE + [ArticleID] = @ArticleID +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdatePage') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdatePage +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdatePage + @PageID int, + @ArticleID int, + @Title nvarchar(255), + @PageText ntext, + @SortOrder int +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page SET + [ArticleID] = @ArticleID, + [Title] = @Title, + [PageText] = @PageText, + [SortOrder] = @SortOrder +WHERE + [PageID] = @PageID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.00.03.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.00.03.SqlDataProvider new file mode 100755 index 0000000..cec6144 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.00.03.SqlDataProvider @@ -0,0 +1,14 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID int, + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255) +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.00.04.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.00.04.SqlDataProvider new file mode 100755 index 0000000..c36b15d --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.00.04.SqlDataProvider @@ -0,0 +1,8 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryStatistics') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryStatistics + @ModuleID int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.00.05.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.00.05.SqlDataProvider new file mode 100755 index 0000000..c016c48 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.00.05.SqlDataProvider @@ -0,0 +1,255 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + StartDate datetime NULL, + EndDate datetime NULL, + ModuleID int NULL +GO + +UPDATE + {databaseOwner}{objectQualifier}dnnforge_newsarticles_article +SET + {databaseOwner}{objectQualifier}dnnforge_newsarticles_article.moduleid = (select moduleid from {databaseOwner}{objectQualifier}dnnforge_newsarticles_category where {databaseOwner}{objectQualifier}dnnforge_newsarticles_category.categoryid = {databaseOwner}{objectQualifier}dnnforge_newsarticles_article.categoryid) +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +drop table {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories +GO + +if not exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +BEGIN +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ( + [ArticleID] [int] NOT NULL , + [CategoryID] [int] NOT NULL +) ON [PRIMARY] +END +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories WITH NOCHECK ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_ArticleCategories] PRIMARY KEY CLUSTERED + ( + [ArticleID], + [CategoryID] + ) ON [PRIMARY] +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ADD + CONSTRAINT FK_{objectQualifier}DnnForge_NewsArticles_ArticleCategories_DnnForge_NewsArticles_Article FOREIGN KEY + ( + [ArticleID] + ) REFERENCES {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [ArticleID] + ) , + CONSTRAINT FK_{objectQualifier}DnnForge_NewsArticles_ArticleCategories_DnnForge_NewsArticles_Category FOREIGN KEY + ( + [CategoryID] + ) REFERENCES {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ( + [CategoryID] + ) +GO + +insert into {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories select ArticleID, CategoryID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + DROP CONSTRAINT FK_{objectQualifier}DnnForge_NewsArticles_Article_{objectQualifier}DnnForge_NewsArticles_Category +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + DROP COLUMN CategoryID +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article WITH NOCHECK ADD CONSTRAINT + FK_{objectQualifier}DnnForge_NewsArticles_Article_Modules FOREIGN KEY + ( + ModuleID + ) REFERENCES {databaseOwner}{objectQualifier}Modules + ( + ModuleID + ) ON DELETE CASCADE + +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary nvarchar(4000), + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews, + [IsDraft] = @IsDraft, + [StartDate] = @StartDate, + [EndDate] = @EndDate, + [ModuleID] = @ModuleID +WHERE + [ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary nvarchar(4000), + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews], + [IsDraft], + [StartDate], + [EndDate], + [ModuleID] +) VALUES ( + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews, + @IsDraft, + @StartDate, + @EndDate, + @ModuleID +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList + @ModuleID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved + @ModuleID int, + @IsApproved bit +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor + @ModuleID int, + @AuthorID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus + @ModuleID int, + @AuthorID int, + @IsApproved bit, + @IsDraft bit +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255) +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryStatistics + @ModuleID int +AS +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteArticleCategories + @ArticleID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories +WHERE + [ArticleID] = @ArticleID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticleCategory + @ArticleID int, + @CategoryID int +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories( ArticleID, CategoryID ) +VALUES (@ArticleID, @CategoryID) +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleCategories + @ArticleID int +AS + +SELECT + Category.CategoryID, + Category.[Name] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories, {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category Category + +WHERE + ArticleCategories.CategoryID = Category.CategoryID + AND + ArticleCategories.ArticleID = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.00.06.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.00.06.SqlDataProvider new file mode 100755 index 0000000..89b6376 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.00.06.SqlDataProvider @@ -0,0 +1,13 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255) +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.00.07.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.00.07.SqlDataProvider new file mode 100755 index 0000000..a39a2e8 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.00.07.SqlDataProvider @@ -0,0 +1,144 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + ImageUrl nvarchar(255) NULL +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary nvarchar(4000), + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews], + [IsDraft], + [StartDate], + [EndDate], + [ModuleID], + [ImageUrl] +) VALUES ( + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews, + @IsDraft, + @StartDate, + @EndDate, + @ModuleID, + @ImageUrl +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary nvarchar(4000), + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255) +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews, + [IsDraft] = @IsDraft, + [StartDate] = @StartDate, + [EndDate] = @EndDate, + [ModuleID] = @ModuleID, + [ImageUrl] = @ImageUrl +WHERE + [ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved + @ModuleID int, + @IsApproved bit +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor + @ModuleID int, + @AuthorID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus + @ModuleID int, + @AuthorID int, + @IsApproved bit, + @IsDraft bit +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255) +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.00.10.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.00.10.SqlDataProvider new file mode 100755 index 0000000..ef0f293 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.00.10.SqlDataProvider @@ -0,0 +1,15 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteArticle + @ArticleID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories +WHERE + [ArticleID] = @ArticleID + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +WHERE + [ArticleID] = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.01.00.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.01.00.SqlDataProvider new file mode 100755 index 0000000..fa9c110 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.01.00.SqlDataProvider @@ -0,0 +1,269 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + IsFeatured bit NOT NULL CONSTRAINT DF_{objectQualifier}DnnForge_NewsArticles_Article_IsFeatured DEFAULT 0 +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment + DROP CONSTRAINT FK_{objectQualifier}DnnForge_NewsArticles_Comment_{objectQualifier}DnnForge_NewsArticles_Article +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ADD + Rating float NULL, + RemoteAddress nvarchar(50) NULL +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment WITH NOCHECK ADD CONSTRAINT + FK_{objectQualifier}DnnForge_NewsArticles_Comment_{objectQualifier}DnnForge_NewsArticles_Article FOREIGN KEY + ( + ArticleID + ) REFERENCES {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + ( + ArticleID + ) ON DELETE CASCADE + +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary nvarchar(4000), + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews], + [IsDraft], + [StartDate], + [EndDate], + [ModuleID], + [ImageUrl], + [IsFeatured] +) VALUES ( + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews, + @IsDraft, + @StartDate, + @EndDate, + @ModuleID, + @ImageUrl, + @IsFeatured +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary nvarchar(4000), + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews, + [IsDraft] = @IsDraft, + [StartDate] = @StartDate, + [EndDate] = @EndDate, + [ModuleID] = @ModuleID, + [ImageUrl] = @ImageUrl, + [IsFeatured] = @IsFeatured +WHERE + [ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved + @ModuleID int, + @IsApproved bit +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor + @ModuleID int, + @AuthorID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus + @ModuleID int, + @AuthorID int, + @IsApproved bit, + @IsDraft bit +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList + @ModuleID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment + @ArticleID int, + @UserID int, + @Comment ntext, + @Rating float, + @RemoteAddress nvarchar(50) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ( + [ArticleID], + [UserID], + [Comment], + [Rating], + [RemoteAddress] +) VALUES ( + @ArticleID, + @UserID, + @Comment, + @Rating, + @RemoteAddress +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment + @CommentID int, + @ArticleID int, + @UserID int, + @Comment ntext, + @Rating float, + @RemoteAddress nvarchar(50) +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment SET + [ArticleID] = @ArticleID, + [UserID] = @UserID, + [Comment] = @Comment, + [Rating] = @Rating, + [RemoteAddress] = @RemoteAddress +WHERE + [CommentID] = @CommentID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment + @CommentID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList + @ArticleID int +AS +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorList + @ModuleID int +AS + +SELECT DISTINCT + Authors.UserID, + Authors.Username, + Authors.FirstName, + Authors.LastName + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Articles, {databaseOwner}{objectQualifier}Users Authors + +WHERE + Articles.AuthorID = Authors.UserID + and + Articles.ModuleID = @ModuleID + and + Articles.IsApproved = 1 + +ORDER BY + Authors.FirstName, Authors.LastName +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.01.01.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.01.01.SqlDataProvider new file mode 100755 index 0000000..00202dc --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.01.01.SqlDataProvider @@ -0,0 +1,16 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.01.02.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.01.02.SqlDataProvider new file mode 100755 index 0000000..5472184 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.01.02.SqlDataProvider @@ -0,0 +1,291 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + DROP CONSTRAINT FK_{objectQualifier}DnnForge_NewsArticles_Article_{objectQualifier}Users +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + DROP CONSTRAINT FK_{objectQualifier}DnnForge_NewsArticles_Article_Modules +GO + +CREATE TABLE {databaseOwner}{objectQualifier}Tmp_DnnForge_NewsArticles_Article + ( + ArticleID int NOT NULL IDENTITY (1, 1), + AuthorID int NOT NULL, + ApproverID int NULL, + CreatedDate datetime NOT NULL, + LastUpdate datetime NOT NULL, + Title nvarchar(255) NOT NULL, + Summary ntext NOT NULL, + IsApproved bit NOT NULL, + NumberOfViews int NOT NULL, + IsDraft bit NOT NULL, + StartDate datetime NULL, + EndDate datetime NULL, + ModuleID int NULL, + ImageUrl nvarchar(255) NULL, + IsFeatured bit NOT NULL + ) ON [PRIMARY] + TEXTIMAGE_ON [PRIMARY] +GO + +SET IDENTITY_INSERT {databaseOwner}{objectQualifier}Tmp_DnnForge_NewsArticles_Article ON +GO + +IF EXISTS(SELECT * FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article) + EXEC('INSERT INTO {databaseOwner}{objectQualifier}Tmp_DnnForge_NewsArticles_Article (ArticleID, AuthorID, ApproverID, CreatedDate, LastUpdate, Title, Summary, IsApproved, NumberOfViews, IsDraft, StartDate, EndDate, ModuleID, ImageUrl, IsFeatured) + SELECT ArticleID, AuthorID, ApproverID, CreatedDate, LastUpdate, Title, CONVERT(ntext, Summary), IsApproved, NumberOfViews, IsDraft, StartDate, EndDate, ModuleID, ImageUrl, IsFeatured FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article (HOLDLOCK TABLOCKX)') +GO + +SET IDENTITY_INSERT {databaseOwner}{objectQualifier}Tmp_DnnForge_NewsArticles_Article OFF +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories + DROP CONSTRAINT FK_{objectQualifier}DnnForge_NewsArticles_ArticleCategories_DnnForge_NewsArticles_Article +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment + DROP CONSTRAINT FK_{objectQualifier}DnnForge_NewsArticles_Comment_{objectQualifier}DnnForge_NewsArticles_Article +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page + DROP CONSTRAINT FK_{objectQualifier}DnnForge_NewsArticles_Page_{objectQualifier}DnnForge_NewsArticles_Article +GO + +DROP TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +GO + +EXECUTE sp_rename N'{objectQualifier}Tmp_DnnForge_NewsArticles_Article', N'{objectQualifier}DnnForge_NewsArticles_Article', 'OBJECT' +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD CONSTRAINT + PK_{objectQualifier}DnnForge_NewsArticles_Article PRIMARY KEY CLUSTERED + ( + ArticleID + ) ON [PRIMARY] + +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article WITH NOCHECK ADD CONSTRAINT + FK_{objectQualifier}DnnForge_NewsArticles_Article_Modules FOREIGN KEY + ( + ModuleID + ) REFERENCES {databaseOwner}{objectQualifier}Modules + ( + ModuleID + ) ON DELETE CASCADE + + +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article WITH NOCHECK ADD CONSTRAINT + FK_{objectQualifier}DnnForge_NewsArticles_Article_Users FOREIGN KEY + ( + AuthorID + ) REFERENCES {databaseOwner}{objectQualifier}Users + ( + UserID + ) ON DELETE CASCADE + +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page WITH NOCHECK ADD CONSTRAINT + FK_{objectQualifier}DnnForge_NewsArticles_Page_{objectQualifier}DnnForge_NewsArticles_Article FOREIGN KEY + ( + ArticleID + ) REFERENCES {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + ( + ArticleID + ) ON DELETE CASCADE + +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment WITH NOCHECK ADD CONSTRAINT + FK_{objectQualifier}DnnForge_NewsArticles_Comment_{objectQualifier}DnnForge_NewsArticles_Article FOREIGN KEY + ( + ArticleID + ) REFERENCES {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + ( + ArticleID + ) ON DELETE CASCADE + + +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories WITH NOCHECK ADD CONSTRAINT + FK_{objectQualifier}DnnForge_NewsArticles_ArticleCategories_{objectQualifier}DnnForge_NewsArticles_Article FOREIGN KEY + ( + ArticleID + ) REFERENCES {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + ( + ArticleID + ) + +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + LastUpdateID int NULL +GO + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET LastUpdateID = AuthorID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews], + [IsDraft], + [StartDate], + [EndDate], + [ModuleID], + [ImageUrl], + [IsFeatured], + [LastUpdateID] +) VALUES ( + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews, + @IsDraft, + @StartDate, + @EndDate, + @ModuleID, + @ImageUrl, + @IsFeatured, + @LastUpdateID +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews, + [IsDraft] = @IsDraft, + [StartDate] = @StartDate, + [EndDate] = @EndDate, + [ModuleID] = @ModuleID, + [ImageUrl] = @ImageUrl, + [IsFeatured] = @IsFeatured, + [LastUpdateID] = @LastUpdateID +WHERE + [ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved + @ModuleID int, + @IsApproved bit +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor + @ModuleID int, + @AuthorID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus + @ModuleID int, + @AuthorID int, + @IsApproved bit, + @IsDraft bit +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList + @ModuleID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.02.00.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.02.00.SqlDataProvider new file mode 100755 index 0000000..41d2242 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.02.00.SqlDataProvider @@ -0,0 +1,15 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteCategory + @CategoryID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories +WHERE + [CategoryID] = @CategoryID + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [CategoryID] = @CategoryID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.02.05.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.02.05.SqlDataProvider new file mode 100755 index 0000000..1bfa11a --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.02.05.SqlDataProvider @@ -0,0 +1,111 @@ +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_EmailTemplate ( + [TemplateID] [int] IDENTITY (1, 1) NOT NULL , + [ModuleID] [int] NOT NULL , + [Name] [nvarchar] (50) NOT NULL , + [Subject] [nvarchar] (255) NOT NULL , + [Template] [ntext] NOT NULL +) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_EmailTemplate ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_EmailTemplate] PRIMARY KEY CLUSTERED + ( + [TemplateID] + ) ON [PRIMARY] +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_EmailTemplateGet + @TemplateID int +AS + +SELECT + [TemplateID], + [ModuleID], + [Name], + [Subject], + [Template] +FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_EmailTemplate +WHERE + [TemplateID] = @TemplateID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_EmailTemplateList + @ModuleID int +AS + +SELECT + [TemplateID], + [ModuleID], + [Name], + [Subject], + [Template] +FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_EmailTemplate +WHERE + [ModuleID] = @ModuleID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_EmailTemplateAdd + @ModuleID int, + @Name nvarchar(50), + @Subject nvarchar(255), + @Template ntext +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_EmailTemplate ( + [ModuleID], + [Name], + [Subject], + [Template] +) VALUES ( + @ModuleID, + @Name, + @Subject, + @Template +) + +select SCOPE_IDENTITY() +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_EmailTemplateUpdate + @TemplateID int, + @ModuleID int, + @Name nvarchar(50), + @Subject nvarchar(255), + @Template ntext +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_EmailTemplate SET + [ModuleID] = @ModuleID, + [Name] = @Name, + [Subject] = @Subject, + [Template] = @Template +WHERE + [TemplateID] = @TemplateID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_EmailTemplateDelete + @TemplateID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_EmailTemplate +WHERE + [TemplateID] = @TemplateID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_EmailTemplateGetByName + @ModuleID int, + @Name nvarchar(50) +AS + +SELECT + [TemplateID], + [ModuleID], + [Name], + [Subject], + [Template] +FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_EmailTemplate +WHERE + [ModuleID] = @ModuleID + and + [Name] = @Name +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.02.07.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.02.07.SqlDataProvider new file mode 100755 index 0000000..ccd619e --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.02.07.SqlDataProvider @@ -0,0 +1,4 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + DROP CONSTRAINT FK_{objectQualifier}DnnForge_NewsArticles_Article_Users +GO + diff --git a/Providers/DataProvider/SqlDataProvider/00.03.00.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.03.00.SqlDataProvider new file mode 100755 index 0000000..f5ff526 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.03.00.SqlDataProvider @@ -0,0 +1,7 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.03.02.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.03.02.SqlDataProvider new file mode 100755 index 0000000..c7fd868 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.03.02.SqlDataProvider @@ -0,0 +1,8 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved + @ModuleID int, + @IsApproved bit +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.04.02.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.04.02.SqlDataProvider new file mode 100755 index 0000000..1aa3bd5 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.04.02.SqlDataProvider @@ -0,0 +1,18 @@ + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @SortBy varchar(50) +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.04.03.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.04.03.SqlDataProvider new file mode 100755 index 0000000..4caf4c2 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.04.03.SqlDataProvider @@ -0,0 +1,171 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + URL nvarchar(255) NULL +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @SortBy varchar(50) +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews], + [IsDraft], + [StartDate], + [EndDate], + [ModuleID], + [ImageUrl], + [IsFeatured], + [LastUpdateID], + [Url] +) VALUES ( + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews, + @IsDraft, + @StartDate, + @EndDate, + @ModuleID, + @ImageUrl, + @IsFeatured, + @LastUpdateID, + @Url +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255) +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews, + [IsDraft] = @IsDraft, + [StartDate] = @StartDate, + [EndDate] = @EndDate, + [ModuleID] = @ModuleID, + [ImageUrl] = @ImageUrl, + [IsFeatured] = @IsFeatured, + [LastUpdateID] = @LastUpdateID, + [Url] = @Url +WHERE + [ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved + @ModuleID int, + @IsApproved bit +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor + @ModuleID int, + @AuthorID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus + @ModuleID int, + @AuthorID int, + @IsApproved bit, + @IsDraft bit +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList + @ModuleID int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.04.08.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.04.08.SqlDataProvider new file mode 100755 index 0000000..f958e6b --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.04.08.SqlDataProvider @@ -0,0 +1,23 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories DROP + CONSTRAINT FK_{objectQualifier}DnnForge_NewsArticles_ArticleCategories_{objectQualifier}DnnForge_NewsArticles_Article +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories DROP + CONSTRAINT FK_{objectQualifier}DnnForge_NewsArticles_ArticleCategories_DnnForge_NewsArticles_Category +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ADD + CONSTRAINT FK_{objectQualifier}DnnForge_NewsArticles_ArticleCategories_{objectQualifier}DnnForge_NewsArticles_Article FOREIGN KEY + ( + [ArticleID] + ) REFERENCES {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [ArticleID] + ) ON DELETE CASCADE + , + CONSTRAINT FK_{objectQualifier}DnnForge_NewsArticles_ArticleCategories_{objectQualifier}DnnForge_NewsArticles_Category FOREIGN KEY + ( + [CategoryID] + ) REFERENCES {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ( + [CategoryID] + ) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.04.09.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.04.09.SqlDataProvider new file mode 100755 index 0000000..8bdbb67 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.04.09.SqlDataProvider @@ -0,0 +1,12 @@ +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET StartDate = CreatedDate +WHERE StartDate IS NULL +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryStatistics + @ModuleID int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.00.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.00.SqlDataProvider new file mode 100755 index 0000000..b6dc815 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.00.SqlDataProvider @@ -0,0 +1,116 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ADD + Type int NOT NULL Default 0, + TrackbackUrl nvarchar(255) NULL, + TrackbackTitle nvarchar(255) NULL, + TrackbackBlogName nvarchar(255) NULL, + TrackbackExcerpt ntext NULL +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment + @ArticleID int, + @UserID int, + @Comment ntext, + @Rating float, + @RemoteAddress nvarchar(50) , + @Type int, + @TrackbackUrl nvarchar(255), + @TrackbackTitle nvarchar(255), + @TrackbackBlogName nvarchar(255), + @TrackbackExcerpt ntext +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ( + [ArticleID], + [UserID], + [Comment], + [Rating], + [RemoteAddress], + [Type], + [TrackbackUrl], + [TrackbackTitle], + [TrackbackBlogName], + [TrackbackExcerpt] +) VALUES ( + @ArticleID, + @UserID, + @Comment, + @Rating, + @RemoteAddress, + @Type, + @TrackbackUrl, + @TrackbackTitle, + @TrackbackBlogName, + @TrackbackExcerpt +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment + @CommentID int, + @ArticleID int, + @UserID int, + @Comment ntext, + @Rating float, + @RemoteAddress nvarchar(50), + @Type int, + @TrackbackUrl nvarchar(255), + @TrackbackTitle nvarchar(255), + @TrackbackBlogName nvarchar(255), + @TrackbackExcerpt ntext +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment SET + [ArticleID] = @ArticleID, + [UserID] = @UserID, + [Comment] = @Comment, + [Rating] = @Rating, + [RemoteAddress] = @RemoteAddress, + [Type] = @Type, + [TrackbackUrl] = @TrackbackUrl, + [TrackbackTitle] = @TrackbackTitle, + [TrackbackBlogName] = @TrackbackBlogName, + [TrackbackExcerpt] = @TrackbackExcerpt +WHERE + [CommentID] = @CommentID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment + @CommentID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList + @ArticleID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @SortBy varchar(50) +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.02.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.02.SqlDataProvider new file mode 100755 index 0000000..9532b78 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.02.SqlDataProvider @@ -0,0 +1,19 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryStatistics + @ModuleID int +AS + +select + Category.CategoryID, + Category.Name, + (select count(*) from {databaseOwner}{objectQualifier}dnnforge_newsarticles_articlecategories articleCategories, {databaseOwner}{objectQualifier}dnnforge_newsarticles_article articles where categoryid = Category.CategoryID and articleCategories.articleID = articles.ArticleID and articles.IsApproved = 1 AND (articles.StartDate is null or articles.StartDate < DateAdd(mi, 1, GetDate())) AND (articles.EndDate is null or articles.EndDate > DateAdd(mi, 1, GetDate())) ) as 'NumberOfArticles', + (select sum(NumberOfViews) from {databaseOwner}{objectQualifier}dnnforge_newsarticles_articlecategories articleCategories, {databaseOwner}{objectQualifier}dnnforge_newsarticles_article articles where categoryid = Category.CategoryID and articleCategories.articleID = articles.ArticleID AND (articles.StartDate is null or articles.StartDate < DateAdd(mi, 1, GetDate())) AND (articles.EndDate is null or articles.EndDate > DateAdd(mi, 1, GetDate())) ) as 'NumberOfViews' +from + {databaseOwner}{objectQualifier}dnnforge_newsarticles_category Category +where + Category.ModuleID = @ModuleID +ORDER BY + Category.Name +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.05.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.05.SqlDataProvider new file mode 100755 index 0000000..61424e9 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.05.SqlDataProvider @@ -0,0 +1,30 @@ +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive + @ModuleID int +AS + +select Month(StartDate) as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] +from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article +where ModuleID = @ModuleID and IsApproved = 1 and IsDraft = 0 +group by Year(StartDate), Month(StartDate) +order by [Year] desc, [Month] desc +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @SortBy varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.09.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.09.SqlDataProvider new file mode 100755 index 0000000..6b7da1a --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.09.SqlDataProvider @@ -0,0 +1,25 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive + @ModuleID int, + @CategoryID varchar(255) +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +EXEC(' +select Month(StartDate) as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] +from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article +where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' +group by Year(StartDate), Month(StartDate) +order by [Year] desc, [Month] desc') +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.11.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.11.SqlDataProvider new file mode 100755 index 0000000..577cdcc --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.11.SqlDataProvider @@ -0,0 +1,28 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive + @ModuleID int, + @CategoryID varchar(255) +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +EXEC(' +select Month(StartDate) as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] +from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article +where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' +group by Year(StartDate), Month(StartDate) +order by [Year] desc, [Month] desc') +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.12.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.12.SqlDataProvider new file mode 100755 index 0000000..24289d9 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.12.SqlDataProvider @@ -0,0 +1,465 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive + @ModuleID int, + @CategoryID varchar(255) +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +EXEC(' +select Month(StartDate) as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] +from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article +where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' +group by Year(StartDate), Month(StartDate) +order by [Year] desc, [Month] desc') +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @SortBy varchar(50), + @Month int, + @Year int +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = ' 1 = 1 ' + +IF (@MaxCount is not null) + SELECT @strTop = ' TOP ' + convert(nvarchar, @MaxCount) + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@MaxAge is not null) and (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND Article.CreatedDate > ''' + convert(nvarchar, DateAdd(day, @MaxAge, @StartDate)) + '''' + +IF (@MaxAge is not null) and (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND Article.CreatedDate < ''' + convert(nvarchar, @StartDate) + '''' + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE ''%' + @Keywords + '%'' OR Article.Summary LIKE ''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE ''%' + @Keywords + '%'') > 0))' + +IF (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null or Article.StartDate < ''' + convert(nvarchar, DateAdd(mi, 1, GetDate())) + ''')' + +IF (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null or Article.EndDate > ''' + convert(nvarchar, DateAdd(day, -1, GetDate())) + ''')' + +IF (@Month is not null) + SELECT @strWhere = @strWhere + ' AND Month(Article.StartDate) = ' + convert(nvarchar, @Month) + +IF (@Year is not null) + SELECT @strWhere = @strWhere + ' AND Year(Article.StartDate) = ' + convert(nvarchar, @Year) + +EXEC(' +SELECT ' + @strTop + ' + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + '''' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '''' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as ''PageCount'', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as ''CommentCount'', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as ''Rating'', + case when Images.FileName is null then '''' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article INNER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID INNER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = ''fileid='' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = ''fileid='' + CONVERT(nvarchar, Images.FileID) + +WHERE ' + + @strWhere + ' + +ORDER BY + ' + @SortBy + ' DESC') +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as 'PageCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'Rating', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article INNER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID INNER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) + +WHERE + Article.[ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved + @ModuleID int, + @IsApproved bit +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as 'PageCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'Rating', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article INNER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID INNER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) + +WHERE + Article.[ModuleID] = @ModuleID + AND + Article.[IsApproved] = @IsApproved + AND + Article.[IsDraft] = 0 + +ORDER BY + Article.[CreatedDate] DESC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor + @ModuleID int, + @AuthorID int +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'Rating', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article INNER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID INNER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) +WHERE + Article.[ModuleID] = @ModuleID + AND + Article.[AuthorID] = @AuthorID + +ORDER BY + Article.[CreatedDate] DESC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus + @ModuleID int, + @AuthorID int, + @IsApproved bit, + @IsDraft bit +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as CommentCount, + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as Rating, + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS Url + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article INNER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID INNER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) +WHERE + Article.[ModuleID] = @ModuleID + AND + Article.[AuthorID] = @AuthorID + AND + Article.[IsApproved] = @IsApproved + AND + Article.[IsDraft] = @IsDraft + +ORDER BY + Article.[CreatedDate] DESC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList + @ModuleID int +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article INNER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID INNER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) +WHERE + Article.[ModuleID] = @ModuleID + +ORDER BY + Article.[CreatedDate] DESC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment + @CommentID int +AS + +SELECT + Comment.[CommentID], + Comment.[ArticleID], + Comment.[UserID], + Comment.[CreatedDate], + Comment.[Comment], + Comment.[Rating], + Comment.[RemoteAddress], + Comment.[Type], + Comment.[TrackbackUrl], + Comment.[TrackbackTitle], + Comment.[TrackbackBlogName], + Comment.[TrackbackExcerpt], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Comment.UserID = Author.UserID +WHERE + [CommentID] = @CommentID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList + @ArticleID int +AS + +SELECT + Comment.[CommentID], + Comment.[ArticleID], + Comment.[UserID], + Comment.[CreatedDate], + Comment.[Comment], + Comment.[Rating], + Comment.[RemoteAddress], + Comment.[Type], + Comment.[TrackbackUrl], + Comment.[TrackbackTitle], + Comment.[TrackbackBlogName], + Comment.[TrackbackExcerpt], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Comment.UserID = Author.UserID +WHERE + Comment.[ArticleID] = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.13.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.13.SqlDataProvider new file mode 100755 index 0000000..fbf4290 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.13.SqlDataProvider @@ -0,0 +1,30 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive + @ModuleID int, + @CategoryID varchar(255) +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null or Article.StartDate < ''' + convert(nvarchar, DateAdd(mi, 1, GetDate())) + ''')' + +EXEC(' +select Month(StartDate) as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] +from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article +where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' +group by Year(StartDate), Month(StartDate) +order by [Year] desc, [Month] desc') +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.17.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.17.SqlDataProvider new file mode 100755 index 0000000..933e47b --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.17.SqlDataProvider @@ -0,0 +1,274 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + IsSecure int NOT NULL Default 0 +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @SortBy varchar(50), + @Month int, + @Year int +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = ' 1 = 1 ' + +IF (@MaxCount is not null) + SELECT @strTop = ' TOP ' + convert(nvarchar, @MaxCount) + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@MaxAge is not null) and (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND Article.CreatedDate > ''' + convert(nvarchar, DateAdd(day, @MaxAge, @StartDate)) + '''' + +IF (@MaxAge is not null) and (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND Article.CreatedDate < ''' + convert(nvarchar, @StartDate) + '''' + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE ''%' + @Keywords + '%'' OR Article.Summary LIKE ''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE ''%' + @Keywords + '%'') > 0))' + +IF (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null or Article.StartDate < ''' + convert(nvarchar, DateAdd(mi, 1, GetDate())) + ''')' + +IF (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null or Article.EndDate > ''' + convert(nvarchar, DateAdd(day, -1, GetDate())) + ''')' + +IF (@Month is not null) + SELECT @strWhere = @strWhere + ' AND Month(Article.StartDate) = ' + convert(nvarchar, @Month) + +IF (@Year is not null) + SELECT @strWhere = @strWhere + ' AND Year(Article.StartDate) = ' + convert(nvarchar, @Year) + +EXEC(' +SELECT ' + @strTop + ' + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + '''' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '''' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as ''PageCount'', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as ''CommentCount'', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as ''Rating'', + case when Images.FileName is null then '''' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article INNER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID INNER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = ''fileid='' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = ''fileid='' + CONVERT(nvarchar, Images.FileID) + +WHERE ' + + @strWhere + ' + +ORDER BY + ' + @SortBy + ' DESC') +GO + + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as 'PageCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'Rating', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article INNER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID INNER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) + +WHERE + Article.[ArticleID] = @ArticleID +GO + + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews], + [IsDraft], + [StartDate], + [EndDate], + [ModuleID], + [ImageUrl], + [IsFeatured], + [LastUpdateID], + [Url], + [IsSecure] +) VALUES ( + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews, + @IsDraft, + @StartDate, + @EndDate, + @ModuleID, + @ImageUrl, + @IsFeatured, + @LastUpdateID, + @Url, + @IsSecure +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews, + [IsDraft] = @IsDraft, + [StartDate] = @StartDate, + [EndDate] = @EndDate, + [ModuleID] = @ModuleID, + [ImageUrl] = @ImageUrl, + [IsFeatured] = @IsFeatured, + [LastUpdateID] = @LastUpdateID, + [Url] = @Url, + [IsSecure] = @IsSecure +WHERE + [ArticleID] = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.20.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.20.SqlDataProvider new file mode 100755 index 0000000..8619d1b --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.20.SqlDataProvider @@ -0,0 +1,163 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ADD + AnonymousName nvarchar(255) NULL, + AnonymousEmail nvarchar(255) NULL, + AnonymousURL nvarchar(255) NULL +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment + @ArticleID int, + @UserID int, + @Comment ntext, + @Rating float, + @RemoteAddress nvarchar(50) , + @Type int, + @TrackbackUrl nvarchar(255), + @TrackbackTitle nvarchar(255), + @TrackbackBlogName nvarchar(255), + @TrackbackExcerpt ntext, + @AnonymousName nvarchar(255), + @AnonymousEmail nvarchar(255), + @AnonymousURL nvarchar(255) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ( + [ArticleID], + [UserID], + [Comment], + [Rating], + [RemoteAddress], + [Type], + [TrackbackUrl], + [TrackbackTitle], + [TrackbackBlogName], + [TrackbackExcerpt], + [AnonymousName], + [AnonymousEmail], + [AnonymousURL] +) VALUES ( + @ArticleID, + @UserID, + @Comment, + @Rating, + @RemoteAddress, + @Type, + @TrackbackUrl, + @TrackbackTitle, + @TrackbackBlogName, + @TrackbackExcerpt, + @AnonymousName, + @AnonymousEmail, + @AnonymousURL +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment + @CommentID int, + @ArticleID int, + @UserID int, + @Comment ntext, + @Rating float, + @RemoteAddress nvarchar(50), + @Type int, + @TrackbackUrl nvarchar(255), + @TrackbackTitle nvarchar(255), + @TrackbackBlogName nvarchar(255), + @TrackbackExcerpt ntext, + @AnonymousName nvarchar(255), + @AnonymousEmail nvarchar(255), + @AnonymousURL nvarchar(255) +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment SET + [ArticleID] = @ArticleID, + [UserID] = @UserID, + [Comment] = @Comment, + [Rating] = @Rating, + [RemoteAddress] = @RemoteAddress, + [Type] = @Type, + [TrackbackUrl] = @TrackbackUrl, + [TrackbackTitle] = @TrackbackTitle, + [TrackbackBlogName] = @TrackbackBlogName, + [TrackbackExcerpt] = @TrackbackExcerpt, + [AnonymousName] = @AnonymousName, + [AnonymousEmail] = @AnonymousEmail, + [AnonymousURL] = @AnonymousURL +WHERE + [CommentID] = @CommentID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment + @CommentID int +AS + +SELECT + Comment.[CommentID], + Comment.[ArticleID], + Comment.[UserID], + Comment.[CreatedDate], + Comment.[Comment], + Comment.[Rating], + Comment.[RemoteAddress], + Comment.[Type], + Comment.[TrackbackUrl], + Comment.[TrackbackTitle], + Comment.[TrackbackBlogName], + Comment.[TrackbackExcerpt], + Comment.[AnonymousName], + Comment.[AnonymousEmail], + Comment.[AnonymousURL], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Comment.UserID = Author.UserID +WHERE + [CommentID] = @CommentID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList + @ArticleID int +AS + +SELECT + Comment.[CommentID], + Comment.[ArticleID], + Comment.[UserID], + Comment.[CreatedDate], + Comment.[Comment], + Comment.[Rating], + Comment.[RemoteAddress], + Comment.[Type], + Comment.[TrackbackUrl], + Comment.[TrackbackTitle], + Comment.[TrackbackBlogName], + Comment.[TrackbackExcerpt], + Comment.[AnonymousName], + Comment.[AnonymousEmail], + Comment.[AnonymousURL], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Comment.UserID = Author.UserID +WHERE + Comment.[ArticleID] = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.21.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.21.SqlDataProvider new file mode 100755 index 0000000..84ee571 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.21.SqlDataProvider @@ -0,0 +1,168 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ADD + NotifyMe bit NOT NULL CONSTRAINT DF_{objectQualifier}DnnForge_NewsArticles_Comment_NotifyMe DEFAULT 0 +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment + @ArticleID int, + @UserID int, + @Comment ntext, + @Rating float, + @RemoteAddress nvarchar(50) , + @Type int, + @TrackbackUrl nvarchar(255), + @TrackbackTitle nvarchar(255), + @TrackbackBlogName nvarchar(255), + @TrackbackExcerpt ntext, + @AnonymousName nvarchar(255), + @AnonymousEmail nvarchar(255), + @AnonymousURL nvarchar(255), + @NotifyMe bit +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ( + [ArticleID], + [UserID], + [Comment], + [Rating], + [RemoteAddress], + [Type], + [TrackbackUrl], + [TrackbackTitle], + [TrackbackBlogName], + [TrackbackExcerpt], + [AnonymousName], + [AnonymousEmail], + [AnonymousURL], + [NotifyMe] +) VALUES ( + @ArticleID, + @UserID, + @Comment, + @Rating, + @RemoteAddress, + @Type, + @TrackbackUrl, + @TrackbackTitle, + @TrackbackBlogName, + @TrackbackExcerpt, + @AnonymousName, + @AnonymousEmail, + @AnonymousURL, + @NotifyMe +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment + @CommentID int, + @ArticleID int, + @UserID int, + @Comment ntext, + @Rating float, + @RemoteAddress nvarchar(50), + @Type int, + @TrackbackUrl nvarchar(255), + @TrackbackTitle nvarchar(255), + @TrackbackBlogName nvarchar(255), + @TrackbackExcerpt ntext, + @AnonymousName nvarchar(255), + @AnonymousEmail nvarchar(255), + @AnonymousURL nvarchar(255), + @NotifyMe bit +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment SET + [ArticleID] = @ArticleID, + [UserID] = @UserID, + [Comment] = @Comment, + [Rating] = @Rating, + [RemoteAddress] = @RemoteAddress, + [Type] = @Type, + [TrackbackUrl] = @TrackbackUrl, + [TrackbackTitle] = @TrackbackTitle, + [TrackbackBlogName] = @TrackbackBlogName, + [TrackbackExcerpt] = @TrackbackExcerpt, + [AnonymousName] = @AnonymousName, + [AnonymousEmail] = @AnonymousEmail, + [AnonymousURL] = @AnonymousURL, + [NotifyMe] = @NotifyMe +WHERE + [CommentID] = @CommentID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment + @CommentID int +AS + +SELECT + Comment.[CommentID], + Comment.[ArticleID], + Comment.[UserID], + Comment.[CreatedDate], + Comment.[Comment], + Comment.[Rating], + Comment.[RemoteAddress], + Comment.[Type], + Comment.[TrackbackUrl], + Comment.[TrackbackTitle], + Comment.[TrackbackBlogName], + Comment.[TrackbackExcerpt], + Comment.[AnonymousName], + Comment.[AnonymousEmail], + Comment.[AnonymousURL], + Comment.[NotifyMe], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Comment.UserID = Author.UserID +WHERE + [CommentID] = @CommentID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList + @ArticleID int +AS + +SELECT + Comment.[CommentID], + Comment.[ArticleID], + Comment.[UserID], + Comment.[CreatedDate], + Comment.[Comment], + Comment.[Rating], + Comment.[RemoteAddress], + Comment.[Type], + Comment.[TrackbackUrl], + Comment.[TrackbackTitle], + Comment.[TrackbackBlogName], + Comment.[TrackbackExcerpt], + Comment.[AnonymousName], + Comment.[AnonymousEmail], + Comment.[AnonymousURL], + Comment.[NotifyMe], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Comment.UserID = Author.UserID +WHERE + Comment.[ArticleID] = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.22.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.22.SqlDataProvider new file mode 100755 index 0000000..654f4f0 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.22.SqlDataProvider @@ -0,0 +1,109 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @SortBy varchar(50), + @Month int, + @Year int +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = ' 1 = 1 ' + +IF (@MaxCount is not null) + SELECT @strTop = ' TOP ' + convert(nvarchar, @MaxCount) + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@MaxAge is not null) and (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND Article.CreatedDate > ''' + convert(nvarchar, DateAdd(day, @MaxAge, @StartDate)) + '''' + +IF (@MaxAge is not null) and (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND Article.CreatedDate < ''' + convert(nvarchar, @StartDate) + '''' + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE ''%' + @Keywords + '%'' OR Article.Summary LIKE ''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE ''%' + @Keywords + '%'') > 0))' + +IF (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null or Article.StartDate < ''' + convert(nvarchar, DateAdd(mi, 1, GetDate())) + ''')' + +IF (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null or Article.EndDate > ''' + convert(nvarchar, GetDate()) + ''')' + +IF (@Month is not null) + SELECT @strWhere = @strWhere + ' AND Month(Article.StartDate) = ' + convert(nvarchar, @Month) + +IF (@Year is not null) + SELECT @strWhere = @strWhere + ' AND Year(Article.StartDate) = ' + convert(nvarchar, @Year) + +EXEC(' +SELECT ' + @strTop + ' + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + '''' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '''' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as ''PageCount'', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as ''CommentCount'', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as ''Rating'', + case when Images.FileName is null then '''' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article INNER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID INNER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = ''fileid='' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = ''fileid='' + CONVERT(nvarchar, Images.FileID) + +WHERE ' + + @strWhere + ' + +ORDER BY + ' + @SortBy + ' DESC') +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.24.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.24.SqlDataProvider new file mode 100755 index 0000000..5b2a0c0 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.24.SqlDataProvider @@ -0,0 +1,37 @@ + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList + @ArticleID int +AS + +SELECT + Comment.[CommentID], + Comment.[ArticleID], + Comment.[UserID], + Comment.[CreatedDate], + Comment.[Comment], + Comment.[Rating], + Comment.[RemoteAddress], + Comment.[Type], + Comment.[TrackbackUrl], + Comment.[TrackbackTitle], + Comment.[TrackbackBlogName], + Comment.[TrackbackExcerpt], + Comment.[AnonymousName], + Comment.[AnonymousEmail], + Comment.[AnonymousURL], + Comment.[NotifyMe], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Comment.UserID = Author.UserID +WHERE + Comment.[ArticleID] = @ArticleID +ORDER BY + Comment.[CreatedDate] ASC +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.26.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.26.SqlDataProvider new file mode 100755 index 0000000..2074d25 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.26.SqlDataProvider @@ -0,0 +1,378 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @SortBy varchar(50), + @Month int, + @Year int +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = ' 1 = 1 ' + +IF (@MaxCount is not null) + SELECT @strTop = ' TOP ' + convert(nvarchar, @MaxCount) + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@MaxAge is not null) and (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, DateAdd(day, @MaxAge, @StartDate)) + '''' + +IF (@MaxAge is not null) and (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND Article.StartDate < ''' + convert(nvarchar, @StartDate) + '''' + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE ''%' + @Keywords + '%'' OR Article.Summary LIKE ''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE ''%' + @Keywords + '%'') > 0))' + +IF (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null or Article.StartDate < ''' + convert(nvarchar, DateAdd(mi, 1, GetDate())) + ''')' + +IF (@ShowHiddenAndExpired = 0) + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null or Article.EndDate > ''' + convert(nvarchar, GetDate()) + ''')' + +IF (@Month is not null) + SELECT @strWhere = @strWhere + ' AND Month(Article.StartDate) = ' + convert(nvarchar, @Month) + +IF (@Year is not null) + SELECT @strWhere = @strWhere + ' AND Year(Article.StartDate) = ' + convert(nvarchar, @Year) + +EXEC(' +SELECT ' + @strTop + ' + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + '''' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '''' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as ''PageCount'', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as ''CommentCount'', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as ''Rating'', + case when Images.FileName is null then '''' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = ''fileid='' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = ''fileid='' + CONVERT(nvarchar, Images.FileID) + +WHERE ' + + @strWhere + ' + +ORDER BY + ' + @SortBy + ' DESC') +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as 'PageCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'Rating', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) + +WHERE + Article.[ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor + @ModuleID int, + @AuthorID int +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'Rating', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) +WHERE + Article.[ModuleID] = @ModuleID + AND + Article.[AuthorID] = @AuthorID + +ORDER BY + Article.[CreatedDate] DESC +GO + + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus + @ModuleID int, + @AuthorID int, + @IsApproved bit, + @IsDraft bit +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'Rating', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) +WHERE + Article.[ModuleID] = @ModuleID + AND + Article.[AuthorID] = @AuthorID + AND + Article.[IsApproved] = @IsApproved + AND + Article.[IsDraft] = @IsDraft + +ORDER BY + Article.[CreatedDate] DESC +GO + + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList + @ModuleID int +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) +WHERE + Article.[ModuleID] = @ModuleID + +ORDER BY + Article.[CreatedDate] DESC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved + @ModuleID int, + @IsApproved bit +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as 'PageCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'Rating', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) + +WHERE + Article.[ModuleID] = @ModuleID + AND + Article.[IsApproved] = @IsApproved + AND + Article.[IsDraft] = 0 + +ORDER BY + Article.[CreatedDate] DESC +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.28.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.28.SqlDataProvider new file mode 100755 index 0000000..eca3b7b --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.28.SqlDataProvider @@ -0,0 +1,19 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @SortBy varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.40.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.40.SqlDataProvider new file mode 100755 index 0000000..3fe492a --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.40.SqlDataProvider @@ -0,0 +1,33 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryStatistics + @ModuleID int, + @CategoryID varchar(255) +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Category.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND CategoryID in (' + @CategoryID + ')' + +EXEC(' +select + Category.CategoryID, + Category.Name, + (select count(*) from {databaseOwner}{objectQualifier}dnnforge_newsarticles_articlecategories articleCategories, {databaseOwner}{objectQualifier}dnnforge_newsarticles_article articles where categoryid = Category.CategoryID and articleCategories.articleID = articles.ArticleID and articles.IsApproved = 1 AND (articles.StartDate is null or articles.StartDate < DateAdd(mi, 1, GetDate())) AND (articles.EndDate is null or articles.EndDate > DateAdd(mi, 1, GetDate())) ) as ''NumberOfArticles'', + (select sum(NumberOfViews) from {databaseOwner}{objectQualifier}dnnforge_newsarticles_articlecategories articleCategories, {databaseOwner}{objectQualifier}dnnforge_newsarticles_article articles where categoryid = Category.CategoryID and articleCategories.articleID = articles.ArticleID AND (articles.StartDate is null or articles.StartDate < DateAdd(mi, 1, GetDate())) AND (articles.EndDate is null or articles.EndDate > DateAdd(mi, 1, GetDate())) ) as ''NumberOfViews'' +from + {databaseOwner}{objectQualifier}dnnforge_newsarticles_category Category +where 1 = 1 ' + + @strWhere + ' +ORDER BY + Category.Name') +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.41.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.41.SqlDataProvider new file mode 100755 index 0000000..79b6a9e --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.41.SqlDataProvider @@ -0,0 +1,27 @@ +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics + @ModuleID int, + @CategoryID varchar(255) +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ArticleID in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryID + '))' + +EXEC(' +SELECT + UserID, UserName, FirstName, LastName, count(*) as ''ArticleCount'' +FROM + {databaseOwner}{objectQualifier}Users Users, {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Articles +where 1 = 1 and Users.UserID = Articles.AuthorID ' + + @strWhere + ' +GROUP BY + UserID, UserName, FirstName, LastName') +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.46.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.46.SqlDataProvider new file mode 100755 index 0000000..ce8df66 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.46.SqlDataProvider @@ -0,0 +1,537 @@ +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating ( + [RatingID] [int] IDENTITY (1, 1) NOT NULL , + [ArticleID] [int] NOT NULL , + [UserID] [int] NOT NULL , + [CreatedDate] [datetime] NOT NULL , + [Rating] [float] NULL +) ON [PRIMARY] +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_Rating] PRIMARY KEY CLUSTERED + ( + [RatingID] + ) ON [PRIMARY] +GO + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating(ArticleID, UserID, CreatedDate, Rating) +SELECT ArticleID, UserID, CreatedDate, Rating FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment WHERE Rating is not null +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_RatingAdd + @ArticleID int, + @UserID int, + @CreatedDate datetime, + @Rating float +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating ( + [ArticleID], + [UserID], + [CreatedDate], + [Rating] +) VALUES ( + @ArticleID, + @UserID, + @CreatedDate, + @Rating +) + +select SCOPE_IDENTITY() +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_RatingDelete + @RatingID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating +WHERE + [RatingID] = @RatingID + +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_RatingGet + @ArticleID int, + @UserID int + +AS + +SELECT + [RatingID], + [ArticleID], + [UserID], + [CreatedDate], + [Rating] +FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating +WHERE + [ArticleID] = @ArticleID + and + [UserID] = @UserID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_RatingGetByID + @RatingID int + +AS + +SELECT + [RatingID], + [ArticleID], + [UserID], + [CreatedDate], + [Rating] +FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating +WHERE + [RatingID] = @RatingID +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment + DROP COLUMN Rating +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment + @ArticleID int, + @UserID int, + @Comment ntext, + @RemoteAddress nvarchar(50) , + @Type int, + @TrackbackUrl nvarchar(255), + @TrackbackTitle nvarchar(255), + @TrackbackBlogName nvarchar(255), + @TrackbackExcerpt ntext, + @AnonymousName nvarchar(255), + @AnonymousEmail nvarchar(255), + @AnonymousURL nvarchar(255), + @NotifyMe bit +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ( + [ArticleID], + [UserID], + [Comment], + [RemoteAddress], + [Type], + [TrackbackUrl], + [TrackbackTitle], + [TrackbackBlogName], + [TrackbackExcerpt], + [AnonymousName], + [AnonymousEmail], + [AnonymousURL], + [NotifyMe] +) VALUES ( + @ArticleID, + @UserID, + @Comment, + @RemoteAddress, + @Type, + @TrackbackUrl, + @TrackbackTitle, + @TrackbackBlogName, + @TrackbackExcerpt, + @AnonymousName, + @AnonymousEmail, + @AnonymousURL, + @NotifyMe +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment + @CommentID int +AS + +SELECT + Comment.[CommentID], + Comment.[ArticleID], + Comment.[UserID], + Comment.[CreatedDate], + Comment.[Comment], + Comment.[RemoteAddress], + Comment.[Type], + Comment.[TrackbackUrl], + Comment.[TrackbackTitle], + Comment.[TrackbackBlogName], + Comment.[TrackbackExcerpt], + Comment.[AnonymousName], + Comment.[AnonymousEmail], + Comment.[AnonymousURL], + Comment.[NotifyMe], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Comment.UserID = Author.UserID +WHERE + [CommentID] = @CommentID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList + @ArticleID int +AS + +SELECT + Comment.[CommentID], + Comment.[ArticleID], + Comment.[UserID], + Comment.[CreatedDate], + Comment.[Comment], + Comment.[RemoteAddress], + Comment.[Type], + Comment.[TrackbackUrl], + Comment.[TrackbackTitle], + Comment.[TrackbackBlogName], + Comment.[TrackbackExcerpt], + Comment.[AnonymousName], + Comment.[AnonymousEmail], + Comment.[AnonymousURL], + Comment.[NotifyMe], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Comment.UserID = Author.UserID +WHERE + Comment.[ArticleID] = @ArticleID +ORDER BY + Comment.[CreatedDate] ASC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment + @CommentID int, + @ArticleID int, + @UserID int, + @Comment ntext, + @RemoteAddress nvarchar(50), + @Type int, + @TrackbackUrl nvarchar(255), + @TrackbackTitle nvarchar(255), + @TrackbackBlogName nvarchar(255), + @TrackbackExcerpt ntext, + @AnonymousName nvarchar(255), + @AnonymousEmail nvarchar(255), + @AnonymousURL nvarchar(255), + @NotifyMe bit +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment SET + [ArticleID] = @ArticleID, + [UserID] = @UserID, + [Comment] = @Comment, + [RemoteAddress] = @RemoteAddress, + [Type] = @Type, + [TrackbackUrl] = @TrackbackUrl, + [TrackbackTitle] = @TrackbackTitle, + [TrackbackBlogName] = @TrackbackBlogName, + [TrackbackExcerpt] = @TrackbackExcerpt, + [AnonymousName] = @AnonymousName, + [AnonymousEmail] = @AnonymousEmail, + [AnonymousURL] = @AnonymousURL, + [NotifyMe] = @NotifyMe +WHERE + [CommentID] = @CommentID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as 'PageCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'Rating', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) + +WHERE + Article.[ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList + @ModuleID int +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) +WHERE + Article.[ModuleID] = @ModuleID + +ORDER BY + Article.[CreatedDate] DESC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved + @ModuleID int, + @IsApproved bit +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as 'PageCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'Rating', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) + +WHERE + Article.[ModuleID] = @ModuleID + AND + Article.[IsApproved] = @IsApproved + AND + Article.[IsDraft] = 0 + +ORDER BY + Article.[CreatedDate] DESC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor + @ModuleID int, + @AuthorID int +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'Rating', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) +WHERE + Article.[ModuleID] = @ModuleID + AND + Article.[AuthorID] = @AuthorID + +ORDER BY + Article.[CreatedDate] DESC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus + @ModuleID int, + @AuthorID int, + @IsApproved bit, + @IsDraft bit +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'Rating', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) +WHERE + Article.[ModuleID] = @ModuleID + AND + Article.[AuthorID] = @AuthorID + AND + Article.[IsApproved] = @IsApproved + AND + Article.[IsDraft] = @IsDraft + +ORDER BY + Article.[CreatedDate] DESC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @SortBy varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.48.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.48.SqlDataProvider new file mode 100755 index 0000000..7a29c79 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.48.SqlDataProvider @@ -0,0 +1,421 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + ADD IsNewWindow bit NOT NULL CONSTRAINT DF_{objectQualifier}DnnForge_NewsArticles_Article_IsNewWindow DEFAULT 0 +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit, + @IsNewWindow bit +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews], + [IsDraft], + [StartDate], + [EndDate], + [ModuleID], + [ImageUrl], + [IsFeatured], + [LastUpdateID], + [Url], + [IsSecure], + [IsNewWindow] +) VALUES ( + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews, + @IsDraft, + @StartDate, + @EndDate, + @ModuleID, + @ImageUrl, + @IsFeatured, + @LastUpdateID, + @Url, + @IsSecure, + @IsNewWindow +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit, + @IsNewWindow bit +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews, + [IsDraft] = @IsDraft, + [StartDate] = @StartDate, + [EndDate] = @EndDate, + [ModuleID] = @ModuleID, + [ImageUrl] = @ImageUrl, + [IsFeatured] = @IsFeatured, + [LastUpdateID] = @LastUpdateID, + [Url] = @Url, + [IsSecure] = @IsSecure, + [IsNewWindow] = @IsNewWindow +WHERE + [ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as 'PageCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'Rating', + (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'RatingCount', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) + +WHERE + Article.[ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList + @ModuleID int +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as 'PageCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'Rating', + (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'RatingCount', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) +WHERE + Article.[ModuleID] = @ModuleID + +ORDER BY + Article.[CreatedDate] DESC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved + @ModuleID int, + @IsApproved bit +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as 'PageCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'Rating', + (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'RatingCount', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) + +WHERE + Article.[ModuleID] = @ModuleID + AND + Article.[IsApproved] = @IsApproved + AND + Article.[IsDraft] = 0 + +ORDER BY + Article.[CreatedDate] DESC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor + @ModuleID int, + @AuthorID int +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'Rating', + (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'RatingCount', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) +WHERE + Article.[ModuleID] = @ModuleID + AND + Article.[AuthorID] = @AuthorID + +ORDER BY + Article.[CreatedDate] DESC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus + @ModuleID int, + @AuthorID int, + @IsApproved bit, + @IsDraft bit +AS + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'Rating', + (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'RatingCount', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) +WHERE + Article.[ModuleID] = @ModuleID + AND + Article.[AuthorID] = @AuthorID + AND + Article.[IsApproved] = @IsApproved + AND + Article.[IsDraft] = @IsDraft + +ORDER BY + Article.[CreatedDate] DESC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @SortBy varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.51.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.51.SqlDataProvider new file mode 100755 index 0000000..16975c9 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.51.SqlDataProvider @@ -0,0 +1,20 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.55.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.55.SqlDataProvider new file mode 100755 index 0000000..9abf13d --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.55.SqlDataProvider @@ -0,0 +1,21 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.56.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.56.SqlDataProvider new file mode 100755 index 0000000..b83ef97 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.56.SqlDataProvider @@ -0,0 +1,22 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowHiddenAndExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.58.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.58.SqlDataProvider new file mode 100755 index 0000000..072310d --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.58.SqlDataProvider @@ -0,0 +1,23 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowPending bit, + @ShowExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.66.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.66.SqlDataProvider new file mode 100755 index 0000000..072310d --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.66.SqlDataProvider @@ -0,0 +1,23 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowPending bit, + @ShowExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.68.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.68.SqlDataProvider new file mode 100755 index 0000000..072310d --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.68.SqlDataProvider @@ -0,0 +1,23 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @MaxAge int, + @IsApproved int, + @StartDate datetime, + @KeyWords varchar(255), + @ShowPending bit, + @ShowExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.69.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.69.SqlDataProvider new file mode 100755 index 0000000..4b74274 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.69.SqlDataProvider @@ -0,0 +1,50 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + '' as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + '' as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as 'PageCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'Rating', + (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'RatingCount', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) + +WHERE + Article.[ArticleID] = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.74.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.74.SqlDataProvider new file mode 100755 index 0000000..0602bc3 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.74.SqlDataProvider @@ -0,0 +1,36 @@ +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleList +GO + +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByApproved +GO + +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthor +GO + +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListByAuthorByStatus +GO + +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @MaxAge int, + @IsApproved bit, + @IsDraft bit, + @StartDate datetime, + @KeyWords varchar(255), + @ShowPending bit, + @ShowExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.76.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.76.SqlDataProvider new file mode 100755 index 0000000..fb8f447 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.76.SqlDataProvider @@ -0,0 +1,24 @@ +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @MaxAge int, + @IsApproved bit, + @IsDraft bit, + @StartDate datetime, + @KeyWords varchar(255), + @ShowPending bit, + @ShowExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.77.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.77.SqlDataProvider new file mode 100755 index 0000000..dc9b9e3 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.77.SqlDataProvider @@ -0,0 +1,52 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment.ArticleID = Article.ArticleID) as 'CommentCount', + (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page.ArticleID = Article.ArticleID) as 'PageCount', + (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'Rating', + (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating.ArticleID = Article.ArticleID) as 'RatingCount', + case when Images.FileName is null then '' else Images.Folder + Images.FileName end AS ImageUrlResolved, + case when UrlFiles.FileName is null then Article.URL else UrlFiles.Folder + UrlFiles.FileName end AS URL + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files UrlFiles ON Article.URL = 'fileid=' + CONVERT(nvarchar, UrlFiles.FileID) LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Files Images ON Article.ImageUrl = 'fileid=' + CONVERT(nvarchar, Images.FileID) + +WHERE + Article.[ArticleID] = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.05.78.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.05.78.SqlDataProvider new file mode 100755 index 0000000..6c9d8af --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.05.78.SqlDataProvider @@ -0,0 +1,84 @@ +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @MaxAge int, + @IsApproved bit, + @IsDraft bit, + @StartDate datetime, + @KeyWords varchar(255), + @ShowPending bit, + @ShowExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO + +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorList + @ModuleID int +AS + +SELECT DISTINCT + Authors.UserID, + Authors.Username, + Authors.FirstName, + Authors.LastName, + Authors.DisplayName + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Articles, {databaseOwner}{objectQualifier}Users Authors + +WHERE + Articles.AuthorID = Authors.UserID + and + Articles.ModuleID = @ModuleID + and + Articles.IsApproved = 1 + +ORDER BY + Authors.FirstName, Authors.LastName +GO + +drop procedure {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive + @ModuleID int, + @CategoryID varchar(255) +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null or Article.StartDate < ''' + convert(nvarchar, DateAdd(mi, 1, GetDate())) + ''')' +SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null or Article.EndDate > ''' + convert(nvarchar, DateAdd(mi, -1, GetDate())) + ''')' + +EXEC(' +select Month(StartDate) as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] +from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article +where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' +group by Year(StartDate), Month(StartDate) +order by [Year] desc, [Month] desc') +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.06.00.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.06.00.SqlDataProvider new file mode 100755 index 0000000..cc52fb0 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.06.00.SqlDataProvider @@ -0,0 +1,218 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ADD + isApproved bit NOT NULL CONSTRAINT DF_{objectQualifier}DnnForge_NewsArticles_Comment_isApproved DEFAULT 1, + approvedBy int NULL +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment + @ArticleID int, + @UserID int, + @Comment ntext, + @RemoteAddress nvarchar(50) , + @Type int, + @TrackbackUrl nvarchar(255), + @TrackbackTitle nvarchar(255), + @TrackbackBlogName nvarchar(255), + @TrackbackExcerpt ntext, + @AnonymousName nvarchar(255), + @AnonymousEmail nvarchar(255), + @AnonymousURL nvarchar(255), + @NotifyMe bit, + @IsApproved bit, + @ApprovedBy int +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ( + [ArticleID], + [UserID], + [Comment], + [RemoteAddress], + [Type], + [TrackbackUrl], + [TrackbackTitle], + [TrackbackBlogName], + [TrackbackExcerpt], + [AnonymousName], + [AnonymousEmail], + [AnonymousURL], + [NotifyMe], + [IsApproved], + [ApprovedBy] +) VALUES ( + @ArticleID, + @UserID, + @Comment, + @RemoteAddress, + @Type, + @TrackbackUrl, + @TrackbackTitle, + @TrackbackBlogName, + @TrackbackExcerpt, + @AnonymousName, + @AnonymousEmail, + @AnonymousURL, + @NotifyMe, + @IsApproved, + @ApprovedBy +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment + @CommentID int, + @ArticleID int, + @UserID int, + @Comment ntext, + @RemoteAddress nvarchar(50), + @Type int, + @TrackbackUrl nvarchar(255), + @TrackbackTitle nvarchar(255), + @TrackbackBlogName nvarchar(255), + @TrackbackExcerpt ntext, + @AnonymousName nvarchar(255), + @AnonymousEmail nvarchar(255), + @AnonymousURL nvarchar(255), + @NotifyMe bit, + @IsApproved bit, + @ApprovedBy int +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment SET + [ArticleID] = @ArticleID, + [UserID] = @UserID, + [Comment] = @Comment, + [RemoteAddress] = @RemoteAddress, + [Type] = @Type, + [TrackbackUrl] = @TrackbackUrl, + [TrackbackTitle] = @TrackbackTitle, + [TrackbackBlogName] = @TrackbackBlogName, + [TrackbackExcerpt] = @TrackbackExcerpt, + [AnonymousName] = @AnonymousName, + [AnonymousEmail] = @AnonymousEmail, + [AnonymousURL] = @AnonymousURL, + [NotifyMe] = @NotifyMe, + [IsApproved] = @IsApproved, + [ApprovedBy] = @ApprovedBy +WHERE + [CommentID] = @CommentID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList + @ModuleID int, + @ArticleID int, + @IsApproved bit +AS + +SELECT + Comment.[CommentID], + Comment.[ArticleID], + Comment.[UserID], + Comment.[CreatedDate], + Comment.[Comment], + Comment.[RemoteAddress], + Comment.[Type], + Comment.[TrackbackUrl], + Comment.[TrackbackTitle], + Comment.[TrackbackBlogName], + Comment.[TrackbackExcerpt], + Comment.[AnonymousName], + Comment.[AnonymousEmail], + Comment.[AnonymousURL], + Comment.[NotifyMe], + Comment.[IsApproved], + Comment.[ApprovedBy], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article on Comment.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Comment.UserID = Author.UserID +WHERE + Article.ModuleID = @ModuleID + and + (@ArticleID is null OR Comment.[ArticleID] = @ArticleID) + and + Comment.IsApproved = @IsApproved +ORDER BY + Comment.[CreatedDate] ASC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment + @CommentID int +AS + +SELECT + Comment.[CommentID], + Comment.[ArticleID], + Comment.[UserID], + Comment.[CreatedDate], + Comment.[Comment], + Comment.[RemoteAddress], + Comment.[Type], + Comment.[TrackbackUrl], + Comment.[TrackbackTitle], + Comment.[TrackbackBlogName], + Comment.[TrackbackExcerpt], + Comment.[AnonymousName], + Comment.[AnonymousEmail], + Comment.[AnonymousURL], + Comment.[NotifyMe], + Comment.[IsApproved], + Comment.[ApprovedBy], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Comment.UserID = Author.UserID +WHERE + [CommentID] = @CommentID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @MaxAge int, + @IsApproved bit, + @IsDraft bit, + @StartDate datetime, + @KeyWords varchar(255), + @ShowPending bit, + @ShowExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.06.04.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.06.04.SqlDataProvider new file mode 100755 index 0000000..335a20b --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.06.04.SqlDataProvider @@ -0,0 +1,45 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive + @ModuleID int, + @CategoryID varchar(255), + @GroupBy varchar(255) +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null or Article.StartDate < ''' + convert(nvarchar, DateAdd(mi, 1, GetDate())) + ''')' +SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null or Article.EndDate > ''' + convert(nvarchar, DateAdd(mi, -1, GetDate())) + ''')' + +IF( @GroupBy = 'Month' ) +BEGIN +EXEC(' +select Month(StartDate) as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] +from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article +where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' +group by Year(StartDate), Month(StartDate) +order by [Year] desc, [Month] desc') +END +ELSE +BEGIN +EXEC(' +select 1 as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] +from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article +where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' +group by Year(StartDate) +order by [Year] desc') +END +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.06.07.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.06.07.SqlDataProvider new file mode 100755 index 0000000..72d5284 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.06.07.SqlDataProvider @@ -0,0 +1,74 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + Add Summary2 ntext +GO + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + SET Summary2 = Summary +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + DROP COLUMN Summary +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + Add Summary ntext +GO + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + SET Summary = Summary2 +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + DROP COLUMN Summary2 +GO + +CREATE TABLE #Article +( + ArticleID INT +) + +INSERT INTO #Article +select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article where Article.ArticleID not in (select ArticleID FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page WHERE Article.ArticleID = Page.ArticleID) + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page(ArticleID, Title, PageText, SortOrder) +select ArticleID, Title, Summary, 0 from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article where Article.ArticleID not in (select ArticleID FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page WHERE Article.ArticleID = Page.ArticleID) + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET Summary = null +WHERE ArticleID in (select ArticleID from #Article) + +DROP TABLE #Article +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @MaxAge int, + @IsApproved bit, + @IsDraft bit, + @StartDate datetime, + @KeyWords varchar(255), + @ShowPending bit, + @ShowExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.06.08.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.06.08.SqlDataProvider new file mode 100755 index 0000000..cfe460c --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.06.08.SqlDataProvider @@ -0,0 +1,24 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @MaxAge int, + @IsApproved bit, + @IsDraft bit, + @StartDate datetime, + @KeyWords varchar(255), + @ShowPending bit, + @ShowExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.06.09.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.06.09.SqlDataProvider new file mode 100755 index 0000000..cfe460c --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.06.09.SqlDataProvider @@ -0,0 +1,24 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @MaxAge int, + @IsApproved bit, + @IsDraft bit, + @StartDate datetime, + @KeyWords varchar(255), + @ShowPending bit, + @ShowExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.06.11.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.06.11.SqlDataProvider new file mode 100755 index 0000000..18dea9d --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.06.11.SqlDataProvider @@ -0,0 +1,63 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics + @ModuleID int, + @CategoryID varchar(255) +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ArticleID in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryID + '))' + +EXEC(' +SELECT + UserID, UserName, DisplayName, FirstName, LastName, count(*) as ''ArticleCount'' +FROM + {databaseOwner}{objectQualifier}Users Users, {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Articles +where 1 = 1 and Users.UserID = Articles.AuthorID ' + + @strWhere + ' +GROUP BY + UserID, UserName, DisplayName, FirstName, LastName') +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @MaxAge int, + @IsApproved bit, + @IsDraft bit, + @StartDate datetime, + @KeyWords varchar(255), + @ShowPending bit, + @ShowExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.06.14.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.06.14.SqlDataProvider new file mode 100755 index 0000000..a825ac0 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.06.14.SqlDataProvider @@ -0,0 +1,26 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @MaxAge int, + @IsApproved bit, + @IsDraft bit, + @StartDate datetime, + @KeyWords varchar(255), + @ShowPending bit, + @ShowExpired bit, + @AuthorID int, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @SortBy varchar(50), + @SortDirection varchar(50), + @Month int, + @Year int +AS +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.06.16.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.06.16.SqlDataProvider new file mode 100755 index 0000000..9142f72 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.06.16.SqlDataProvider @@ -0,0 +1,116 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetComment + @CommentID int +AS + +SELECT + Comment.[CommentID], + Comment.[ArticleID], + Comment.[UserID], + Comment.[CreatedDate], + Comment.[Comment], + Comment.[RemoteAddress], + Comment.[Type], + Comment.[TrackbackUrl], + Comment.[TrackbackTitle], + Comment.[TrackbackBlogName], + Comment.[TrackbackExcerpt], + Comment.[AnonymousName], + Comment.[AnonymousEmail], + Comment.[AnonymousURL], + Comment.[NotifyMe], + Comment.[IsApproved], + Comment.[ApprovedBy], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Comment.UserID = Author.UserID +WHERE + [CommentID] = @CommentID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList + @ModuleID int, + @ArticleID int, + @IsApproved bit +AS + +SELECT + Comment.[CommentID], + Comment.[ArticleID], + Comment.[UserID], + Comment.[CreatedDate], + Comment.[Comment], + Comment.[RemoteAddress], + Comment.[Type], + Comment.[TrackbackUrl], + Comment.[TrackbackTitle], + Comment.[TrackbackBlogName], + Comment.[TrackbackExcerpt], + Comment.[AnonymousName], + Comment.[AnonymousEmail], + Comment.[AnonymousURL], + Comment.[NotifyMe], + Comment.[IsApproved], + Comment.[ApprovedBy], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article on Comment.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Comment.UserID = Author.UserID +WHERE + Article.ModuleID = @ModuleID + and + (@ArticleID is null OR Comment.[ArticleID] = @ArticleID) + and + Comment.IsApproved = @IsApproved +ORDER BY + Comment.[CreatedDate] ASC +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics + @ModuleID int, + @CategoryID varchar(255), + @SortBy varchar(255) +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ArticleID in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryID + '))' + +EXEC(' +SELECT + UserID, UserName, DisplayName, FirstName, LastName, count(*) as ''ArticleCount'' +FROM + {databaseOwner}{objectQualifier}Users Users, {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Articles +where 1 = 1 and Users.UserID = Articles.AuthorID ' + + @strWhere + ' +GROUP BY + UserID, UserName, DisplayName, FirstName, LastName +ORDER BY ' + + @SortBy) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.06.18.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.06.18.SqlDataProvider new file mode 100755 index 0000000..af0744a --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.06.18.SqlDataProvider @@ -0,0 +1 @@ + diff --git a/Providers/DataProvider/SqlDataProvider/00.07.00.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.00.SqlDataProvider new file mode 100755 index 0000000..10e5a60 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.00.SqlDataProvider @@ -0,0 +1,653 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + ADD [CommentCount] int, [PageCount] int, [Rating] decimal(3,2), [RatingCount] int +GO + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +GO + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +GO + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +GO + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords varchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit +AS +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as UpdatedDisplayName, + Page.PageText as 'Body' + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + Article.[ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive + @ModuleID int, + @CategoryID varchar(255), + @GroupBy varchar(255) +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null or Article.StartDate < ''' + convert(nvarchar, DateAdd(mi, 1, GetDate())) + ''')' + +IF( @GroupBy = 'Month' ) +BEGIN +EXEC(' + select Month(StartDate) as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] + from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article + where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' + group by Year(StartDate), Month(StartDate) + order by [Year] desc, [Month] desc') +END +ELSE +BEGIN +EXEC(' + select 1 as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] + from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article + where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' + group by Year(StartDate) + order by [Year] desc') +END +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics + @ModuleID int, + @CategoryID varchar(255), + @SortBy varchar(255) +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ArticleID in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryID + '))' + +EXEC(' +SELECT + UserID, UserName, DisplayName, FirstName, LastName, count(*) as ''ArticleCount'' +FROM + {databaseOwner}{objectQualifier}Users Users, {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Articles +where Articles.IsApproved = 1 and Articles.IsDraft = 0 and Users.UserID = Articles.AuthorID ' + + @strWhere + ' +GROUP BY + UserID, UserName, DisplayName, FirstName, LastName +ORDER BY ' + + @SortBy) +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryStatistics + @ModuleID int, + @CategoryID varchar(255) +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND c.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND c.CategoryID in (' + @CategoryID + ')' + +EXEC(' +SELECT + c.CategoryID, c.Name, count(ac.ArticleID) as ''NumberOfArticles'', sum(a.NumberOfViews) as ''NumberOfViews'' +FROM + {databaseOwner}{objectQualifier}dnnforge_newsarticles_category c + INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac ON c.CategoryID = ac.CategoryID + INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a ON + a.ArticleID = ac.ArticleID AND + a.IsDraft = 0 AND + a.IsApproved = 1 AND + (a.StartDate is null or a.StartDate < DateAdd(mi, 1, GetDate())) +WHERE + 1=1 ' + + @strWhere + ' +GROUP BY + c.CategoryID, c.Name +ORDER BY + c.Name') +GO + +DELETE FROM {databaseOwner}{objectQualifier}ModuleControls WHERE ControlSrc = 'DesktopModules/DnnForge - NewsArticles/ucArticleView.ascx' +GO + +DELETE FROM {databaseOwner}{objectQualifier}ModuleControls WHERE ControlSrc = 'DesktopModules/DnnForge - NewsArticles/ucArchiveView.ascx' +GO + +DELETE FROM {databaseOwner}{objectQualifier}ModuleControls WHERE ControlSrc = 'DesktopModules/DnnForge - NewsArticles/ucAuthorView.ascx' +GO + +DELETE FROM {databaseOwner}{objectQualifier}ModuleControls WHERE ControlSrc = 'DesktopModules/DnnForge - NewsArticles/ucCategories.ascx' +GO + +DELETE FROM {databaseOwner}{objectQualifier}ModuleControls WHERE ControlSrc = 'DesktopModules/DnnForge - NewsArticles/ucCategoryView.ascx' +GO + +DELETE FROM {databaseOwner}{objectQualifier}ModuleControls WHERE ControlSrc = 'DesktopModules/DnnForge - NewsArticles/ucDeleteComment.ascx' +GO + +DELETE FROM {databaseOwner}{objectQualifier}ModuleControls WHERE ControlSrc = 'DesktopModules/DnnForge - NewsArticles/ucPostComment.ascx' +GO + +DELETE FROM {databaseOwner}{objectQualifier}ModuleControls WHERE ControlSrc = 'DesktopModules/DnnForge - NewsArticles/ucSearch.ascx' +GO + +DELETE FROM {databaseOwner}{objectQualifier}ModuleControls WHERE ControlSrc = 'DesktopModules/DnnForge - NewsArticles/ucSyndication.ascx' +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddPage +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddPage + @ArticleID int, + @Title nvarchar(255), + @PageText ntext, + @SortOrder int +AS + +declare @count int + +select @count = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where ArticleID = @ArticleID) + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page ( + [ArticleID], + [Title], + [PageText], + [SortOrder] +) VALUES ( + @ArticleID, + @Title, + @PageText, + @count +) + +select SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeletePage +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeletePage + @PageID int +AS + +DECLARE @ArticleID int +SELECT @ArticleID = ArticleID FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page WHERE [PageID] = @PageID + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page +WHERE + [PageID] = @PageID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdatePage +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdatePage + @PageID int, + @ArticleID int, + @Title nvarchar(255), + @PageText ntext, + @SortOrder int +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page SET + [ArticleID] = @ArticleID, + [Title] = @Title, + [PageText] = @PageText, + [SortOrder] = @SortOrder +WHERE + [PageID] = @PageID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment + @ArticleID int, + @UserID int, + @Comment ntext, + @RemoteAddress nvarchar(50) , + @Type int, + @TrackbackUrl nvarchar(255), + @TrackbackTitle nvarchar(255), + @TrackbackBlogName nvarchar(255), + @TrackbackExcerpt ntext, + @AnonymousName nvarchar(255), + @AnonymousEmail nvarchar(255), + @AnonymousURL nvarchar(255), + @NotifyMe bit, + @IsApproved bit, + @ApprovedBy int +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ( + [ArticleID], + [UserID], + [Comment], + [RemoteAddress], + [Type], + [TrackbackUrl], + [TrackbackTitle], + [TrackbackBlogName], + [TrackbackExcerpt], + [AnonymousName], + [AnonymousEmail], + [AnonymousURL], + [NotifyMe], + [IsApproved], + [ApprovedBy] +) VALUES ( + @ArticleID, + @UserID, + @Comment, + @RemoteAddress, + @Type, + @TrackbackUrl, + @TrackbackTitle, + @TrackbackBlogName, + @TrackbackExcerpt, + @AnonymousName, + @AnonymousEmail, + @AnonymousURL, + @NotifyMe, + @IsApproved, + @ApprovedBy +) + +select SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteComment + @CommentID int +AS + +DECLARE @ArticleID int +SELECT @ArticleID = ArticleID FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment WHERE [CommentID] = @CommentID + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment +WHERE [CommentID] = @CommentID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateComment + @CommentID int, + @ArticleID int, + @UserID int, + @Comment ntext, + @RemoteAddress nvarchar(50), + @Type int, + @TrackbackUrl nvarchar(255), + @TrackbackTitle nvarchar(255), + @TrackbackBlogName nvarchar(255), + @TrackbackExcerpt ntext, + @AnonymousName nvarchar(255), + @AnonymousEmail nvarchar(255), + @AnonymousURL nvarchar(255), + @NotifyMe bit, + @IsApproved bit, + @ApprovedBy int +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment SET + [ArticleID] = @ArticleID, + [UserID] = @UserID, + [Comment] = @Comment, + [RemoteAddress] = @RemoteAddress, + [Type] = @Type, + [TrackbackUrl] = @TrackbackUrl, + [TrackbackTitle] = @TrackbackTitle, + [TrackbackBlogName] = @TrackbackBlogName, + [TrackbackExcerpt] = @TrackbackExcerpt, + [AnonymousName] = @AnonymousName, + [AnonymousEmail] = @AnonymousEmail, + [AnonymousURL] = @AnonymousURL, + [NotifyMe] = @NotifyMe, + [IsApproved] = @IsApproved, + [ApprovedBy] = @ApprovedBy +WHERE + [CommentID] = @CommentID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_RatingAdd +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_RatingAdd + @ArticleID int, + @UserID int, + @CreatedDate datetime, + @Rating float +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating ( + [ArticleID], + [UserID], + [CreatedDate], + [Rating] +) VALUES ( + @ArticleID, + @UserID, + @CreatedDate, + @Rating +) + +select SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_RatingDelete +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_RatingDelete + @RatingID int +AS + +DECLARE @ArticleID int +SELECT @ArticleID = ArticleID FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating WHERE [RatingID] = @RatingID + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating +WHERE [RatingID] = @RatingID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit, + @IsNewWindow bit +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews], + [IsDraft], + [StartDate], + [EndDate], + [ModuleID], + [ImageUrl], + [IsFeatured], + [LastUpdateID], + [Url], + [IsSecure], + [IsNewWindow] +) VALUES ( + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews, + @IsDraft, + @StartDate, + @EndDate, + @ModuleID, + @ImageUrl, + @IsFeatured, + @LastUpdateID, + @Url, + @IsSecure, + @IsNewWindow +) + +select SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit, + @IsNewWindow bit +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews, + [IsDraft] = @IsDraft, + [StartDate] = @StartDate, + [EndDate] = @EndDate, + [ModuleID] = @ModuleID, + [ImageUrl] = @ImageUrl, + [IsFeatured] = @IsFeatured, + [LastUpdateID] = @LastUpdateID, + [Url] = @Url, + [IsSecure] = @IsSecure, + [IsNewWindow] = @IsNewWindow +WHERE + [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.01.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.01.SqlDataProvider new file mode 100755 index 0000000..f9189de --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.01.SqlDataProvider @@ -0,0 +1,204 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords varchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + ''')' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate > ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE ''%' + @Keywords + '%'' OR Article.Summary LIKE ''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE ''%' + @Keywords + '%'') > 0))' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.05.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.05.SqlDataProvider new file mode 100755 index 0000000..17eed4e --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.05.SqlDataProvider @@ -0,0 +1,204 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords varchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate < GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate > ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE ''%' + @Keywords + '%'' OR Article.Summary LIKE ''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE ''%' + @Keywords + '%'') > 0))' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.06.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.06.SqlDataProvider new file mode 100755 index 0000000..b1b7165 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.06.SqlDataProvider @@ -0,0 +1,170 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + ADD [ParentID] int NULL +GO + +UPDATE + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +SET + [ParentID] = -1 +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory + @ModuleID int, + @ParentID int, + @Name nvarchar(255), + @Image nvarchar(255) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ( + [ModuleID], + [ParentID], + [Name], + [Image] +) VALUES ( + @ModuleID, + @ParentID, + @Name, + @Image +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory + @CategoryID int, + @ModuleID int, + @ParentID int, + @Name nvarchar(255), + @Image nvarchar(255) +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category SET + [ModuleID] = @ModuleID, + [ParentID] = @ParentID, + [Name] = @Name, + [Image] = @Image +WHERE + [CategoryID] = @CategoryID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory + @CategoryID int +AS + +SELECT + [CategoryID], + [ParentID], + [ModuleID], + [Name], + [Image] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [CategoryID] = @CategoryID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList + @ModuleID int, + @ParentID int +AS + +SELECT + [CategoryID], + [ParentID], + [ModuleID], + [Name], + [Image] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [ModuleID] = @ModuleID + AND + [ParentID] = @ParentID +ORDER BY + [Name] +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @Current int, + @CategoryID varchar(255) +AS + +SET NOCOUNT ON +DECLARE @level int, @line int + +CREATE TABLE #hierarchy(HierarchyID int IDENTITY (1,1), CategoryID int, level int) +CREATE TABLE #stack (item int, level int) +INSERT INTO #stack VALUES (@current, 1) +SELECT @level = 1 + +WHILE @level > 0 +BEGIN + IF EXISTS (SELECT * FROM #stack WHERE level = @level) + BEGIN + SELECT @current = item + FROM #stack + WHERE level = @level + + insert into #hierarchy(CategoryID, level) values(@current, @level) + + DELETE FROM #stack + WHERE level = @level + AND item = @current + + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [Name] DESC + + IF @@ROWCOUNT > 0 + SELECT @level = @level + 1 + END + ELSE + SELECT @level = @level - 1 +END -- WHILE + +DECLARE @strModuleID nvarchar(50) +SELECT @strModuleID = convert(varchar, @ModuleID) + +DECLARE @strCategoryId nvarchar(255) +IF (@CategoryId is not null) + SELECT @strCategoryId = ' AND c.CategoryID in (' + @CategoryID + ')' + +EXEC(' +SELECT + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE(''.'',(level-2)*2) + c.[Name] as ''NameIndented'', + c.[Image], + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac WHERE ac.CategoryID = c.CategoryID) as ''NumberofArticles'', + (SELECT SUM(a.NumberOfViews) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac ON a.ArticleID = ac.ArticleID WHERE ac.CategoryID = c.CategoryID) as ''NumberofViews'' +FROM + #hierarchy h INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON h.CategoryID = c.CategoryID +WHERE + c.[ModuleID] = ' + @strModuleID + @strCategoryId + ' +ORDER BY + h.HierarchyID ASC') + +drop table #hierarchy +drop table #stack +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryStatistics +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.08.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.08.SqlDataProvider new file mode 100755 index 0000000..633aa2f --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.08.SqlDataProvider @@ -0,0 +1,173 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + ADD [Description] ntext +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory + @ModuleID int, + @ParentID int, + @Name nvarchar(255), + @Image nvarchar(255), + @Description ntext +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ( + [ModuleID], + [ParentID], + [Name], + [Image], + [Description] +) VALUES ( + @ModuleID, + @ParentID, + @Name, + @Image, + @Description +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory + @CategoryID int, + @ModuleID int, + @ParentID int, + @Name nvarchar(255), + @Image nvarchar(255), + @Description ntext +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category SET + [ModuleID] = @ModuleID, + [ParentID] = @ParentID, + [Name] = @Name, + [Image] = @Image, + [Description] = @Description +WHERE + [CategoryID] = @CategoryID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory + @CategoryID int +AS + +SELECT + [CategoryID], + [ParentID], + [ModuleID], + [Name], + [Image], + [Description] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [CategoryID] = @CategoryID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList + @ModuleID int, + @ParentID int +AS + +SELECT + [CategoryID], + [ParentID], + [ModuleID], + [Name], + [Image], + [Description] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [ModuleID] = @ModuleID + AND + [ParentID] = @ParentID +ORDER BY + [Name] +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @Current int, + @CategoryID varchar(255) +AS + +SET NOCOUNT ON +DECLARE @level int, @line int + +CREATE TABLE #hierarchy(HierarchyID int IDENTITY (1,1), CategoryID int, level int) +CREATE TABLE #stack (item int, level int) +INSERT INTO #stack VALUES (@current, 1) +SELECT @level = 1 + +WHILE @level > 0 +BEGIN + IF EXISTS (SELECT * FROM #stack WHERE level = @level) + BEGIN + SELECT @current = item + FROM #stack + WHERE level = @level + + insert into #hierarchy(CategoryID, level) values(@current, @level) + + DELETE FROM #stack + WHERE level = @level + AND item = @current + + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [Name] DESC + + IF @@ROWCOUNT > 0 + SELECT @level = @level + 1 + END + ELSE + SELECT @level = @level - 1 +END -- WHILE + +DECLARE @strModuleID nvarchar(50) +SELECT @strModuleID = convert(varchar, @ModuleID) + +DECLARE @strCategoryId nvarchar(255) +IF (@CategoryId is not null) + SELECT @strCategoryId = ' AND c.CategoryID in (' + @CategoryID + ')' + +EXEC(' +SELECT + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE(''.'',(level-2)*2) + c.[Name] as ''NameIndented'', + c.[Image], + [Description], + level-1 as ''Level'', + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac WHERE ac.CategoryID = c.CategoryID) as ''NumberofArticles'', + (SELECT SUM(a.NumberOfViews) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac ON a.ArticleID = ac.ArticleID WHERE ac.CategoryID = c.CategoryID) as ''NumberofViews'' +FROM + #hierarchy h INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON h.CategoryID = c.CategoryID +WHERE + c.[ModuleID] = ' + @strModuleID + @strCategoryId + ' +ORDER BY + h.HierarchyID ASC') + +drop table #hierarchy +drop table #stack +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.10.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.10.SqlDataProvider new file mode 100755 index 0000000..5b96359 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.10.SqlDataProvider @@ -0,0 +1,197 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + ADD SortOrder int +GO + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category SET SortOrder = 0 +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory + @ModuleID int, + @ParentID int, + @Name nvarchar(255), + @Image nvarchar(255), + @Description ntext, + @SortOrder int +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ( + [ModuleID], + [ParentID], + [Name], + [Image], + [Description], + [SortOrder] +) VALUES ( + @ModuleID, + @ParentID, + @Name, + @Image, + @Description, + @SortOrder +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory + @CategoryID int, + @ModuleID int, + @ParentID int, + @Name nvarchar(255), + @Image nvarchar(255), + @Description ntext, + @SortOrder int +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category SET + [ModuleID] = @ModuleID, + [ParentID] = @ParentID, + [Name] = @Name, + [Image] = @Image, + [Description] = @Description, + [SortOrder] = @SortOrder +WHERE + [CategoryID] = @CategoryID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory + @CategoryID int +AS + +SELECT + [CategoryID], + [ParentID], + [ModuleID], + [Name], + [Image], + [Description], + [SortOrder] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [CategoryID] = @CategoryID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList + @ModuleID int, + @ParentID int +AS + +SELECT + [CategoryID], + [ParentID], + [ModuleID], + [Name], + [Image], + [Description], + [SortOrder] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [ModuleID] = @ModuleID + AND + [ParentID] = @ParentID +ORDER BY + [SortOrder], [Name] +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @Current int, + @CategoryID varchar(255), + @MaxDepth int +AS + +SET NOCOUNT ON + +DECLARE @FilterID int +SET @FilterID = @Current + +DECLARE @level int, @line int + +CREATE TABLE #hierarchy(HierarchyID int IDENTITY (1,1), CategoryID int, level int) +CREATE TABLE #stack (item int, level int) +INSERT INTO #stack VALUES (@current, 1) +SELECT @level = 1 + +WHILE @level > 0 +BEGIN + IF EXISTS (SELECT * FROM #stack WHERE level = @level) + BEGIN + SELECT @current = item + FROM #stack + WHERE level = @level + + insert into #hierarchy(CategoryID, level) values(@current, @level) + + DELETE FROM #stack + WHERE level = @level + AND item = @current + + IF( @MaxDepth IS NULL OR @MaxDepth >= @level ) + BEGIN + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [SortOrder] DESC, [Name] DESC + + IF @@ROWCOUNT > 0 + SELECT @level = @level + 1 + END + END + ELSE + SELECT @level = @level - 1 +END -- WHILE + +IF( @FilterID IS NOT NULL ) +BEGIN + DELETE FROM #hierarchy WHERE CategoryID = @FilterID +END + +DECLARE @strModuleID nvarchar(50) +SELECT @strModuleID = convert(varchar, @ModuleID) + +DECLARE @strCategoryId nvarchar(255) +IF (@CategoryId is not null) + SELECT @strCategoryId = ' AND c.CategoryID in (' + @CategoryID + ')' + +EXEC(' +SELECT + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE(''.'',(level-2)*2) + c.[Name] as ''NameIndented'', + c.[Image], + c.[Description], + c.[SortOrder], + level-1 as ''Level'', + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac WHERE ac.CategoryID = c.CategoryID) as ''NumberofArticles'', + (SELECT SUM(a.NumberOfViews) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac ON a.ArticleID = ac.ArticleID WHERE ac.CategoryID = c.CategoryID) as ''NumberofViews'' +FROM + #hierarchy h INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON h.CategoryID = c.CategoryID +WHERE + c.[ModuleID] = ' + @strModuleID + @strCategoryId + ' +ORDER BY + h.HierarchyID ASC') + +drop table #hierarchy +drop table #stack +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.13.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.13.SqlDataProvider new file mode 100755 index 0000000..43d8b50 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.13.SqlDataProvider @@ -0,0 +1,207 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords varchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate < GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate > ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE ''%' + @Keywords + '%'' OR Article.Summary LIKE ''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE ''%' + @Keywords + '%'') > 0))' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.14.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.14.SqlDataProvider new file mode 100755 index 0000000..1fbcc10 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.14.SqlDataProvider @@ -0,0 +1,88 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @Current int, + @CategoryID varchar(255), + @MaxDepth int +AS + +SET NOCOUNT ON + +DECLARE @FilterID int +SET @FilterID = @Current + +DECLARE @level int, @line int + +CREATE TABLE #hierarchy(HierarchyID int IDENTITY (1,1), CategoryID int, level int) +CREATE TABLE #stack (item int, level int) +INSERT INTO #stack VALUES (@current, 1) +SELECT @level = 1 + +WHILE @level > 0 +BEGIN + IF EXISTS (SELECT * FROM #stack WHERE level = @level) + BEGIN + SELECT @current = item + FROM #stack + WHERE level = @level + + insert into #hierarchy(CategoryID, level) values(@current, @level) + + DELETE FROM #stack + WHERE level = @level + AND item = @current + + IF( @MaxDepth IS NULL OR @MaxDepth >= @level ) + BEGIN + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [SortOrder] DESC, [Name] DESC + + IF @@ROWCOUNT > 0 + SELECT @level = @level + 1 + END + END + ELSE + SELECT @level = @level - 1 +END -- WHILE + +IF( @FilterID IS NOT NULL ) +BEGIN + DELETE FROM #hierarchy WHERE CategoryID = @FilterID +END + +DECLARE @strModuleID nvarchar(50) +SELECT @strModuleID = convert(varchar, @ModuleID) + +DECLARE @strCategoryId nvarchar(255) +IF (@CategoryId is not null) + SELECT @strCategoryId = ' AND c.CategoryID in (' + @CategoryID + ')' + +EXEC(' +SELECT + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE(''.'',(level-2)*2) + c.[Name] as ''NameIndented'', + c.[Image], + c.[Description], + c.[SortOrder], + level-1 as ''Level'', + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a ON ac.ArticleID = a.ArticleID WHERE ac.CategoryID = c.CategoryID AND a.IsDraft = 0 AND a.IsApproved = 1) as ''NumberofArticles'', + (SELECT SUM(a.NumberOfViews) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac ON a.ArticleID = ac.ArticleID WHERE ac.CategoryID = c.CategoryID) as ''NumberofViews'' +FROM + #hierarchy h INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON h.CategoryID = c.CategoryID +WHERE + c.[ModuleID] = ' + @strModuleID + @strCategoryId + ' +ORDER BY + h.HierarchyID ASC') + +drop table #hierarchy +drop table #stack +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.20.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.20.SqlDataProvider new file mode 100755 index 0000000..64e3763 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.20.SqlDataProvider @@ -0,0 +1,138 @@ +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Handout( + [HandoutID] [int] IDENTITY(1,1) NOT NULL, + [ModuleID] [int] NOT NULL, + [UserID] [int] NULL, + [Name] [nvarchar](255) NOT NULL, + [Description] [ntext] NULL +) ON [PRIMARY] +GO + +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_HandoutArticle( + [HandoutID] [int] NOT NULL, + [ArticleID] [int] NOT NULL, + [SortOrder] [int] NOT NULL +) ON [PRIMARY] +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddHandout + @ModuleID int, + @UserID int, + @Name nvarchar(255), + @Description ntext +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Handout ( + [ModuleID], + [UserID], + [Name], + [Description] +) VALUES ( + @ModuleID, + @UserID, + @Name, + @Description +) + +select SCOPE_IDENTITY() +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddHandoutArticle + @HandoutID int, + @ArticleID int, + @SortOrder int +AS + +INSERT INTO + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_HandoutArticle(HandoutID, ArticleID, SortOrder) +VALUES + (@HandoutID, @ArticleID, @SortOrder) +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteHandout + @HandoutID int +AS + +DELETE FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Handout +WHERE + HandoutID = @HandoutID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteHandoutArticleList + @HandoutID int +AS + +DELETE FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_HandoutArticle +WHERE + HandoutID = @HandoutID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetHandout + @HandoutID int +AS + +SELECT + [HandoutID], + [ModuleID], + [UserID], + [Name], + [Description] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Handout +WHERE + HandoutID = @HandoutID +Go + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetHandoutArticleList + @HandoutID int +AS + +SELECT + [HandoutID], + [ArticleID], + [SortOrder] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_HandoutArticle +WHERE + HandoutID = @HandoutID +ORDER BY + [SortOrder] ASC +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetHandoutList + @UserID int +AS + +SELECT + [HandoutID], + [ModuleID], + [UserID], + [Name], + [Description] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Handout +WHERE + [UserID] = @UserID +ORDER BY + [Name] +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateHandout + @HandoutID int, + @ModuleID int, + @UserID int, + @Name nvarchar(255), + @Description ntext +AS + +UPDATE + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Handout +SET + [ModuleID] = @ModuleID, + [UserID] = @UserID, + [Name] = @Name, + [Description] = @Description +WHERE + HandoutID = @HandoutID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.32.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.32.SqlDataProvider new file mode 100755 index 0000000..1fdbd5c --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.32.SqlDataProvider @@ -0,0 +1,398 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics + @ModuleID int, + @CategoryID varchar(255), + @SortBy varchar(255), + @ShowPending bit +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ArticleID in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@ShowPending is null ) + SELECT @strWhere = @strWhere + ' AND (Articles.StartDate is null OR Articles.StartDate < ''' + convert(nvarchar, DateAdd(mi, 1, GetDate())) + ''')' + +EXEC(' +SELECT + UserID, UserName, DisplayName, FirstName, LastName, count(*) as ''ArticleCount'' +FROM + {databaseOwner}{objectQualifier}Users Users, {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Articles +where Articles.IsApproved = 1 and Articles.IsDraft = 0 and Users.UserID = Articles.AuthorID ' + + @strWhere + ' +GROUP BY + UserID, UserName, DisplayName, FirstName, LastName +ORDER BY ' + + @SortBy) +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @Current int, + @CategoryID varchar(255), + @MaxDepth int, + @ShowPending bit +AS + +SET NOCOUNT ON + +DECLARE @FilterID int +SET @FilterID = @Current + +DECLARE @level int, @line int + +CREATE TABLE #hierarchy(HierarchyID int IDENTITY (1,1), CategoryID int, level int) +CREATE TABLE #stack (item int, level int) +INSERT INTO #stack VALUES (@current, 1) +SELECT @level = 1 + +WHILE @level > 0 +BEGIN + IF EXISTS (SELECT * FROM #stack WHERE level = @level) + BEGIN + SELECT @current = item + FROM #stack + WHERE level = @level + + insert into #hierarchy(CategoryID, level) values(@current, @level) + + DELETE FROM #stack + WHERE level = @level + AND item = @current + + IF( @MaxDepth IS NULL OR @MaxDepth >= @level ) + BEGIN + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [SortOrder] DESC, [Name] DESC + + IF @@ROWCOUNT > 0 + SELECT @level = @level + 1 + END + END + ELSE + SELECT @level = @level - 1 +END -- WHILE + +IF( @FilterID IS NOT NULL ) +BEGIN + DELETE FROM #hierarchy WHERE CategoryID = @FilterID +END + +DECLARE @strModuleID nvarchar(50) +SELECT @strModuleID = convert(varchar, @ModuleID) + +DECLARE @strCategoryId nvarchar(255) +IF (@CategoryId is not null) + SELECT @strCategoryId = ' AND c.CategoryID in (' + @CategoryID + ')' + +DECLARE @strPending nvarchar(2000) +IF (@ShowPending is null) + SELECT @strPending = ' AND (a.StartDate IS NULL OR a.StartDate < GetDate())' + +EXEC(' +SELECT + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE(''.'',(level-2)*2) + c.[Name] as ''NameIndented'', + c.[Image], + c.[Description], + c.[SortOrder], + level-1 as ''Level'', + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a ON ac.ArticleID = a.ArticleID WHERE ac.CategoryID = c.CategoryID AND a.IsDraft = 0 AND a.IsApproved = 1 ' + @strPending + ') as ''NumberofArticles'', + (SELECT SUM(a.NumberOfViews) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac ON a.ArticleID = ac.ArticleID WHERE ac.CategoryID = c.CategoryID) as ''NumberofViews'' +FROM + #hierarchy h INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON h.CategoryID = c.CategoryID +WHERE + c.[ModuleID] = ' + @strModuleID + @strCategoryId + ' +ORDER BY + h.HierarchyID ASC') + +drop table #hierarchy +drop table #stack +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive + @ModuleID int, + @CategoryID varchar(255), + @GroupBy varchar(255), + @ShowPending bit +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@ShowPending is null) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null or Article.StartDate < ''' + convert(nvarchar, DateAdd(mi, 1, GetDate())) + ''')' +END + +IF( @GroupBy = 'Month' ) +BEGIN +EXEC(' + select Month(StartDate) as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] + from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article + where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' + group by Year(StartDate), Month(StartDate) + order by [Year] desc, [Month] desc') +END +ELSE +BEGIN +EXEC(' + select 1 as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] + from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article + where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' + group by Year(StartDate) + order by [Year] desc') +END +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords varchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate < GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @CurrentDate is not null AND @AgedDate is not null ) + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + '''))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' + END +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate > ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE ''%' + @Keywords + '%'' OR Article.Summary LIKE ''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE ''%' + @Keywords + '%'') > 0))' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.33.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.33.SqlDataProvider new file mode 100755 index 0000000..081f079 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.33.SqlDataProvider @@ -0,0 +1,193 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics + @ModuleID int, + @CategoryID varchar(255), + @AuthorID int, + @SortBy varchar(255), + @ShowPending bit +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ArticleID in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@ShowPending is null ) + SELECT @strWhere = @strWhere + ' AND (Articles.StartDate is null OR Articles.StartDate < ''' + convert(nvarchar, DateAdd(mi, 1, GetDate())) + ''')' + +EXEC(' +SELECT + UserID, UserName, DisplayName, FirstName, LastName, count(*) as ''ArticleCount'' +FROM + {databaseOwner}{objectQualifier}Users Users, {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Articles +where Articles.IsApproved = 1 and Articles.IsDraft = 0 and Users.UserID = Articles.AuthorID ' + + @strWhere + ' +GROUP BY + UserID, UserName, DisplayName, FirstName, LastName +ORDER BY ' + + @SortBy) +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive + @ModuleID int, + @CategoryID varchar(255), + @AuthorID int, + @GroupBy varchar(255), + @ShowPending bit +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@ShowPending is null) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null or Article.StartDate < ''' + convert(nvarchar, DateAdd(mi, 1, GetDate())) + ''')' +END + +IF( @GroupBy = 'Month' ) +BEGIN +EXEC(' + select Month(StartDate) as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] + from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article + where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' + group by Year(StartDate), Month(StartDate) + order by [Year] desc, [Month] desc') +END +ELSE +BEGIN +EXEC(' + select 1 as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] + from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article + where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' + group by Year(StartDate) + order by [Year] desc') +END +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @Current int, + @CategoryID varchar(255), + @AuthorID int, + @MaxDepth int, + @ShowPending bit +AS + +SET NOCOUNT ON + +DECLARE @FilterID int +SET @FilterID = @Current + +DECLARE @level int, @line int + +CREATE TABLE #hierarchy(HierarchyID int IDENTITY (1,1), CategoryID int, level int) +CREATE TABLE #stack (item int, level int) +INSERT INTO #stack VALUES (@current, 1) +SELECT @level = 1 + +WHILE @level > 0 +BEGIN + IF EXISTS (SELECT * FROM #stack WHERE level = @level) + BEGIN + SELECT @current = item + FROM #stack + WHERE level = @level + + insert into #hierarchy(CategoryID, level) values(@current, @level) + + DELETE FROM #stack + WHERE level = @level + AND item = @current + + IF( @MaxDepth IS NULL OR @MaxDepth >= @level ) + BEGIN + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [SortOrder] DESC, [Name] DESC + + IF @@ROWCOUNT > 0 + SELECT @level = @level + 1 + END + END + ELSE + SELECT @level = @level - 1 +END -- WHILE + +IF( @FilterID IS NOT NULL ) +BEGIN + DELETE FROM #hierarchy WHERE CategoryID = @FilterID +END + +DECLARE @strModuleID nvarchar(50) +SELECT @strModuleID = convert(varchar, @ModuleID) + +DECLARE @strCategoryId nvarchar(255) +IF (@CategoryId is not null) + SELECT @strCategoryId = ' AND c.CategoryID in (' + @CategoryID + ')' + +DECLARE @strAuthorId nvarchar(255) +IF (@authorId is not null) + SELECT @strAuthorId = ' AND a.AuthorID = ' + cast(@AuthorID as nvarchar) + +DECLARE @strPending nvarchar(2000) +IF (@ShowPending is null) + SELECT @strPending = ' AND (a.StartDate IS NULL OR a.StartDate < GetDate())' + +EXEC(' +SELECT + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE(''.'',(level-2)*2) + c.[Name] as ''NameIndented'', + c.[Image], + c.[Description], + c.[SortOrder], + level-1 as ''Level'', + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a ON ac.ArticleID = a.ArticleID WHERE ac.CategoryID = c.CategoryID AND a.IsDraft = 0 AND a.IsApproved = 1 ' + @strAuthorId + @strPending + ') as ''NumberofArticles'', + (SELECT SUM(a.NumberOfViews) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac ON a.ArticleID = ac.ArticleID WHERE ac.CategoryID = c.CategoryID) as ''NumberofViews'' +FROM + #hierarchy h INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON h.CategoryID = c.CategoryID +WHERE + c.[ModuleID] = ' + @strModuleID + @strCategoryId + ' +ORDER BY + h.HierarchyID ASC') + +drop table #hierarchy +drop table #stack +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.41.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.41.SqlDataProvider new file mode 100755 index 0000000..48fa2af --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.41.SqlDataProvider @@ -0,0 +1,217 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(255), + @CategoryIDCount int, + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate < GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @CurrentDate is not null AND @AgedDate is not null ) + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + '''))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' + END +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate > ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE ''%' + @Keywords + '%'' OR Article.Summary LIKE ''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE ''%' + @Keywords + '%'') > 0))' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.44.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.44.SqlDataProvider new file mode 100755 index 0000000..0bd6bf8 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.44.SqlDataProvider @@ -0,0 +1,230 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + MetaTitle nvarchar(200) NULL, + MetaDescription nvarchar(500) NULL, + MetaKeywords nvarchar(500) NULL, + PageHeadText nvarchar(500) NULL +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit, + @IsNewWindow bit, + @MetaTitle nvarchar(200), + @MetaDescription nvarchar(500), + @MetaKeywords nvarchar(500), + @PageHeadText nvarchar(500) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews], + [IsDraft], + [StartDate], + [EndDate], + [ModuleID], + [ImageUrl], + [IsFeatured], + [LastUpdateID], + [Url], + [IsSecure], + [IsNewWindow], + [MetaTitle], + [MetaDescription], + [MetaKeywords], + [PageHeadText] +) VALUES ( + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews, + @IsDraft, + @StartDate, + @EndDate, + @ModuleID, + @ImageUrl, + @IsFeatured, + @LastUpdateID, + @Url, + @IsSecure, + @IsNewWindow, + @MetaTitle, + @MetaDescription, + @MetaKeywords, + @PageHeadText +) + +select SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit, + @IsNewWindow bit, + @MetaTitle nvarchar(200), + @MetaDescription nvarchar(500), + @MetaKeywords nvarchar(500), + @PageHeadText nvarchar(500) +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews, + [IsDraft] = @IsDraft, + [StartDate] = @StartDate, + [EndDate] = @EndDate, + [ModuleID] = @ModuleID, + [ImageUrl] = @ImageUrl, + [IsFeatured] = @IsFeatured, + [LastUpdateID] = @LastUpdateID, + [Url] = @Url, + [IsSecure] = @IsSecure, + [IsNewWindow] = @IsNewWindow, + [MetaTitle] = @MetaTitle, + [MetaDescription] = @MetaDescription, + [MetaKeywords] = @MetaKeywords, + [PageHeadText] = @PageHeadText +WHERE + [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as UpdatedDisplayName, + Page.PageText as 'Body' + +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + Article.[ArticleID] = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.46.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.46.SqlDataProvider new file mode 100755 index 0000000..f6637d9 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.46.SqlDataProvider @@ -0,0 +1,221 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate < GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @CurrentDate is not null AND @AgedDate is not null ) + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + '''))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' + END +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate > ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE ''%' + @Keywords + '%'' OR Article.Summary LIKE ''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE ''%' + @Keywords + '%'') > 0))' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.47.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.47.SqlDataProvider new file mode 100755 index 0000000..999a871 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.47.SqlDataProvider @@ -0,0 +1,288 @@ +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomField( + [CustomFieldID] [int] IDENTITY(1,1) NOT NULL, + [ModuleID] [int] NOT NULL, + [Name] [nvarchar](255) NOT NULL, + [FieldType] [int] NOT NULL, + [FieldElements] [ntext] NULL, + [DefaultValue] [nvarchar](255) NULL, + [Caption] [nvarchar](255) NULL, + [CaptionHelp] [nvarchar](255) NULL, + [IsRequired] [bit] NOT NULL, + [IsVisible] [bit] NOT NULL, + [SortOrder] [int] NOT NULL, + [ValidationType] [int] NOT NULL, + [RegularExpression] [nvarchar](4000) NULL, + [Length] [int] NULL +) ON [PRIMARY] +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomField ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_CustomField] PRIMARY KEY CLUSTERED + ( + [CustomFieldID] + ) ON [PRIMARY] +GO + +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue( + [CustomValueID] [int] IDENTITY(1,1) NOT NULL, + [ArticleID] [int] NOT NULL, + [CustomFieldID] [int] NOT NULL, + [CustomValue] [ntext] NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_CustomValue] PRIMARY KEY CLUSTERED + ( + [CustomValueID] + ) ON [PRIMARY] +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteArticle + @ArticleID int +AS + +DELETE FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue +WHERE + [ArticleID] = @ArticleID + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories +WHERE + [ArticleID] = @ArticleID + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +WHERE + [ArticleID] = @ArticleID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteCustomField + @CustomFieldID int +AS + +DELETE FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue +WHERE + CustomFieldID = @CustomFieldID + +DELETE FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomField +WHERE + CustomFieldID = @CustomFieldID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteCustomValue + @CustomValueID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue +WHERE + [CustomValueID] = @CustomValueID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCustomField + @CustomFieldID int +AS + +SELECT + CustomFieldID, + ModuleID, + [Name], + FieldType, + FieldElements, + DefaultValue, + Caption, + CaptionHelp, + IsRequired, + IsVisible, + SortOrder, + ValidationType, + RegularExpression, + [Length] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomField +WHERE + [CustomFieldID] = @CustomFieldID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCustomFieldList + @ModuleID int +AS + +SELECT + CustomFieldID, + ModuleID, + [Name], + FieldType, + FieldElements, + DefaultValue, + Caption, + CaptionHelp, + IsRequired, + IsVisible, + SortOrder, + ValidationType, + RegularExpression, + [Length] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomField +WHERE + [ModuleID] = @ModuleID +ORDER BY + SortOrder +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCustomValueByField + @ArticleID int, + @CustomFieldID int +AS + +SELECT + [CustomValueID], + [ArticleID], + [CustomFieldID], + [CustomValue] +FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue +WHERE + [ArticleID] = @ArticleID + and + [CustomFieldID] = @CustomFieldID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCustomValueList + @ArticleID int +AS + +SELECT + [CustomValueID], + [ArticleID], + [CustomFieldID], + [CustomValue] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue +WHERE + [ArticleID] = @ArticleID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCustomField + @CustomFieldID int, + @ModuleID int, + @Name nvarchar(255), + @FieldType int, + @FieldElements ntext, + @DefaultValue nvarchar(255), + @Caption nvarchar(255), + @CaptionHelp nvarchar(255), + @IsRequired bit, + @IsVisible bit, + @SortOrder int, + @ValidationType int, + @Length int, + @RegularExpression nvarchar(4000) +AS + +UPDATE + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomField +SET + [ModuleID] = @ModuleID, + [Name] = @Name, + [FieldType] = @FieldType, + [FieldElements] = @FieldElements, + [DefaultValue] = @DefaultValue, + [Caption] = @Caption, + [CaptionHelp] = @CaptionHelp, + [IsRequired] = @IsRequired, + [IsVisible] = @IsVisible, + [SortOrder] = @SortOrder, + [ValidationType] = @ValidationType, + [Length] = @Length, + [RegularExpression] = @RegularExpression +WHERE + CustomFieldID = @CustomFieldID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCustomValue + @CustomValueID int, + @ArticleID int, + @CustomFieldID int, + @CustomValue ntext +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue SET + [ArticleID] = @ArticleID, + [CustomFieldID] = @CustomFieldID, + [CustomValue] = @CustomValue +WHERE + [CustomValueID] = @CustomValueID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCustomField + @ModuleID int, + @Name nvarchar(255), + @FieldType int, + @FieldElements ntext, + @DefaultValue nvarchar(255), + @Caption nvarchar(255), + @CaptionHelp nvarchar(255), + @IsRequired bit, + @IsVisible bit, + @SortOrder int, + @ValidationType int, + @Length int, + @RegularExpression nvarchar(4000) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomField ( + [ModuleID], + [Name], + [FieldType], + [FieldElements], + [DefaultValue], + [Caption], + [CaptionHelp], + [IsRequired], + [IsVisible], + [SortOrder], + [ValidationType], + [Length], + [RegularExpression] +) VALUES ( + @ModuleID, + @Name, + @FieldType, + @FieldElements, + @DefaultValue, + @Caption, + @CaptionHelp, + @IsRequired, + @IsVisible, + @SortOrder, + @ValidationType, + @Length, + @RegularExpression +) + +select SCOPE_IDENTITY() +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCustomValue + @ArticleID int, + @CustomFieldID int, + @CustomValue ntext +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue ( + [ArticleID], + [CustomFieldID], + [CustomValue] +) VALUES ( + @ArticleID, + @CustomFieldID, + @CustomValue +) + +select SCOPE_IDENTITY() +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.48.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.48.SqlDataProvider new file mode 100755 index 0000000..d7c9ebe --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.48.SqlDataProvider @@ -0,0 +1,10 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue DROP + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_CustomValue] +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_CustomValue] PRIMARY KEY CLUSTERED + ( + [CustomValueID] + ) ON [PRIMARY] +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.52.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.52.SqlDataProvider new file mode 100755 index 0000000..52a4aad --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.52.SqlDataProvider @@ -0,0 +1,6 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Handout ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_Handout] PRIMARY KEY CLUSTERED + ( + [HandoutID] + ) ON [PRIMARY] +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.53.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.53.SqlDataProvider new file mode 100755 index 0000000..bb75557 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.53.SqlDataProvider @@ -0,0 +1,487 @@ +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Tag( + [TagID] [int] IDENTITY(1,1) NOT NULL, + [ModuleID] [int] NOT NULL, + [Name] [nvarchar](255) NOT NULL, + [NameLowered] [nvarchar](255) NOT NULL, + [Usages] [int] NULL +) ON [PRIMARY] +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Tag ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_Tag] PRIMARY KEY CLUSTERED + ( + [TagID] + ) ON [PRIMARY] +GO + +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag( + [ArticleID] [int] NOT NULL, + [TagID] [int] NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_ArticleTag] PRIMARY KEY CLUSTERED + ( + [ArticleID] ASC, + [TagID] ASC + ) ON [PRIMARY] +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_TagAdd + @ModuleID int, + @Name nvarchar(50), + @NameLowered nvarchar(50) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Tag ( + [ModuleID], + [Name], + [NameLowered] +) VALUES ( + @ModuleID, + @Name, + @NameLowered +) + +select SCOPE_IDENTITY() +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_TagGet + @TagID int +AS + +SELECT + [TagID], + [ModuleID], + [Name], + [NameLowered], + [Usages] +FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Tag +WHERE + [TagID] = @TagID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_TagGetByName + @ModuleID int, + @NameLowered nvarchar(50) +AS + +SELECT TOP 1 + [TagID], + [ModuleID], + [Name], + [NameLowered], + [Usages] +FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Tag +WHERE + [ModuleID] = @ModuleID + and + [NameLowered] = @NameLowered +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_TagList + @ModuleID int, + @MaxCount int +AS + +if( @MaxCount is not null ) +begin + SET ROWCOUNT @MaxCount +end + +SELECT + t.[TagID], + t.[ModuleID], + t.[Name], + t.[NameLowered], + t.[Usages] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Tag t +WHERE + t.[ModuleID] = @ModuleID +ORDER BY + t.[Usages] DESC +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_TagUpdate + @TagID int, + @ModuleID int, + @Name nvarchar(50), + @NameLowered nvarchar(50), + @Usages int +AS + +UPDATE + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Tag +SET + [ModuleID] = @ModuleID, + [Name] = @Name, + [NameLowered] = @NameLowered, + [Usages] = @Usages +WHERE + [TagID] = @TagID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTagAdd + @ArticleID int, + @TagID 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) + VALUES(@ArticleID, @TagID) + + 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 + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTagDelete + @ArticleID int +AS + +UPDATE + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Tag +SET + Usages = Usages - 1 +WHERE + TagID in (SELECT pt.TagID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag pt where ArticleID = @ArticleID) + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Tag +WHERE Usages = 0 + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag +WHERE ArticleID = @ArticleID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTagDeleteByTag + @TagID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag +WHERE TagID = @TagID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_TagDelete + @TagID int +AS + +exec {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTagDeleteByTag @TagID + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Tag +WHERE + [TagID] = @TagID +GO + +CREATE 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 + + RETURN LTRIM(@p_str) + +END +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate < GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @CurrentDate is not null AND @AgedDate is not null ) + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + '''))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' + END +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate > ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE ''%' + @Keywords + '%'' OR Article.Summary LIKE ''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE ''%' + @Keywords + '%'') > 0))' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as UpdatedDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + Article.[ArticleID] = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.55.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.55.SqlDataProvider new file mode 100755 index 0000000..45e6742 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.55.SqlDataProvider @@ -0,0 +1,469 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + ShortUrl nvarchar(50) NULL +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit, + @IsNewWindow bit, + @MetaTitle nvarchar(200), + @MetaDescription nvarchar(500), + @MetaKeywords nvarchar(500), + @PageHeadText nvarchar(500), + @ShortUrl nvarchar(50) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews], + [IsDraft], + [StartDate], + [EndDate], + [ModuleID], + [ImageUrl], + [IsFeatured], + [LastUpdateID], + [Url], + [IsSecure], + [IsNewWindow], + [MetaTitle], + [MetaDescription], + [MetaKeywords], + [PageHeadText], + [ShortUrl] +) VALUES ( + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews, + @IsDraft, + @StartDate, + @EndDate, + @ModuleID, + @ImageUrl, + @IsFeatured, + @LastUpdateID, + @Url, + @IsSecure, + @IsNewWindow, + @MetaTitle, + @MetaDescription, + @MetaKeywords, + @PageHeadText, + @ShortUrl +) + +select SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit, + @IsNewWindow bit, + @MetaTitle nvarchar(200), + @MetaDescription nvarchar(500), + @MetaKeywords nvarchar(500), + @PageHeadText nvarchar(500), + @ShortUrl nvarchar(50) +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews, + [IsDraft] = @IsDraft, + [StartDate] = @StartDate, + [EndDate] = @EndDate, + [ModuleID] = @ModuleID, + [ImageUrl] = @ImageUrl, + [IsFeatured] = @IsFeatured, + [LastUpdateID] = @LastUpdateID, + [Url] = @Url, + [IsSecure] = @IsSecure, + [IsNewWindow] = @IsNewWindow, + [MetaTitle] = @MetaTitle, + [MetaDescription] = @MetaDescription, + [MetaKeywords] = @MetaKeywords, + [PageHeadText] = @PageHeadText, + [ShortUrl] = @ShortUrl +WHERE + [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate < GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @CurrentDate is not null AND @AgedDate is not null ) + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + '''))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' + END +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate > ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE ''%' + @Keywords + '%'' OR Article.Summary LIKE ''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE ''%' + @Keywords + '%'') > 0))' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as UpdatedDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + Article.[ArticleID] = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.56.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.56.SqlDataProvider new file mode 100755 index 0000000..c246660 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.56.SqlDataProvider @@ -0,0 +1,261 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate < GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @CurrentDate is not null AND @AgedDate is not null ) + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + '''))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' + END +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate > ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''%' + @Keywords + '%'' OR Article.Summary LIKE N''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE N''%' + @Keywords + '%'') > 0))' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO + +DROP FUNCTION {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags +GO + +CREATE 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 + + IF( LEN(@p_str) > 0 ) + BEGIN + SELECT @p_str = SUBSTRING(@p_str, 2, (LEN(@p_str)-1)) + END + + RETURN LTRIM(@p_str) + +END +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.57.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.57.SqlDataProvider new file mode 100755 index 0000000..81e7657 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.57.SqlDataProvider @@ -0,0 +1,615 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + RssGuid nvarchar(255) NULL +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int, + @RssGuid nvarchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate < GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @CurrentDate is not null AND @AgedDate is not null ) + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + '''))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' + END +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate > ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''%' + @Keywords + '%'' OR Article.Summary LIKE N''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE N''%' + @Keywords + '%'') > 0))' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +IF (@RssGuid is not null) + SELECT @strWhere = @strWhere + ' AND Article.RssGuid = N''' + @RssGuid + '''' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO + +DROP FUNCTION {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags +GO + +CREATE 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 + + IF( LEN(@p_str) > 0 ) + BEGIN + SELECT @p_str = SUBSTRING(@p_str, 2, (LEN(@p_str)-1)) + END + + RETURN LTRIM(@p_str) + +END +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit, + @IsNewWindow bit, + @MetaTitle nvarchar(200), + @MetaDescription nvarchar(500), + @MetaKeywords nvarchar(500), + @PageHeadText nvarchar(500), + @ShortUrl nvarchar(50), + @RssGuid nvarchar(255) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews], + [IsDraft], + [StartDate], + [EndDate], + [ModuleID], + [ImageUrl], + [IsFeatured], + [LastUpdateID], + [Url], + [IsSecure], + [IsNewWindow], + [MetaTitle], + [MetaDescription], + [MetaKeywords], + [PageHeadText], + [ShortUrl], + [RssGuid] +) VALUES ( + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews, + @IsDraft, + @StartDate, + @EndDate, + @ModuleID, + @ImageUrl, + @IsFeatured, + @LastUpdateID, + @Url, + @IsSecure, + @IsNewWindow, + @MetaTitle, + @MetaDescription, + @MetaKeywords, + @PageHeadText, + @ShortUrl, + @RssGuid +) + +select SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit, + @IsNewWindow bit, + @MetaTitle nvarchar(200), + @MetaDescription nvarchar(500), + @MetaKeywords nvarchar(500), + @PageHeadText nvarchar(500), + @ShortUrl nvarchar(50), + @RssGuid nvarchar(255) +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews, + [IsDraft] = @IsDraft, + [StartDate] = @StartDate, + [EndDate] = @EndDate, + [ModuleID] = @ModuleID, + [ImageUrl] = @ImageUrl, + [IsFeatured] = @IsFeatured, + [LastUpdateID] = @LastUpdateID, + [Url] = @Url, + [IsSecure] = @IsSecure, + [IsNewWindow] = @IsNewWindow, + [MetaTitle] = @MetaTitle, + [MetaDescription] = @MetaDescription, + [MetaKeywords] = @MetaKeywords, + [PageHeadText] = @PageHeadText, + [ShortUrl] = @ShortUrl, + [RssGuid] = @RssGuid +WHERE + [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID +GO + +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Feed( + [FeedID] [int] IDENTITY(1,1) NOT NULL, + [ModuleID] [int] NOT NULL, + [Title] [nvarchar](255) NULL, + [Url] [nvarchar](255) NOT NULL, + [UserID] [int] NOT NULL, + [AutoFeature] [bit] NOT NULL, + [IsActive] [bit] NOT NULL, +) ON [PRIMARY] +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Feed ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_Feed] PRIMARY KEY CLUSTERED + ( + [FeedID] + ) ON [PRIMARY] +GO + +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedCategory( + [FeedID] [int] NOT NULL, + [CategoryID] [int] NOT NULL, +) ON [PRIMARY] +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedCategory ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_FeedCategory] PRIMARY KEY CLUSTERED + ( + [FeedID], + [CategoryID] + ) ON [PRIMARY] +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedAdd + @ModuleID int, + @Title nvarchar(255), + @Url nvarchar(255), + @UserID int, + @AutoFeature bit, + @IsActive bit +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Feed ( + [ModuleID], + [Title], + [Url], + [UserID], + [AutoFeature], + [IsActive] +) VALUES ( + @ModuleID, + @Title, + @Url, + @UserID, + @AutoFeature, + @IsActive +) + +select SCOPE_IDENTITY() +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedCategoryAdd + @FeedID int, + @CategoryID int +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedCategory(FeedID, CategoryID) + VALUES(@FeedID, @CategoryID) +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedCategoryDelete + @FeedID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedCategory +WHERE FeedID = @FeedID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedCategoryList + @FeedID int +AS + +SELECT + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + c.[Image], + c.[Description], + c.[SortOrder] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedCategory fc INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON fc.categoryID = c.categoryID +WHERE + fc.FeedID = @FeedID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedDelete + @FeedID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Feed +WHERE + [FeedID] = @FeedID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedGet + @FeedID int +AS + +SELECT + FeedID, + ModuleID, + Title, + Url, + UserID, + AutoFeature, + IsActive +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Feed +WHERE + FeedID = @FeedID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedList + @ModuleID int, + @ShowActiveOnly bit +AS + +SELECT + FeedID, + ModuleID, + Title, + Url, + UserID, + AutoFeature, + IsActive +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Feed +WHERE + (@ModuleID = -1 OR ModuleID = @ModuleID) + AND + (@ShowActiveOnly = 0 OR IsActive = 1) +ORDER BY + Title +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedUpdate + @FeedID int, + @ModuleID int, + @Title nvarchar(255), + @Url nvarchar(255), + @UserID int, + @AutoFeature bit, + @IsActive bit +AS + +UPDATE + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Feed +SET + [ModuleID] = @ModuleID, + [Title] = @Title, + [Url] = @Url, + [UserID] = @UserID, + [AutoFeature] = @AutoFeature, + [IsActive] = @IsActive +WHERE + [FeedID] = @FeedID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.58.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.58.SqlDataProvider new file mode 100755 index 0000000..a5670b8 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.58.SqlDataProvider @@ -0,0 +1,299 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int, + @RssGuid nvarchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate < GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @CurrentDate is not null AND @AgedDate is not null ) + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate < ''' + convert(nvarchar, @CurrentDate) + '''))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate > ''' + convert(nvarchar, @AgedDate) + '''' + END +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate > ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''%' + @Keywords + '%'' OR Article.Summary LIKE N''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE N''%' + @Keywords + '%'') > 0))' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +IF (@RssGuid is not null) + SELECT @strWhere = @strWhere + ' AND Article.RssGuid = N''' + @RssGuid + '''' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as UpdatedDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + Article.[ArticleID] = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.59.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.59.SqlDataProvider new file mode 100755 index 0000000..423b3a7 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.59.SqlDataProvider @@ -0,0 +1,240 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int, + @RssGuid nvarchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate <= ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate <= GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @CurrentDate is not null AND @AgedDate is not null ) + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate <= ''' + convert(nvarchar, @CurrentDate) + '''))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' + END +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate >= ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''%' + @Keywords + '%'' OR Article.Summary LIKE N''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE N''%' + @Keywords + '%'') > 0))' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +IF (@RssGuid is not null) + SELECT @strWhere = @strWhere + ' AND Article.RssGuid = N''' + @RssGuid + '''' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.61.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.61.SqlDataProvider new file mode 100755 index 0000000..a2a703e --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.61.SqlDataProvider @@ -0,0 +1,806 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Feed ADD + DateMode int NOT NULL CONSTRAINT DF_{objectQualifier}DnnForge_NewsArticles_Feed_DateMode DEFAULT 0, + AutoExpire int NULL, + AutoExpireUnit int NULL +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedAdd +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedAdd + @ModuleID int, + @Title nvarchar(255), + @Url nvarchar(255), + @UserID int, + @AutoFeature bit, + @IsActive bit, + @DateMode int, + @AutoExpire int, + @AutoExpireUnit int +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Feed ( + [ModuleID], + [Title], + [Url], + [UserID], + [AutoFeature], + [IsActive], + [DateMode], + [AutoExpire], + [AutoExpireUnit] +) VALUES ( + @ModuleID, + @Title, + @Url, + @UserID, + @AutoFeature, + @IsActive, + @DateMode, + @AutoExpire, + @AutoExpireUnit +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedGet +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedGet + @FeedID int +AS + +SELECT + FeedID, + ModuleID, + Title, + Url, + UserID, + AutoFeature, + IsActive, + DateMode, + AutoExpire, + AutoExpireUnit +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Feed +WHERE + FeedID = @FeedID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedList + @ModuleID int, + @ShowActiveOnly bit +AS + +SELECT + FeedID, + ModuleID, + Title, + Url, + UserID, + AutoFeature, + IsActive, + DateMode, + AutoExpire, + AutoExpireUnit +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Feed +WHERE + (@ModuleID = -1 OR ModuleID = @ModuleID) + AND + (@ShowActiveOnly = 0 OR IsActive = 1) +ORDER BY + Title +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedUpdate +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FeedUpdate + @FeedID int, + @ModuleID int, + @Title nvarchar(255), + @Url nvarchar(255), + @UserID int, + @AutoFeature bit, + @IsActive bit, + @DateMode int, + @AutoExpire int, + @AutoExpireUnit int +AS + +UPDATE + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Feed +SET + [ModuleID] = @ModuleID, + [Title] = @Title, + [Url] = @Url, + [UserID] = @UserID, + [AutoFeature] = @AutoFeature, + [IsActive] = @IsActive, + [DateMode] = @DateMode, + [AutoExpire] = @AutoExpire, + [AutoExpireUnit] = @AutoExpireUnit +WHERE + [FeedID] = @FeedID +GO + +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image( + [ImageID] [int] IDENTITY(1,1) NOT NULL, + [ArticleID] [int] NULL, + [Title] [nvarchar](100) NULL, + [FileName] [nvarchar](100) NULL, + [Extension] [nvarchar](100) NULL, + [Size] [int] NULL, + [Width] [int] NULL, + [Height] [int] NULL, + [ContentType] [nvarchar](200) NULL, + [Folder] [nvarchar](200) NULL, + [SortOrder] [int] NOT NULL CONSTRAINT [DF_{objectQualifier}DnnForge_NewsArticles_Image_SortOrder] DEFAULT ((0)), + [ImageGuid] [nvarchar](50) NULL, + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_Image] PRIMARY KEY CLUSTERED +( + [ImageID] ASC +) +) ON [PRIMARY] +GO + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image(ArticleID, Title, FileName, Extension, Size, Width, Height, ContentType, Folder, SortOrder) +SELECT + a.ArticleID, + f.FileName, + f.FileName, + f.Extension, + f.Size, + f.Width, + f.Height, + f.ContentType, + f.Folder, + 0 +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN + {databaseOwner}{objectQualifier}Files f ON 'FileID=' + CONVERT(varchar, f.FileID) = a.ImageUrl +GO + +UPDATE + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET + ImageUrl = NULL +WHERE + ArticleID IN (SELECT a.ArticleID FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN {databaseOwner}{objectQualifier}Files f ON 'FileID=' + CONVERT(varchar, f.FileID) = a.ImageUrl) +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageAdd + @ArticleID int, + @Title nvarchar(100), + @FileName nvarchar(100), + @Extension nvarchar(100), + @Size int, + @Width int, + @Height int, + @ContentType nvarchar(200), + @Folder nvarchar(200), + @SortOrder int, + @ImageGuid nvarchar(50) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image ( + [ArticleID], + [Title], + [FileName], + [Extension], + [Size], + [Width], + [Height], + [ContentType], + [Folder], + [SortOrder], + [ImageGuid] +) VALUES ( + @ArticleID, + @Title, + @FileName, + @Extension, + @Size, + @Width, + @Height, + @ContentType, + @Folder, + @SortOrder, + @ImageGuid +) + +select SCOPE_IDENTITY() +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageUpdate + @ImageID int, + @ArticleID int, + @Title nvarchar(100), + @FileName nvarchar(100), + @Extension nvarchar(100), + @Size int, + @Width int, + @Height int, + @ContentType nvarchar(200), + @Folder nvarchar(200), + @SortOrder int, + @ImageGuid nvarchar(50) +AS + +UPDATE + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image +SET + [ArticleID] = @ArticleID, + [Title] = @Title, + [FileName] = @FileName, + [Extension] = @Extension, + [Size] = @Size, + [Width] = @Width, + [Height] = @Height, + [ContentType] = @ContentType, + [Folder] = @Folder, + [SortOrder] = @SortOrder, + [ImageGuid] = @ImageGuid +WHERE + [ImageID] = @ImageID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageGet + @ImageID int +AS + +SELECT + ImageID, + ArticleID, + Title, + FileName, + Extension, + Size, + Width, + Height, + ContentType, + Folder, + SortOrder, + ImageGuid +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image +WHERE + ImageID = @ImageID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageList + @ArticleID int, + @ImageGuid nvarchar(50) +AS + +SELECT + ImageID, + ArticleID, + Title, + FileName, + Extension, + Size, + Width, + Height, + ContentType, + Folder, + SortOrder, + ImageGuid +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image +WHERE + (@ArticleID IS NULL OR ArticleID = @ArticleID) + AND + (@ImageGuid IS NULL OR ImageGuid = @ImageGuid) +ORDER BY + SortOrder +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageDelete + @ImageID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image WHERE ImageID = @ImageID +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + ImageCount int NULL +GO + +UPDATE + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET + ImageCount = (SELECT count(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image i WHERE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID = i.ArticleID) +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int, + @RssGuid nvarchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate <= ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate <= GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @CurrentDate is not null AND @AgedDate is not null ) + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate <= ''' + convert(nvarchar, @CurrentDate) + '''))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' + END +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate >= ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''%' + @Keywords + '%'' OR Article.Summary LIKE N''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE N''%' + @Keywords + '%'') > 0))' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +IF (@RssGuid is not null) + SELECT @strWhere = @strWhere + ' AND Article.RssGuid = N''' + @RssGuid + '''' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[ImageCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[ImageCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as UpdatedDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + Article.[ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit, + @IsNewWindow bit, + @MetaTitle nvarchar(200), + @MetaDescription nvarchar(500), + @MetaKeywords nvarchar(500), + @PageHeadText nvarchar(500), + @ShortUrl nvarchar(50), + @RssGuid nvarchar(255) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews], + [IsDraft], + [StartDate], + [EndDate], + [ModuleID], + [ImageUrl], + [IsFeatured], + [LastUpdateID], + [Url], + [IsSecure], + [IsNewWindow], + [MetaTitle], + [MetaDescription], + [MetaKeywords], + [PageHeadText], + [ShortUrl], + [RssGuid] +) VALUES ( + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews, + @IsDraft, + @StartDate, + @EndDate, + @ModuleID, + @ImageUrl, + @IsFeatured, + @LastUpdateID, + @Url, + @IsSecure, + @IsNewWindow, + @MetaTitle, + @MetaDescription, + @MetaKeywords, + @PageHeadText, + @ShortUrl, + @RssGuid +) + +select SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [ImageCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image i where i.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit, + @IsNewWindow bit, + @MetaTitle nvarchar(200), + @MetaDescription nvarchar(500), + @MetaKeywords nvarchar(500), + @PageHeadText nvarchar(500), + @ShortUrl nvarchar(50), + @RssGuid nvarchar(255) +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews, + [IsDraft] = @IsDraft, + [StartDate] = @StartDate, + [EndDate] = @EndDate, + [ModuleID] = @ModuleID, + [ImageUrl] = @ImageUrl, + [IsFeatured] = @IsFeatured, + [LastUpdateID] = @LastUpdateID, + [Url] = @Url, + [IsSecure] = @IsSecure, + [IsNewWindow] = @IsNewWindow, + [MetaTitle] = @MetaTitle, + [MetaDescription] = @MetaDescription, + [MetaKeywords] = @MetaKeywords, + [PageHeadText] = @PageHeadText, + [ShortUrl] = @ShortUrl, + [RssGuid] = @RssGuid +WHERE + [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [ImageCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image i where i.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.63.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.63.SqlDataProvider new file mode 100755 index 0000000..46fcaa2 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.63.SqlDataProvider @@ -0,0 +1,236 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int, + @RssGuid nvarchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate <= ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate <= GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate >= ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''%' + @Keywords + '%'' OR Article.Summary LIKE N''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE N''%' + @Keywords + '%'') > 0))' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +IF (@RssGuid is not null) + SELECT @strWhere = @strWhere + ' AND Article.RssGuid = N''' + @RssGuid + '''' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[ImageCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.64.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.64.SqlDataProvider new file mode 100755 index 0000000..7cb3921 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.64.SqlDataProvider @@ -0,0 +1,241 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int, + @RssGuid nvarchar(255), + @CustomFieldID int, + @CustomValue nvarchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate <= ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate <= GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate >= ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''%' + @Keywords + '%'' OR Article.Summary LIKE N''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE N''%' + @Keywords + '%'') > 0))' + +IF (@CustomFieldID is not null AND @CustomValue is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID IN (SELECT ArticleID FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue cv WHERE cv.customFieldID = ' + convert(nvarchar, @CustomFieldID) + ' AND cv.CustomValue LIKE N''%' + @CustomValue + '%'')' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +IF (@RssGuid is not null) + SELECT @strWhere = @strWhere + ' AND Article.RssGuid = N''' + @RssGuid + '''' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[ImageCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.66.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.66.SqlDataProvider new file mode 100755 index 0000000..0ed7574 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.66.SqlDataProvider @@ -0,0 +1,13 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteCustomValue +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteCustomValue + @ArticleID int, + @CustomFieldID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue +WHERE + [ArticleID] = @ArticleID AND + [CustomFieldID] = @CustomFieldID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.67.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.67.SqlDataProvider new file mode 100755 index 0000000..e94aad1 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.67.SqlDataProvider @@ -0,0 +1,110 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @Current int, + @CategoryID varchar(255), + @AuthorID int, + @MaxDepth int, + @ShowPending bit, + @SortType int +AS + +SET NOCOUNT ON + +DECLARE @FilterID int +SET @FilterID = @Current + +DECLARE @level int, @line int + +CREATE TABLE #hierarchy(HierarchyID int IDENTITY (1,1), CategoryID int, level int) +CREATE TABLE #stack (item int, level int) +INSERT INTO #stack VALUES (@current, 1) +SELECT @level = 1 + +WHILE @level > 0 +BEGIN + IF EXISTS (SELECT * FROM #stack WHERE level = @level) + BEGIN + SELECT @current = item + FROM #stack + WHERE level = @level + + insert into #hierarchy(CategoryID, level) values(@current, @level) + + DELETE FROM #stack + WHERE level = @level + AND item = @current + + IF( @MaxDepth IS NULL OR @MaxDepth >= @level ) + BEGIN + IF( @SortType = 0 ) + BEGIN + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [SortOrder] DESC, [Name] DESC + END + ELSE + BEGIN + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [Name] DESC + END + + IF @@ROWCOUNT > 0 + SELECT @level = @level + 1 + END + END + ELSE + SELECT @level = @level - 1 +END -- WHILE + +IF( @FilterID IS NOT NULL ) +BEGIN + DELETE FROM #hierarchy WHERE CategoryID = @FilterID +END + +DECLARE @strModuleID nvarchar(50) +SELECT @strModuleID = convert(varchar, @ModuleID) + +DECLARE @strCategoryId nvarchar(255) +IF (@CategoryId is not null) + SELECT @strCategoryId = ' AND c.CategoryID in (' + @CategoryID + ')' + +DECLARE @strAuthorId nvarchar(255) +IF (@authorId is not null) + SELECT @strAuthorId = ' AND a.AuthorID = ' + cast(@AuthorID as nvarchar) + +DECLARE @strPending nvarchar(2000) +IF (@ShowPending is null) + SELECT @strPending = ' AND (a.StartDate IS NULL OR a.StartDate < GetDate())' + +EXEC(' +SELECT + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE(''.'',(level-2)*2) + c.[Name] as ''NameIndented'', + c.[Image], + c.[Description], + c.[SortOrder], + level-1 as ''Level'', + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a ON ac.ArticleID = a.ArticleID WHERE ac.CategoryID = c.CategoryID AND a.IsDraft = 0 AND a.IsApproved = 1 ' + @strAuthorId + @strPending + ') as ''NumberofArticles'', + (SELECT SUM(a.NumberOfViews) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac ON a.ArticleID = ac.ArticleID WHERE ac.CategoryID = c.CategoryID) as ''NumberofViews'' +FROM + #hierarchy h INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON h.CategoryID = c.CategoryID +WHERE + c.[ModuleID] = ' + @strModuleID + @strCategoryId + ' +ORDER BY + h.HierarchyID ASC') + +drop table #hierarchy +drop table #stack +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.68.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.68.SqlDataProvider new file mode 100755 index 0000000..5f69070 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.68.SqlDataProvider @@ -0,0 +1,601 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ADD + FileCount int NULL +GO + +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_File ( + [FileID] [int] IDENTITY(1,1) NOT NULL, + [ArticleID] [int] NULL, + [Title] [nvarchar](255) NULL, + [FileName] [nvarchar](255) NULL, + [Extension] [nvarchar](100) NULL, + [Size] [int] NULL, + [ContentType] [nvarchar](255) NULL, + [Folder] [nvarchar](255) NULL, + [SortOrder] [int] NOT NULL, + [FileGuid] [nvarchar](50) NULL +) ON [PRIMARY] +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_File ADD + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_File] PRIMARY KEY CLUSTERED + ( + [FileID] + ) ON [PRIMARY] +GO + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_File +SELECT + a.ArticleID, + f.FileName, + CASE WHEN fo.StorageLocation = 0 THEN f.FileName ELSE f.FileName + '.resources' END AS 'FileName', + f.Extension, + f.Size, + f.ContentType, + f.Folder, + 0 AS 'SortOrder', + '' AS 'FileGuid' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN + {databaseOwner}{objectQualifier}Files f ON replace(a.Url, 'FileID=', '') = f.FileID INNER JOIN + {databaseOwner}{objectQualifier}Folders fo ON f.FolderID = fo.FolderID +WHERE + a.Url LIKE 'FileID=%' +GO + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET Url = null +WHERE articleID IN +( + SELECT a.articleID + FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN + {databaseOwner}{objectQualifier}Files f ON replace(a.Url, 'FileID=', '') = f.FileID INNER JOIN + {databaseOwner}{objectQualifier}Folders fo ON f.FolderID = fo.FolderID + WHERE + a.Url LIKE 'FileID=%' +) +GO + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [FileCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_File f where f.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FileAdd + @ArticleID int, + @Title nvarchar(255), + @FileName nvarchar(255), + @Extension nvarchar(200), + @Size int, + @ContentType nvarchar(200), + @Folder nvarchar(255), + @SortOrder int, + @FileGuid nvarchar(50) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_File ( + [ArticleID], + [Title], + [FileName], + [Extension], + [Size], + [ContentType], + [Folder], + [SortOrder], + [FileGuid] +) VALUES ( + @ArticleID, + @Title, + @FileName, + @Extension, + @Size, + @ContentType, + @Folder, + @SortOrder, + @FileGuid +) + +select SCOPE_IDENTITY() +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FileDelete + @FileID int +AS + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_File WHERE FileID = @FileID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FileGet + @FileID int +AS + +SELECT + FileID, + ArticleID, + Title, + FileName, + Extension, + Size, + ContentType, + Folder, + SortOrder, + FileGuid +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_File +WHERE + FileID = @FileID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FileList + @ArticleID int, + @FileGuid nvarchar(50) +AS + +SELECT + FileID, + ArticleID, + Title, + FileName, + Extension, + Size, + ContentType, + Folder, + SortOrder, + FileGuid +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_File +WHERE + (@ArticleID IS NULL OR ArticleID = @ArticleID) + AND + (@FileGuid IS NULL OR FileGuid = @FileGuid) +ORDER BY + SortOrder +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_FileUpdate + @FileID int, + @ArticleID int, + @Title nvarchar(255), + @FileName nvarchar(255), + @Extension nvarchar(200), + @Size int, + @ContentType nvarchar(200), + @Folder nvarchar(255), + @SortOrder int, + @FileGuid nvarchar(50) +AS + +UPDATE + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_File +SET + [ArticleID] = @ArticleID, + [Title] = @Title, + [FileName] = @FileName, + [Extension] = @Extension, + [Size] = @Size, + [ContentType] = @ContentType, + [Folder] = @Folder, + [SortOrder] = @SortOrder, + [FileGuid] = @FileGuid +WHERE + [FileID] = @FileID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_DeleteArticle + @ArticleID int +AS + +DELETE FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue +WHERE + [ArticleID] = @ArticleID + +DELETE FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image +WHERE + [ArticleID] = @ArticleID + +DELETE FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_File +WHERE + [ArticleID] = @ArticleID + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories +WHERE + [ArticleID] = @ArticleID + +DELETE FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +WHERE + [ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int, + @RssGuid nvarchar(255), + @CustomFieldID int, + @CustomValue nvarchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate <= ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate <= GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate >= ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) + if(@CategoryIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''%' + @Keywords + '%'' OR Article.Summary LIKE N''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE N''%' + @Keywords + '%'') > 0))' + +IF (@CustomFieldID is not null AND @CustomValue is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID IN (SELECT ArticleID FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue cv WHERE cv.customFieldID = ' + convert(nvarchar, @CustomFieldID) + ' AND cv.CustomValue LIKE N''%' + @CustomValue + '%'')' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +IF (@RssGuid is not null) + SELECT @strWhere = @strWhere + ' AND Article.RssGuid = N''' + @RssGuid + '''' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[FileCount], + Article.[ImageCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO + + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticle + @ArticleID int, + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit, + @IsNewWindow bit, + @MetaTitle nvarchar(200), + @MetaDescription nvarchar(500), + @MetaKeywords nvarchar(500), + @PageHeadText nvarchar(500), + @ShortUrl nvarchar(50), + @RssGuid nvarchar(255) +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article SET + [AuthorID] = @AuthorID, + [ApproverID] = @ApproverID, + [CreatedDate] = @CreatedDate, + [LastUpdate] = @LastUpdate, + [Title] = @Title, + [Summary] = @Summary, + [IsApproved] = @IsApproved, + [NumberOfViews] = @NumberOfViews, + [IsDraft] = @IsDraft, + [StartDate] = @StartDate, + [EndDate] = @EndDate, + [ModuleID] = @ModuleID, + [ImageUrl] = @ImageUrl, + [IsFeatured] = @IsFeatured, + [LastUpdateID] = @LastUpdateID, + [Url] = @Url, + [IsSecure] = @IsSecure, + [IsNewWindow] = @IsNewWindow, + [MetaTitle] = @MetaTitle, + [MetaDescription] = @MetaDescription, + [MetaKeywords] = @MetaKeywords, + [PageHeadText] = @PageHeadText, + [ShortUrl] = @ShortUrl, + [RssGuid] = @RssGuid +WHERE + [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [ImageCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image i where i.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [FileCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_File f where f.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticle + @ArticleID int +AS +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[IsDraft], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[FileCount], + Article.[ImageCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as UpdatedDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + Article.[ArticleID] = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.69.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.69.SqlDataProvider new file mode 100755 index 0000000..cd87f74 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.69.SqlDataProvider @@ -0,0 +1,53 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCommentList + @ModuleID int, + @ArticleID int, + @IsApproved bit, + @SortDirection int, + @MaxCount int +AS + +IF( @MaxCount is not null ) +BEGIN + SET ROWCOUNT @MaxCount +END + +SELECT + Comment.[CommentID], + Comment.[ArticleID], + Comment.[UserID], + Comment.[CreatedDate], + Comment.[Comment], + Comment.[RemoteAddress], + Comment.[Type], + Comment.[TrackbackUrl], + Comment.[TrackbackTitle], + Comment.[TrackbackBlogName], + Comment.[TrackbackExcerpt], + Comment.[AnonymousName], + Comment.[AnonymousEmail], + Comment.[AnonymousURL], + Comment.[NotifyMe], + Comment.[IsApproved], + Comment.[ApprovedBy], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article on Comment.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Comment.UserID = Author.UserID +WHERE + Article.ModuleID = @ModuleID + and + (@ArticleID is null OR Comment.[ArticleID] = @ArticleID) + and + Comment.IsApproved = @IsApproved +ORDER BY + CASE WHEN @SortDirection = 0 THEN Comment.[CreatedDate] END ASC, + CASE WHEN @SortDirection = 1 THEN Comment.[CreatedDate] END DESC +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.71.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.71.SqlDataProvider new file mode 100755 index 0000000..8b9aade --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.71.SqlDataProvider @@ -0,0 +1,223 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ADD + InheritSecurity bit NOT NULL CONSTRAINT DF_{objectQualifier}DnnForge_NewsArticles_Category_InheritSecurity DEFAULT 1 +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory + @ModuleID int, + @ParentID int, + @Name nvarchar(255), + @Image nvarchar(255), + @Description ntext, + @SortOrder int, + @InheritSecurity bit +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ( + [ModuleID], + [ParentID], + [Name], + [Image], + [Description], + [SortOrder], + [InheritSecurity] +) VALUES ( + @ModuleID, + @ParentID, + @Name, + @Image, + @Description, + @SortOrder, + @InheritSecurity +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory + @CategoryID int +AS + +SELECT + [CategoryID], + [ParentID], + [ModuleID], + [Name], + [Image], + [Description], + [SortOrder], + [InheritSecurity] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [CategoryID] = @CategoryID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList + @ModuleID int, + @ParentID int +AS + +SELECT + [CategoryID], + [ParentID], + [ModuleID], + [Name], + [Image], + [Description], + [SortOrder], + [InheritSecurity] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [ModuleID] = @ModuleID + AND + [ParentID] = @ParentID +ORDER BY + [SortOrder], [Name] +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @Current int, + @CategoryID varchar(255), + @AuthorID int, + @MaxDepth int, + @ShowPending bit, + @SortType int +AS + +SET NOCOUNT ON + +DECLARE @FilterID int +SET @FilterID = @Current + +DECLARE @level int, @line int + +CREATE TABLE #hierarchy(HierarchyID int IDENTITY (1,1), CategoryID int, level int) +CREATE TABLE #stack (item int, level int) +INSERT INTO #stack VALUES (@current, 1) +SELECT @level = 1 + +WHILE @level > 0 +BEGIN + IF EXISTS (SELECT * FROM #stack WHERE level = @level) + BEGIN + SELECT @current = item + FROM #stack + WHERE level = @level + + insert into #hierarchy(CategoryID, level) values(@current, @level) + + DELETE FROM #stack + WHERE level = @level + AND item = @current + + IF( @MaxDepth IS NULL OR @MaxDepth >= @level ) + BEGIN + IF( @SortType = 0 ) + BEGIN + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [SortOrder] DESC, [Name] DESC + END + ELSE + BEGIN + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [Name] DESC + END + IF @@ROWCOUNT > 0 + SELECT @level = @level + 1 + END + END + ELSE + SELECT @level = @level - 1 +END -- WHILE + +IF( @FilterID IS NOT NULL ) +BEGIN + DELETE FROM #hierarchy WHERE CategoryID = @FilterID +END + +DECLARE @strModuleID nvarchar(50) +SELECT @strModuleID = convert(varchar, @ModuleID) + +DECLARE @strCategoryId nvarchar(255) +IF (@CategoryId is not null) + SELECT @strCategoryId = ' AND c.CategoryID in (' + @CategoryID + ')' + +DECLARE @strAuthorId nvarchar(255) +IF (@authorId is not null) + SELECT @strAuthorId = ' AND a.AuthorID = ' + cast(@AuthorID as nvarchar) + +DECLARE @strPending nvarchar(2000) +IF (@ShowPending is null) + SELECT @strPending = ' AND (a.StartDate IS NULL OR a.StartDate < GetDate())' + +EXEC(' +SELECT + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE(''.'',(level-2)*2) + c.[Name] as ''NameIndented'', + c.[Image], + c.[Description], + c.[SortOrder], + c.[InheritSecurity], + level-1 as ''Level'', + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a ON ac.ArticleID = a.ArticleID WHERE ac.CategoryID = c.CategoryID AND a.IsDraft = 0 AND a.IsApproved = 1 ' + @strAuthorId + @strPending + ') as ''NumberofArticles'', + (SELECT SUM(a.NumberOfViews) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac ON a.ArticleID = ac.ArticleID WHERE ac.CategoryID = c.CategoryID) as ''NumberofViews'' +FROM + #hierarchy h INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON h.CategoryID = c.CategoryID +WHERE + c.[ModuleID] = ' + @strModuleID + @strCategoryId + ' +ORDER BY + h.HierarchyID ASC') + +drop table #hierarchy +drop table #stack +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory + @CategoryID int, + @ModuleID int, + @ParentID int, + @Name nvarchar(255), + @Image nvarchar(255), + @Description ntext, + @SortOrder int, + @InheritSecurity bit +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category SET + [ModuleID] = @ModuleID, + [ParentID] = @ParentID, + [Name] = @Name, + [Image] = @Image, + [Description] = @Description, + [SortOrder] = @SortOrder, + [InheritSecurity] = @InheritSecurity +WHERE + [CategoryID] = @CategoryID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.72.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.72.SqlDataProvider new file mode 100755 index 0000000..518fffb --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.72.SqlDataProvider @@ -0,0 +1,18 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleCategories +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleCategories + @ArticleID int +AS + +SELECT + Category.CategoryID, + Category.[Name], + Category.[InheritSecurity] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories, {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category Category +WHERE + ArticleCategories.CategoryID = Category.CategoryID + AND + ArticleCategories.ArticleID = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.73.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.73.SqlDataProvider new file mode 100755 index 0000000..e57ce9a --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.73.SqlDataProvider @@ -0,0 +1,231 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ADD + CategorySecurityType int NOT NULL CONSTRAINT DF_{objectQualifier}DnnForge_NewsArticles_Category_CategorySecurityType DEFAULT 0 +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory + @ModuleID int, + @ParentID int, + @Name nvarchar(255), + @Image nvarchar(255), + @Description ntext, + @SortOrder int, + @InheritSecurity bit, + @CategorySecurityType int +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ( + [ModuleID], + [ParentID], + [Name], + [Image], + [Description], + [SortOrder], + [InheritSecurity], + [CategorySecurityType] +) VALUES ( + @ModuleID, + @ParentID, + @Name, + @Image, + @Description, + @SortOrder, + @InheritSecurity, + @CategorySecurityType +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory + @CategoryID int +AS + +SELECT + [CategoryID], + [ParentID], + [ModuleID], + [Name], + [Image], + [Description], + [SortOrder], + [InheritSecurity], + [CategorySecurityType] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [CategoryID] = @CategoryID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList + @ModuleID int, + @ParentID int +AS + +SELECT + [CategoryID], + [ParentID], + [ModuleID], + [Name], + [Image], + [Description], + [SortOrder], + [InheritSecurity], + [CategorySecurityType] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [ModuleID] = @ModuleID + AND + [ParentID] = @ParentID +ORDER BY + [SortOrder], [Name] +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @Current int, + @CategoryID varchar(255), + @AuthorID int, + @MaxDepth int, + @ShowPending bit, + @SortType int +AS + +SET NOCOUNT ON + +DECLARE @FilterID int +SET @FilterID = @Current + +DECLARE @level int, @line int + +CREATE TABLE #hierarchy(HierarchyID int IDENTITY (1,1), CategoryID int, level int) +CREATE TABLE #stack (item int, level int) +INSERT INTO #stack VALUES (@current, 1) +SELECT @level = 1 + +WHILE @level > 0 +BEGIN + IF EXISTS (SELECT * FROM #stack WHERE level = @level) + BEGIN + SELECT @current = item + FROM #stack + WHERE level = @level + + insert into #hierarchy(CategoryID, level) values(@current, @level) + + DELETE FROM #stack + WHERE level = @level + AND item = @current + + IF( @MaxDepth IS NULL OR @MaxDepth >= @level ) + BEGIN + IF( @SortType = 0 ) + BEGIN + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [SortOrder] DESC, [Name] DESC + END + ELSE + BEGIN + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [Name] DESC + END + IF @@ROWCOUNT > 0 + SELECT @level = @level + 1 + END + END + ELSE + SELECT @level = @level - 1 +END -- WHILE + +IF( @FilterID IS NOT NULL ) +BEGIN + DELETE FROM #hierarchy WHERE CategoryID = @FilterID +END + +DECLARE @strModuleID nvarchar(50) +SELECT @strModuleID = convert(varchar, @ModuleID) + +DECLARE @strCategoryId nvarchar(255) +IF (@CategoryId is not null) + SELECT @strCategoryId = ' AND c.CategoryID in (' + @CategoryID + ')' + +DECLARE @strAuthorId nvarchar(255) +IF (@authorId is not null) + SELECT @strAuthorId = ' AND a.AuthorID = ' + cast(@AuthorID as nvarchar) + +DECLARE @strPending nvarchar(2000) +IF (@ShowPending is null) + SELECT @strPending = ' AND (a.StartDate IS NULL OR a.StartDate < GetDate())' + +EXEC(' +SELECT + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE(''.'',(level-2)*2) + c.[Name] as ''NameIndented'', + c.[Image], + c.[Description], + c.[SortOrder], + c.[InheritSecurity], + c.[CategorySecurityType], + level-1 as ''Level'', + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a ON ac.ArticleID = a.ArticleID WHERE ac.CategoryID = c.CategoryID AND a.IsDraft = 0 AND a.IsApproved = 1 ' + @strAuthorId + @strPending + ') as ''NumberofArticles'', + (SELECT SUM(a.NumberOfViews) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac ON a.ArticleID = ac.ArticleID WHERE ac.CategoryID = c.CategoryID) as ''NumberofViews'' +FROM + #hierarchy h INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON h.CategoryID = c.CategoryID +WHERE + c.[ModuleID] = ' + @strModuleID + @strCategoryId + ' +ORDER BY + h.HierarchyID ASC') + +drop table #hierarchy +drop table #stack +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory + @CategoryID int, + @ModuleID int, + @ParentID int, + @Name nvarchar(255), + @Image nvarchar(255), + @Description ntext, + @SortOrder int, + @InheritSecurity bit, + @CategorySecurityType int +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category SET + [ModuleID] = @ModuleID, + [ParentID] = @ParentID, + [Name] = @Name, + [Image] = @Image, + [Description] = @Description, + [SortOrder] = @SortOrder, + [InheritSecurity] = @InheritSecurity, + [CategorySecurityType] = @CategorySecurityType +WHERE + [CategoryID] = @CategoryID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.74.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.74.SqlDataProvider new file mode 100755 index 0000000..5278655 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.74.SqlDataProvider @@ -0,0 +1,383 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int, + @RssGuid nvarchar(255), + @CustomFieldID int, + @CustomValue nvarchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate <= ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate <= GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate >= ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) +BEGIN + IF(@CategoryIDCount is not null) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + END + ELSE + BEGIN + IF( CHARINDEX('-1', @CategoryID) = 0 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ')) OR Article.ArticleID not in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories))' + END + END +END + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''%' + @Keywords + '%'' OR Article.Summary LIKE N''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE N''%' + @Keywords + '%'') > 0))' + +IF (@CustomFieldID is not null AND @CustomValue is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID IN (SELECT ArticleID FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue cv WHERE cv.customFieldID = ' + convert(nvarchar, @CustomFieldID) + ' AND cv.CustomValue LIKE N''%' + @CustomValue + '%'')' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +IF (@RssGuid is not null) + SELECT @strWhere = @strWhere + ' AND Article.RssGuid = N''' + @RssGuid + '''' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[FileCount], + Article.[ImageCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive + @ModuleID int, + @CategoryID varchar(2000), + @CategoryIDExclude varchar(2000), + @AuthorID int, + @GroupBy varchar(255), + @ShowPending bit +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) +BEGIN + IF( CHARINDEX('-1', @CategoryID) = 0 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ')) OR Article.ArticleID not in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories))' + END +END + +IF (@CategoryIDExclude is not null) +BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID NOT IN (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' +END + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@ShowPending is null) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null or Article.StartDate < ''' + convert(nvarchar, DateAdd(mi, 1, GetDate())) + ''')' +END + +IF( @GroupBy = 'Month' ) +BEGIN +EXEC(' + select Month(StartDate) as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] + from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article + where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' + group by Year(StartDate), Month(StartDate) + order by [Year] desc, [Month] desc') +END +ELSE +BEGIN +EXEC(' + select 1 as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] + from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article + where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' + group by Year(StartDate) + order by [Year] desc') +END +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics + @ModuleID int, + @CategoryID varchar(2000), + @CategoryIDExclude varchar(2000), + @AuthorID int, + @SortBy varchar(255), + @ShowPending bit +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) +BEGIN + IF( CHARINDEX('-1', @CategoryID) = 0 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND Articles.ArticleID in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryID + '))' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Articles.ArticleID in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryID + ')) OR Articles.ArticleID not in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories))' + END +END + +IF (@CategoryIDExclude is not null) +BEGIN + SELECT @strWhere = @strWhere + ' AND Articles.ArticleID NOT IN (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' +END + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@ShowPending is null ) + SELECT @strWhere = @strWhere + ' AND (Articles.StartDate is null OR Articles.StartDate < ''' + convert(nvarchar, DateAdd(mi, 1, GetDate())) + ''')' + +EXEC(' +SELECT + UserID, UserName, DisplayName, FirstName, LastName, count(*) as ''ArticleCount'' +FROM + {databaseOwner}{objectQualifier}Users Users, {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Articles +where Articles.IsApproved = 1 and Articles.IsDraft = 0 and Users.UserID = Articles.AuthorID ' + + @strWhere + ' +GROUP BY + UserID, UserName, DisplayName, FirstName, LastName +ORDER BY ' + + @SortBy) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.75.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.75.SqlDataProvider new file mode 100755 index 0000000..6449ec7 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.75.SqlDataProvider @@ -0,0 +1,7 @@ +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_SecureCheck + @PortalID int, + @ArticleID int, + @UserID int +AS + SELECT 1 +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.77.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.77.SqlDataProvider new file mode 100755 index 0000000..82616ac --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.77.SqlDataProvider @@ -0,0 +1,262 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int, + @RssGuid nvarchar(255), + @CustomFieldID int, + @CustomValue nvarchar(255), + @LinkFilter nvarchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate <= ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate <= GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate >= ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) +BEGIN + IF(@CategoryIDCount is not null) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + END + ELSE + BEGIN + IF( CHARINDEX('-1', @CategoryID) = 0 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ')) OR Article.ArticleID not in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories))' + END + END +END + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''%' + @Keywords + '%'' OR Article.Summary LIKE N''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE N''%' + @Keywords + '%'') > 0))' + +IF (@CustomFieldID is not null AND @CustomValue is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID IN (SELECT ArticleID FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue cv WHERE cv.customFieldID = ' + convert(nvarchar, @CustomFieldID) + ' AND cv.CustomValue LIKE N''%' + @CustomValue + '%'')' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +IF (@RssGuid is not null) + SELECT @strWhere = @strWhere + ' AND Article.RssGuid = N''' + @RssGuid + '''' + +IF (@LinkFilter is not null) + SELECT @strWhere = @strWhere + ' AND Article.Url = N''' + @LinkFilter + '''' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[FileCount], + Article.[ImageCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.81.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.81.SqlDataProvider new file mode 100755 index 0000000..9efa4bf --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.81.SqlDataProvider @@ -0,0 +1,257 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ADD + MetaTitle nvarchar(200) NULL, + MetaDescription nvarchar(500) NULL, + MetaKeywords nvarchar(500) NULL +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddCategory + @ModuleID int, + @ParentID int, + @Name nvarchar(255), + @Image nvarchar(255), + @Description ntext, + @SortOrder int, + @InheritSecurity bit, + @CategorySecurityType bit, + @MetaTitle nvarchar(200), + @MetaDescription nvarchar(500), + @MetaKeywords nvarchar(500) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category ( + [ModuleID], + [ParentID], + [Name], + [Image], + [Description], + [SortOrder], + [InheritSecurity], + [CategorySecurityType], + [MetaTitle], + [MetaDescription], + [MetaKeywords] +) VALUES ( + @ModuleID, + @ParentID, + @Name, + @Image, + @Description, + @SortOrder, + @InheritSecurity, + @CategorySecurityType, + @MetaTitle, + @MetaDescription, + @MetaKeywords +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateCategory + @CategoryID int, + @ModuleID int, + @ParentID int, + @Name nvarchar(255), + @Image nvarchar(255), + @Description ntext, + @SortOrder int, + @InheritSecurity bit, + @CategorySecurityType int, + @MetaTitle nvarchar(200), + @MetaDescription nvarchar(500), + @MetaKeywords nvarchar(500) +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category SET + [ModuleID] = @ModuleID, + [ParentID] = @ParentID, + [Name] = @Name, + [Image] = @Image, + [Description] = @Description, + [SortOrder] = @SortOrder, + [InheritSecurity] = @InheritSecurity, + [CategorySecurityType] = @CategorySecurityType, + [MetaTitle] = @MetaTitle, + [MetaDescription] = @MetaDescription, + [MetaKeywords] = @MetaKeywords +WHERE + [CategoryID] = @CategoryID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategory + @CategoryID int +AS + +SELECT + [CategoryID], + [ParentID], + [ModuleID], + [Name], + [Image], + [Description], + [SortOrder], + [InheritSecurity], + [CategorySecurityType], + [MetaTitle], + [MetaDescription], + [MetaKeywords] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [CategoryID] = @CategoryID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryList + @ModuleID int, + @ParentID int +AS + +SELECT + [CategoryID], + [ParentID], + [ModuleID], + [Name], + [Image], + [Description], + [SortOrder], + [InheritSecurity], + [CategorySecurityType], + [MetaTitle], + [MetaDescription], + [MetaKeywords] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category +WHERE + [ModuleID] = @ModuleID + AND + [ParentID] = @ParentID +ORDER BY + [SortOrder], [Name] +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @Current int, + @CategoryID varchar(255), + @AuthorID int, + @MaxDepth int, + @ShowPending bit, + @SortType int +AS + +SET NOCOUNT ON + +DECLARE @FilterID int +SET @FilterID = @Current + +DECLARE @level int, @line int + +CREATE TABLE #hierarchy(HierarchyID int IDENTITY (1,1), CategoryID int, level int) +CREATE TABLE #stack (item int, level int) +INSERT INTO #stack VALUES (@current, 1) +SELECT @level = 1 + +WHILE @level > 0 +BEGIN + IF EXISTS (SELECT * FROM #stack WHERE level = @level) + BEGIN + SELECT @current = item + FROM #stack + WHERE level = @level + + insert into #hierarchy(CategoryID, level) values(@current, @level) + + DELETE FROM #stack + WHERE level = @level + AND item = @current + + IF( @MaxDepth IS NULL OR @MaxDepth >= @level ) + BEGIN + IF( @SortType = 0 ) + BEGIN + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [SortOrder] DESC, [Name] DESC + END + ELSE + BEGIN + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [Name] DESC + END + IF @@ROWCOUNT > 0 + SELECT @level = @level + 1 + END + END + ELSE + SELECT @level = @level - 1 +END -- WHILE + +IF( @FilterID IS NOT NULL ) +BEGIN + DELETE FROM #hierarchy WHERE CategoryID = @FilterID +END + +DECLARE @strModuleID nvarchar(50) +SELECT @strModuleID = convert(varchar, @ModuleID) + +DECLARE @strCategoryId nvarchar(255) +IF (@CategoryId is not null) + SELECT @strCategoryId = ' AND c.CategoryID in (' + @CategoryID + ')' + +DECLARE @strAuthorId nvarchar(255) +IF (@authorId is not null) + SELECT @strAuthorId = ' AND a.AuthorID = ' + cast(@AuthorID as nvarchar) + +DECLARE @strPending nvarchar(2000) +IF (@ShowPending is null) + SELECT @strPending = ' AND (a.StartDate IS NULL OR a.StartDate < GetDate())' + +EXEC(' +SELECT + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE(''.'',(level-2)*2) + c.[Name] as ''NameIndented'', + c.[Image], + c.[Description], + c.[SortOrder], + c.[InheritSecurity], + c.[CategorySecurityType], + c.[MetaTitle], + c.[MetaDescription], + c.[MetaKeywords], + level-1 as ''Level'', + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a ON ac.ArticleID = a.ArticleID WHERE ac.CategoryID = c.CategoryID AND a.IsDraft = 0 AND a.IsApproved = 1 ' + @strAuthorId + @strPending + ') as ''NumberofArticles'', + (SELECT SUM(a.NumberOfViews) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac ON a.ArticleID = ac.ArticleID WHERE ac.CategoryID = c.CategoryID) as ''NumberofViews'' +FROM + #hierarchy h INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON h.CategoryID = c.CategoryID +WHERE + c.[ModuleID] = ' + @strModuleID + @strCategoryId + ' +ORDER BY + h.HierarchyID ASC') + +drop table #hierarchy +drop table #stack +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.84.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.84.SqlDataProvider new file mode 100755 index 0000000..6b82048 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.84.SqlDataProvider @@ -0,0 +1,105 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image +ADD Title2 nvarchar(100) +GO + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image +SET Title2 = Title +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image +DROP COLUMN Title +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image +ADD Title nvarchar(255) +GO + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image +SET Title = Title2 +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image +DROP COLUMN Title2 +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageAdd +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageAdd + @ArticleID int, + @Title nvarchar(255), + @FileName nvarchar(100), + @Extension nvarchar(100), + @Size int, + @Width int, + @Height int, + @ContentType nvarchar(200), + @Folder nvarchar(200), + @SortOrder int, + @ImageGuid nvarchar(50) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image ( + [ArticleID], + [Title], + [FileName], + [Extension], + [Size], + [Width], + [Height], + [ContentType], + [Folder], + [SortOrder], + [ImageGuid] +) VALUES ( + @ArticleID, + @Title, + @FileName, + @Extension, + @Size, + @Width, + @Height, + @ContentType, + @Folder, + @SortOrder, + @ImageGuid +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageUpdate +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageUpdate + @ImageID int, + @ArticleID int, + @Title nvarchar(255), + @FileName nvarchar(100), + @Extension nvarchar(100), + @Size int, + @Width int, + @Height int, + @ContentType nvarchar(200), + @Folder nvarchar(200), + @SortOrder int, + @ImageGuid nvarchar(50) +AS + +UPDATE + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image +SET + [ArticleID] = @ArticleID, + [Title] = @Title, + [FileName] = @FileName, + [Extension] = @Extension, + [Size] = @Size, + [Width] = @Width, + [Height] = @Height, + [ContentType] = @ContentType, + [Folder] = @Folder, + [SortOrder] = @SortOrder, + [ImageGuid] = @ImageGuid +WHERE + [ImageID] = @ImageID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.85.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.85.SqlDataProvider new file mode 100755 index 0000000..f69de7a --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.85.SqlDataProvider @@ -0,0 +1,39 @@ +CREATE NONCLUSTERED INDEX [_dta_index_{objectQualifier}DnnForge_NewsArticles_Page] ON {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page +( + [SortOrder] ASC, + [ArticleID] ASC +) ON [PRIMARY] +GO + +CREATE NONCLUSTERED INDEX [_dta_index_{objectQualifier}DnnForge_NewsArticles_Article] ON {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +( + [ModuleID] ASC, + [ArticleID] ASC, + [IsApproved] ASC, + [IsDraft] ASC, + [EndDate] ASC, + [StartDate] ASC +) ON [PRIMARY] +GO + +CREATE NONCLUSTERED INDEX [_dta_index_{objectQualifier}DnnForge_NewsArticles_Article_Category] ON {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories +( + [ArticleID] ASC, + [CategoryID] ASC +)ON [PRIMARY] +GO + +CREATE NONCLUSTERED INDEX [_dta_index_{objectQualifier}DnnForge_NewsArticles_Article_Views] ON {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +( + [ArticleID] ASC +) +INCLUDE ( [NumberOfViews]) ON [PRIMARY] +GO + +CREATE NONCLUSTERED INDEX [_dta_index_{objectQualifier}DnnForge_NewsArticles_Article_Status] ON {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +( + [ArticleID] ASC, + [IsDraft] ASC, + [IsApproved] ASC +)ON [PRIMARY] +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.87.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.87.SqlDataProvider new file mode 100755 index 0000000..95cfece --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.87.SqlDataProvider @@ -0,0 +1,271 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int, + @RssGuid nvarchar(255), + @CustomFieldID int, + @CustomValue nvarchar(255), + @LinkFilter nvarchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate <= ''' + convert(nvarchar, @CurrentDate) + ''' AND Article.StartDate <= GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' +END +ELSE +BEGIN + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + convert(nvarchar, @AgedDate) + '''' +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate >= ''' + convert(nvarchar, @CurrentDate) + ''')' +END + +IF (@CategoryId is not null) +BEGIN + IF(@CategoryIDCount is not null) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + END + ELSE + BEGIN + IF( CHARINDEX('-1', @CategoryID) = 0 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ')) OR Article.ArticleID not in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories))' + END + END +END + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) +BEGIN + IF( LEN(@Keywords) = 1 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''' + @Keywords + '%'')' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''%' + @Keywords + '%'' OR Article.Summary LIKE N''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE N''%' + @Keywords + '%'') > 0))' + END +END + +IF (@CustomFieldID is not null AND @CustomValue is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID IN (SELECT ArticleID FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue cv WHERE cv.customFieldID = ' + convert(nvarchar, @CustomFieldID) + ' AND cv.CustomValue LIKE N''%' + @CustomValue + '%'')' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +IF (@RssGuid is not null) + SELECT @strWhere = @strWhere + ' AND Article.RssGuid = N''' + @RssGuid + '''' + +IF (@LinkFilter is not null) + SELECT @strWhere = @strWhere + ' AND Article.Url = N''' + @LinkFilter + '''' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[FileCount], + Article.[ImageCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.88.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.88.SqlDataProvider new file mode 100755 index 0000000..0ce0468 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.88.SqlDataProvider @@ -0,0 +1,61 @@ +CREATE TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Mirror( + [ArticleID] [int] NOT NULL, + [LinkedArticleID] [int] NOT NULL, + [LinkedPortalID] [int] NOT NULL, + [AutoUpdate] [bit] NOT NULL, + CONSTRAINT [PK_{objectQualifier}DnnForge_NewsArticles_Mirror] PRIMARY KEY CLUSTERED +( + [ArticleID] ASC +) +) ON [PRIMARY] +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetMirrorArticle + @ArticleID int +AS + +SELECT + m.[ArticleID], + m.[LinkedArticleID], + m.[LinkedPortalID], + m.[AutoUpdate] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Mirror m +WHERE + m.[ArticleID] = @ArticleID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetMirrorArticleList + @LinkedArticleID int +AS + +SELECT + m.[ArticleID], + m.[LinkedArticleID], + m.[LinkedPortalID], + m.[AutoUpdate] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Mirror m +WHERE + m.[LinkedArticleID] = @LinkedArticleID +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddMirrorArticle + @ArticleID int, + @LinkedArticleID int, + @LinkedPortalID int, + @AutoUpdate bit +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Mirror ( + [ArticleID], + [LinkedArticleID], + [LinkedPortalID], + [AutoUpdate] +) VALUES ( + @ArticleID, + @LinkedArticleID, + @LinkedPortalID, + @AutoUpdate +) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.89.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.89.SqlDataProvider new file mode 100755 index 0000000..759d1ff --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.89.SqlDataProvider @@ -0,0 +1,21 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetMirrorArticleList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetMirrorArticleList + @LinkedArticleID int +AS + +SELECT + m.[ArticleID], + m.[LinkedArticleID], + m.[LinkedPortalID], + m.[AutoUpdate], + mo.[PortalID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Mirror m INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a ON m.ArticleID = a.ArticleID INNER JOIN + {databaseOwner}{objectQualifier}Modules mo ON a.ModuleID = mo.ModuleID +WHERE + m.[LinkedArticleID] = @LinkedArticleID +GO + \ No newline at end of file diff --git a/Providers/DataProvider/SqlDataProvider/00.07.96.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.96.SqlDataProvider new file mode 100755 index 0000000..7ea8171 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.96.SqlDataProvider @@ -0,0 +1,396 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int, + @RssGuid nvarchar(255), + @CustomFieldID int, + @CustomValue nvarchar(255), + @LinkFilter nvarchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate <= ''' + CONVERT(char(24), @CurrentDate, 126) + ''' AND Article.StartDate <= GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + CONVERT(char(24), @AgedDate, 126) + '''' +END +ELSE +BEGIN + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + CONVERT(char(24), @AgedDate, 126) + '''' +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate >= ''' + CONVERT(char(24), @CurrentDate, 126) + ''')' +END + +IF (@CategoryId is not null) +BEGIN + IF(@CategoryIDCount is not null) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + END + ELSE + BEGIN + IF( CHARINDEX('-1', @CategoryID) = 0 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ')) OR Article.ArticleID not in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories))' + END + END +END + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) +BEGIN + IF( LEN(@Keywords) = 1 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''' + @Keywords + '%'')' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''%' + @Keywords + '%'' OR Article.Summary LIKE N''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE N''%' + @Keywords + '%'') > 0))' + END +END + +IF (@CustomFieldID is not null AND @CustomValue is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID IN (SELECT ArticleID FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue cv WHERE cv.customFieldID = ' + convert(nvarchar, @CustomFieldID) + ' AND cv.CustomValue LIKE N''%' + @CustomValue + '%'')' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +IF (@RssGuid is not null) + SELECT @strWhere = @strWhere + ' AND Article.RssGuid = N''' + @RssGuid + '''' + +IF (@LinkFilter is not null) + SELECT @strWhere = @strWhere + ' AND Article.Url = N''' + @LinkFilter + '''' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[FileCount], + Article.[ImageCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive + @ModuleID int, + @CategoryID varchar(2000), + @CategoryIDExclude varchar(2000), + @AuthorID int, + @GroupBy varchar(255), + @ShowPending bit +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) +BEGIN + IF( CHARINDEX('-1', @CategoryID) = 0 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ')) OR Article.ArticleID not in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories))' + END +END + +IF (@CategoryIDExclude is not null) +BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID NOT IN (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' +END + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@ShowPending is null) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null or Article.StartDate < ''' + CONVERT(char(24), DateAdd(mi, 1, GetDate()), 126) + ''')' +END + +IF( @GroupBy = 'Month' ) +BEGIN +EXEC(' + select Month(StartDate) as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] + from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article + where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' + group by Year(StartDate), Month(StartDate) + order by [Year] desc, [Month] desc') +END +ELSE +BEGIN +EXEC(' + select 1 as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] + from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article + where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' + group by Year(StartDate) + order by [Year] desc') +END +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics + @ModuleID int, + @CategoryID varchar(2000), + @CategoryIDExclude varchar(2000), + @AuthorID int, + @SortBy varchar(255), + @ShowPending bit +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) +BEGIN + IF( CHARINDEX('-1', @CategoryID) = 0 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND Articles.ArticleID in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryID + '))' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Articles.ArticleID in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryID + ')) OR Articles.ArticleID not in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories))' + END +END + +IF (@CategoryIDExclude is not null) +BEGIN + SELECT @strWhere = @strWhere + ' AND Articles.ArticleID NOT IN (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' +END + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@ShowPending is null ) + SELECT @strWhere = @strWhere + ' AND (Articles.StartDate is null OR Articles.StartDate < ''' + CONVERT(char(24), DateAdd(mi, 1, GetDate()), 126) + ''')' + +EXEC(' +SELECT + UserID, UserName, DisplayName, FirstName, LastName, count(*) as ''ArticleCount'' +FROM + {databaseOwner}{objectQualifier}Users Users, {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Articles +where Articles.IsApproved = 1 and Articles.IsDraft = 0 and Users.UserID = Articles.AuthorID ' + + @strWhere + ' +GROUP BY + UserID, UserName, DisplayName, FirstName, LastName +ORDER BY ' + + @SortBy) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.97.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.97.SqlDataProvider new file mode 100755 index 0000000..dc76b87 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.97.SqlDataProvider @@ -0,0 +1,149 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image ADD + Description ntext NULL +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageAdd +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageAdd + @ArticleID int, + @Title nvarchar(255), + @FileName nvarchar(100), + @Extension nvarchar(100), + @Size int, + @Width int, + @Height int, + @ContentType nvarchar(200), + @Folder nvarchar(200), + @SortOrder int, + @ImageGuid nvarchar(50), + @Description ntext +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image ( + [ArticleID], + [Title], + [FileName], + [Extension], + [Size], + [Width], + [Height], + [ContentType], + [Folder], + [SortOrder], + [ImageGuid], + [Description] +) VALUES ( + @ArticleID, + @Title, + @FileName, + @Extension, + @Size, + @Width, + @Height, + @ContentType, + @Folder, + @SortOrder, + @ImageGuid, + @Description +) + +select SCOPE_IDENTITY() +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageGet +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageGet + @ImageID int +AS + +SELECT + ImageID, + ArticleID, + Title, + FileName, + Extension, + Size, + Width, + Height, + ContentType, + Folder, + SortOrder, + ImageGuid, + Description +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image +WHERE + ImageID = @ImageID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageList +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageList + @ArticleID int, + @ImageGuid nvarchar(50) +AS + +SELECT + ImageID, + ArticleID, + Title, + FileName, + Extension, + Size, + Width, + Height, + ContentType, + Folder, + SortOrder, + ImageGuid, + Description +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image +WHERE + (@ArticleID IS NULL OR ArticleID = @ArticleID) + AND + (@ImageGuid IS NULL OR ImageGuid = @ImageGuid) +ORDER BY + SortOrder +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageUpdate +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ImageUpdate + @ImageID int, + @ArticleID int, + @Title nvarchar(255), + @FileName nvarchar(100), + @Extension nvarchar(100), + @Size int, + @Width int, + @Height int, + @ContentType nvarchar(200), + @Folder nvarchar(200), + @SortOrder int, + @ImageGuid nvarchar(50), + @Description ntext +AS + +UPDATE + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image +SET + [ArticleID] = @ArticleID, + [Title] = @Title, + [FileName] = @FileName, + [Extension] = @Extension, + [Size] = @Size, + [Width] = @Width, + [Height] = @Height, + [ContentType] = @ContentType, + [Folder] = @Folder, + [SortOrder] = @SortOrder, + [ImageGuid] = @ImageGuid, + [Description] = @Description +WHERE + [ImageID] = @ImageID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.98.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.98.SqlDataProvider new file mode 100755 index 0000000..d3bbbcd --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.98.SqlDataProvider @@ -0,0 +1,402 @@ +CREATE NONCLUSTERED INDEX [_dta_index_{objectQualifier}DnnForge_NewsArticles_Articl_5_160719625__K2] ON {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories +( + [CategoryID] ASC +)WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY] +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int, + @RssGuid nvarchar(255), + @CustomFieldID int, + @CustomValue nvarchar(255), + @LinkFilter nvarchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate <= ''' + CONVERT(char(24), @CurrentDate, 126) + ''' AND Article.StartDate <= GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + CONVERT(char(24), @AgedDate, 126) + '''' +END +ELSE +BEGIN + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + CONVERT(char(24), @AgedDate, 126) + '''' +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate >= ''' + CONVERT(char(24), @CurrentDate, 126) + ''')' +END + +IF (@CategoryId is not null) +BEGIN + IF(@CategoryIDCount is not null) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + END + ELSE + BEGIN + IF( CHARINDEX('-1', @CategoryID) = 0 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ')) OR Article.ArticleID not in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories))' + END + END +END + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) +BEGIN + IF( LEN(@Keywords) = 1 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''' + @Keywords + '%'')' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''%' + @Keywords + '%'' OR Article.Summary LIKE N''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE N''%' + @Keywords + '%'') > 0) OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue cv where cv.ArticleID = Article.ArticleID and cv.CustomValue LIKE N''%' + @Keywords + '%'') > 0))' + END +END + +IF (@CustomFieldID is not null AND @CustomValue is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID IN (SELECT ArticleID FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue cv WHERE cv.customFieldID = ' + convert(nvarchar, @CustomFieldID) + ' AND cv.CustomValue LIKE N''%' + @CustomValue + '%'')' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +IF (@RssGuid is not null) + SELECT @strWhere = @strWhere + ' AND Article.RssGuid = N''' + @RssGuid + '''' + +IF (@LinkFilter is not null) + SELECT @strWhere = @strWhere + ' AND Article.Url = N''' + @LinkFilter + '''' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[FileCount], + Article.[ImageCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive + @ModuleID int, + @CategoryID varchar(2000), + @CategoryIDExclude varchar(2000), + @AuthorID int, + @GroupBy varchar(255), + @ShowPending bit +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) +BEGIN + IF( CHARINDEX('-1', @CategoryID) = 0 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ')) OR Article.ArticleID not in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories))' + END +END + +IF (@CategoryIDExclude is not null) +BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID NOT IN (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' +END + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@ShowPending is null) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null or Article.StartDate < ''' + CONVERT(char(24), DateAdd(mi, 1, GetDate()), 126) + ''')' +END + +IF( @GroupBy = 'Month' ) +BEGIN +EXEC(' + select Month(StartDate) as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] + from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article + where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' + group by Year(StartDate), Month(StartDate) + order by [Year] desc, [Month] desc') +END +ELSE +BEGIN +EXEC(' + select 1 as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] + from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article + where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' + group by Year(StartDate) + order by [Year] desc') +END +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics + @ModuleID int, + @CategoryID varchar(2000), + @CategoryIDExclude varchar(2000), + @AuthorID int, + @SortBy varchar(255), + @ShowPending bit +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) +BEGIN + IF( CHARINDEX('-1', @CategoryID) = 0 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND Articles.ArticleID in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryID + '))' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Articles.ArticleID in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryID + ')) OR Articles.ArticleID not in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories))' + END +END + +IF (@CategoryIDExclude is not null) +BEGIN + SELECT @strWhere = @strWhere + ' AND Articles.ArticleID NOT IN (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' +END + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@ShowPending is null ) + SELECT @strWhere = @strWhere + ' AND (Articles.StartDate is null OR Articles.StartDate < ''' + CONVERT(char(24), DateAdd(mi, 1, GetDate()), 126) + ''')' + +EXEC(' +SELECT + UserID, UserName, DisplayName, FirstName, LastName, count(*) as ''ArticleCount'' +FROM + {databaseOwner}{objectQualifier}Users Users, {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Articles +where Articles.IsApproved = 1 and Articles.IsDraft = 0 and Users.UserID = Articles.AuthorID ' + + @strWhere + ' +GROUP BY + UserID, UserName, DisplayName, FirstName, LastName +ORDER BY ' + + @SortBy) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.07.99.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.07.99.SqlDataProvider new file mode 100755 index 0000000..ee1f7f8 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.07.99.SqlDataProvider @@ -0,0 +1,396 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetArticleListBySearchCriteria + @ModuleID int, + @CurrentDate datetime, + @AgedDate datetime, + @CategoryID varchar(2000), + @CategoryIDCount int, + @CategoryIDExclude varchar(2000), + @MaxCount int, + @PageNumber int, + @PageSize int, + @SortBy varchar(50), + @SortDirection varchar(50), + @IsApproved bit, + @IsDraft bit, + @KeyWords nvarchar(255), + @AuthorID int, + @ShowPending bit, + @ShowExpired bit, + @ShowFeaturedOnly bit, + @ShowNotFeaturedOnly bit, + @ShowSecuredOnly bit, + @ShowNotSecuredOnly bit, + @ArticleIDs varchar(255), + @TagID varchar(2000), + @TagIDCount int, + @RssGuid nvarchar(255), + @CustomFieldID int, + @CustomValue nvarchar(255), + @LinkFilter nvarchar(255) +AS + +-- Form Where Query + +DECLARE @strWhere nvarchar(4000) +SELECT @strWhere = 'Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF( @CurrentDate is null ) + SELECT @CurrentDate = GetDate() + +IF( @ShowPending is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null OR (Article.StartDate <= ''' + CONVERT(char(24), @CurrentDate, 126) + ''' AND Article.StartDate <= GetDate()))' + + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + CONVERT(char(24), @AgedDate, 126) + '''' +END +ELSE +BEGIN + IF( @AgedDate is not null ) + SELECT @strWhere = @strWhere + ' AND Article.StartDate >= ''' + CONVERT(char(24), @AgedDate, 126) + '''' +END + +IF( @ShowExpired is null ) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.EndDate is null OR Article.EndDate >= ''' + CONVERT(char(24), @CurrentDate, 126) + ''')' +END + +IF (@CategoryId is not null) +BEGIN + IF(@CategoryIDCount is not null) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ') group by articleID having count(*) > ' + convert(nvarchar, @CategoryIDCount) + ')' + END + ELSE + BEGIN + IF( CHARINDEX('-1', @CategoryID) = 0 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ')) OR Article.ArticleID not in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories))' + END + END +END + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@CategoryIDExclude is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID not in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@IsApproved = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 1' + +IF (@IsApproved = 0 ) + SELECT @strWhere = @strWhere + ' AND Article.IsApproved = 0' + +IF (@IsDraft = 0) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 0' + +IF (@IsDraft = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsDraft = 1' + +IF (@ShowFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 1' + +IF (@ShowNotFeaturedOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsFeatured = 0' + +IF (@ShowSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 1' + +IF (@ShowNotSecuredOnly = 1 ) + SELECT @strWhere = @strWhere + ' AND Article.IsSecure = 0' + +IF (@Keywords is not null) +BEGIN + IF( LEN(@Keywords) = 1 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''' + @Keywords + '%'')' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.Title LIKE N''%' + @Keywords + '%'' OR Article.Summary LIKE N''%' + @Keywords + '%'' OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = Article.ArticleID and Page.PageText LIKE N''%' + @Keywords + '%'') > 0) OR ((select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue cv where cv.ArticleID = Article.ArticleID and cv.CustomValue LIKE N''%' + @Keywords + '%'') > 0))' + END +END + +IF (@CustomFieldID is not null AND @CustomValue is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID IN (SELECT ArticleID FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_CustomValue cv WHERE cv.customFieldID = ' + convert(nvarchar, @CustomFieldID) + ' AND cv.CustomValue LIKE N''%' + @CustomValue + '%'')' + +IF (@ArticleIDs is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in (' + @ArticleIDs + ')' + +IF (@SortBy = 'Title') + SELECT @SortBy = 'Article.Title' + +IF (@SortBy = 'IsFeatured DESC, Title') + SELECT @SortBy = 'IsFeatured DESC, Article.Title' + +IF (@TagID is not null) + if(@TagIDCount is not null) + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + ') group by articleID having count(*) > ' + convert(nvarchar, @TagIDCount) + ')' + else + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag.TagID in (' + @TagID + '))' + +IF (@RssGuid is not null) + SELECT @strWhere = @strWhere + ' AND Article.RssGuid = N''' + @RssGuid + '''' + +IF (@LinkFilter is not null) + SELECT @strWhere = @strWhere + ' AND Article.Url = N''' + @LinkFilter + '''' + +-- Set Paging Options + +IF( @PageNumber is null ) + SET @PageNumber = 1 + +IF( @PageSize is null ) + SET @PageSize = 100 + +SET @PageNumber = @PageNumber - 1 + +DECLARE @startRowIndex int +SET @startRowIndex = (@PageNumber * @PageSize) + +DECLARE @maxRow int +SET @maxRow = (@startRowIndex + @PageSize) +IF( @MaxCount is not null ) +BEGIN + IF( @MaxCount < @MaxRow ) + BEGIN + SET ROWCOUNT @MaxCount + END + ELSE + BEGIN + SET ROWCOUNT @maxRow + END +END +ELSE +BEGIN + SET ROWCOUNT @maxRow +END + +-- Create Temporary Table + +CREATE TABLE #TempItems +( + ID int IDENTITY, + ArticleID int +) + +EXEC(' +INSERT INTO #TempItems (ArticleID) +SELECT + Article.[ArticleID] +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID +WHERE ' + + @strWhere + ' +ORDER BY + ' + @SortBy + ' ' + @SortDirection) + +SET ROWCOUNT 0 + +SELECT + Article.[ArticleID], + Article.[AuthorID], + Article.[ApproverID], + Article.[CreatedDate], + Article.[LastUpdate], + Article.[Title], + Article.[Summary], + Article.[IsApproved], + Article.[NumberOfViews], + Article.[StartDate], + Article.[EndDate], + Article.[ModuleID], + Article.[IsFeatured], + Article.[ImageUrl], + Article.[LastUpdateID], + Article.[IsSecure], + Article.[IsNewWindow], + Article.[ImageUrl], + Article.[Url], + Article.[PageCount], + Article.[CommentCount], + Article.[Rating], + Article.[RatingCount], + Article.[FileCount], + Article.[ImageCount], + Article.[MetaTitle], + Article.[MetaDescription], + Article.[MetaKeywords], + Article.[PageHeadText], + Article.[ShortUrl], + Article.[RssGuid], + Author.[Email] as AuthorEmail, + Author.[UserName] as AuthorUserName, + Author.[FirstName] as AuthorFirstName, + Author.[LastName] as AuthorLastName, + Author.[DisplayName] as AuthorDisplayName, + Updated.[Email] as LastUpdateEmail, + Updated.[UserName] as LastUpdateUserName, + Updated.[FirstName] as LastUpdateFirstName, + Updated.[LastName] as LastUpdateLastName, + Updated.[DisplayName] as LastUpdateDisplayName, + Page.PageText as 'Body', + {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags(Article.[ArticleID]) as 'Tags' + +FROM + #TempItems t INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article ON t.ArticleID = Article.ArticleID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page on Page.ArticleID = Article.ArticleID AND Page.SortOrder = 0 LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Author ON Article.AuthorID = Author.UserID LEFT OUTER JOIN + {databaseOwner}{objectQualifier}Users Updated ON Article.LastUpdateID = Updated.UserID + +WHERE + ID > @startRowIndex + +ORDER BY + ID + +DROP TABLE #TempItems + +EXEC(' +SELECT + COUNT(Article.ArticleID) as ''TotalRecords'' +FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Article +WHERE ' + + @strWhere ) +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetNewsArchive + @ModuleID int, + @CategoryID varchar(2000), + @CategoryIDExclude varchar(2000), + @AuthorID int, + @GroupBy varchar(255), + @ShowPending bit +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Article.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) +BEGIN + IF( CHARINDEX('-1', @CategoryID) = 0 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + '))' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.ArticleID in ( select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories where {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.ArticleID = Article.ArticleID and {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories.CategoryID in (' + @CategoryID + ')) OR Article.ArticleID not in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories))' + END +END + +IF (@CategoryIDExclude is not null) +BEGIN + SELECT @strWhere = @strWhere + ' AND Article.ArticleID NOT IN (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' +END + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Article.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@ShowPending is null) +BEGIN + SELECT @strWhere = @strWhere + ' AND (Article.StartDate is null or Article.StartDate < ''' + CONVERT(char(24), DateAdd(mi, 1, GetDate()), 126) + ''')' +END + +IF( @GroupBy = 'Month' ) +BEGIN +EXEC(' + select Month(StartDate) as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] + from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article + where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' + group by Year(StartDate), Month(StartDate) + order by [Year] desc, [Month] desc') +END +ELSE +BEGIN +EXEC(' + select 1 as [Month], Year(StartDate) as [Year], 1 as Day, Count(*) as [Count] + from {databaseOwner}{objectQualifier}dnnforge_newsarticles_article Article + where IsApproved = 1 and IsDraft = 0 ' + + @strWhere + ' + group by Year(StartDate) + order by [Year] desc') +END +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetAuthorStatistics + @ModuleID int, + @CategoryID varchar(2000), + @CategoryIDExclude varchar(2000), + @AuthorID int, + @SortBy varchar(255), + @ShowPending bit +AS + +DECLARE @strTop nvarchar(2000) +DECLARE @strWhere nvarchar(2000) + +SELECT @strTop = '' +SELECT @strWhere = '' + +IF (@ModuleID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.ModuleID = ' + convert(nvarchar, @ModuleId) + +IF (@CategoryId is not null) +BEGIN + IF( CHARINDEX('-1', @CategoryID) = 0 ) + BEGIN + SELECT @strWhere = @strWhere + ' AND Articles.ArticleID in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryID + '))' + END + ELSE + BEGIN + SELECT @strWhere = @strWhere + ' AND (Articles.ArticleID in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryID + ')) OR Articles.ArticleID not in (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories))' + END +END + +IF (@CategoryIDExclude is not null) +BEGIN + SELECT @strWhere = @strWhere + ' AND Articles.ArticleID NOT IN (select ArticleID from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ArticleCategories where ArticleCategories.CategoryID in (' + @CategoryIDExclude + '))' +END + +IF (@AuthorID is not null) + SELECT @strWhere = @strWhere + ' AND Articles.AuthorID = ' + convert(nvarchar, @AuthorID) + +IF (@ShowPending is null ) + SELECT @strWhere = @strWhere + ' AND (Articles.StartDate is null OR Articles.StartDate < ''' + CONVERT(char(24), DateAdd(mi, 1, GetDate()), 126) + ''')' + +EXEC(' +SELECT + UserID, UserName, DisplayName, FirstName, LastName, count(*) as ''ArticleCount'' +FROM + {databaseOwner}{objectQualifier}Users Users, {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article Articles +where Articles.IsApproved = 1 and Articles.IsDraft = 0 and Users.UserID = Articles.AuthorID ' + + @strWhere + ' +GROUP BY + UserID, UserName, DisplayName, FirstName, LastName +ORDER BY ' + + @SortBy) +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.08.00.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.08.00.SqlDataProvider new file mode 100755 index 0000000..5cdaf0f --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.08.00.SqlDataProvider @@ -0,0 +1,114 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @Current int, + @CategoryID varchar(255), + @AuthorID int, + @MaxDepth int, + @ShowPending bit, + @SortType int +AS + +SET NOCOUNT ON + +DECLARE @FilterID int +SET @FilterID = @Current + +DECLARE @level int, @line int + +CREATE TABLE #hierarchy(HierarchyID int IDENTITY (1,1), CategoryID int, level int) +CREATE TABLE #stack (StackID int IDENTITY (1,1), item int, level int) +INSERT INTO #stack VALUES (@current, 1) +SELECT @level = 1 + +WHILE @level > 0 +BEGIN + IF EXISTS (SELECT TOP 1 * FROM #stack WHERE level = @level ORDER BY StackID) + BEGIN + SELECT @current = item + FROM #stack + WHERE level = @level + + insert into #hierarchy(CategoryID, level) values(@current, @level) + + DELETE FROM #stack + WHERE level = @level + AND item = @current + + IF( @MaxDepth IS NULL OR @MaxDepth >= @level ) + BEGIN + IF( @SortType = 0 ) + BEGIN + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [SortOrder] DESC, [Name] DESC + END + ELSE + BEGIN + INSERT #stack + SELECT CategoryID, @level + 1 + FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE ParentID = @current and ModuleID = @ModuleID + ORDER BY [Name] DESC + END + IF @@ROWCOUNT > 0 + SELECT @level = @level + 1 + END + END + ELSE + SELECT @level = @level - 1 +END -- WHILE + +IF( @FilterID IS NOT NULL ) +BEGIN + DELETE FROM #hierarchy WHERE CategoryID = @FilterID +END + +DECLARE @strModuleID nvarchar(50) +SELECT @strModuleID = convert(varchar, @ModuleID) + +DECLARE @strCategoryId nvarchar(255) +IF (@CategoryId is not null) + SELECT @strCategoryId = ' AND c.CategoryID in (' + @CategoryID + ')' + +DECLARE @strAuthorId nvarchar(255) +IF (@authorId is not null) + SELECT @strAuthorId = ' AND a.AuthorID = ' + cast(@AuthorID as nvarchar) + +DECLARE @strPending nvarchar(2000) +IF (@ShowPending is null) + SELECT @strPending = ' AND (a.StartDate IS NULL OR a.StartDate < GetDate())' + +EXEC(' +SELECT + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE(''.'',(level-2)*2) + c.[Name] as ''NameIndented'', + c.[Image], + c.[Description], + c.[SortOrder], + c.[InheritSecurity], + c.[CategorySecurityType], + c.[MetaTitle], + c.[MetaDescription], + c.[MetaKeywords], + level-1 as ''Level'', + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a ON ac.ArticleID = a.ArticleID WHERE ac.CategoryID = c.CategoryID AND a.IsDraft = 0 AND a.IsApproved = 1 ' + @strAuthorId + @strPending + ') as ''NumberofArticles'', + (SELECT SUM(a.NumberOfViews) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac ON a.ArticleID = ac.ArticleID WHERE ac.CategoryID = c.CategoryID) as ''NumberofViews'' +FROM + #hierarchy h INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON h.CategoryID = c.CategoryID +WHERE + c.[ModuleID] = ' + @strModuleID + @strCategoryId + ' +ORDER BY + h.HierarchyID ASC') + +drop table #hierarchy +drop table #stack +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.08.04.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.08.04.SqlDataProvider new file mode 100755 index 0000000..1229535 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.08.04.SqlDataProvider @@ -0,0 +1,134 @@ +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdateArticleCount + @ArticleID int, + @NumberOfViews int +AS + UPDATE + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article + SET + [NumberOfViews] = @NumberOfViews + WHERE + [ArticleID] = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @AuthorID int, + @ShowPending bit, + @SortType int +AS + +;WITH CategoryHierarchy AS +( + SELECT + CategoryID, + ParentID, + CONVERT(nvarchar(max), Name) AS Path, + 1 as level, + SortOrder * (CONVERT(bigint, '1' + REPLICATE('0', 10))) AS 'SortOrderCount' + FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE + ParentID = -1 + AND + ModuleID = @ModuleID + + UNION ALL + + SELECT + TH.CategoryID, + TH.ParentID, + CONVERT(nvarchar(max), CategoryHierarchy.Path + ' \ ' + TH.Name) AS Path, + level = level + 1, + CategoryHierarchy.SortOrderCount + (CONVERT(bigint, CONVERT(varchar, TH.SortOrder) + REPLICATE('0', 10-level))) AS 'SortOrderCount' + FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category TH INNER JOIN + CategoryHierarchy ON CategoryHierarchy.CategoryID = TH.ParentID +) + +SELECT + SortOrderCount, + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE('.',(level-1)*2) + c.[Name] as 'NameIndented', + c.[Image], + c.[Description], + c.[SortOrder], + c.[InheritSecurity], + c.[CategorySecurityType], + c.[MetaTitle], + c.[MetaDescription], + c.[MetaKeywords], + ch.[level], + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a ON ac.ArticleID = a.ArticleID WHERE ac.CategoryID = c.CategoryID AND a.IsDraft = 0 AND a.IsApproved = 1 AND (@authorId IS NULL OR a.AuthorID = @authorID) AND (@ShowPending IS NOT NULL OR (a.StartDate IS NULL OR a.StartDate < GetDate()))) as 'NumberofArticles' +FROM + CategoryHierarchy ch INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON ch.CategoryID = c.CategoryID +ORDER BY + CASE WHEN @SortType = 0 THEN CAST(ch.SortOrderCount AS VARCHAR) ELSE ch.Path END +GO + +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page +ALTER COLUMN PageText nvarchar(max) +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddPage +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddPage + @ArticleID int, + @Title nvarchar(255), + @PageText nvarchar(max), + @SortOrder int +AS + +declare @count int + +select @count = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page where ArticleID = @ArticleID) + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page ( + [ArticleID], + [Title], + [PageText], + [SortOrder] +) VALUES ( + @ArticleID, + @Title, + @PageText, + @count +) + +select SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = @ArticleID +GO + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdatePage +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_UpdatePage + @PageID int, + @ArticleID int, + @Title nvarchar(255), + @PageText nvarchar(max), + @SortOrder int +AS + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page SET + [ArticleID] = @ArticleID, + [Title] = @Title, + [PageText] = @PageText, + [SortOrder] = @SortOrder +WHERE + [PageID] = @PageID + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = @ArticleID +GO diff --git a/Providers/DataProvider/SqlDataProvider/00.08.05.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.08.05.SqlDataProvider new file mode 100755 index 0000000..9f700b0 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.08.05.SqlDataProvider @@ -0,0 +1,62 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @AuthorID int, + @ShowPending bit, + @SortType int +AS + +;WITH CategoryHierarchy AS +( + SELECT + CategoryID, + ParentID, + CONVERT(nvarchar(max), Name) AS Path, + 1 as level, + (SortOrder+1) * (CONVERT(bigint, '1' + REPLICATE('0', 10))) AS 'SortOrderCount' + FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE + ParentID = -1 + AND + ModuleID = @ModuleID + + UNION ALL + + SELECT + TH.CategoryID, + TH.ParentID, + CONVERT(nvarchar(max), CategoryHierarchy.Path + ' \ ' + TH.Name) AS Path, + level = level + 1, + CategoryHierarchy.SortOrderCount + (CONVERT(bigint, CONVERT(varchar, TH.SortOrder) + REPLICATE('0', 10-level))) AS 'SortOrderCount' + FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category TH INNER JOIN + CategoryHierarchy ON CategoryHierarchy.CategoryID = TH.ParentID +) + +SELECT + SortOrderCount, + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE('.',(level-1)*2) + c.[Name] as 'NameIndented', + c.[Image], + c.[Description], + c.[SortOrder], + c.[InheritSecurity], + c.[CategorySecurityType], + c.[MetaTitle], + c.[MetaDescription], + c.[MetaKeywords], + ch.[level], + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a ON ac.ArticleID = a.ArticleID WHERE ac.CategoryID = c.CategoryID AND a.IsDraft = 0 AND a.IsApproved = 1 AND (@authorId IS NULL OR a.AuthorID = @authorID) AND (@ShowPending IS NOT NULL OR (a.StartDate IS NULL OR a.StartDate < GetDate()))) as 'NumberofArticles' +FROM + CategoryHierarchy ch INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON ch.CategoryID = c.CategoryID +ORDER BY + CASE WHEN @SortType = 0 THEN CAST(ch.SortOrderCount AS VARCHAR) ELSE ch.Path END +GO + diff --git a/Providers/DataProvider/SqlDataProvider/00.08.06.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.08.06.SqlDataProvider new file mode 100755 index 0000000..e0798c0 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.08.06.SqlDataProvider @@ -0,0 +1,62 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @AuthorID int, + @ShowPending bit, + @SortType int +AS + +;WITH CategoryHierarchy AS +( + SELECT + CategoryID, + ParentID, + CONVERT(nvarchar(max), Name) AS Path, + 1 as level, + (SortOrder+1) * (CONVERT(bigint, '1' + REPLICATE('0', 10))) AS 'SortOrderCount' + FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE + ParentID = -1 + AND + ModuleID = @ModuleID + + UNION ALL + + SELECT + TH.CategoryID, + TH.ParentID, + CONVERT(nvarchar(max), CategoryHierarchy.Path + ' \ ' + TH.Name) AS Path, + level = level + 1, + CategoryHierarchy.SortOrderCount + (CONVERT(bigint, CONVERT(varchar, (TH.SortOrder+1)) + REPLICATE('0', 10-(level*2)))) AS 'SortOrderCount' + FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category TH INNER JOIN + CategoryHierarchy ON CategoryHierarchy.CategoryID = TH.ParentID +) + +SELECT + SortOrderCount, + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE('.',(level-1)*2) + c.[Name] as 'NameIndented', + c.[Image], + c.[Description], + c.[SortOrder], + c.[InheritSecurity], + c.[CategorySecurityType], + c.[MetaTitle], + c.[MetaDescription], + c.[MetaKeywords], + ch.[level], + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a ON ac.ArticleID = a.ArticleID WHERE ac.CategoryID = c.CategoryID AND a.IsDraft = 0 AND a.IsApproved = 1 AND (@authorId IS NULL OR a.AuthorID = @authorID) AND (@ShowPending IS NOT NULL OR (a.StartDate IS NULL OR a.StartDate < GetDate()))) as 'NumberofArticles' +FROM + CategoryHierarchy ch INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON ch.CategoryID = c.CategoryID +ORDER BY + CASE WHEN @SortType = 0 THEN CAST(ch.SortOrderCount AS VARCHAR) ELSE ch.Path END +GO + diff --git a/Providers/DataProvider/SqlDataProvider/00.09.02.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.09.02.SqlDataProvider new file mode 100755 index 0000000..0658855 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.09.02.SqlDataProvider @@ -0,0 +1,109 @@ + +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddArticle + @AuthorID int, + @ApproverID int, + @CreatedDate datetime, + @LastUpdate datetime, + @Title nvarchar(255), + @Summary ntext, + @IsApproved bit, + @NumberOfViews int, + @IsDraft bit, + @StartDate DateTime, + @EndDate DateTime, + @ModuleID int, + @ImageUrl nvarchar(255), + @IsFeatured bit, + @LastUpdateID int, + @Url nvarchar(255), + @IsSecure bit, + @IsNewWindow bit, + @MetaTitle nvarchar(200), + @MetaDescription nvarchar(500), + @MetaKeywords nvarchar(500), + @PageHeadText nvarchar(500), + @ShortUrl nvarchar(50), + @RssGuid nvarchar(255) +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article ( + [AuthorID], + [ApproverID], + [CreatedDate], + [LastUpdate], + [Title], + [Summary], + [IsApproved], + [NumberOfViews], + [IsDraft], + [StartDate], + [EndDate], + [ModuleID], + [ImageUrl], + [IsFeatured], + [LastUpdateID], + [Url], + [IsSecure], + [IsNewWindow], + [MetaTitle], + [MetaDescription], + [MetaKeywords], + [PageHeadText], + [ShortUrl], + [RssGuid] +) VALUES ( + @AuthorID, + @ApproverID, + @CreatedDate, + @LastUpdate, + @Title, + @Summary, + @IsApproved, + @NumberOfViews, + @IsDraft, + @StartDate, + @EndDate, + @ModuleID, + @ImageUrl, + @IsFeatured, + @LastUpdateID, + @Url, + @IsSecure, + @IsNewWindow, + @MetaTitle, + @MetaDescription, + @MetaKeywords, + @PageHeadText, + @ShortUrl, + @RssGuid +) + +select SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [PageCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Page Page where Page.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE ArticleID = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [Rating] = (select AVG(rating) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [RatingCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Rating Rating where Rating.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [ImageCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Image i where i.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [FileCount] = (select COUNT(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_File f where f.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID) +WHERE [ArticleID] = SCOPE_IDENTITY() +GO \ No newline at end of file diff --git a/Providers/DataProvider/SqlDataProvider/00.09.05.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.09.05.SqlDataProvider new file mode 100755 index 0000000..c8f499c --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.09.05.SqlDataProvider @@ -0,0 +1,71 @@ +ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_HandoutArticle ADD CONSTRAINT + PK_{objectQualifier}DnnForge_NewsArticles_HandoutArticle PRIMARY KEY CLUSTERED + ( + HandoutID, + ArticleID + ) ON [PRIMARY] + +GO + +ALTER PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_AddComment + @ArticleID int, + @CreatedDate datetime, + @UserID int, + @Comment ntext, + @RemoteAddress nvarchar(50) , + @Type int, + @TrackbackUrl nvarchar(255), + @TrackbackTitle nvarchar(255), + @TrackbackBlogName nvarchar(255), + @TrackbackExcerpt ntext, + @AnonymousName nvarchar(255), + @AnonymousEmail nvarchar(255), + @AnonymousURL nvarchar(255), + @NotifyMe bit, + @IsApproved bit, + @ApprovedBy int +AS + +INSERT INTO {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment ( + [ArticleID], + [CreatedDate], + [UserID], + [Comment], + [RemoteAddress], + [Type], + [TrackbackUrl], + [TrackbackTitle], + [TrackbackBlogName], + [TrackbackExcerpt], + [AnonymousName], + [AnonymousEmail], + [AnonymousURL], + [NotifyMe], + [IsApproved], + [ApprovedBy] +) VALUES ( + @ArticleID, + @CreatedDate, + @UserID, + @Comment, + @RemoteAddress, + @Type, + @TrackbackUrl, + @TrackbackTitle, + @TrackbackBlogName, + @TrackbackExcerpt, + @AnonymousName, + @AnonymousEmail, + @AnonymousURL, + @NotifyMe, + @IsApproved, + @ApprovedBy +) + +select SCOPE_IDENTITY() + +UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article +SET [CommentCount] = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Comment Comment where Comment.ArticleID = {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article.ArticleID and Comment.IsApproved = 1) +WHERE ArticleID = @ArticleID +GO + diff --git a/Providers/DataProvider/SqlDataProvider/00.09.11.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/00.09.11.SqlDataProvider new file mode 100755 index 0000000..0cd4155 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/00.09.11.SqlDataProvider @@ -0,0 +1,61 @@ +DROP PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_GetCategoryListAll + @ModuleID int, + @AuthorID int, + @ShowPending bit, + @SortType int +AS + +;WITH CategoryHierarchy AS +( + SELECT + CategoryID, + ParentID, + CONVERT(nvarchar(max), Name) AS Path, + 1 as level, + (SortOrder+1) * (CONVERT(bigint, '1' + REPLICATE('0', 15))) AS 'SortOrderCount' + FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category + WHERE + ParentID = -1 + AND + ModuleID = @ModuleID + + UNION ALL + + SELECT + TH.CategoryID, + TH.ParentID, + CONVERT(nvarchar(max), CategoryHierarchy.Path + ' \ ' + TH.Name) AS Path, + level = level + 1, + CategoryHierarchy.SortOrderCount + 1 + (CONVERT(bigint, CONVERT(varchar, TH.SortOrder) + REPLICATE('0', 15-level*2))) AS 'SortOrderCount' + FROM + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category TH INNER JOIN + CategoryHierarchy ON CategoryHierarchy.CategoryID = TH.ParentID +) + +SELECT + SortOrderCount, + c.[CategoryID], + c.[ParentID], + c.[ModuleID], + c.[Name], + REPLICATE('.',(level-1)*2) + c.[Name] as 'NameIndented', + c.[Image], + c.[Description], + c.[SortOrder], + c.[InheritSecurity], + c.[CategorySecurityType], + c.[MetaTitle], + c.[MetaDescription], + c.[MetaKeywords], + ch.[level], + (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleCategories ac INNER JOIN {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Article a ON ac.ArticleID = a.ArticleID WHERE ac.CategoryID = c.CategoryID AND a.IsDraft = 0 AND a.IsApproved = 1 AND (@authorId IS NULL OR a.AuthorID = @authorID) AND (@ShowPending IS NOT NULL OR (a.StartDate IS NULL OR a.StartDate < GetDate()))) as 'NumberofArticles' +FROM + CategoryHierarchy ch INNER JOIN + {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Category c ON ch.CategoryID = c.CategoryID +ORDER BY + CASE WHEN @SortType = 0 THEN CAST(ch.SortOrderCount AS VARCHAR) ELSE ch.Path END +GO \ No newline at end of file diff --git a/Providers/DataProvider/SqlDataProvider/My Project/AssemblyInfo.vb b/Providers/DataProvider/SqlDataProvider/My Project/AssemblyInfo.vb new file mode 100755 index 0000000..249403e --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/My Project/AssemblyInfo.vb @@ -0,0 +1,34 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + + diff --git a/Providers/DataProvider/SqlDataProvider/SqlDataProvider.vb b/Providers/DataProvider/SqlDataProvider/SqlDataProvider.vb new file mode 100755 index 0000000..16049d2 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/SqlDataProvider.vb @@ -0,0 +1,585 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2005 +' by Scott McCulloch ( smcculloch@iinet.net.au ) ( http://www.smcculloch.net ) +' + +Imports System +Imports System.Configuration +Imports System.Data +Imports Microsoft.ApplicationBlocks.Data + +Imports DotNetNuke +Imports DotNetNuke.Common.Utilities +Imports System.Web.UI.WebControls + +Namespace Ventrian.NewsArticles + + Public Class SqlDataProvider + + Inherits DataProvider + +#Region " Private Members " + + Private Const ProviderType As String = "data" + + Private _providerConfiguration As Framework.Providers.ProviderConfiguration = Framework.Providers.ProviderConfiguration.GetProviderConfiguration(ProviderType) + Private _connectionString As String + Private _providerPath As String + Private _objectQualifier As String + Private _databaseOwner As String + +#End Region + +#Region " Constructors " + + Public Sub New() + + ' Read the configuration specific information for this provider + Dim objProvider As Framework.Providers.Provider = CType(_providerConfiguration.Providers(_providerConfiguration.DefaultProvider), Framework.Providers.Provider) + + _connectionString = DotNetNuke.Common.Utilities.Config.GetConnectionString() + + _providerPath = objProvider.Attributes("providerPath") + + _objectQualifier = objProvider.Attributes("objectQualifier") + If _objectQualifier <> "" And _objectQualifier.EndsWith("_") = False Then + _objectQualifier += "_" + End If + + _databaseOwner = objProvider.Attributes("databaseOwner") + If _databaseOwner <> "" And _databaseOwner.EndsWith(".") = False Then + _databaseOwner += "." + End If + + End Sub + +#End Region + +#Region " Properties " + + Public ReadOnly Property ConnectionString() As String + Get + Return _connectionString + End Get + End Property + + Public ReadOnly Property ProviderPath() As String + Get + Return _providerPath + End Get + End Property + + Public ReadOnly Property ObjectQualifier() As String + Get + Return _objectQualifier + End Get + End Property + + Public ReadOnly Property DatabaseOwner() As String + Get + Return _databaseOwner + End Get + End Property + +#End Region + +#Region " Public Methods " + + Private Function GetNull(ByVal Field As Object) As Object + Return DotNetNuke.Common.Utilities.Null.GetNull(Field, DBNull.Value) + End Function + +#Region " Article Methods " + + Public Overrides Function GetArticleListByApproved(ByVal moduleID As Integer, ByVal isApproved As Boolean) As IDataReader + If (isApproved) Then + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetArticleListBySearchCriteria", GetNull(moduleID), DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, isApproved, False, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, "StartDate", "DESC", DBNull.Value, DBNull.Value), IDataReader) + Else + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetArticleListBySearchCriteria", GetNull(moduleID), DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, isApproved, False, DBNull.Value, DBNull.Value, True, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, "StartDate", "DESC", DBNull.Value, DBNull.Value), IDataReader) + End If + + End Function + + Public Overrides Function GetArticleListBySearchCriteria(ByVal moduleID As Integer, ByVal currentDate As DateTime, ByVal agedDate As DateTime, ByVal categoryID As Integer(), ByVal matchAll As Boolean, ByVal categoryIDExclude As Integer(), ByVal maxCount As Integer, ByVal pageNumber As Integer, ByVal pageSize As Integer, ByVal sortBy As String, ByVal sortDirection As String, ByVal isApproved As Boolean, ByVal isDraft As Boolean, ByVal keywords As String, ByVal authorID As Integer, ByVal showPending As Boolean, ByVal showExpired As Boolean, ByVal showFeaturedOnly As Boolean, ByVal showNotFeaturedOnly As Boolean, ByVal showSecuredOnly As Boolean, ByVal showNotSecuredOnly As Boolean, ByVal articleIDs As String, ByVal tagID As Integer(), ByVal matchAllTag As Boolean, ByVal rssGuid As String, ByVal customFieldID As Integer, ByVal customValue As String, ByVal linkFilter As String) As IDataReader + Dim categories As String = DotNetNuke.Common.Utilities.Null.NullString + Dim categoryIDCount As Integer = Null.NullInteger + + If Not (categoryID Is Nothing) Then + For Each category As Integer In categoryID + If Not (categories = DotNetNuke.Common.Utilities.Null.NullString) Then + categories = categories & "," + End If + categories = categories & category.ToString() + Next + + If (matchAll) Then + categoryIDCount = categoryID.Length - 1 + End If + End If + + Dim tags As String = DotNetNuke.Common.Utilities.Null.NullString + Dim tagIDCount As Integer = Null.NullInteger + + If Not (tagID Is Nothing) Then + For Each tag As Integer In tagID + If Not (tags = DotNetNuke.Common.Utilities.Null.NullString) Then + tags = tags & "," + End If + tags = tags & tag.ToString() + Next + + If (matchAllTag) Then + tagIDCount = tagID.Length - 1 + End If + End If + + Dim categoriesExclude As String = DotNetNuke.Common.Utilities.Null.NullString + If Not (categoryIDExclude Is Nothing) Then + For Each category As Integer In categoryIDExclude + If Not (categoriesExclude = DotNetNuke.Common.Utilities.Null.NullString) Then + categoriesExclude = categoriesExclude & "," + End If + categoriesExclude = categoriesExclude & category.ToString() + Next + End If + + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetArticleListBySearchCriteria", moduleID, GetNull(currentDate), GetNull(agedDate), GetNull(categories), GetNull(categoryIDCount), GetNull(categoriesExclude), GetNull(maxCount), GetNull(pageNumber), GetNull(pageSize), sortBy, sortDirection, isApproved, isDraft, GetNull(keywords), GetNull(authorID), GetNull(showPending), GetNull(showExpired), showFeaturedOnly, showNotFeaturedOnly, showSecuredOnly, showNotSecuredOnly, GetNull(articleIDs), GetNull(tags), GetNull(tagIDCount), GetNull(rssGuid), GetNull(customFieldID), GetNull(customValue), GetNull(linkFilter)), IDataReader) + End Function + + Public Overrides Function GetArticle(ByVal articleID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetArticle", articleID), IDataReader) + End Function + + Public Overrides Function GetArticleCategories(ByVal articleID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetArticleCategories", articleID), IDataReader) + End Function + + Public Overrides Function GetNewsArchive(ByVal moduleID As Integer, ByVal categoryID As Integer(), ByVal categoryIDExclude As Integer(), ByVal authorID As Integer, ByVal groupBy As String, ByVal showPending As Boolean) As IDataReader + Dim categories As String = DotNetNuke.Common.Utilities.Null.NullString + + If Not (categoryID Is Nothing) Then + For Each category As Integer In categoryID + If Not (categories = DotNetNuke.Common.Utilities.Null.NullString) Then + categories = categories & "," + End If + categories = categories & category.ToString() + Next + End If + + Dim categoriesExclude As String = DotNetNuke.Common.Utilities.Null.NullString + + If Not (categoryIDExclude Is Nothing) Then + For Each category As Integer In categoryIDExclude + If Not (categoriesExclude = DotNetNuke.Common.Utilities.Null.NullString) Then + categoriesExclude = categoriesExclude & "," + End If + categoriesExclude = categoriesExclude & category.ToString() + Next + End If + + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetNewsArchive", moduleID, GetNull(categories), GetNull(categoriesExclude), GetNull(authorID), groupBy, GetNull(showPending)), IDataReader) + End Function + + Public Overrides Sub DeleteArticle(ByVal articleID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_DeleteArticle", articleID) + End Sub + + Public Overrides Sub DeleteArticleCategories(ByVal articleID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_DeleteArticleCategories", articleID) + End Sub + + Public Overrides Function AddArticle(ByVal authorID As Integer, ByVal approverID As Integer, ByVal createdDate As DateTime, ByVal lastUpdate As DateTime, ByVal title As String, ByVal summary As String, ByVal isApproved As Boolean, ByVal numberOfViews As Integer, ByVal isDraft As Boolean, ByVal startDate As DateTime, ByVal endDate As DateTime, ByVal moduleID As Integer, ByVal imageUrl As String, ByVal isFeatured As Boolean, ByVal lastUpdateID As Integer, ByVal url As String, ByVal isSecure As Boolean, ByVal isNewWindow As Boolean, ByVal metaTitle As String, ByVal metaDescription As String, ByVal metaKeywords As String, ByVal pageHeadText As String, ByVal shortUrl As String, ByVal rssGuid As String) As Integer + Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_AddArticle", authorID, approverID, createdDate, lastUpdate, title, GetNull(summary), isApproved, numberOfViews, isDraft, GetNull(startDate), GetNull(endDate), moduleID, GetNull(imageUrl), isFeatured, GetNull(lastUpdateID), GetNull(url), isSecure, isNewWindow, GetNull(metaTitle), GetNull(metaDescription), GetNull(metaKeywords), GetNull(pageHeadText), GetNull(shortUrl), GetNull(rssGuid)), Integer) + End Function + + Public Overrides Sub AddArticleCategory(ByVal articleID As Integer, ByVal categoryID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_AddArticleCategory", articleID, categoryID) + End Sub + + Public Overrides Sub UpdateArticle(ByVal articleID As Integer, ByVal authorID As Integer, ByVal approverID As Integer, ByVal createdDate As DateTime, ByVal lastUpdate As DateTime, ByVal title As String, ByVal summary As String, ByVal isApproved As Boolean, ByVal numberOfViews As Integer, ByVal isDraft As Boolean, ByVal startDate As DateTime, ByVal endDate As DateTime, ByVal moduleID As Integer, ByVal imageUrl As String, ByVal isFeatured As Boolean, ByVal lastUpdateID As Integer, ByVal url As String, ByVal isSecure As Boolean, ByVal isNewWindow As Boolean, ByVal metaTitle As String, ByVal metaDescription As String, ByVal metaKeywords As String, ByVal pageHeadText As String, ByVal shortUrl As String, ByVal rssGuid As String) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_UpdateArticle", articleID, authorID, approverID, createdDate, lastUpdate, title, GetNull(summary), isApproved, numberOfViews, isDraft, GetNull(startDate), GetNull(endDate), moduleID, GetNull(imageUrl), isFeatured, GetNull(lastUpdateID), GetNull(url), isSecure, isNewWindow, GetNull(metaTitle), GetNull(metaDescription), GetNull(metaKeywords), GetNull(pageHeadText), GetNull(shortUrl), GetNull(rssGuid)) + End Sub + + Public Overrides Sub UpdateArticleCount(ByVal articleID As Integer, ByVal numberOfViews As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_UpdateArticleCount", articleID, numberOfViews) + End Sub + + Public Overrides Function SecureCheck(ByVal portalID As Integer, ByVal articleID As Integer, ByVal userID As Integer) As Boolean + Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_SecureCheck", portalID, articleID, userID), Boolean) + End Function +#End Region + +#Region " Author Methods " + + Public Overrides Function GetAuthorList(ByVal moduleID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetAuthorList", moduleID), IDataReader) + End Function + + Public Overrides Function GetAuthorStatistics(ByVal moduleID As Integer, ByVal categoryID As Integer(), ByVal categoryIDExclude As Integer(), ByVal authorID As Integer, ByVal sortBy As String, ByVal showPending As Boolean) As IDataReader + Dim categories As String = DotNetNuke.Common.Utilities.Null.NullString + + If Not (categoryID Is Nothing) Then + For Each category As Integer In categoryID + If Not (categories = DotNetNuke.Common.Utilities.Null.NullString) Then + categories = categories & "," + End If + categories = categories & category.ToString() + Next + End If + + Dim categoriesExclude As String = DotNetNuke.Common.Utilities.Null.NullString + + If Not (categoryIDExclude Is Nothing) Then + For Each category As Integer In categoryIDExclude + If Not (categoriesExclude = DotNetNuke.Common.Utilities.Null.NullString) Then + categoriesExclude = categoriesExclude & "," + End If + categoriesExclude = categoriesExclude & category.ToString() + Next + End If + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetAuthorStatistics", moduleID, GetNull(categories), GetNull(categoriesExclude), GetNull(authorID), sortBy, GetNull(showPending)), IDataReader) + End Function + +#End Region + +#Region " Category Methods " + + Public Overrides Function GetCategoryList(ByVal moduleID As Integer, ByVal parentID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetCategoryList", moduleID, parentID), IDataReader) + End Function + + Public Overrides Function GetCategoryListAll(ByVal moduleID As Integer, ByVal authorID As Integer, ByVal showPending As Boolean, ByVal sortType As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetCategoryListAll", moduleID, GetNull(authorID), GetNull(showPending), sortType), IDataReader) + End Function + + Public Overrides Function GetCategory(ByVal categoryID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetCategory", categoryID), IDataReader) + End Function + + Public Overrides Sub DeleteCategory(ByVal categoryID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_DeleteCategory", categoryID) + End Sub + + Public Overrides Function AddCategory(ByVal moduleID As Integer, ByVal parentID As Integer, ByVal name As String, ByVal image As String, ByVal description As String, ByVal sortOrder As Integer, ByVal inheritSecurity As Boolean, ByVal categorySecurityType As Integer, ByVal metaTitle As String, ByVal metaDescription As String, ByVal metaKeywords As String) As Integer + Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_AddCategory", moduleID, parentID, name, image, GetNull(description), sortOrder, inheritSecurity, categorySecurityType, GetNull(metaTitle), GetNull(metaDescription), GetNull(metaKeywords)), Integer) + End Function + + Public Overrides Sub UpdateCategory(ByVal categoryID As Integer, ByVal moduleID As Integer, ByVal parentID As Integer, ByVal name As String, ByVal image As String, ByVal description As String, ByVal sortOrder As Integer, ByVal inheritSecurity As Boolean, ByVal categorySecurityType As Integer, ByVal metaTitle As String, ByVal metaDescription As String, ByVal metaKeywords As String) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_UpdateCategory", categoryID, moduleID, parentID, name, image, GetNull(description), sortOrder, inheritSecurity, categorySecurityType, GetNull(metaTitle), GetNull(metaDescription), GetNull(metaKeywords)) + End Sub +#End Region + +#Region " Comment Methods " + Public Overrides Function GetCommentList(ByVal moduleID As Integer, ByVal articleID As Integer, ByVal isApproved As Boolean, ByVal direction As SortDirection, ByVal maxCount As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetCommentList", moduleID, GetNull(articleID), isApproved, direction, GetNull(maxCount)), IDataReader) + End Function + + Public Overrides Function GetComment(ByVal commentID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetComment", commentID), IDataReader) + End Function + + Public Overrides Sub DeleteComment(ByVal commentID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_DeleteComment", commentID) + End Sub + + Public Overrides Function AddComment(ByVal articleID As Integer, ByVal createdDate As DateTime, ByVal userID As Integer, ByVal comment As String, ByVal remoteAddress As String, ByVal type As Integer, ByVal trackbackUrl As String, ByVal trackbackTitle As String, ByVal trackbackBlogName As String, ByVal trackbackExcerpt As String, ByVal anonymousName As String, ByVal anonymousEmail As String, ByVal anonymousURL As String, ByVal notifyMe As Boolean, ByVal isApproved As Boolean, ByVal approvedBy As Integer) As Integer + Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_AddComment", articleID, createdDate, userID, comment, GetNull(remoteAddress), type, GetNull(trackbackUrl), GetNull(trackbackTitle), GetNull(trackbackBlogName), GetNull(trackbackExcerpt), GetNull(anonymousName), GetNull(anonymousEmail), GetNull(anonymousURL), notifyMe, isApproved, GetNull(approvedBy)), Integer) + End Function + + Public Overrides Sub UpdateComment(ByVal commentID As Integer, ByVal articleID As Integer, ByVal userID As Integer, ByVal comment As String, ByVal remoteAddress As String, ByVal type As Integer, ByVal trackbackUrl As String, ByVal trackbackTitle As String, ByVal trackbackBlogName As String, ByVal trackbackExcerpt As String, ByVal anonymousName As String, ByVal anonymousEmail As String, ByVal anonymousURL As String, ByVal notifyMe As Boolean, ByVal isApproved As Boolean, ByVal approvedBy As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_UpdateComment", commentID, articleID, userID, comment, GetNull(remoteAddress), type, GetNull(trackbackUrl), GetNull(trackbackTitle), GetNull(trackbackBlogName), GetNull(trackbackExcerpt), GetNull(anonymousName), GetNull(anonymousEmail), GetNull(anonymousURL), notifyMe, isApproved, GetNull(approvedBy)) + End Sub +#End Region + +#Region " Custom Field Methods " + Public Overrides Function GetCustomField(ByVal customFieldID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetCustomField", customFieldID), IDataReader) + End Function + + Public Overrides Function GetCustomFieldList(ByVal moduleID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetCustomFieldList", moduleID), IDataReader) + End Function + + Public Overrides Sub DeleteCustomField(ByVal customFieldID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_DeleteCustomField", customFieldID) + End Sub + + Public Overrides Function AddCustomField(ByVal moduleID As Integer, ByVal name As String, ByVal fieldType As Integer, ByVal fieldElements As String, ByVal defaultValue As String, ByVal caption As String, ByVal captionHelp As String, ByVal isRequired As Boolean, ByVal isVisible As Boolean, ByVal sortOrder As Integer, ByVal validationType As Integer, ByVal length As Integer, ByVal regularExpression As String) As Integer + Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_AddCustomField", moduleID, name, fieldType, GetNull(fieldElements), GetNull(defaultValue), GetNull(caption), GetNull(captionHelp), isRequired, isVisible, sortOrder, validationType, length, GetNull(regularExpression)), Integer) + End Function + + Public Overrides Sub UpdateCustomField(ByVal customFieldID As Integer, ByVal moduleID As Integer, ByVal name As String, ByVal fieldType As Integer, ByVal fieldElements As String, ByVal defaultValue As String, ByVal caption As String, ByVal captionHelp As String, ByVal isRequired As Boolean, ByVal isVisible As Boolean, ByVal sortOrder As Integer, ByVal validationType As Integer, ByVal length As Integer, ByVal regularExpression As String) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_UpdateCustomField", customFieldID, moduleID, name, fieldType, GetNull(fieldElements), GetNull(defaultValue), GetNull(caption), GetNull(captionHelp), isRequired, isVisible, sortOrder, validationType, length, GetNull(regularExpression)) + End Sub +#End Region + +#Region " Custom Value Methods " + + Public Overrides Function GetCustomValueList(ByVal articleID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetCustomValueList", articleID), IDataReader) + End Function + + Public Overrides Sub DeleteCustomValue(ByVal articleID As Integer, ByVal customFieldID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_DeleteCustomValue", articleID, customFieldID) + End Sub + + Public Overrides Function AddCustomValue(ByVal articleID As Integer, ByVal customFieldID As Integer, ByVal customValue As String) As Integer + Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_AddCustomValue", articleID, customFieldID, customValue), Integer) + End Function + + Public Overrides Sub UpdateCustomValue(ByVal customValueID As Integer, ByVal articleID As Integer, ByVal customFieldID As Integer, ByVal customValue As String) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_UpdateCustomValue", customValueID, articleID, customFieldID, customValue) + End Sub + +#End Region + +#Region " Feed Methods " + + Public Overrides Function AddFeed(ByVal moduleID As Integer, ByVal title As String, ByVal url As String, ByVal userID As Integer, ByVal autoFeature As Boolean, ByVal isActive As Boolean, ByVal dateMode As Integer, ByVal autoExpire As Integer, ByVal autoExpireUnit As Integer) As Integer + Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_FeedAdd", moduleID, title, url, userID, autoFeature, isActive, dateMode, GetNull(autoExpire), GetNull(autoExpireUnit)), Integer) + End Function + + Public Overrides Sub UpdateFeed(ByVal feedID As Integer, ByVal moduleID As Integer, ByVal title As String, ByVal url As String, ByVal userID As Integer, ByVal autoFeature As Boolean, ByVal isActive As Boolean, ByVal dateMode As Integer, ByVal autoExpire As Integer, ByVal autoExpireUnit As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_FeedUpdate", feedID, moduleID, title, url, userID, autoFeature, isActive, dateMode, GetNull(autoExpire), GetNull(autoExpireUnit)) + End Sub + + Public Overrides Sub DeleteFeed(ByVal feedID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_FeedDelete", feedID) + End Sub + + Public Overrides Function GetFeed(ByVal feedID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_FeedGet", feedID), IDataReader) + End Function + + Public Overrides Function GetFeedList(ByVal moduleID As Integer, ByVal showActiveOnly As Boolean) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_FeedList", moduleID, showActiveOnly), IDataReader) + End Function + + Public Overrides Sub AddFeedCategory(ByVal feedID As Integer, ByVal categoryID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_FeedCategoryAdd", feedID, categoryID) + End Sub + + Public Overrides Function GetFeedCategoryList(ByVal feedID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_FeedCategoryList", feedID), IDataReader) + End Function + + Public Overrides Sub DeleteFeedCategory(ByVal feedID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_FeedCategoryDelete", feedID) + End Sub + +#End Region + +#Region " File Methods " + + Public Overrides Function AddFile(ByVal articleID As Integer, ByVal title As String, ByVal fileName As String, ByVal extension As String, ByVal size As Integer, ByVal contentType As String, ByVal folder As String, ByVal sortOrder As Integer, ByVal fileGuid As String) As Integer + Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_FileAdd", GetNull(articleID), GetNull(title), GetNull(fileName), GetNull(extension), GetNull(size), GetNull(contentType), GetNull(folder), sortOrder, GetNull(fileGuid)), Integer) + End Function + + Public Overrides Sub UpdateFile(ByVal fileID As Integer, ByVal articleID As Integer, ByVal title As String, ByVal fileName As String, ByVal extension As String, ByVal size As Integer, ByVal contentType As String, ByVal folder As String, ByVal sortOrder As Integer, ByVal fileGuid As String) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_FileUpdate", fileID, GetNull(articleID), GetNull(title), GetNull(fileName), GetNull(extension), GetNull(size), GetNull(contentType), GetNull(folder), sortOrder, GetNull(fileGuid)) + End Sub + + Public Overrides Sub DeleteFile(ByVal fileID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_FileDelete", fileID) + End Sub + + Public Overrides Function GetFile(ByVal fileID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_FileGet", fileID), IDataReader) + End Function + + Public Overrides Function GetFileList(ByVal articleID As Integer, ByVal fileGuid As String) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_FileList", GetNull(articleID), GetNull(fileGuid)), IDataReader) + End Function + +#End Region + +#Region " Image Methods " + + Public Overrides Function AddImage(ByVal articleID As Integer, ByVal title As String, ByVal fileName As String, ByVal extension As String, ByVal size As Integer, ByVal width As Integer, ByVal height As Integer, ByVal contentType As String, ByVal folder As String, ByVal sortOrder As Integer, ByVal imageGuid As String, ByVal description As String) As Integer + Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_ImageAdd", GetNull(articleID), GetNull(title), GetNull(fileName), GetNull(extension), GetNull(size), GetNull(width), GetNull(height), GetNull(contentType), GetNull(folder), sortOrder, GetNull(imageGuid), GetNull(description)), Integer) + End Function + + Public Overrides Sub UpdateImage(ByVal imageID As Integer, ByVal articleID As Integer, ByVal title As String, ByVal fileName As String, ByVal extension As String, ByVal size As Integer, ByVal width As Integer, ByVal height As Integer, ByVal contentType As String, ByVal folder As String, ByVal sortOrder As Integer, ByVal imageGuid As String, ByVal description As String) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_ImageUpdate", imageID, GetNull(articleID), GetNull(title), GetNull(fileName), GetNull(extension), GetNull(size), GetNull(width), GetNull(height), GetNull(contentType), GetNull(folder), sortOrder, GetNull(imageGuid), GetNull(description)) + End Sub + + Public Overrides Sub DeleteImage(ByVal imageID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_ImageDelete", imageID) + End Sub + + Public Overrides Function GetImage(ByVal imageID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_ImageGet", imageID), IDataReader) + End Function + + Public Overrides Function GetImageList(ByVal articleID As Integer, ByVal imageGuid As String) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_ImageList", GetNull(articleID), GetNull(imageGuid)), IDataReader) + End Function + +#End Region + +#Region " Mirror Article Methods " + + Public Overrides Sub AddMirrorArticle(ByVal articleID As Integer, ByVal linkedArticleID As Integer, ByVal linkedPortalID As Integer, ByVal autoUpdate As Boolean) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_AddMirrorArticle", articleID, linkedArticleID, linkedPortalID, autoUpdate) + End Sub + + Public Overrides Function GetMirrorArticle(ByVal articleID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetMirrorArticle", articleID), IDataReader) + End Function + + Public Overrides Function GetMirrorArticleList(ByVal linkedArticleID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetMirrorArticleList", linkedArticleID), IDataReader) + End Function + +#End Region + +#Region " Page Methods " + Public Overrides Function GetPageList(ByVal articleID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetPageList", articleID), IDataReader) + End Function + + Public Overrides Function GetPage(ByVal pageID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetPage", pageID), IDataReader) + End Function + + Public Overrides Sub DeletePage(ByVal pageID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_DeletePage", pageID) + End Sub + + Public Overrides Function AddPage(ByVal articleID As Integer, ByVal title As String, ByVal pageText As String, ByVal sortOrder As Integer) As Integer + Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_AddPage", articleID, title, pageText, sortOrder), Integer) + End Function + + Public Overrides Sub UpdatePage(ByVal pageID As Integer, ByVal articleID As Integer, ByVal title As String, ByVal pageText As String, ByVal sortOrder As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_UpdatePage", pageID, articleID, title, pageText, sortOrder) + End Sub +#End Region + +#Region " EmailTemplate Methods " + Public Overrides Function GetEmailTemplate(ByVal templateID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_EmailTemplateGet", templateID), IDataReader) + End Function + + Public Overrides Function GetEmailTemplateByName(ByVal moduleID As Integer, ByVal name As String) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_EmailTemplateGetByName", moduleID, name), IDataReader) + End Function + + Public Overrides Function ListEmailTemplate(ByVal moduleID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_EmailTemplateList", moduleID), IDataReader) + End Function + + Public Overrides Function AddEmailTemplate(ByVal moduleID As Integer, ByVal name As String, ByVal subject As String, ByVal template As String) As Integer + Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_EmailTemplateAdd", moduleID, name, subject, template), Integer) + End Function + + Public Overrides Sub UpdateEmailTemplate(ByVal templateID As Integer, ByVal moduleID As Integer, ByVal name As String, ByVal subject As String, ByVal template As String) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_EmailTemplateUpdate", templateID, moduleID, name, subject, template) + End Sub + + Public Overrides Sub DeleteEmailTemplate(ByVal templateID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_EmailTemplateDelete", templateID) + End Sub +#End Region + +#Region " Rating Methods " + + Public Overrides Function AddRating(ByVal articleID As Integer, ByVal userID As Integer, ByVal createdDate As DateTime, ByVal rating As Double) As Integer + Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_RatingAdd", articleID, userID, createdDate, GetNull(rating)), Integer) + End Function + + Public Overrides Function GetRating(ByVal articleID As Integer, ByVal userID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_RatingGet", articleID, userID), IDataReader) + End Function + + Public Overrides Function GetRatingByID(ByVal ratingID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_RatingGetByID", ratingID), IDataReader) + End Function + + Public Overrides Sub DeleteRating(ByVal ratingID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_RatingDelete", ratingID) + End Sub + +#End Region + +#Region " Rating Methods " + + Public Overrides Function AddHandout(ByVal moduleID As Integer, ByVal userID As Integer, ByVal name As String, ByVal description As String) As Integer + Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_AddHandout", moduleID, userID, name, GetNull(description)), Integer) + End Function + + Public Overrides Sub AddHandoutArticle(ByVal handoutID As Integer, ByVal articleID As Integer, ByVal sortOrder As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_AddHandoutArticle", handoutID, articleID, sortOrder) + End Sub + + Public Overrides Sub DeleteHandout(ByVal handoutID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_DeleteHandout", handoutID) + End Sub + + Public Overrides Sub DeleteHandoutArticleList(ByVal ratingID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_DeleteHandoutArticleList", ratingID) + End Sub + + Public Overrides Function GetHandout(ByVal handoutID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetHandout", handoutID), IDataReader) + End Function + + Public Overrides Function GetHandoutList(ByVal userID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetHandoutList", userID), IDataReader) + End Function + + Public Overrides Function GetHandoutArticleList(ByVal handoutID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_GetHandoutArticleList", handoutID), IDataReader) + End Function + + Public Overrides Sub UpdateHandout(ByVal handoutID As Integer, ByVal moduleID As Integer, ByVal userID As Integer, ByVal name As String, ByVal description As String) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_UpdateHandout", handoutID, moduleID, userID, name, GetNull(description)) + End Sub + +#End Region + +#Region " Tag Methods " + + Public Overrides Function GetTag(ByVal tagID As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_TagGet", tagID), IDataReader) + End Function + + Public Overrides Function GetTagByName(ByVal moduleID As Integer, ByVal name As String) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_TagGetByName", moduleID, name), IDataReader) + End Function + + Public Overrides Function ListTag(ByVal moduleID As Integer, ByVal maxCount As Integer) As IDataReader + Return CType(SqlHelper.ExecuteReader(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_TagList", moduleID, GetNull(maxCount)), IDataReader) + End Function + + Public Overrides Function AddTag(ByVal moduleID As Integer, ByVal name As String, ByVal nameLowered As String) As Integer + Return CType(SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_TagAdd", moduleID, name, nameLowered), Integer) + End Function + + Public Overrides Sub UpdateTag(ByVal tagID As Integer, ByVal moduleID As Integer, ByVal name As String, ByVal nameLowered As String, ByVal usages As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_TagUpdate", tagID, moduleID, name, nameLowered, usages) + End Sub + + Public Overrides Sub DeleteTag(ByVal tagID As Integer) + 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) + End Sub + + Public Overrides Sub DeleteArticleTag(ByVal articleID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_ArticleTagDelete", articleID) + End Sub + + Public Overrides Sub DeleteArticleTagByTag(ByVal tagID As Integer) + SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_ArticleTagDeleteByTag", tagID) + End Sub + +#End Region + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Providers/DataProvider/SqlDataProvider/Uninstall.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/Uninstall.SqlDataProvider new file mode 100755 index 0000000..894308b Binary files /dev/null and b/Providers/DataProvider/SqlDataProvider/Uninstall.SqlDataProvider differ diff --git a/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.sln b/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.sln new file mode 100755 index 0000000..8641cf0 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ventrian.NewsArticles.SqlDataProvider", "Ventrian.NewsArticles.SqlDataProvider.vbproj", "{D1901326-AD43-466F-942D-AA796EA58D8E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D1901326-AD43-466F-942D-AA796EA58D8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D1901326-AD43-466F-942D-AA796EA58D8E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D1901326-AD43-466F-942D-AA796EA58D8E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D1901326-AD43-466F-942D-AA796EA58D8E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.suo b/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.suo new file mode 100755 index 0000000..e532a6a Binary files /dev/null and b/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.suo differ diff --git a/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.v11.suo b/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.v11.suo new file mode 100755 index 0000000..e532a6a Binary files /dev/null and b/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.v11.suo differ diff --git a/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.vbproj b/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.vbproj new file mode 100755 index 0000000..b1b0253 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.vbproj @@ -0,0 +1,267 @@ + + + + Local + 9.0.21022 + 2.0 + {D1901326-AD43-466F-942D-AA796EA58D8E} + Debug + AnyCPU + + + + + Ventrian.NewsArticles.SqlDataProvider + + + None + JScript + Grid + IE50 + false + Library + Binary + On + Off + + + + + + + Windows + + + 3.5 + v3.5 + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + ..\..\..\..\..\bin\ + DnnForge.NewsArticles.SqlDataProvider.xml + 285212672 + + + + + true + true + true + false + false + false + false + 1 + 42016,42017,42018,42019,42032,42353,42354,42355 + full + + + ..\..\..\..\..\bin\ + DnnForge.NewsArticles.SqlDataProvider.xml + 285212672 + + + + + false + true + false + true + false + false + false + 1 + 42016,42017,42018,42019,42032,42353,42354,42355 + none + + + + False + ..\..\..\..\..\bin\DotNetNuke.dll + False + + + False + ..\..\..\..\..\bin\Microsoft.ApplicationBlocks.Data.dll + False + + + System + + + + System.Data + + + System.Drawing + + + System.Web + + + System.XML + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Code + + + + + {25F6A930-34CD-4730-8324-D234D4637898} + Ventrian.NewsArticles + False + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + + + + + + + + \ No newline at end of file diff --git a/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.vbproj.user b/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.vbproj.user new file mode 100755 index 0000000..dcf0c09 --- /dev/null +++ b/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.vbproj.user @@ -0,0 +1,66 @@ + + + + 7.10.3077 + Debug + AnyCPU + C:\Projects\DotNetNuke\Sites\DotNetNuke311\bin\;D:\Projects\DotNetNuke\Sites\DotNetNuke311\bin\ + + + + + 0 + ProjectFiles + 0 + + + + + + + en-US + false + + + false + false + false + false + false + + + Project + + + + + + + + + + + false + + + false + false + false + false + false + + + Project + + + + + + + + + + + false + + \ No newline at end of file diff --git a/Providers/FileProvider/CoreFileProvider.vb b/Providers/FileProvider/CoreFileProvider.vb new file mode 100755 index 0000000..aff6975 --- /dev/null +++ b/Providers/FileProvider/CoreFileProvider.vb @@ -0,0 +1,144 @@ +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Portals +Imports DotNetNuke.Services.FileSystem +Imports System.IO +Imports DotNetNuke.Entities.Modules + +Namespace Ventrian.NewsArticles + + Public Class CoreFileProvider + + Inherits FileProvider + +#Region " Public Methods " + + Public Overrides Function AddFile(ByVal articleID As Integer, ByVal moduleID As Integer, ByVal objPostedFile As System.Web.HttpPostedFile) As Integer + + Dim objFile As New FileInfo + + objFile.ArticleID = articleID + objFile.FileName = objPostedFile.FileName + objFile.SortOrder = 0 + + Dim filesList As List(Of FileInfo) = GetFiles(articleID) + + If (filesList.Count > 0) Then + objFile.SortOrder = CType(filesList(filesList.Count - 1), FileInfo).SortOrder + 1 + End If + + Dim objPortalSettings As PortalSettings = PortalController.GetCurrentPortalSettings() + + Dim folder As String = "" + + Dim objModuleController As New ModuleController() + Dim objSettings As Hashtable = objModuleController.GetModuleSettings(moduleID) + + Dim folderID As Integer = Null.NullInteger + If (IsNumeric(HttpContext.Current.Request.Form("FolderID"))) Then + folderID = Convert.ToInt32(HttpContext.Current.Request.Form("FolderID")) + End If + + If (folderID <> Null.NullInteger) Then + Dim objFolderController As New FolderController + Dim objFolder As FolderInfo = objFolderController.GetFolderInfo(objPortalSettings.PortalId, folderID) + If (objFolder IsNot Nothing) Then + folder = objFolder.FolderPath + End If + End If + + objFile.Folder = folder + objFile.ContentType = objPostedFile.ContentType + + If (objFile.FileName.Split("."c).Length > 0) Then + objFile.Extension = objFile.FileName.Split("."c)(objFile.FileName.Split("."c).Length - 1) + + If (objFile.Extension.ToLower() = "jpg") Then + objFile.ContentType = "image/jpeg" + End If + If (objFile.Extension.ToLower() = "gif") Then + objFile.ContentType = "image/gif" + End If + If (objFile.Extension.ToLower() = "txt") Then + objFile.ContentType = "text/plain" + End If + If (objFile.Extension.ToLower() = "html") Then + objFile.ContentType = "text/html" + End If + If (objFile.Extension.ToLower() = "mp3") Then + objFile.ContentType = "audio/mpeg" + End If + + End If + objFile.Title = objFile.FileName.Replace("." & objFile.Extension, "") + + Dim filePath As String = objPortalSettings.HomeDirectoryMapPath & folder.Replace("/", "\") + + If Not (Directory.Exists(filePath)) Then + Directory.CreateDirectory(filePath) + End If + + If (File.Exists(filePath & objFile.FileName)) Then + For i As Integer = 1 To 100 + If (File.Exists(filePath & i.ToString() & "_" & objFile.FileName) = False) Then + objFile.FileName = i.ToString() & "_" & objFile.FileName + Exit For + End If + Next + End If + + objFile.Size = objPostedFile.ContentLength + objPostedFile.SaveAs(filePath & objFile.FileName) + + Dim objFileController As New FileController + objFile.FileID = objFileController.Add(objFile) + + If (articleID > 0) Then + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(articleID) + objArticle.FileCount = objArticle.FileCount + 1 + objArticleController.UpdateArticle(objArticle) + End If + + Return objFile.FileID + + End Function + + Public Overrides Function AddFile(ByVal articleID As Integer, ByVal moduleID As Integer, ByVal objPostedFile As HttpPostedFile, ByVal providerParams As Object) As Integer + Return AddFile(articleID, moduleID, objPostedFile) + End Function + + Public Overrides Function AddExistingFile(ByVal articleID As Integer, ByVal moduleID As Integer, ByVal providerParams As Object) As Integer + Throw New NotImplementedException() + End Function + + Public Overrides Sub DeleteFile(ByVal articleID As Integer, ByVal fileID As Integer) + Dim objFileController As New FileController() + objFileController.Delete(fileID) + End Sub + + Public Overrides Function GetFile(ByVal fileID As Integer) As FileInfo + Dim objFileController As New FileController() + Dim objFile As FileInfo = objFileController.Get(fileID) + objFile.Link = PortalController.GetCurrentPortalSettings().HomeDirectory() & objFile.Folder & objFile.FileName + Return objFile + End Function + + Public Overrides Function GetFiles(ByVal articleID As Integer) As System.Collections.Generic.List(Of FileInfo) + Dim objFileController As New FileController() + Dim objFiles As List(Of FileInfo) = objFileController.GetFileList(articleID, Null.NullString()) + For Each objFile As FileInfo In objFiles + objFile.Link = PortalController.GetCurrentPortalSettings().HomeDirectory() & objFile.Folder & objFile.FileName + Next + Return objFiles + End Function + + Public Overrides Sub UpdateFile(ByVal objFile As FileInfo) + Dim objFileController As New FileController() + objFileController.Update(objFile) + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Providers/FileProvider/CoreFileProvider2.vb b/Providers/FileProvider/CoreFileProvider2.vb new file mode 100755 index 0000000..2c3f728 --- /dev/null +++ b/Providers/FileProvider/CoreFileProvider2.vb @@ -0,0 +1,144 @@ +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Portals +Imports DotNetNuke.Services.FileSystem +Imports System.IO +Imports DotNetNuke.Entities.Modules + +Namespace Ventrian.NewsArticles + + Public Class CoreFileProvider2 + + Inherits FileProvider + +#Region " Public Methods " + + Public Overrides Function AddFile(ByVal articleID As Integer, ByVal moduleID As Integer, ByVal objPostedFile As System.Web.HttpPostedFile) As Integer + + Dim objFile As New FileInfo + + objFile.ArticleID = articleID + objFile.FileName = objPostedFile.FileName + objFile.SortOrder = 0 + + Dim filesList As List(Of FileInfo) = GetFiles(articleID) + + If (filesList.Count > 0) Then + objFile.SortOrder = CType(filesList(filesList.Count - 1), FileInfo).SortOrder + 1 + End If + + Dim objPortalSettings As PortalSettings = PortalController.GetCurrentPortalSettings() + + Dim folder As String = "" + + Dim objModuleController As New ModuleController() + Dim objSettings As Hashtable = objModuleController.GetModuleSettings(moduleID) + + If (objSettings.ContainsKey(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING)) Then + If (IsNumeric(objSettings(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING))) Then + Dim folderID As Integer = Convert.ToInt32(objSettings(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING)) + Dim objFolderController As New FolderController + Dim objFolder As FolderInfo = objFolderController.GetFolderInfo(objPortalSettings.PortalId, folderID) + If (objFolder IsNot Nothing) Then + folder = objFolder.FolderPath + End If + End If + End If + + objFile.Folder = folder + objFile.ContentType = objPostedFile.ContentType + + If (objFile.FileName.Split("."c).Length > 0) Then + objFile.Extension = objFile.FileName.Split("."c)(objFile.FileName.Split("."c).Length - 1) + + If (objFile.Extension.ToLower() = "jpg") Then + objFile.ContentType = "image/jpeg" + End If + If (objFile.Extension.ToLower() = "gif") Then + objFile.ContentType = "image/gif" + End If + If (objFile.Extension.ToLower() = "txt") Then + objFile.ContentType = "text/plain" + End If + If (objFile.Extension.ToLower() = "html") Then + objFile.ContentType = "text/html" + End If + If (objFile.Extension.ToLower() = "mp3") Then + objFile.ContentType = "audio/mpeg" + End If + + End If + objFile.Title = objFile.FileName.Replace("." & objFile.Extension, "") + + Dim filePath As String = objPortalSettings.HomeDirectoryMapPath & folder.Replace("/", "\") + + If Not (Directory.Exists(filePath)) Then + Directory.CreateDirectory(filePath) + End If + + If (File.Exists(filePath & objFile.FileName)) Then + For i As Integer = 1 To 100 + If (File.Exists(filePath & i.ToString() & "_" & objFile.FileName) = False) Then + objFile.FileName = i.ToString() & "_" & objFile.FileName + Exit For + End If + Next + End If + + objFile.Size = objPostedFile.ContentLength + objPostedFile.SaveAs(filePath & objFile.FileName) + + Dim objFileController As New FileController + objFile.FileID = objFileController.Add(objFile) + + If (articleID <> Null.NullInteger) Then + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(articleID) + If (objArticle IsNot Nothing) Then + objArticle.FileCount = objArticle.FileCount + 1 + objArticleController.UpdateArticle(objArticle) + End If + End If + + Return objFile.FileID + + End Function + + Public Overrides Function AddFile(ByVal articleID As Integer, ByVal moduleID As Integer, ByVal objPostedFile As HttpPostedFile, ByVal providerParams As Object) As Integer + Return AddFile(articleID, moduleID, objPostedFile) + End Function + + Public Overrides Function AddExistingFile(ByVal articleID As Integer, ByVal moduleID As Integer, ByVal providerParams As Object) As Integer + Throw New NotImplementedException() + End Function + + Public Overrides Sub DeleteFile(ByVal articleID As Integer, ByVal fileID As Integer) + Dim objFileController As New FileController() + objFileController.Delete(fileID) + End Sub + + Public Overrides Function GetFile(ByVal fileID As Integer) As FileInfo + Dim objFileController As New FileController() + Dim objFile As FileInfo = objFileController.Get(fileID) + objFile.Link = PortalController.GetCurrentPortalSettings().HomeDirectory() & objFile.Folder & objFile.FileName & "1" + Return objFile + End Function + + Public Overrides Function GetFiles(ByVal articleID As Integer) As System.Collections.Generic.List(Of FileInfo) + Dim objFileController As New FileController() + Dim objFiles As List(Of FileInfo) = objFileController.GetFileList(articleID, Null.NullString()) + For Each objFile As FileInfo In objFiles + objFile.Link = PortalController.GetCurrentPortalSettings().HomeDirectory() & objFile.Folder & objFile.FileName & "1" + Next + Return objFiles + End Function + + Public Overrides Sub UpdateFile(ByVal objFile As FileInfo) + Dim objFileController As New FileController() + objFileController.Update(objFile) + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Providers/FileProvider/FileController.vb b/Providers/FileProvider/FileController.vb new file mode 100755 index 0000000..2ebf5a5 --- /dev/null +++ b/Providers/FileProvider/FileController.vb @@ -0,0 +1,85 @@ +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public Class FileController + + Public Shared Sub ClearCache(ByVal articleID As Integer) + + Dim itemsToRemove As New List(Of String)() + + Dim enumerator As IDictionaryEnumerator = HttpContext.Current.Cache.GetEnumerator() + While enumerator.MoveNext() + If enumerator.Key.ToString().ToLower().Contains("ventrian-newsarticles-files-" & articleID.ToString()) Then + itemsToRemove.Add(enumerator.Key.ToString()) + End If + End While + + For Each itemToRemove As String In itemsToRemove + DataCache.RemoveCache(itemToRemove.Replace("DNN_", "")) + Next + + End Sub + +#Region " Public Methods " + + Public Function [Get](ByVal fileID As Integer) As FileInfo + + Return CType(CBO.FillObject(DataProvider.Instance().GetFile(fileID), GetType(FileInfo)), FileInfo) + + End Function + + Public Function GetFileList(ByVal articleID As Integer, ByVal fileGuid As String) As List(Of FileInfo) + + If (articleID = Null.NullInteger) Then + Return CBO.FillCollection(Of FileInfo)(DataProvider.Instance().GetFileList(articleID, fileGuid)) + Else + Dim cacheKey As String = "ventrian-newsarticles-files-" & articleID.ToString() & "-" & fileGuid.ToString() + + Dim objFiles As List(Of FileInfo) = CType(DataCache.GetCache(cacheKey), List(Of FileInfo)) + + If (objFiles Is Nothing) Then + objFiles = CBO.FillCollection(Of FileInfo)(DataProvider.Instance().GetFileList(articleID, fileGuid)) + DataCache.SetCache(cacheKey, objFiles) + End If + + Return objFiles + End If + + End Function + + Public Function Add(ByVal objFile As FileInfo) As Integer + + Dim fileID As Integer = CType(DataProvider.Instance().AddFile(objFile.ArticleID, objFile.Title, objFile.FileName, objFile.Extension, objFile.Size, objFile.ContentType, objFile.Folder, objFile.SortOrder, objFile.FileGuid), Integer) + + FileController.ClearCache(objFile.ArticleID) + ArticleController.ClearArticleCache(objFile.ArticleID) + + Return fileID + + End Function + + Public Sub Update(ByVal objFile As FileInfo) + + DataProvider.Instance().UpdateFile(objFile.FileID, objFile.ArticleID, objFile.Title, objFile.FileName, objFile.Extension, objFile.Size, objFile.ContentType, objFile.Folder, objFile.SortOrder, objFile.FileGuid) + + FileController.ClearCache(objFile.ArticleID) + + End Sub + + Public Sub Delete(ByVal fileID As Integer) + + Dim objFile As FileInfo = [Get](fileID) + + If (objFile IsNot Nothing) Then + DataProvider.Instance().DeleteFile(fileID) + FileController.ClearCache(objFile.ArticleID) + End If + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/Providers/FileProvider/FileInfo.vb b/Providers/FileProvider/FileInfo.vb new file mode 100755 index 0000000..cf886d5 --- /dev/null +++ b/Providers/FileProvider/FileInfo.vb @@ -0,0 +1,129 @@ +Imports DotNetNuke.Entities.Portals + +Namespace Ventrian.NewsArticles + + Public Class FileInfo + +#Region " Private Members " + + Dim _fileID As Integer + Dim _articleID As Integer + + Dim _title As String + Dim _fileName As String + Dim _extension As String + Dim _size As Integer + Dim _contentType As String + Dim _folder As String + Dim _sortOrder As Integer + Dim _fileGuid As String + Dim _link As String + +#End Region + +#Region " Public Properties " + + Public Property FileID() As Integer + Get + Return _fileID + End Get + Set(ByVal value As Integer) + _fileID = value + End Set + End Property + + Public Property ArticleID() As Integer + Get + Return _articleID + End Get + Set(ByVal value As Integer) + _articleID = value + End Set + End Property + + Public Property Title() As String + Get + Return _title + End Get + Set(ByVal value As String) + _title = value + End Set + End Property + + Public Property FileName() As String + Get + Return _fileName + End Get + Set(ByVal value As String) + _fileName = value + End Set + End Property + + Public Property Extension() As String + Get + Return _extension + End Get + Set(ByVal value As String) + _extension = value + End Set + End Property + + Public Property Size() As Integer + Get + Return _size + End Get + Set(ByVal value As Integer) + _size = value + End Set + End Property + + Public Property ContentType() As String + Get + Return _contentType + End Get + Set(ByVal value As String) + _contentType = value + End Set + End Property + + Public Property Folder() As String + Get + Return _folder + End Get + Set(ByVal value As String) + _folder = value + End Set + End Property + + Public Property SortOrder() As Integer + Get + Return _sortOrder + End Get + Set(ByVal value As Integer) + _sortOrder = value + End Set + End Property + + Public Property FileGuid() As String + Get + Return _fileGuid + End Get + Set(ByVal value As String) + _fileGuid = value + End Set + End Property + + Public Property Link() As String + Get + Return _link + End Get + Set(ByVal value As String) + _link = value + End Set + End Property + +#End Region + + End Class + +End Namespace diff --git a/Providers/FileProvider/FileProvider.vb b/Providers/FileProvider/FileProvider.vb new file mode 100755 index 0000000..78f377c --- /dev/null +++ b/Providers/FileProvider/FileProvider.vb @@ -0,0 +1,49 @@ +Imports DotNetNuke +Imports DotNetNuke.Common.Utilities + +Namespace Ventrian.NewsArticles + + Public MustInherit Class FileProvider + +#Region " Shared/Static Methods " + + ' singleton reference to the instantiated object + Private Shared objProvider As FileProvider = Nothing + + ' constructor + Shared Sub New() + CreateProvider() + End Sub + + ' dynamically create provider + Private Shared Sub CreateProvider() + If (ConfigurationManager.AppSettings("NewsArticlesFileProvider") IsNot Nothing) Then + objProvider = CType(Framework.Reflection.CreateObject(ConfigurationManager.AppSettings("NewsArticlesFileProvider").ToString(), "Ventrian_NaFileProvider"), FileProvider) + Else + objProvider = CType(Framework.Reflection.CreateObject("Ventrian.NewsArticles.CoreFileProvider", "Ventrian_NaFileProvider"), FileProvider) + End If + End Sub + + ' return the provider + Public Shared Shadows Function Instance() As FileProvider + Return objProvider + End Function + +#End Region + +#Region " Abstract methods " + + Public MustOverride Function AddFile(ByVal articleID As Integer, ByVal moduleID As Integer, ByVal objPostedFile As System.Web.HttpPostedFile) As Integer + Public MustOverride Function AddFile(ByVal articleID As Integer, ByVal moduleID As Integer, ByVal objPostedFile As System.Web.HttpPostedFile, ByVal providerParams As Object) As Integer + Public MustOverride Function AddExistingFile(ByVal articleID As Integer, ByVal moduleID As Integer, ByVal providerParams As Object) As Integer + Public MustOverride Sub DeleteFile(ByVal articleID As Integer, ByVal fileID As Integer) + Public MustOverride Function GetFile(ByVal fileID As Integer) As FileInfo + Public MustOverride Function GetFiles(ByVal articleID As Integer) As List(Of FileInfo) + Public MustOverride Sub UpdateFile(ByVal objFile As FileInfo) + + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Resources.zip b/Resources.zip new file mode 100755 index 0000000..e1c72a6 Binary files /dev/null and b/Resources.zip differ diff --git a/Resources.zip.manifest b/Resources.zip.manifest new file mode 100755 index 0000000..2329843 --- /dev/null +++ b/Resources.zip.manifest @@ -0,0 +1,860 @@ + + + + App_LocalResources/ + Archives.ascx.resx + + + App_LocalResources/ + NewsSearch.ascx.resx + + + App_LocalResources/ + PostComment.ascx.resx + + + App_LocalResources/ + PostRating.ascx.resx + + + App_LocalResources/ + SharedResources.resx + + + App_LocalResources/ + ucAdminOptions.ascx.resx + + + App_LocalResources/ + ucApproveArticles.ascx.resx + + + App_LocalResources/ + ucApproveComments.ascx.resx + + + App_LocalResources/ + ucEditCategories.ascx.resx + + + App_LocalResources/ + ucEditCategory.ascx.resx + + + App_LocalResources/ + ucEditComment.ascx.resx + + + App_LocalResources/ + ucEditCustomField.ascx.resx + + + App_LocalResources/ + ucEditCustomFields.ascx.resx + + + App_LocalResources/ + ucEditPage.ascx.resx + + + App_LocalResources/ + ucEditPages.ascx.resx + + + App_LocalResources/ + ucEditPageSortOrder.ascx.resx + + + App_LocalResources/ + ucEditTag.ascx.resx + + + App_LocalResources/ + ucEditTags.ascx.resx + + + App_LocalResources/ + ucEmailTemplates.ascx.resx + + + App_LocalResources/ + ucImportFeed.ascx.resx + + + App_LocalResources/ + ucImportFeeds.ascx.resx + + + App_LocalResources/ + ucMyArticles.ascx.resx + + + App_LocalResources/ + ucNotAuthenticated.ascx.resx + + + App_LocalResources/ + ucNotAuthorized.ascx.resx + + + App_LocalResources/ + ucSubmitNews.ascx.resx + + + App_LocalResources/ + ucSubmitNewsComplete.ascx.resx + + + App_LocalResources/ + ucTemplateEditor.ascx.resx + + + App_LocalResources/ + ucViewOptions.ascx.resx + + + App_LocalResources/ + UploadFiles.ascx.resx + + + App_LocalResources/ + UploadImages.ascx.resx + + + App_LocalResources/ + ViewArchive.ascx.resx + + + App_LocalResources/ + ViewArticle.ascx.resx + + + App_LocalResources/ + ViewAuthor.ascx.resx + + + App_LocalResources/ + ViewCategory.ascx.resx + + + App_LocalResources/ + ViewSearch.ascx.resx + + + App_LocalResources/ + ViewTag.ascx.resx + + + Controls/ + Listing.ascx + + + Controls/ + PostComment.ascx + + + Controls/ + PostRating.ascx + + + Controls/ + SWFUploader.ashx + + + Controls/ + SWFUploaderFiles.ashx + + + Controls/ + UploadFiles.ascx + + + Controls/ + UploadImages.ascx + + + Images/Admin/ + Categories.gif + + + Images/Admin/ + MainOptions.gif + + + Images/Admin/ + Templates.gif + + + Images/ + appearance.png + + + Images/ + details.png + + + Images/ + left_both.gif + + + Images/Lightbox/ + lightbox-ico-loading.gif + + + Images/ + linkto.png + + + Images/ + publishing.png + + + Images/Rating/ + stars-0-0.gif + + + Images/Rating/ + stars-0-5.gif + + + Images/Rating/ + stars-1-0.gif + + + Images/Rating/ + stars-1-5.gif + + + Images/Rating/ + stars-2-0.gif + + + Images/Rating/ + stars-2-5.gif + + + Images/Rating/ + stars-3-0.gif + + + Images/Rating/ + stars-3-5.gif + + + Images/Rating/ + stars-4-0.gif + + + Images/Rating/ + stars-4-5.gif + + + Images/Rating/ + stars-5-0.gif + + + Images/ + right_both.gif + + + Images/ + rssbutton.gif + + + Images/SmartThinker/ + articleadd.png + + + Images/SmartThinker/ + commentadd.png + + + Images/SmartThinker/ + rateadd.png + + + Images/ + spacer.gif + + + Images/ + summary.png + + + Images/ + tab_background.gif + + + Images/Uploader/ + cancelbutton.gif + + + Images/Uploader/ + error.gif + + + Images/Uploader/ + toobig.gif + + + Images/Uploader/ + uploadlimit.gif + + + Images/Uploader/ + XPButtonNoText_160x22.png + + + Images/Uploader/ + zerobyte.gif + + + Includes/ColorPicker/ + ColorPicker.js + + + Includes/Lightbox/ + jquery-1.3.2.min.js + + + Includes/Lightbox/ + jquery.lightbox-0.4.js + + + Includes/Lightbox/ + jquery.lightbox-0.4.pack.js + + + Includes/Uploader/ + handlers.00.07.61.js + + + Includes/Uploader/ + jquery-1.3.2.min.js + + + Includes/Uploader/ + swfupload.00.07.61.js + + + Includes/Uploader/ + swfupload.00.07.61.swf + + + Includes/ + VentrianValidators.js + + + Tracking/ + Trackback.aspx + + + Tracking/ + Pingback.ashx + + + + ucNotAuthorized.ascx + + + + ucSubmitNews.ascx + + + + ucSubmitNewsComplete.ascx + + + + ucTemplateEditor.ascx + + + + ucViewOptions.ascx + + + + ViewArchive.ascx + + + + ViewArticle.ascx + + + + ViewAuthor.ascx + + + + ViewCategory.ascx + + + + ViewCurrent.ascx + + + + ViewSearch.ascx + + + + ViewTag.ascx + + + + Archives.ascx + + + + NewsArticles.ascx + + + + ucAdminOptions.ascx + + + + ucApproveArticles.ascx + + + + ucApproveComments.ascx + + + + ucEditCategories.ascx + + + + ucEditCategory.ascx + + + + ucEditComment.ascx + + + + ucEditCustomField.ascx + + + + ucEditCustomFields.ascx + + + + ucEditPage.ascx + + + + ucEditPages.ascx + + + + ucEditPageSortOrder.ascx + + + + ucEditTag.ascx + + + + ucEditTags.ascx + + + + ucEmailTemplates.ascx + + + + ucHeader.ascx + + + + ucImportFeed.ascx + + + + ucImportFeeds.ascx + + + + ucMyArticles.ascx + + + + ucNotAuthenticated.ascx + + + + web.config + + + + module.css + + + + icon_comment.gif + + + + icon_xml.gif + + + Includes/Shadowbox/ + close.png + + + Includes/Shadowbox/ + loading.gif + + + Includes/Shadowbox/ + next.png + + + Includes/Shadowbox/ + pause.png + + + Includes/Shadowbox/ + play.png + + + Includes/Shadowbox/ + previous.png + + + Includes/Shadowbox/ + shadowbox.css + + + Includes/Shadowbox/ + shadowbox.js + + + + ImageHandler.ashx + + + + Print.aspx + + + + Rss.aspx + + + + RssComments.aspx + + + + NewsSearch.ascx + + + + NewsSearchOptions.ascx + + + API/MetaWebLog/ + Handler.ashx + + + API/MetaWebLog/ + wlwmanifest.xml + + + API/ + Rsd.ashx + + + Templates/Default/ + Comment.Footer.html + + + Templates/Default/ + Comment.Header.html + + + Templates/Default/ + Comment.Item.html + + + Templates/Default/Images/ + icon_comment.gif + + + Templates/Default/ + Listing.Empty.html + + + Templates/Default/ + Listing.Featured.html + + + Templates/Default/ + Listing.Featured.xml + + + Templates/Default/ + Listing.Footer.html + + + Templates/Default/ + Listing.Footer.xml + + + Templates/Default/ + Listing.Header.html + + + Templates/Default/ + Listing.Item.html + + + Templates/Default/ + Listing.Item.xml + + + Templates/Default/ + Menu.Item.html + + + Templates/Default/ + Print.Footer.html + + + Templates/Default/ + Print.Header.html + + + Templates/Default/ + Print.Item.html + + + Templates/Default/ + Template.css + + + Templates/Default/ + View.Footer.html + + + Templates/Default/ + View.Header.html + + + Templates/Default/ + View.Item.html + + + Templates/Default/ + View.Item.xml + + + Templates/Default/ + View.PageHeader.Html + + + Templates/Default/ + View.Title.Html + + + Templates/Standard/ + Category.Child.html + + + Templates/Standard/ + Category.html + + + Templates/Standard/ + Comment.Item.html + + + Templates/Standard/ + File.Footer.Html + + + Templates/Standard/ + File.Header.Html + + + Templates/Standard/ + File.Item.Html + + + Templates/Standard/ + Handout.Cover.html + + + Templates/Standard/ + Handout.End.html + + + Templates/Standard/ + Handout.Footer.html + + + Templates/Standard/ + Handout.Header.html + + + Templates/Standard/ + Handout.Item.html + + + Templates/Standard/ + Image.Footer.Html + + + Templates/Standard/ + Image.Header.Html + + + Templates/Standard/ + Image.Item.Html + + + Templates/Standard/Images/ + 01.gif + + + Templates/Standard/Images/ + 02.gif + + + Templates/Standard/Images/ + 03.gif + + + Templates/Standard/Images/ + 04.gif + + + Templates/Standard/Images/ + 05.gif + + + Templates/Standard/Images/ + 06.gif + + + Templates/Standard/Images/ + 07.gif + + + Templates/Standard/Images/ + 08.gif + + + Templates/Standard/Images/ + 09.gif + + + Templates/Standard/Images/ + 10.gif + + + Templates/Standard/Images/ + 11.gif + + + Templates/Standard/Images/ + 12.gif + + + Templates/Standard/Images/ + rssbutton.gif + + + Templates/Standard/ + Listing.Empty.html + + + Templates/Standard/ + Listing.Featured.html + + + Templates/Standard/ + Listing.Footer.html + + + Templates/Standard/ + Listing.Header.html + + + Templates/Standard/ + Listing.Item.html + + + Templates/Standard/ + Menu.Item.html + + + Templates/Standard/ + Print.Item.html + + + Templates/Standard/ + Related.Footer.html + + + Templates/Standard/ + Related.Header.html + + + Templates/Standard/ + Related.Item.html + + + Templates/Standard/ + Rss.Comment.Footer.html + + + Templates/Standard/ + Rss.Comment.Header.html + + + Templates/Standard/ + Rss.Comment.Item.html + + + Templates/Standard/ + Rss.Footer.html + + + Templates/Standard/ + Rss.Header.html + + + Templates/Standard/ + Rss.Item.html + + + Templates/Standard/ + Template.css + + + Templates/Standard/ + View.Description.html + + + Templates/Standard/ + View.Item.html + + + Templates/Standard/ + View.Keyword.html + + + Templates/Standard/ + View.PageHeader.Html + + + Templates/Standard/ + View.Title.Html + + + \ No newline at end of file diff --git a/ResourcesLatestArticles.zip b/ResourcesLatestArticles.zip new file mode 100755 index 0000000..290a5ca Binary files /dev/null and b/ResourcesLatestArticles.zip differ diff --git a/ResourcesLatestComments.zip b/ResourcesLatestComments.zip new file mode 100755 index 0000000..5465738 Binary files /dev/null and b/ResourcesLatestComments.zip differ diff --git a/ResourcesNewsArchives.zip b/ResourcesNewsArchives.zip new file mode 100755 index 0000000..8401253 Binary files /dev/null and b/ResourcesNewsArchives.zip differ diff --git a/ResourcesNewsSearch.zip b/ResourcesNewsSearch.zip new file mode 100755 index 0000000..b006e5d Binary files /dev/null and b/ResourcesNewsSearch.zip differ diff --git a/Rss.aspx b/Rss.aspx new file mode 100755 index 0000000..060e84d --- /dev/null +++ b/Rss.aspx @@ -0,0 +1 @@ +<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Rss.aspx.vb" Inherits="Ventrian.NewsArticles.Rss" %> diff --git a/Rss.aspx.designer.vb b/Rss.aspx.designer.vb new file mode 100755 index 0000000..ec34203 --- /dev/null +++ b/Rss.aspx.designer.vb @@ -0,0 +1,17 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class Rss + End Class +End Namespace diff --git a/Rss.aspx.vb b/Rss.aspx.vb new file mode 100755 index 0000000..8ceb995 --- /dev/null +++ b/Rss.aspx.vb @@ -0,0 +1,882 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System.IO +Imports System.Xml + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Entities.Portals +Imports DotNetNuke.Entities.Tabs +Imports DotNetNuke.Framework +Imports System.Net + +Namespace Ventrian.NewsArticles + + Partial Public Class Rss + Inherits System.Web.UI.Page + +#Region " Private Members " + + Private m_articleIDs As String = Null.NullString + Private m_count As Integer = Null.NullInteger + Private m_categoryID() As Integer = Nothing + Private m_categoryIDExclude() As Integer = Nothing + Private m_tabID As Integer = Null.NullInteger + Private m_TabInfo As DotNetNuke.Entities.Tabs.TabInfo + Private m_moduleID As Integer = Null.NullInteger + Private m_authorID As Integer = Null.NullInteger + Private m_featuredOnly As Boolean = False + Private m_matchAll As Boolean = False + Private m_notFeaturedOnly As Boolean = False + Private m_securedOnly As Boolean = False + Private m_notSecuredOnly As Boolean = False + Private m_showExpired As Boolean = False + Private m_sortBy As String = ArticleConstants.DEFAULT_SORT_BY + Private m_sortDirection As String = ArticleConstants.DEFAULT_SORT_DIRECTION + Private m_tagID() As Integer = Nothing + Private m_tagMatch As Boolean = False + + Private m_month As Integer = Null.NullInteger + Private m_year As Integer = Null.NullInteger + + Private _template As String = "Standard" + + Private _enableSyndicationEnclosures As Boolean = True + Private _enableSyndicationHtml As Boolean = False + Private _enclosureType As SyndicationEnclosureType = SyndicationEnclosureType.Attachment + Private _syndicationSummaryLength As Integer = Null.NullInteger + +#End Region + +#Region " Private Methods " + + Private Sub ReadQueryString() + + If (Request("TabID") <> "") Then + + If (IsNumeric(Request("TabID"))) Then + + m_tabID = Convert.ToInt32(Request("TabID")) + + Dim objTabController As New TabController + m_TabInfo = objTabController.GetTab(m_tabID, Globals.GetPortalSettings().PortalId, False) + + End If + + End If + + If (Request("ModuleID") <> "") Then + + If (IsNumeric(Request("ModuleID"))) Then + + m_moduleID = Convert.ToInt32(Request("ModuleID")) + + End If + + End If + + If (Request("CategoryID") <> "") Then + + Dim categories As String() = Request("CategoryID").ToString().Split(Convert.ToChar(",")) + + If (categories.Length > 0) Then + ReDim m_categoryID(categories.Length - 1) + For i As Integer = 0 To categories.Length - 1 + m_categoryID(i) = Convert.ToInt32(categories(i)) + Next + End If + + End If + + If (Request("CategoryIDExclude") <> "") Then + + Dim categories As String() = Request("CategoryIDExclude").ToString().Split(Convert.ToChar(",")) + + If (categories.Length > 0) Then + ReDim m_categoryIDExclude(categories.Length - 1) + For i As Integer = 0 To categories.Length - 1 + m_categoryIDExclude(i) = Convert.ToInt32(categories(i)) + Next + End If + + End If + + If (Request("MaxCount") <> "") Then + + If (IsNumeric(Request("MaxCount"))) Then + + m_count = Convert.ToInt32(Request("MaxCount")) + + End If + + End If + + If (Request("AuthorID") <> "") Then + + If (IsNumeric(Request("AuthorID"))) Then + + m_authorID = Convert.ToInt32(Request("AuthorID")) + + End If + + End If + + If (Request("FeaturedOnly") <> "") Then + + m_featuredOnly = Convert.ToBoolean(Request("FeaturedOnly")) + + End If + + If (Request("NotFeaturedOnly") <> "") Then + + m_notFeaturedOnly = Convert.ToBoolean(Request("NotFeaturedOnly")) + + End If + + If (Request("ShowExpired") <> "") Then + m_showExpired = Convert.ToBoolean(Request("ShowExpired")) + End If + + If (Request("SecuredOnly") <> "") Then + m_securedOnly = Convert.ToBoolean(Request("SecuredOnly")) + End If + + If (Request("NotSecuredOnly") <> "") Then + m_notSecuredOnly = Convert.ToBoolean(Request("NotSecuredOnly")) + End If + + If (Request("ArticleIDs") <> "") Then + m_articleIDs = Request("ArticleIDs") + End If + + If (Request("SortBy") <> "") Then + + m_sortBy = Request("SortBy").ToString() + + End If + + If (Request("SortDirection") <> "") Then + + m_sortDirection = Request("SortDirection").ToString() + + End If + + If (Request("Month") <> "") Then + If (IsNumeric(Request("Month"))) Then + m_month = Convert.ToInt32(Request("Month")) + End If + End If + + If (Request("Year") <> "") Then + If (IsNumeric(Request("Year"))) Then + m_year = Convert.ToInt32(Request("Year")) + End If + End If + + If (Request("MatchTag") <> "") Then + If (Request("MatchTag") = "1") Then + m_tagMatch = True + End If + End If + + If (Request("TagIDs") <> "") Then + Dim tagIDs() As String = Request("TagIDs").Split(","c) + If (tagIDs.Length > 0) Then + Dim tags As New List(Of Integer) + For Each tag As String In tagIDs + If (IsNumeric(tag)) Then + tags.Add(Convert.ToInt32(tag)) + End If + Next + m_tagID = tags.ToArray() + End If + End If + + If (Request("Tags") <> "") Then + Dim tags As New List(Of Integer) + For Each tag As String In Request("Tags").Split("|"c) + If (tag <> "") Then + Dim objTagController As New TagController() + Dim objTag As TagInfo = objTagController.Get(m_moduleID, Server.UrlDecode(tag).ToLower()) + If (objTag IsNot Nothing) Then + tags.Add(objTag.TagID) + Else + If (m_tagMatch) Then + tags.Add(Null.NullInteger) + End If + End If + End If + Next + If (tags.Count > 0) Then + m_tagID = tags.ToArray() + End If + End If + + End Sub + + Private Function GetParentPortal(ByVal sportalalias As String) As String + If (sportalalias.IndexOf("localhost") < 0) Then + If (sportalalias.IndexOf("/") > 0) Then + sportalalias = sportalalias.Substring(0, sportalalias.IndexOf("/")) + End If + End If + + GetParentPortal = sportalalias + End Function + + Private Function FormatTitle(ByVal title As String) As String + + Return OnlyAlphaNumericChars(title) & ".aspx" + + End Function + + Public Function OnlyAlphaNumericChars(ByVal OrigString As String) As String + '*********************************************************** + 'INPUT: Any String + 'OUTPUT: The Input String with all non-alphanumeric characters + ' removed + 'EXAMPLE Debug.Print OnlyAlphaNumericChars("Hello World!") + 'output = "HelloWorld") + 'NOTES: Not optimized for speed and will run slow on long + ' strings. If you plan on using long strings, consider + ' using alternative method of appending to output string, + ' such as the method at + ' http://www.freevbcode.com/ShowCode.Asp?ID=154 + '*********************************************************** + Dim lLen As Integer + Dim sAns As String = "" + Dim lCtr As Integer + Dim sChar As String + + OrigString = Trim(OrigString) + lLen = Len(OrigString) + For lCtr = 1 To lLen + sChar = Mid(OrigString, lCtr, 1) + If IsAlphaNumeric(Mid(OrigString, lCtr, 1)) Then + sAns = sAns & sChar + End If + Next + + OnlyAlphaNumericChars = sAns + + End Function + + Private Function IsAlphaNumeric(ByVal sChr As String) As Boolean + IsAlphaNumeric = sChr Like "[0-9A-Za-z]" + End Function + + Private Sub ProcessHeaderFooter(ByRef objPlaceHolder As ControlCollection, ByVal templateArray As String()) + + For iPtr As Integer = 0 To templateArray.Length - 1 Step 2 + + objPlaceHolder.Add(New LiteralControl(templateArray(iPtr).ToString())) + + If iPtr < templateArray.Length - 1 Then + + Select Case templateArray(iPtr + 1) + + Case "PORTALNAME" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & iPtr.ToString()) + objLiteral.Text = Server.HtmlEncode(PortalController.GetCurrentPortalSettings().PortalName) + objPlaceHolder.Add(objLiteral) + + Case "PORTALURL" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & iPtr.ToString()) + objLiteral.Text = Server.HtmlEncode(AddHTTP(PortalController.GetCurrentPortalSettings().PortalAlias.HTTPAlias)) + objPlaceHolder.Add(objLiteral) + + End Select + + End If + + Next + + End Sub + + Private Function ProcessItem(ByVal item As String) As String + + If (item.Contains("<")) Then + ' already encoded? + Return item + End If + Return Server.HtmlEncode(item) + + End Function + + Private Sub ProcessItem(ByRef objPlaceHolder As ControlCollection, ByVal templateArray As String(), ByVal objArticle As ArticleInfo, ByVal articleSettings As ArticleSettings, ByVal objTab As TabInfo) + + Dim portalSettings As PortalSettings = PortalController.GetCurrentPortalSettings() + + Dim enclosureLink As String = "" + Dim enclosureType As String = "" + Dim enclosureLength As String = "" + + If (_enableSyndicationEnclosures) Then + If (_enclosureType = SyndicationEnclosureType.Attachment) Then + If (objArticle.FileCount > 0 Or objArticle.Url.ToLower().StartsWith("http://") Or objArticle.Url.ToLower().StartsWith("https://")) Then + If (objArticle.FileCount > 0) Then + + Dim objFileController As New FileController() + Dim objFiles As List(Of FileInfo) = objFileController.GetFileList(objArticle.ArticleID, "") + + If (objFiles.Count > 0) Then + If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then + enclosureLink = AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & portalSettings.HomeDirectory & objFiles(0).Folder & objFiles(0).FileName) + Else + enclosureLink = AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & portalSettings.HomeDirectory & objFiles(0).Folder & objFiles(0).FileName) + End If + enclosureType = objFiles(0).ContentType + enclosureLength = objFiles(0).Size.ToString() + End If + + Else + If (objArticle.Url.ToLower().StartsWith("http://") Or objArticle.Url.ToLower().StartsWith("https://")) Then + + Dim objFileInfo As Hashtable = CType(DataCache.GetCache("NA-" & objArticle.Url), Hashtable) + + If (objFileInfo Is Nothing) Then + + objFileInfo = New Hashtable + + Try + + Dim Url As New Uri(objArticle.Url) + + Dim myHttpWebRequest As HttpWebRequest = DirectCast(WebRequest.Create(Url), HttpWebRequest) + Dim myHttpWebResponse As HttpWebResponse = DirectCast(myHttpWebRequest.GetResponse(), HttpWebResponse) + + objFileInfo.Add("ContentType", myHttpWebResponse.ContentType) + objFileInfo.Add("ContentLength", myHttpWebResponse.ContentLength) + + myHttpWebResponse.Close() + + Catch + End Try + + DataCache.SetCache("NA-" & objArticle.Url, objFileInfo) + + End If + + If (objFileInfo.Count > 0) Then + enclosureLink = objArticle.Url + enclosureType = objFileInfo("ContentType").ToString() + enclosureLength = objFileInfo("ContentLength").ToString() + End If + End If + End If + End If + Else + If (objArticle.ImageCount > 0) Then + Dim objImageController As New ImageController + Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString()) + + If (objImages.Count > 0) Then + + If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then + enclosureLink = AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & portalSettings.HomeDirectory & objImages(0).Folder & objImages(0).FileName) + Else + enclosureLink = AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & portalSettings.HomeDirectory & objImages(0).Folder & objImages(0).FileName) + End If + + enclosureType = objImages(0).ContentType + enclosureLength = objImages(0).Size.ToString() + End If + End If + End If + End If + + Dim hasEnclosure As Boolean = False + + If (enclosureLink <> "") Then + hasEnclosure = True + End If + + For iPtr As Integer = 0 To templateArray.Length - 1 Step 2 + + objPlaceHolder.Add(New LiteralControl(templateArray(iPtr).ToString())) + + If iPtr < templateArray.Length - 1 Then + + Select Case templateArray(iPtr + 1) + + Case "ARTICLELINK" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + Dim pageID As Integer = Null.NullInteger + If (articleSettings.SyndicationLinkType = SyndicationLinkType.Attachment And (objArticle.Url <> "" Or objArticle.FileCount > 0)) Then + If (objArticle.FileCount > 0) Then + Dim objFileController As New FileController() + Dim objFiles As List(Of FileInfo) = objFileController.GetFileList(objArticle.ArticleID, "") + + If (objFiles.Count > 0) Then + If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then + objLiteral.Text = AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & portalSettings.HomeDirectory & objFiles(0).Folder & objFiles(0).FileName).Replace("&", "&") + Else + objLiteral.Text = AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & portalSettings.HomeDirectory & objFiles(0).Folder & objFiles(0).FileName).Replace("&", "&") + End If + End If + Else + objLiteral.Text = DotNetNuke.Common.Globals.LinkClick(objArticle.Url, m_tabID, objArticle.ModuleID, False).Replace("&", "&") + If (objLiteral.Text.ToLower().StartsWith("http") = False) Then + If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then + objLiteral.Text = AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & objLiteral.Text) + Else + objLiteral.Text = AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & objLiteral.Text) + End If + End If + End If + Else + objLiteral.Text = Common.GetArticleLink(objArticle, m_TabInfo, articleSettings, False).Replace("&", "&") + End If + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "COMMENTLINK" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + objLiteral.Text = Common.GetArticleLink(objArticle, m_TabInfo, articleSettings, False).Replace("&", "&") & "#Comments" + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "DESCRIPTION" + Dim description As String = "" + If (Common.StripTags(Server.HtmlDecode(objArticle.Summary)) <> "") Then + If (_enableSyndicationHtml) Then + description = ProcessItem(Common.ProcessPostTokens(Server.HtmlDecode(objArticle.Summary), m_TabInfo, articleSettings)) + Else + If (_syndicationSummaryLength <> Null.NullInteger) Then + Dim summary As String = Common.ProcessPostTokens(Common.StripTags(Server.HtmlDecode(objArticle.Summary)), m_TabInfo, articleSettings) + If (summary.Length > _syndicationSummaryLength) Then + description = ProcessItem(Common.ProcessPostTokens(Common.StripTags(Server.HtmlDecode(objArticle.Summary)), m_TabInfo, articleSettings).Substring(0, _syndicationSummaryLength) & "...") + Else + description = ProcessItem(Common.ProcessPostTokens(Common.StripTags(Server.HtmlDecode(objArticle.Summary)), m_TabInfo, articleSettings)) + End If + Else + description = ProcessItem(Common.ProcessPostTokens(Common.StripTags(Server.HtmlDecode(objArticle.Summary)), m_TabInfo, articleSettings)) + End If + End If + Else + If (_enableSyndicationHtml) Then + description = ProcessItem(Common.ProcessPostTokens(Server.HtmlDecode(objArticle.Body), m_TabInfo, articleSettings)) + Else + If (_syndicationSummaryLength <> Null.NullInteger) Then + Dim summary As String = ProcessItem(Common.ProcessPostTokens(Common.StripTags(Server.HtmlDecode(objArticle.Body)), m_TabInfo, articleSettings)) + If (summary.Length > _syndicationSummaryLength) Then + description = ProcessItem(Common.ProcessPostTokens(Common.StripTags(Server.HtmlDecode(objArticle.Body)), m_TabInfo, articleSettings).Substring(0, _syndicationSummaryLength) & "...") + Else + description = ProcessItem(Common.ProcessPostTokens(Common.StripTags(Server.HtmlDecode(objArticle.Body)), m_TabInfo, articleSettings)) + End If + Else + description = ProcessItem(Common.ProcessPostTokens(Common.StripTags(Server.HtmlDecode(objArticle.Body)), m_TabInfo, articleSettings)) + End If + End If + End If + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + objLiteral.Text = description + objPlaceHolder.Add(objLiteral) + + Case "DETAILS" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + If (objArticle.PageCount > 0) Then + Dim pageID As Integer = Null.NullInteger + If (IsNumeric(Request("PageID"))) Then + pageID = Convert.ToInt32(Request("PageID")) + End If + If (pageID = Null.NullInteger) Then + objLiteral.Text = ProcessItem(Common.ProcessPostTokens(objArticle.Body, objTab, articleSettings)) + Else + Dim pageController As New PageController + Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID) + For Each objPage As PageInfo In pageList + If (objPage.PageID = pageID) Then + objLiteral.Text = ProcessItem(Common.ProcessPostTokens(objPage.PageText, objTab, articleSettings)) + Exit For + End If + Next + If (objLiteral.Text = Null.NullString) Then + objLiteral.Text = ProcessItem(Common.ProcessPostTokens(objArticle.Body, objTab, articleSettings)) + End If + End If + End If + objPlaceHolder.Add(objLiteral) + + Case "ENCLOSURELENGTH" + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + objLiteral.Text = enclosureLength + objPlaceHolder.Add(objLiteral) + + Case "ENCLOSURELINK" + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + objLiteral.Text = enclosureLink.Replace("&", "&").Replace("&", "&").Replace(" ", "%20") + objPlaceHolder.Add(objLiteral) + + Case "ENCLOSURETYPE" + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + objLiteral.Text = enclosureType + objPlaceHolder.Add(objLiteral) + + Case "GUID" + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + objLiteral.Text = "f1397696-738c-4295-afcd-943feb885714:" & objArticle.ArticleID.ToString() + objPlaceHolder.Add(objLiteral) + + Case "HASENCLOSURE" + If (hasEnclosure = False) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/HASENCLOSURE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASENCLOSURE" + ' Do Nothing + + Case "IMAGELINK" + If (objArticle.ImageUrl <> "") Then + Dim objLiteral As New Literal + objLiteral.Text = objArticle.ImageUrl + objPlaceHolder.Add(objLiteral) + Else + Dim objImageController As New ImageController + Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString()) + + If (objImages.Count > 0) Then + Dim objLiteral As New Literal + objLiteral.Text = AddHTTP(Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & portalSettings.HomeDirectory & objImages(0).Folder & objImages(0).FileName) + objPlaceHolder.Add(objLiteral) + End If + End If + + Case "PUBLISHDATE" + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + objLiteral.Text = objArticle.StartDate.ToUniversalTime().ToString("r") + objPlaceHolder.Add(objLiteral) + + Case "SUMMARY" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + objLiteral.Text = ProcessItem(Common.ProcessPostTokens(objArticle.Summary, objTab, articleSettings)) + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + + Case "TITLE" + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + objLiteral.Text = Server.HtmlEncode(objArticle.Title) + objPlaceHolder.Add(objLiteral) + + Case "TITLEURL" + + Dim title As String = Common.FormatTitle(objArticle.Title, articleSettings) + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + objLiteral.Text = Server.HtmlEncode(title) + objPlaceHolder.Add(objLiteral) + + Case "TRACKBACKLINK" + + Dim link As String = "" + If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then + link = AddHTTP(Request.Url.Host & Me.ResolveUrl("Tracking/Trackback.aspx?ArticleID=" & objArticle.ArticleID.ToString() & "&PortalID=" & portalSettings.PortalId.ToString() & "&TabID=" & portalSettings.ActiveTab.TabID.ToString()).Replace(" ", "%20")) + Else + link = AddHTTP(Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & Me.ResolveUrl("Tracking/Trackback.aspx?ArticleID=" & objArticle.ArticleID.ToString() & "&PortalID=" & portalSettings.PortalId.ToString() & "&TabID=" & portalSettings.ActiveTab.TabID.ToString()).Replace(" ", "%20")) + End If + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + objLiteral.Text = link + objPlaceHolder.Add(objLiteral) + + Case Else + + If (templateArray(iPtr + 1).ToUpper().StartsWith("DETAILS:")) Then + Dim length As Integer = Convert.ToInt32(templateArray(iPtr + 1).Substring(8, templateArray(iPtr + 1).Length - 8)) + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + If (StripHtml(Server.HtmlDecode(objArticle.Body)).TrimStart().Length > length) Then + objLiteral.Text = ProcessItem(Common.ProcessPostTokens(Left(StripHtml(Server.HtmlDecode(objArticle.Body)).TrimStart(), length), objTab, articleSettings) & "...") + Else + objLiteral.Text = ProcessItem(Common.ProcessPostTokens(Left(StripHtml(Server.HtmlDecode(objArticle.Body)).TrimStart(), length), objTab, articleSettings)) + End If + + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Exit Select + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("SUMMARY:")) Then + Dim summary As String = objArticle.Summary + If (IsNumeric(templateArray(iPtr + 1).Substring(8, templateArray(iPtr + 1).Length - 8))) Then + Dim length As Integer = Convert.ToInt32(templateArray(iPtr + 1).Substring(8, templateArray(iPtr + 1).Length - 8)) + If (StripHtml(Server.HtmlDecode(objArticle.Summary)).TrimStart().Length > length) Then + summary = ProcessItem(Common.ProcessPostTokens(Left(StripHtml(Server.HtmlDecode(objArticle.Summary)).TrimStart(), length), objTab, articleSettings) & "...") + Else + summary = ProcessItem(Common.ProcessPostTokens(Left(StripHtml(Server.HtmlDecode(objArticle.Summary)).TrimStart(), length), objTab, articleSettings)) + End If + End If + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + objLiteral.Text = summary + objLiteral.EnableViewState = False + objPlaceHolder.Add(objLiteral) + Exit Select + End If + + Dim objLiteralOther As New Literal + objLiteralOther.ID = Globals.CreateValidID("Rss-" & objArticle.ArticleID.ToString() & iPtr.ToString()) + objLiteralOther.Text = "[" & templateArray(iPtr + 1) & "]" + objLiteralOther.EnableViewState = False + objPlaceHolder.Add(objLiteralOther) + + End Select + + End If + + Next + + End Sub + + Private Function RenderControlToString(ByVal ctrl As Control) As String + + Dim sb As New StringBuilder() + Dim tw As New IO.StringWriter(sb) + Dim hw As New HtmlTextWriter(tw) + + ctrl.RenderControl(hw) + + Return sb.ToString() + + End Function + + Private Function StripHtml(ByVal html As String) As String + + Dim pattern As String = "<(.|\n)*?>" + Return Regex.Replace(html, pattern, String.Empty) + + End Function + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + ReadQueryString() + + Dim displayType As DisplayType = displayType.UserName + Dim launchLinks As Boolean = False + Dim showPending As Boolean = False + + Dim _portalSettings As PortalSettings = CType(HttpContext.Current.Items("PortalSettings"), PortalSettings) + Dim objModuleController As New ModuleController + Dim objModule As ModuleInfo = objModuleController.GetModule(m_moduleID, m_tabID) + Dim articleSettings As ArticleSettings + + If Not (objModule Is Nothing) Then + Dim objTabController As New TabController() + Dim objTab As TabInfo = objTabController.GetTab(objModule.TabID, _portalSettings.PortalId, False) + + Dim settings As Hashtable = objModuleController.GetModuleSettings(objModule.ModuleID) + settings = PortalSettings.GetTabModuleSettings(objModule.TabModuleID, settings) + articleSettings = New ArticleSettings(settings, _portalSettings, objModule) + If (settings.Contains(ArticleConstants.LAUNCH_LINKS)) Then + launchLinks = Convert.ToBoolean(settings(ArticleConstants.LAUNCH_LINKS).ToString()) + End If + If (settings.Contains(ArticleConstants.TEMPLATE_SETTING)) Then + _template = settings(ArticleConstants.TEMPLATE_SETTING).ToString() + End If + If (settings.Contains(ArticleConstants.ENABLE_SYNDICATION_ENCLOSURES_SETTING)) Then + _enableSyndicationEnclosures = Convert.ToBoolean(settings(ArticleConstants.ENABLE_SYNDICATION_ENCLOSURES_SETTING).ToString()) + End If + If (settings.Contains(ArticleConstants.SYNDICATION_ENCLOSURE_TYPE)) Then + _enclosureType = CType(System.Enum.Parse(GetType(SyndicationEnclosureType), settings(ArticleConstants.SYNDICATION_ENCLOSURE_TYPE).ToString()), SyndicationEnclosureType) + End If + If (settings.Contains(ArticleConstants.ENABLE_SYNDICATION_HTML_SETTING)) Then + _enableSyndicationHtml = Convert.ToBoolean(settings(ArticleConstants.ENABLE_SYNDICATION_HTML_SETTING).ToString()) + End If + Dim settingsModule As Hashtable = objModuleController.GetModuleSettings(objModule.ModuleID) + If (settingsModule.Contains(ArticleConstants.SYNDICATION_SUMMARY_LENGTH)) Then + _syndicationSummaryLength = Convert.ToInt32(settingsModule(ArticleConstants.SYNDICATION_SUMMARY_LENGTH).ToString()) + End If + If (settings.Contains(ArticleConstants.SHOW_PENDING_SETTING)) Then + showPending = Convert.ToBoolean(settings(ArticleConstants.SHOW_PENDING_SETTING).ToString()) + End If + If (settings.Contains(ArticleConstants.DISPLAY_MODE)) Then + displayType = CType(System.Enum.Parse(GetType(DisplayType), settings(ArticleConstants.DISPLAY_MODE).ToString()), DisplayType) + End If + If (m_count = Null.NullInteger) Then + If (settings.Contains(ArticleConstants.SYNDICATION_MAX_COUNT)) Then + Try + m_count = Convert.ToInt32(settings(ArticleConstants.SYNDICATION_MAX_COUNT).ToString()) + Catch + m_count = 50 + End Try + Else + m_count = 50 + End If + End If + If (m_categoryID Is Nothing) Then + If (settings.Contains(ArticleConstants.CATEGORIES_SETTING & m_tabID.ToString())) Then + If Not (settings(ArticleConstants.CATEGORIES_SETTING & m_tabID.ToString()).ToString = Null.NullString Or settings(ArticleConstants.CATEGORIES_SETTING & m_tabID.ToString()).ToString = "-1") Then + Dim categories As String() = settings(ArticleConstants.CATEGORIES_SETTING & m_tabID.ToString()).ToString().Split(","c) + Dim cats As New List(Of Integer) + + For Each category As String In categories + If (IsNumeric(category)) Then + cats.Add(Convert.ToInt32(category)) + End If + Next + + m_categoryID = cats.ToArray() + End If + End If + End If + + If (m_categoryID IsNot Nothing) Then + If (m_categoryID.Length > 0) Then + If (settings.Contains(ArticleConstants.MATCH_OPERATOR_SETTING)) Then + Dim objMatchOperator As MatchOperatorType = CType(System.Enum.Parse(GetType(MatchOperatorType), settings(ArticleConstants.MATCH_OPERATOR_SETTING).ToString()), MatchOperatorType) + If (objMatchOperator = MatchOperatorType.MatchAll) Then + m_matchAll = True + End If + End If + + If (Request("MatchCat") <> "" And Request("CategoryID") <> "") Then + m_matchAll = True + End If + End If + End If + + Dim objLayoutController As New LayoutController(_portalSettings, articleSettings, objModule, Page) + 'Dim objLayoutController As New LayoutController(_portalSettings, articleSettings, Me, False, m_tabID, m_moduleID, objModule.TabModuleID, _portalSettings.PortalId, Null.NullInteger, Null.NullInteger, "Rss-" & m_tabID.ToString()) + + Dim layoutHeader As LayoutInfo = LayoutController.GetLayout(articleSettings, objModule, Page, LayoutType.Rss_Header_Html) + Dim layoutItem As LayoutInfo = LayoutController.GetLayout(articleSettings, objModule, Page, LayoutType.Rss_Item_Html) + Dim layoutFooter As LayoutInfo = LayoutController.GetLayout(articleSettings, objModule, Page, LayoutType.Rss_Footer_Html) + + Dim phRSS As New PlaceHolder + + Response.ContentType = "text/xml" + Response.ContentEncoding = Encoding.UTF8 + + ProcessHeaderFooter(phRSS.Controls, layoutHeader.Tokens) + + Dim agedDate As DateTime = Null.NullDate + Dim startDate As DateTime = DateTime.Now.AddMinutes(1) + If (m_year <> Null.NullInteger AndAlso m_month <> Null.NullInteger) Then + agedDate = New DateTime(m_year, m_month, 1) + startDate = agedDate.AddMonths(1).AddSeconds(-1) + End If + + If (m_categoryID Is Nothing) Then + + ' Permission to view category? + Dim objCategoryController As New CategoryController + Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(m_moduleID, Null.NullInteger) + Dim checkCategory = False + + Dim excludeCategories As New List(Of Integer) + For Each objCategory As CategoryInfo In objCategories + If (objCategory.InheritSecurity = False And objCategory.CategorySecurityType = CategorySecurityType.Restrict) Then + excludeCategories.Add(objCategory.CategoryID) + End If + Next + If (excludeCategories.Count > 0) Then + m_categoryIDExclude = excludeCategories.ToArray() + End If + + For Each objCategory As CategoryInfo In objCategories + If (objCategory.InheritSecurity = False And objCategory.CategorySecurityType = CategorySecurityType.Loose) Then + checkCategory = True + End If + Next + + If (checkCategory) Then + If (m_categoryID Is Nothing) Then + Dim includeCategories As New List(Of Integer) + + For Each objCategory As CategoryInfo In objCategories + If (objCategory.InheritSecurity) Then + includeCategories.Add(objCategory.CategoryID) + End If + Next + + If (includeCategories.Count > 0) Then + includeCategories.Add(-1) + End If + + m_categoryID = includeCategories.ToArray() + Else + Dim includeCategories As New List(Of Integer) + + For Each i As Integer In m_categoryID + For Each objCategory As CategoryInfo In objCategories + If (i = objCategory.CategoryID) Then + If (objCategory.InheritSecurity) Then + includeCategories.Add(objCategory.CategoryID) + End If + End If + Next + Next + + m_categoryID = includeCategories.ToArray() + End If + End If + + End If + + Dim objArticleController As New ArticleController + Dim articleList As List(Of ArticleInfo) = objArticleController.GetArticleList(m_moduleID, startDate, agedDate, m_categoryID, m_matchAll, m_categoryIDExclude, m_count, 1, m_count, m_sortBy, m_sortDirection, True, False, Null.NullString, m_authorID, showPending, m_showExpired, m_featuredOnly, m_notFeaturedOnly, m_securedOnly, m_notSecuredOnly, m_articleIDs, m_tagID, m_tagMatch, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, Null.NullInteger) + + For Each objArticle As ArticleInfo In articleList + + Dim delimStr As String = "[]" + Dim delimiter As Char() = delimStr.ToCharArray() + + Dim phItem As New PlaceHolder + ProcessItem(phItem.Controls, layoutItem.Tokens, objArticle, articleSettings, objTab) + objLayoutController.ProcessArticleItem(phRSS.Controls, RenderControlToString(phItem).Split(delimiter), objArticle) + + Next + + ProcessHeaderFooter(phRSS.Controls, layoutFooter.Tokens) + + Response.Write(RenderControlToString(phRSS)) + + End If + + Response.End() + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/RssComments.aspx b/RssComments.aspx new file mode 100755 index 0000000..6bdd9c1 --- /dev/null +++ b/RssComments.aspx @@ -0,0 +1 @@ +<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="RssComments.aspx.vb" Inherits="Ventrian.NewsArticles.RssComments" %> diff --git a/RssComments.aspx.designer.vb b/RssComments.aspx.designer.vb new file mode 100755 index 0000000..b44364d --- /dev/null +++ b/RssComments.aspx.designer.vb @@ -0,0 +1,17 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class RssComments + End Class +End Namespace diff --git a/RssComments.aspx.vb b/RssComments.aspx.vb new file mode 100755 index 0000000..bcfc079 --- /dev/null +++ b/RssComments.aspx.vb @@ -0,0 +1,232 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System.Text +Imports System.Web + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Entities.Portals + +Namespace Ventrian.NewsArticles + + Partial Public Class RssComments + Inherits Page + +#Region " Private Members " + + Private m_articleID As Integer = Null.NullInteger + Private m_tabID As Integer = Null.NullInteger + Private m_TabInfo As DotNetNuke.Entities.Tabs.TabInfo + Private m_moduleID As Integer = Null.NullInteger + +#End Region + +#Region " Private Methods " + + Private Sub ProcessHeaderFooter(ByRef objPlaceHolder As ControlCollection, ByVal templateArray As String()) + + For iPtr As Integer = 0 To templateArray.Length - 1 Step 2 + + objPlaceHolder.Add(New LiteralControl(templateArray(iPtr).ToString())) + + If iPtr < templateArray.Length - 1 Then + + Select Case templateArray(iPtr + 1) + + Case "PORTALEMAIL" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & iPtr.ToString()) + objLiteral.Text = PortalController.GetCurrentPortalSettings().Email + objPlaceHolder.Add(objLiteral) + + Case "PORTALNAME" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & iPtr.ToString()) + objLiteral.Text = Server.HtmlEncode(PortalController.GetCurrentPortalSettings().PortalName) + objPlaceHolder.Add(objLiteral) + + Case "PORTALURL" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Rss-" & iPtr.ToString()) + objLiteral.Text = Server.HtmlEncode(AddHTTP(PortalController.GetCurrentPortalSettings().PortalAlias.HTTPAlias)) + objPlaceHolder.Add(objLiteral) + + End Select + + End If + + Next + + End Sub + + Private Sub ProcessItem(ByRef objPlaceHolder As ControlCollection, ByVal templateArray As String(), ByVal objArticle As ArticleInfo, ByVal objComment As CommentInfo, ByVal articleSettings As ArticleSettings) + + Dim portalSettings As PortalSettings = PortalController.GetCurrentPortalSettings() + + For iPtr As Integer = 0 To templateArray.Length - 1 Step 2 + + objPlaceHolder.Add(New LiteralControl(templateArray(iPtr).ToString())) + + If iPtr < templateArray.Length - 1 Then + + Select Case templateArray(iPtr + 1) + + Case "CREATEDATE" + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("RssComment-" & objComment.CommentID.ToString() & iPtr.ToString()) + objLiteral.Text = objComment.CreatedDate.ToUniversalTime().ToString("r") + objPlaceHolder.Add(objLiteral) + + Case "DESCRIPTION" + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("RssComment-" & objComment.CommentID.ToString() & iPtr.ToString()) + objLiteral.Text = Server.HtmlEncode(objComment.Comment) + objPlaceHolder.Add(objLiteral) + + Case "GUID" + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("RssComment-" & objComment.CommentID.ToString() & iPtr.ToString()) + objLiteral.Text = "f1397696-738c-4295-afcd-943feb885714:" & objComment.CommentID.ToString() + objPlaceHolder.Add(objLiteral) + + Case "TITLE" + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("RssComment-" & objComment.CommentID.ToString() & iPtr.ToString()) + objLiteral.Text = Server.HtmlEncode(objArticle.Title) + objPlaceHolder.Add(objLiteral) + + Case Else + + Dim objLiteralOther As New Literal + objLiteralOther.ID = Globals.CreateValidID("RssComment-" & objComment.CommentID.ToString() & iPtr.ToString()) + objLiteralOther.Text = "[" & templateArray(iPtr + 1) & "]" + objLiteralOther.EnableViewState = False + objPlaceHolder.Add(objLiteralOther) + + End Select + + End If + + Next + + End Sub + + Private Sub ReadQueryString() + + If (Request("ArticleID") <> "") Then + If (IsNumeric(Request("ArticleID"))) Then + m_articleID = Convert.ToInt32(Request("ArticleID")) + End If + End If + + If (Request("TabID") <> "") Then + If (IsNumeric(Request("TabID"))) Then + m_tabID = Convert.ToInt32(Request("TabID")) + Dim objTabController As New DotNetNuke.Entities.Tabs.TabController + m_TabInfo = objTabController.GetTab(m_tabID, Globals.GetPortalSettings().PortalId, False) + End If + End If + + If (Request("ModuleID") <> "") Then + If (IsNumeric(Request("ModuleID"))) Then + m_moduleID = Convert.ToInt32(Request("ModuleID")) + End If + End If + + End Sub + + Private Function RenderControlToString(ByVal ctrl As Control) As String + + Dim sb As New StringBuilder() + Dim tw As New IO.StringWriter(sb) + Dim hw As New HtmlTextWriter(tw) + + ctrl.RenderControl(hw) + + Return sb.ToString() + + End Function + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + ReadQueryString() + + Dim launchLinks As Boolean = False + Dim enableSyndicationHtml As Boolean = False + + Dim _portalSettings As PortalSettings = CType(HttpContext.Current.Items("PortalSettings"), PortalSettings) + Dim objModuleController As New ModuleController + Dim objModule As ModuleInfo = objModuleController.GetModule(m_moduleID, m_tabID) + Dim articleSettings As ArticleSettings + + If Not (objModule Is Nothing) Then + Dim settings As Hashtable = objModuleController.GetTabModuleSettings(objModule.TabModuleID) + articleSettings = New ArticleSettings(settings, _portalSettings, objModule) + If (settings.Contains(ArticleConstants.LAUNCH_LINKS)) Then + launchLinks = Convert.ToBoolean(settings(ArticleConstants.LAUNCH_LINKS).ToString()) + End If + If (settings.Contains(ArticleConstants.ENABLE_SYNDICATION_HTML_SETTING)) Then + enableSyndicationHtml = Convert.ToBoolean(settings(ArticleConstants.ENABLE_SYNDICATION_HTML_SETTING).ToString()) + End If + If (settings.Contains(ArticleConstants.DISPLAY_MODE)) Then + End If + + Response.ContentType = "text/xml" + Response.ContentEncoding = Encoding.UTF8 + + Dim objArticleController As New ArticleController() + Dim objArticle As ArticleInfo = objArticleController.GetArticle(m_articleID) + + Dim objLayoutController As New LayoutController(_portalSettings, articleSettings, objModule, Page) + ' Dim objLayoutController As New LayoutController(_portalSettings, articleSettings, Me, False, m_tabID, m_moduleID, objModule.TabModuleID, _portalSettings.PortalId, Null.NullInteger, Null.NullInteger, "RssComment-" & m_tabID.ToString()) + + Dim layoutHeader As LayoutInfo = LayoutController.GetLayout(articleSettings, objModule, Page, LayoutType.Rss_Comment_Header_Html) + Dim layoutItem As LayoutInfo = LayoutController.GetLayout(articleSettings, objModule, Page, LayoutType.Rss_Comment_Item_Html) + Dim layoutFooter As LayoutInfo = LayoutController.GetLayout(articleSettings, objModule, Page, (LayoutType.Rss_Comment_Footer_Html)) + + Dim phRSS As New PlaceHolder + + ProcessHeaderFooter(phRSS.Controls, layoutHeader.Tokens) + + Dim objCommentController As CommentController = New CommentController + Dim commentList As List(Of CommentInfo) = objCommentController.GetCommentList(m_moduleID, m_articleID, True, SortDirection.Ascending, Null.NullInteger) + + For Each objComment As CommentInfo In commentList + + Dim delimStr As String = "[]" + Dim delimiter As Char() = delimStr.ToCharArray() + + Dim phItem As New PlaceHolder + ProcessItem(phItem.Controls, layoutItem.Tokens, objArticle, objComment, articleSettings) + + objLayoutController.ProcessComment(phRSS.Controls, objArticle, objComment, RenderControlToString(phItem).Split(delimiter)) + Next + + ProcessHeaderFooter(phRSS.Controls, layoutFooter.Tokens) + + Response.Write(RenderControlToString(phRSS)) + + End If + + Response.End() + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Templates/Default/Comment.Footer.html b/Templates/Default/Comment.Footer.html new file mode 100755 index 0000000..5f28270 --- /dev/null +++ b/Templates/Default/Comment.Footer.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Templates/Default/Comment.Header.html b/Templates/Default/Comment.Header.html new file mode 100755 index 0000000..e69de29 diff --git a/Templates/Default/Comment.Item.html b/Templates/Default/Comment.Item.html new file mode 100755 index 0000000..cf01d7d --- /dev/null +++ b/Templates/Default/Comment.Item.html @@ -0,0 +1,36 @@ + + + + + + + + +
+ comment [ISCOMMENT]By + [HASANONYMOUSURL][/HASANONYMOUSURL][AUTHOR][HASANONYMOUSURL][/HASANONYMOUSURL][/ISCOMMENT] [ISTRACKBACK]By [TRACKBACKBLOGNAME][/ISTRACKBACK] @ + [CREATEDATE] [CREATETIME] [RATING] [DELETE] +
+ + + + +
+ + + + +
+ + [ISCOMMENT][COMMENT][/ISCOMMENT] + [ISTRACKBACK] + Comments from the following blog entry: [TRACKBACKTITLE], located at: [TRACKBACKURL] + [/ISTRACKBACK] + [ISPINGBACK] + Comments from the following blog entry: [PINGBACKURL] + [/ISPINGBACK] + +
+
+
+
diff --git a/Templates/Default/Images/icon_comment.gif b/Templates/Default/Images/icon_comment.gif new file mode 100755 index 0000000..50ea05e Binary files /dev/null and b/Templates/Default/Images/icon_comment.gif differ diff --git a/Templates/Default/Listing.Empty.html b/Templates/Default/Listing.Empty.html new file mode 100755 index 0000000..ec72a5b --- /dev/null +++ b/Templates/Default/Listing.Empty.html @@ -0,0 +1,2 @@ + +[RESX:NoArticles] \ No newline at end of file diff --git a/Templates/Default/Listing.Featured.html b/Templates/Default/Listing.Featured.html new file mode 100755 index 0000000..0f2145a --- /dev/null +++ b/Templates/Default/Listing.Featured.html @@ -0,0 +1,50 @@ + + + + + +
+ + + + + + + +
[PUBLISHSTARTDATE]
+ + + + + + + + +
[IMAGETHUMB:100] + [EDIT] [TITLE] +
+ By [AUTHOR] @ [PUBLISHSTARTTIME] :: [VIEWCOUNT] Views [HASCOMMENTSENABLED]:: + [COMMENTCOUNT] Comments [/HASCOMMENTSENABLED][HASRATINGSENABLED] :: [RATING][/HASRATINGSENABLED][HASCATEGORIES] :: [CATEGORIES][/HASCATEGORIES] +
+ + + + +
+ + + + + [HASMOREDETAIL:150] + + + + [/HASMOREDETAIL:150] +
+ [HASSUMMARY][SUMMARY][/HASSUMMARY][HASNOSUMMARY][DETAILS:150][/HASNOSUMMARY] +
Read + More..
+
+
+
+
diff --git a/Templates/Default/Listing.Featured.xml b/Templates/Default/Listing.Featured.xml new file mode 100755 index 0000000..3490293 --- /dev/null +++ b/Templates/Default/Listing.Featured.xml @@ -0,0 +1,23 @@ + + + [CREATEDATE] + + + FormatString + D + + + + + [EDIT] + + + ToolTip + Edit this Article + + + + + [TITLE] + + diff --git a/Templates/Default/Listing.Footer.html b/Templates/Default/Listing.Footer.html new file mode 100755 index 0000000..98ac2d6 --- /dev/null +++ b/Templates/Default/Listing.Footer.html @@ -0,0 +1,4 @@ + +[HASMULTIPLEPAGES] +[PAGER] +[/HASMULTIPLEPAGES] \ No newline at end of file diff --git a/Templates/Default/Listing.Footer.xml b/Templates/Default/Listing.Footer.xml new file mode 100755 index 0000000..de5b658 --- /dev/null +++ b/Templates/Default/Listing.Footer.xml @@ -0,0 +1,11 @@ + + + [CURRENTPAGE] + + + FormatString + D + + + + diff --git a/Templates/Default/Listing.Header.html b/Templates/Default/Listing.Header.html new file mode 100755 index 0000000..7996a8e --- /dev/null +++ b/Templates/Default/Listing.Header.html @@ -0,0 +1 @@ + diff --git a/Templates/Default/Listing.Item.html b/Templates/Default/Listing.Item.html new file mode 100755 index 0000000..3a55dd9 --- /dev/null +++ b/Templates/Default/Listing.Item.html @@ -0,0 +1,50 @@ + + + + + +
+ + + + + + + +
[PUBLISHSTARTDATE]
+ + + + + + + + +
[IMAGETHUMB:100] + [EDIT] [TITLE] +
+ By [AUTHOR] @ [PUBLISHSTARTTIME] :: [VIEWCOUNT] Views [HASCOMMENTSENABLED]:: + [COMMENTCOUNT] Comments [/HASCOMMENTSENABLED][HASRATINGSENABLED] :: [RATING][/HASRATINGSENABLED][HASCATEGORIES] :: [CATEGORIES][/HASCATEGORIES] +
+ + + + +
+ + + + + [HASMOREDETAIL:150] + + + + [/HASMOREDETAIL:150] +
+ [HASSUMMARY][SUMMARY][/HASSUMMARY][HASNOSUMMARY][DETAILS:150][/HASNOSUMMARY] +
Read + More..
+
+
+
+
diff --git a/Templates/Default/Listing.Item.xml b/Templates/Default/Listing.Item.xml new file mode 100755 index 0000000..3490293 --- /dev/null +++ b/Templates/Default/Listing.Item.xml @@ -0,0 +1,23 @@ + + + [CREATEDATE] + + + FormatString + D + + + + + [EDIT] + + + ToolTip + Edit this Article + + + + + [TITLE] + + diff --git a/Templates/Default/Menu.Item.html b/Templates/Default/Menu.Item.html new file mode 100755 index 0000000..04ffa0e --- /dev/null +++ b/Templates/Default/Menu.Item.html @@ -0,0 +1,26 @@ + +

+ [RESX:CurrentArticles] + | + [RESX:Archives] + | + [RESX:Search] + [ISSUBMITTER] +
+ [RESX:MyArticles] + | + [RESX:CreateArticle] + [/ISSUBMITTER] + [ISAPPROVER] + | + [RESX:ApproveArticles] +[HASCOMMENTSENABLED] + | + [RESX:ApproveComments] +[/HASCOMMENTSENABLED] + [/ISAPPROVER] + [ISADMIN] + | + [RESX:AdminOptions] + [/ISADMIN] +

diff --git a/Templates/Default/Print.Footer.html b/Templates/Default/Print.Footer.html new file mode 100755 index 0000000..e69de29 diff --git a/Templates/Default/Print.Header.html b/Templates/Default/Print.Header.html new file mode 100755 index 0000000..e69de29 diff --git a/Templates/Default/Print.Item.html b/Templates/Default/Print.Item.html new file mode 100755 index 0000000..ab60bc6 --- /dev/null +++ b/Templates/Default/Print.Item.html @@ -0,0 +1,42 @@ + + + + + +
+ + + + + + + +
[PUBLISHSTARTDATE]
+ + + + + + + + +
[IMAGE] + [TITLE] +
+ By [AUTHOR] @ [PUBLISHSTARTTIME] :: [VIEWCOUNT] Views [HASCOMMENTSENABLED]:: + [COMMENTCOUNT] Comments [/HASCOMMENTSENABLED][HASRATINGSENABLED] :: [RATING][/HASRATINGSENABLED][HASCATEGORIES] :: [CATEGORIES][/HASCATEGORIES] +
+ + + + +
+ + + + +
[PAGETEXT]
+
+
+
+
diff --git a/Templates/Default/Template.css b/Templates/Default/Template.css new file mode 100755 index 0000000..0e86ec3 --- /dev/null +++ b/Templates/Default/Template.css @@ -0,0 +1,177 @@ +/* News Articles Custom Styles */ +.articleTitle { font-size : 14px; font-weight : bolder; color : #006600; } +.articleTable { background-color: black; margin: 0px; } +.articleTopCell { background-color: #336699; color: white; font-weight: bold; padding: 6px; height: 25px; } +.articleTopCell .NormalBold { color: #FFF; } +.articleContentCell { color: black; padding: 6px; background-color: #FEFEFE; } +.articleTextCell { color: black; padding: 6px; background-color: #FFFFCC; } +.articleIconCell { background-color: #D0D0D0; width: 20px; } +.articleFooterCell { color: #FFFFFF; padding: 3px; background-color: #336699; height: 25px; } +.articleFooterCell .NormalBold { color: #FFF; } +.featuredTopCell { background-color: #336699; color: white; font-weight: bold; padding: 6px; height: 25px; } + +A.Normal.MenuTop:link { + text-decoration: underline; +} + +A.Normal.MenuTop:visited { + text-decoration: underline; +} + +A.Normal.MenuTop:active { + text-decoration: underline; +} + +A.Normal.MenuTop:hover { + text-decoration: underline; + color: #ff0000; +} + +A.Normal.MenuTopSelected:link { + text-decoration: underline; + color: #ff0000; +} + +A.Normal.MenuTopSelected:visited { + text-decoration: underline; + color: #ff0000; +} + +A.Normal.MenuTopSelected:active { + text-decoration: underline; + color: #ff0000; +} + +A.Normal.MenuTopSelected:hover { + text-decoration: underline; + color: #ff0000; +} + + +/* Photo Area */ + +.articleImageList li +{ + display: inline; + float: left; + margin-left:10px; + margin-right:10px; + margin-top:10px; +} + +/** + * jQuery lightBox plugin + * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/) + * and adapted to me for use like a plugin from jQuery. + * @name jquery-lightbox-0.4.css + * @author Leandro Vieira Pinho - http://leandrovieira.com + * @version 0.4 + * @date November 17, 2007 + * @category jQuery plugin + * @copyright (c) 2007 Leandro Vieira Pinho (leandrovieira.com) + * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US + * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin + */ +#jquery-overlay { + position: absolute; + top: 0; + left: 0; + z-index: 90; + width: 100%; + height: 500px; +} +#jquery-lightbox { + position: absolute; + top: 0; + left: 0; + width: 100%; + z-index: 100; + text-align: center; + line-height: 0; +} +#jquery-lightbox a img { border: none; } +#lightbox-container-image-box { + position: relative; + background-color: #fff; + width: 250px; + height: 250px; + margin: 0 auto; +} +#lightbox-container-image { padding: 10px; } +#lightbox-loading { + position: absolute; + top: 40%; + left: 0%; + height: 25%; + width: 100%; + text-align: center; + line-height: 0; +} + +#lightbox-container-image-data-box { + background-color: #fff; + margin:0pt auto; + overflow: auto; + font-family:Verdana,Helvetica,sans-serif; + font-size:10px; + font-size-adjust:none; + font-style:normal; + font-variant:normal; + font-weight:normal; + line-height:1.4em; +} + +#lightbox-container-image-data { + padding: 0 10px; +} + +#lightbox-container-image-details { + float:left; + text-align:left; + width:70%; +} + +#lightbox-container-image-details-caption +{ + font-weight: bold; +} + +#lightbox-container-image-details-currentNumber +{ + clear:left; + display:block; +} + +#lightbox-container-image-details-currentNumber a, lightbox-container-image-details-currentNumber a:hover +{ + border-bottom:medium none; + color:#151410; + text-decoration:underline; +} + +#lightbox-container-image-details-nav { + clear:left; + display:block; + padding:0pt 0pt 10px; +} + +#lightbox-container-image-details-nav a, #lightbox-container-image-details-nav a:hover { + border-bottom:medium none; + color:#151410; + text-decoration:underline; +} + +#lightbox-container-image-details-nav-btnPrev +{ + margin:0pt 8px 0pt 0pt; +} + +#lightbox-image-details-close-btnClose { + float: right; +} + +#lightbox-image-details-close a, #lightbox-image-details-close a:hover { + border-bottom:medium none; + color:#151410; + text-decoration:underline; +} \ No newline at end of file diff --git a/Templates/Default/View.Footer.html b/Templates/Default/View.Footer.html new file mode 100755 index 0000000..e69de29 diff --git a/Templates/Default/View.Header.html b/Templates/Default/View.Header.html new file mode 100755 index 0000000..e69de29 diff --git a/Templates/Default/View.Item.html b/Templates/Default/View.Item.html new file mode 100755 index 0000000..3289688 --- /dev/null +++ b/Templates/Default/View.Item.html @@ -0,0 +1,116 @@ + + + + + + +
+ + + + + + + +
+ [PUBLISHSTARTDATE]
+ + + + + + + + + +
[IMAGE] + [EDIT] [TITLE]
+ By [AUTHOR] @ [PUBLISHSTARTTIME] :: [VIEWCOUNT] Views [HASCOMMENTSENABLED]:: + [COMMENTCOUNT] Comments [/HASCOMMENTSENABLED][HASRATINGSENABLED] :: [RATING][/HASRATINGSENABLED][HASCATEGORIES] :: [CATEGORIES][/HASCATEGORIES] +
[PRINT] 
+ + + + +
+ + + + + [HASLINK] + + + + [/HASLINK] +
[PAGETEXT]
Read + More..
+
+
+
+
+ +[HASMULTIPLEPAGES] +
+ + + + + + + + +
+ [LINKPREVIOUS] | [LINKNEXT] +
+
+[/HASMULTIPLEPAGES] +[HASIMAGES] +
+ + + + + + + +
Images
+ [IMAGES] +
+
+[/HASIMAGES] +[ISRATEABLE] +
+ + + + + + + +
Rating
+ [POSTRATING] +
+
+[/ISRATEABLE] + + + + + + +
+ + + + + + + +
Comments
+[COMMENTS] + +[POSTCOMMENT] +
+
\ No newline at end of file diff --git a/Templates/Default/View.Item.xml b/Templates/Default/View.Item.xml new file mode 100755 index 0000000..c3e8d6e --- /dev/null +++ b/Templates/Default/View.Item.xml @@ -0,0 +1,11 @@ + + + [PUBLISHSTARTDATE] + + + FormatString + D + + + + diff --git a/Templates/Default/View.PageHeader.Html b/Templates/Default/View.PageHeader.Html new file mode 100755 index 0000000..e69de29 diff --git a/Templates/Default/View.Title.Html b/Templates/Default/View.Title.Html new file mode 100755 index 0000000..b7ee51a --- /dev/null +++ b/Templates/Default/View.Title.Html @@ -0,0 +1 @@ +[TITLE] > [SITETITLE] \ No newline at end of file diff --git a/Templates/JWPlayer/Category.Child.html b/Templates/JWPlayer/Category.Child.html new file mode 100755 index 0000000..57f89d6 --- /dev/null +++ b/Templates/JWPlayer/Category.Child.html @@ -0,0 +1,6 @@ +[ISDEPTHABS:3] +
  • [NAME]
  • +[/ISDEPTHABS:3] +[ISNOTDEPTHABS:3] +
  • [NAME]
  • +[/ISNOTDEPTHABS:3] diff --git a/Templates/JWPlayer/Category.html b/Templates/JWPlayer/Category.html new file mode 100755 index 0000000..302e4c6 --- /dev/null +++ b/Templates/JWPlayer/Category.html @@ -0,0 +1,15 @@ +

    [NAME]

    +[DESCRIPTION] +[HASIMAGE]YES[/HASIMAGE] +[HASNOIMAGE]NO[/HASNOIMAGE] +Image: [IMAGETHUMB:100:100] [IMAGE] +
    +
      +[ISDEPTHABS:2] +[CHILDCATEGORIES:2] +[/ISDEPTHABS:2] +[ISNOTDEPTHABS:2] +[CHILDCATEGORIES:1] +[/ISNOTDEPTHABS:2] +
    +
    diff --git a/Templates/JWPlayer/Comment.Item.html b/Templates/JWPlayer/Comment.Item.html new file mode 100755 index 0000000..cd6817c --- /dev/null +++ b/Templates/JWPlayer/Comment.Item.html @@ -0,0 +1,11 @@ + +
    +
    [AUTHOR]
    +
    +
    + # [HASANONYMOUSURL][/HASANONYMOUSURL][AUTHOR][HASANONYMOUSURL][/HASANONYMOUSURL] [EDIT] +
    +
    [CREATEDATE] [CREATETIME]
    + [COMMENT] +
    +
    diff --git a/Templates/JWPlayer/File.Footer.Html b/Templates/JWPlayer/File.Footer.Html new file mode 100755 index 0000000..ca97522 --- /dev/null +++ b/Templates/JWPlayer/File.Footer.Html @@ -0,0 +1 @@ + diff --git a/Templates/JWPlayer/File.Header.Html b/Templates/JWPlayer/File.Header.Html new file mode 100755 index 0000000..5971365 --- /dev/null +++ b/Templates/JWPlayer/File.Header.Html @@ -0,0 +1 @@ +
      diff --git a/Templates/JWPlayer/File.Item.Html b/Templates/JWPlayer/File.Item.Html new file mode 100755 index 0000000..c3993ef --- /dev/null +++ b/Templates/JWPlayer/File.Item.Html @@ -0,0 +1,3 @@ +
    • + [TITLE] ([SIZE]) +
    • diff --git a/Templates/JWPlayer/Handout.Cover.html b/Templates/JWPlayer/Handout.Cover.html new file mode 100755 index 0000000..7393cb9 --- /dev/null +++ b/Templates/JWPlayer/Handout.Cover.html @@ -0,0 +1,10 @@ + + + + +
      + [LOGO]
      +

      [NAME]


      + [DESCRIPTION] +
      +
       
      diff --git a/Templates/JWPlayer/Handout.End.html b/Templates/JWPlayer/Handout.End.html new file mode 100755 index 0000000..5f28270 --- /dev/null +++ b/Templates/JWPlayer/Handout.End.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Templates/JWPlayer/Handout.Footer.html b/Templates/JWPlayer/Handout.Footer.html new file mode 100755 index 0000000..5f28270 --- /dev/null +++ b/Templates/JWPlayer/Handout.Footer.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Templates/JWPlayer/Handout.Header.html b/Templates/JWPlayer/Handout.Header.html new file mode 100755 index 0000000..734380e --- /dev/null +++ b/Templates/JWPlayer/Handout.Header.html @@ -0,0 +1,9 @@ + + + + + +
      [LOGO] +

      [NAME]

      +
      +
      diff --git a/Templates/JWPlayer/Handout.Item.html b/Templates/JWPlayer/Handout.Item.html new file mode 100755 index 0000000..59171e6 --- /dev/null +++ b/Templates/JWPlayer/Handout.Item.html @@ -0,0 +1,19 @@ +
      + +
      +
      [PUBLISHSTARTDATE:dd]
      +
      + + + +
      + [DETAILS] +
      + + [HASCATEGORIES] +
      + Posted in: [CATEGORIES] +
      + [/HASCATEGORIES] + +
      diff --git a/Templates/JWPlayer/Image.Footer.Html b/Templates/JWPlayer/Image.Footer.Html new file mode 100755 index 0000000..ca97522 --- /dev/null +++ b/Templates/JWPlayer/Image.Footer.Html @@ -0,0 +1 @@ +
    diff --git a/Templates/JWPlayer/Image.Header.Html b/Templates/JWPlayer/Image.Header.Html new file mode 100755 index 0000000..ce64b98 --- /dev/null +++ b/Templates/JWPlayer/Image.Header.Html @@ -0,0 +1 @@ +
      diff --git a/Templates/JWPlayer/Image.Item.Html b/Templates/JWPlayer/Image.Item.Html new file mode 100755 index 0000000..3a9c1cd --- /dev/null +++ b/Templates/JWPlayer/Image.Item.Html @@ -0,0 +1,3 @@ +
    • + [ISITEMINDEX:1]YES1[/ISITEMINDEX:1][IMAGETHUMB:125:125] +
    • diff --git a/Templates/JWPlayer/Images/01.gif b/Templates/JWPlayer/Images/01.gif new file mode 100755 index 0000000..7a14861 Binary files /dev/null and b/Templates/JWPlayer/Images/01.gif differ diff --git a/Templates/JWPlayer/Images/02.gif b/Templates/JWPlayer/Images/02.gif new file mode 100755 index 0000000..5e5c7b5 Binary files /dev/null and b/Templates/JWPlayer/Images/02.gif differ diff --git a/Templates/JWPlayer/Images/03.gif b/Templates/JWPlayer/Images/03.gif new file mode 100755 index 0000000..722f291 Binary files /dev/null and b/Templates/JWPlayer/Images/03.gif differ diff --git a/Templates/JWPlayer/Images/04.gif b/Templates/JWPlayer/Images/04.gif new file mode 100755 index 0000000..e743522 Binary files /dev/null and b/Templates/JWPlayer/Images/04.gif differ diff --git a/Templates/JWPlayer/Images/05.gif b/Templates/JWPlayer/Images/05.gif new file mode 100755 index 0000000..55c4337 Binary files /dev/null and b/Templates/JWPlayer/Images/05.gif differ diff --git a/Templates/JWPlayer/Images/06.gif b/Templates/JWPlayer/Images/06.gif new file mode 100755 index 0000000..bc81f14 Binary files /dev/null and b/Templates/JWPlayer/Images/06.gif differ diff --git a/Templates/JWPlayer/Images/07.gif b/Templates/JWPlayer/Images/07.gif new file mode 100755 index 0000000..a11c68e Binary files /dev/null and b/Templates/JWPlayer/Images/07.gif differ diff --git a/Templates/JWPlayer/Images/08.gif b/Templates/JWPlayer/Images/08.gif new file mode 100755 index 0000000..469d886 Binary files /dev/null and b/Templates/JWPlayer/Images/08.gif differ diff --git a/Templates/JWPlayer/Images/09.gif b/Templates/JWPlayer/Images/09.gif new file mode 100755 index 0000000..b2b6c96 Binary files /dev/null and b/Templates/JWPlayer/Images/09.gif differ diff --git a/Templates/JWPlayer/Images/10.gif b/Templates/JWPlayer/Images/10.gif new file mode 100755 index 0000000..fdbe321 Binary files /dev/null and b/Templates/JWPlayer/Images/10.gif differ diff --git a/Templates/JWPlayer/Images/11.gif b/Templates/JWPlayer/Images/11.gif new file mode 100755 index 0000000..0f57ec6 Binary files /dev/null and b/Templates/JWPlayer/Images/11.gif differ diff --git a/Templates/JWPlayer/Images/12.gif b/Templates/JWPlayer/Images/12.gif new file mode 100755 index 0000000..55460fc Binary files /dev/null and b/Templates/JWPlayer/Images/12.gif differ diff --git a/Templates/JWPlayer/Images/rssbutton.gif b/Templates/JWPlayer/Images/rssbutton.gif new file mode 100755 index 0000000..c9c8392 Binary files /dev/null and b/Templates/JWPlayer/Images/rssbutton.gif differ diff --git a/Templates/JWPlayer/Listing.Empty.html b/Templates/JWPlayer/Listing.Empty.html new file mode 100755 index 0000000..ec72a5b --- /dev/null +++ b/Templates/JWPlayer/Listing.Empty.html @@ -0,0 +1,2 @@ + +[RESX:NoArticles] \ No newline at end of file diff --git a/Templates/JWPlayer/Listing.Featured.html b/Templates/JWPlayer/Listing.Featured.html new file mode 100755 index 0000000..5f28270 --- /dev/null +++ b/Templates/JWPlayer/Listing.Featured.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Templates/JWPlayer/Listing.Footer.html b/Templates/JWPlayer/Listing.Footer.html new file mode 100755 index 0000000..89c972c --- /dev/null +++ b/Templates/JWPlayer/Listing.Footer.html @@ -0,0 +1,4 @@ + +[HASMULTIPLEPAGES] +[PAGER] +[/HASMULTIPLEPAGES] diff --git a/Templates/JWPlayer/Listing.Header.html b/Templates/JWPlayer/Listing.Header.html new file mode 100755 index 0000000..e69de29 diff --git a/Templates/JWPlayer/Listing.Item.html b/Templates/JWPlayer/Listing.Item.html new file mode 100755 index 0000000..6513fd0 --- /dev/null +++ b/Templates/JWPlayer/Listing.Item.html @@ -0,0 +1,32 @@ +[PRINT]
      + +
      +
      [PUBLISHSTARTDATE:dd]
      +
      +

      [EDIT][TITLE]

      + + +
      + [HASIMAGE]
      [IMAGETHUMB:100]
      [/HASIMAGE] + [HASSUMMARY][SUMMARY][/HASSUMMARY][HASNOSUMMARY][DETAILS:150][/HASNOSUMMARY] + [ISRSSITEM]

      [Read the rest of this article...]

      [/ISRSSITEM] + [ISNOTRSSITEM] + [HASMOREDETAIL:150] +

      [Read the rest of this article...]

      + [/HASMOREDETAIL:150][/ISNOTRSSITEM][TAGS] +
      + + [HASCATEGORIES] +
      + Posted in: [CATEGORIES] +
      + [/HASCATEGORIES] + +
      + Actions: + E-mail | + Permalink | + [HASCOMMENTSENABLED]Comments ([COMMENTCOUNT]) [ISSYNDICATIONENABLED]RSS comment feed[/ISSYNDICATIONENABLED] [/HASCOMMENTSENABLED] +
      + +
      diff --git a/Templates/JWPlayer/Menu.Item.html b/Templates/JWPlayer/Menu.Item.html new file mode 100755 index 0000000..fd0a277 --- /dev/null +++ b/Templates/JWPlayer/Menu.Item.html @@ -0,0 +1,35 @@ + +
      + [ISSYNDICATIONENABLED] + + + 25 Latest Articles + + + [/ISSYNDICATIONENABLED] + [RESX:CurrentArticles] + | + [RESX:Archives] + | + [RESX:Search] + + [ISSUBMITTER] +
      + [RESX:MyArticles] + | + [RESX:CreateArticle] + [/ISSUBMITTER] + [ISAPPROVER] + | + [RESX:ApproveArticles] + [HASCOMMENTSENABLED] + | + [RESX:ApproveComments] + [/HASCOMMENTSENABLED] + [/ISAPPROVER] + [ISADMIN] + | + [RESX:AdminOptions] + [/ISADMIN] +
      + diff --git a/Templates/JWPlayer/Print.Item.html b/Templates/JWPlayer/Print.Item.html new file mode 100755 index 0000000..368ed52 --- /dev/null +++ b/Templates/JWPlayer/Print.Item.html @@ -0,0 +1,45 @@ + +
      + +
      +
      [PUBLISHSTARTDATE:dd]
      +
      + + + +
      + [HASIMAGE]
      [IMAGETHUMB:100]
      [/HASIMAGE] + [PAGETEXT] +
      + + [HASMULTIPLEPAGES] +
      + Pages: [CURRENTPAGE] of [PAGECOUNT][HASPREVPAGE] [LINKPREVIOUS][/HASPREVPAGE][HASNEXTPAGE] [LINKNEXT][/HASNEXTPAGE] +
      + [/HASMULTIPLEPAGES] + + [HASCATEGORIES] +
      + Posted in: [CATEGORIES] +
      + [/HASCATEGORIES] + +
      + Actions: + E-mail | + Permalink | + [HASCOMMENTSENABLED]Comments ([COMMENTCOUNT]) RSS comment feed | [/HASCOMMENTSENABLED] + Kick it! | + DZone it! | + del.icio.us +
      + +
      + +[HASCOMMENTSENABLED] +
      +

      Comments

      + [HASCOMMENTS][COMMENTS][/HASCOMMENTS] + [HASNOCOMMENTS]There are currently no comments, be the first to post one.[/HASNOCOMMENTS] +
      +[/HASCOMMENTSENABLED] diff --git a/Templates/JWPlayer/Related.Footer.html b/Templates/JWPlayer/Related.Footer.html new file mode 100755 index 0000000..0b70308 --- /dev/null +++ b/Templates/JWPlayer/Related.Footer.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/Templates/JWPlayer/Related.Header.html b/Templates/JWPlayer/Related.Header.html new file mode 100755 index 0000000..ebce010 --- /dev/null +++ b/Templates/JWPlayer/Related.Header.html @@ -0,0 +1,2 @@ + +
      \ No newline at end of file diff --git a/Templates/JWPlayer/Related.Item.html b/Templates/JWPlayer/Related.Item.html new file mode 100755 index 0000000..6fd6988 --- /dev/null +++ b/Templates/JWPlayer/Related.Item.html @@ -0,0 +1,3 @@ + +[TITLE] +[DETAILS:150]
      diff --git a/Templates/JWPlayer/Rss.Comment.Footer.html b/Templates/JWPlayer/Rss.Comment.Footer.html new file mode 100755 index 0000000..49cf466 --- /dev/null +++ b/Templates/JWPlayer/Rss.Comment.Footer.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/Templates/JWPlayer/Rss.Comment.Header.html b/Templates/JWPlayer/Rss.Comment.Header.html new file mode 100755 index 0000000..a528d93 --- /dev/null +++ b/Templates/JWPlayer/Rss.Comment.Header.html @@ -0,0 +1,6 @@ + + + [PORTALNAME] + [PORTALURL] + [PORTALEMAIL] + [PORTALEMAIL] diff --git a/Templates/JWPlayer/Rss.Comment.Item.html b/Templates/JWPlayer/Rss.Comment.Item.html new file mode 100755 index 0000000..7fb2076 --- /dev/null +++ b/Templates/JWPlayer/Rss.Comment.Item.html @@ -0,0 +1,9 @@ + + [AUTHOR] + Comment by [AUTHOR] on '[TITLE]' + [COMMENTLINK] + [CREATEDATE] + [GUID] + [DESCRIPTION] + [COMMENTLINK] + \ No newline at end of file diff --git a/Templates/JWPlayer/Rss.Footer.html b/Templates/JWPlayer/Rss.Footer.html new file mode 100755 index 0000000..17b5ac2 --- /dev/null +++ b/Templates/JWPlayer/Rss.Footer.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Templates/JWPlayer/Rss.Header.html b/Templates/JWPlayer/Rss.Header.html new file mode 100755 index 0000000..451ef4b --- /dev/null +++ b/Templates/JWPlayer/Rss.Header.html @@ -0,0 +1,6 @@ + + + [PORTALNAME] + [PORTALURL] + RSS feeds for [PORTALNAME] + 60 \ No newline at end of file diff --git a/Templates/JWPlayer/Rss.Item.html b/Templates/JWPlayer/Rss.Item.html new file mode 100755 index 0000000..4602234 --- /dev/null +++ b/Templates/JWPlayer/Rss.Item.html @@ -0,0 +1,13 @@ + + [COMMENTLINK] + [COMMENTCOUNT] + [COMMENTRSS] + [TRACKBACKLINK] + [TITLE] + [IMAGELINK] + [DETAILSDATA] + [CATEGORIESNOLINK] - [AUTHOR] + [PUBLISHDATE] + [GUID] + [HASENCLOSURE][/HASENCLOSURE] + \ No newline at end of file diff --git a/Templates/JWPlayer/Template.css b/Templates/JWPlayer/Template.css new file mode 100755 index 0000000..bced75e --- /dev/null +++ b/Templates/JWPlayer/Template.css @@ -0,0 +1,361 @@ +.article +{ + clear: both; + text-align: left; + margin-bottom : 25px; +} + +.articleHeadline h1 { + margin-bottom: 0px; + background-color:#F0F0F0; + border:1px dashed #C8C8C8; +} + +.articleAuthor { + margin-top:5px; +} + +.articleCalendar { + float: left; + margin-right: 6px; + width: 42px; + height: 42px; +} + +.articleCalendarIcon-01 { + background: url('images/01.gif'); +} + +.articleCalendarIcon-02 { + background: url('images/02.gif'); +} + +.articleCalendarIcon-03 { + background: url('images/03.gif'); +} + +.articleCalendarIcon-04 { + background: url('images/04.gif'); +} + +.articleCalendarIcon-05 { + background: url('images/05.gif'); +} + +.articleCalendarIcon-06 { + background: url('images/06.gif'); +} + +.articleCalendarIcon-07 { + background: url('images/07.gif'); +} + +.articleCalendarIcon-08 { + background: url('images/08.gif'); +} + +.articleCalendarIcon-09 { + background: url('images/09.gif'); +} + +.articleCalendarIcon-10 { + background: url('images/10.gif'); +} + +.articleCalendarIcon-11 { + background: url('images/11.gif'); +} + +.articleCalendarIcon-12 { + background: url('images/12.gif'); +} + +.articleCalendarDay { + font-family:Trebuchet MS,Verdana,Arial,Helvetica,sans-serif; + font-size:17px; + font-weight: bold; + color: #000; + width: 42px; + text-align:center; + padding-top: 15px; +} + +.articleEntry { + margin: 10px 5px; +} + +.articleRelated { + margin: 10px 5px; +} + +.articleRelated a { + display:block; + margin-top:5px; +} + +.articleImage { + margin : 2px 10px 4px 4px; + float : left; +} + +.articlePaging { + border-bottom:1px dotted #D8D8D8; + padding-bottom : 2px; + margin-bottom : 2px; +} + +.articleCategories { + border-bottom:1px dotted #D8D8D8; + margin-bottom:2px; + padding-bottom:2px; +} + +.related h2 +{ + margin-bottom: 0px; + background-color:#F0F0F0; + border:1px dashed #C8C8C8; + padding-left: 5px; +} + +.postRating h2 +{ + margin-bottom: 0px; + background-color:#F0F0F0; + border:1px dashed #C8C8C8; + padding-left: 5px; +} + +.articleComments { + text-align: left; +} + +.articleComments h2 { + margin-bottom: 0px; + background-color:#F0F0F0; + border:1px dashed #C8C8C8; + padding-left: 5px; +} + +.articleComment { + margin : 5px 0 0px 0; + padding : 5px; + min-height : 100px; + height:auto !important; + height:100px; +} + +.articleCommentGravatar { + margin : 2px 10px 4px 4px; + float : left; +} + +.articleCommentContent { + text-align: left; + padding:0px 5px 10px 5px; +} + +.articleCommentAuthor { +} + +.articleCommentDate { + border-bottom:1px dotted #D8D8D8; + margin-bottom:2px; + padding-bottom:2px; +} + +.articleImages { + text-align: left; +} + +.articleImages h2 { + margin-bottom: 0px; + background-color:#F0F0F0; + border:1px dashed #C8C8C8; + padding-left: 5px; +} + +.articleFiles { + text-align: left; +} + +.articleFiles h2 { + margin-bottom: 0px; + background-color:#F0F0F0; + border:1px dashed #C8C8C8; + padding-left: 5px; +} + +.postComment +{ + text-align: left; +} + +.postComment p, .postComment div +{ + padding:2px 10px; + margin: 0px; +} + +.postComment h2 +{ + margin-bottom: 0px; + background-color:#F0F0F0; + border:1px dashed #C8C8C8; + padding-left: 5px; +} + +.postComment input +{ + width: 150px; +} + +.postComment #notify input +{ + width: 20px; +} + +.postComment textarea +{ + width: 450px; + height: 150px; +} + +/* Photo Area */ + +.articleImageList li +{ + display: inline; + float: left; + margin-left:10px; + margin-right:10px; + margin-top:10px; +} + +/* File Area */ + +.articleFileList li +{ + display: inline; + float: left; + margin-left:10px; + margin-right:10px; + margin-top:10px; +} + +/** + * jQuery lightBox plugin + * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/) + * and adapted to me for use like a plugin from jQuery. + * @name jquery-lightbox-0.4.css + * @author Leandro Vieira Pinho - http://leandrovieira.com + * @version 0.4 + * @date November 17, 2007 + * @category jQuery plugin + * @copyright (c) 2007 Leandro Vieira Pinho (leandrovieira.com) + * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US + * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin + */ +#jquery-overlay { + position: absolute; + top: 0; + left: 0; + z-index: 3000; + width: 100%; + height: 500px; +} +#jquery-lightbox { + position: absolute; + top: 0; + left: 0; + width: 100%; + z-index: 5000; + text-align: center; + line-height: 0; +} +#jquery-lightbox a img { border: none; } +#lightbox-container-image-box { + position: relative; + background-color: #fff; + width: 250px; + height: 250px; + margin: 0 auto; +} +#lightbox-container-image { padding: 10px; } +#lightbox-loading { + position: absolute; + top: 40%; + left: 0%; + height: 25%; + width: 100%; + text-align: center; + line-height: 0; +} + +#lightbox-container-image-data-box { + background-color: #fff; + margin:0pt auto; + overflow: auto; + font-family:Verdana,Helvetica,sans-serif; + font-size:10px; + font-size-adjust:none; + font-style:normal; + font-variant:normal; + font-weight:normal; + line-height:1.4em; +} + +#lightbox-container-image-data { + padding: 0 10px; +} + +#lightbox-container-image-details { + float:left; + text-align:left; + width:70%; +} + +#lightbox-container-image-details-caption +{ + font-weight: bold; +} + +#lightbox-container-image-details-currentNumber +{ + clear:left; + display:block; +} + +#lightbox-container-image-details-currentNumber a, lightbox-container-image-details-currentNumber a:hover +{ + border-bottom:medium none; + color:#151410; + text-decoration:underline; +} + +#lightbox-container-image-details-nav { + clear:left; + display:block; + padding:0pt 0pt 10px; +} + +#lightbox-container-image-details-nav a, #lightbox-container-image-details-nav a:hover { + border-bottom:medium none; + color:#151410; + text-decoration:underline; +} + +#lightbox-container-image-details-nav-btnPrev +{ + margin:0pt 8px 0pt 0pt; +} + +#lightbox-image-details-close-btnClose { + float: right; +} + +#lightbox-image-details-close a, #lightbox-image-details-close a:hover { + border-bottom:medium none; + color:#151410; + text-decoration:underline; +} \ No newline at end of file diff --git a/Templates/JWPlayer/View.Description.html b/Templates/JWPlayer/View.Description.html new file mode 100755 index 0000000..17d701f --- /dev/null +++ b/Templates/JWPlayer/View.Description.html @@ -0,0 +1 @@ +[SUMMARY:150] \ No newline at end of file diff --git a/Templates/JWPlayer/View.Item.html b/Templates/JWPlayer/View.Item.html new file mode 100755 index 0000000..7099e7b --- /dev/null +++ b/Templates/JWPlayer/View.Item.html @@ -0,0 +1,102 @@ + +
      + +
      +
      [PUBLISHSTARTDATE:dd]
      +
      +

      [EDIT][TITLE]

      + + +
      + [PAGETEXT] + [HASCUSTOMFIELDS][CUSTOMFIELDS][/HASCUSTOMFIELDS] + [HASLINK] +

      [Read More...]

      + [/HASLINK] +
      + + [HASMULTIPLEPAGES] +
      + Pages: [CURRENTPAGE] of [PAGECOUNT][HASPREVPAGE] [LINKPREVIOUS][/HASPREVPAGE][HASNEXTPAGE] [LINKNEXT][/HASNEXTPAGE] +
      + [/HASMULTIPLEPAGES] + + [HASCATEGORIES] +
      + Posted in: [CATEGORIES] +
      + [/HASCATEGORIES] + +
      + Actions: + E-mail | + Permalink | + [HASCOMMENTSENABLED]Comments ([COMMENTCOUNT]) [ISSYNDICATIONENABLED]RSS comment feed[/ISSYNDICATIONENABLED] [/HASCOMMENTSENABLED] +
      + +
      + +[HASIMAGES] +
      +

      Related Images

      +
      [IMAGES]
      +
      +[/HASIMAGES] + +[HASFILES] +
      +

      Related Files

      + [FILES] +
      +[/HASFILES] + +[HASRELATED] + +[/HASRELATED] + +[ISRATEABLE] +
      +

      Post Rating

      + [POSTRATING] +
      +[/ISRATEABLE] + +[HASCOMMENTSENABLED] +
      +

      Comments

      + [HASCOMMENTS][COMMENTS][/HASCOMMENTS] + [HASNOCOMMENTS]There are currently no comments, be the first to post one![/HASNOCOMMENTS] +
      + +
      +

      Post Comment

      + [POSTCOMMENT] +
      +[/HASCOMMENTSENABLED] + + + + + diff --git a/Templates/JWPlayer/View.Keyword.html b/Templates/JWPlayer/View.Keyword.html new file mode 100755 index 0000000..10a1b4b --- /dev/null +++ b/Templates/JWPlayer/View.Keyword.html @@ -0,0 +1 @@ +[CATEGORIESNOLINK] [TAGSNOLINK] \ No newline at end of file diff --git a/Templates/JWPlayer/View.PageHeader.Html b/Templates/JWPlayer/View.PageHeader.Html new file mode 100755 index 0000000..e69de29 diff --git a/Templates/JWPlayer/View.Title.Html b/Templates/JWPlayer/View.Title.Html new file mode 100755 index 0000000..b7ee51a --- /dev/null +++ b/Templates/JWPlayer/View.Title.Html @@ -0,0 +1 @@ +[TITLE] > [SITETITLE] \ No newline at end of file diff --git a/Templates/Standard/Category.Child.html b/Templates/Standard/Category.Child.html new file mode 100755 index 0000000..57f89d6 --- /dev/null +++ b/Templates/Standard/Category.Child.html @@ -0,0 +1,6 @@ +[ISDEPTHABS:3] +
    • [NAME]
    • +[/ISDEPTHABS:3] +[ISNOTDEPTHABS:3] +
    • [NAME]
    • +[/ISNOTDEPTHABS:3] diff --git a/Templates/Standard/Category.html b/Templates/Standard/Category.html new file mode 100755 index 0000000..302e4c6 --- /dev/null +++ b/Templates/Standard/Category.html @@ -0,0 +1,15 @@ +

      [NAME]

      +[DESCRIPTION] +[HASIMAGE]YES[/HASIMAGE] +[HASNOIMAGE]NO[/HASNOIMAGE] +Image: [IMAGETHUMB:100:100] [IMAGE] +
      +
        +[ISDEPTHABS:2] +[CHILDCATEGORIES:2] +[/ISDEPTHABS:2] +[ISNOTDEPTHABS:2] +[CHILDCATEGORIES:1] +[/ISNOTDEPTHABS:2] +
      +
      diff --git a/Templates/Standard/Comment.Item.html b/Templates/Standard/Comment.Item.html new file mode 100755 index 0000000..cd6817c --- /dev/null +++ b/Templates/Standard/Comment.Item.html @@ -0,0 +1,11 @@ + +
      +
      [AUTHOR]
      +
      +
      + # [HASANONYMOUSURL][/HASANONYMOUSURL][AUTHOR][HASANONYMOUSURL][/HASANONYMOUSURL] [EDIT] +
      +
      [CREATEDATE] [CREATETIME]
      + [COMMENT] +
      +
      diff --git a/Templates/Standard/File.Footer.Html b/Templates/Standard/File.Footer.Html new file mode 100755 index 0000000..ca97522 --- /dev/null +++ b/Templates/Standard/File.Footer.Html @@ -0,0 +1 @@ +
    diff --git a/Templates/Standard/File.Header.Html b/Templates/Standard/File.Header.Html new file mode 100755 index 0000000..5971365 --- /dev/null +++ b/Templates/Standard/File.Header.Html @@ -0,0 +1 @@ +
      diff --git a/Templates/Standard/File.Item.Html b/Templates/Standard/File.Item.Html new file mode 100755 index 0000000..c3993ef --- /dev/null +++ b/Templates/Standard/File.Item.Html @@ -0,0 +1,3 @@ +
    • + [TITLE] ([SIZE]) +
    • diff --git a/Templates/Standard/Handout.Cover.html b/Templates/Standard/Handout.Cover.html new file mode 100755 index 0000000..7393cb9 --- /dev/null +++ b/Templates/Standard/Handout.Cover.html @@ -0,0 +1,10 @@ + + + + +
      + [LOGO]
      +

      [NAME]


      + [DESCRIPTION] +
      +
       
      diff --git a/Templates/Standard/Handout.End.html b/Templates/Standard/Handout.End.html new file mode 100755 index 0000000..5f28270 --- /dev/null +++ b/Templates/Standard/Handout.End.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Templates/Standard/Handout.Footer.html b/Templates/Standard/Handout.Footer.html new file mode 100755 index 0000000..5f28270 --- /dev/null +++ b/Templates/Standard/Handout.Footer.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Templates/Standard/Handout.Header.html b/Templates/Standard/Handout.Header.html new file mode 100755 index 0000000..734380e --- /dev/null +++ b/Templates/Standard/Handout.Header.html @@ -0,0 +1,9 @@ + + + + + +
      [LOGO] +

      [NAME]

      +
      +
      diff --git a/Templates/Standard/Handout.Item.html b/Templates/Standard/Handout.Item.html new file mode 100755 index 0000000..59171e6 --- /dev/null +++ b/Templates/Standard/Handout.Item.html @@ -0,0 +1,19 @@ +
      + +
      +
      [PUBLISHSTARTDATE:dd]
      +
      + + + +
      + [DETAILS] +
      + + [HASCATEGORIES] +
      + Posted in: [CATEGORIES] +
      + [/HASCATEGORIES] + +
      diff --git a/Templates/Standard/Image.Footer.Html b/Templates/Standard/Image.Footer.Html new file mode 100755 index 0000000..ca97522 --- /dev/null +++ b/Templates/Standard/Image.Footer.Html @@ -0,0 +1 @@ +
    diff --git a/Templates/Standard/Image.Header.Html b/Templates/Standard/Image.Header.Html new file mode 100755 index 0000000..ce64b98 --- /dev/null +++ b/Templates/Standard/Image.Header.Html @@ -0,0 +1 @@ +
      diff --git a/Templates/Standard/Image.Item.Html b/Templates/Standard/Image.Item.Html new file mode 100755 index 0000000..35ae347 --- /dev/null +++ b/Templates/Standard/Image.Item.Html @@ -0,0 +1,3 @@ +
    • + [IMAGETHUMB:125:125] +
    • diff --git a/Templates/Standard/Images/01.gif b/Templates/Standard/Images/01.gif new file mode 100755 index 0000000..7a14861 Binary files /dev/null and b/Templates/Standard/Images/01.gif differ diff --git a/Templates/Standard/Images/02.gif b/Templates/Standard/Images/02.gif new file mode 100755 index 0000000..5e5c7b5 Binary files /dev/null and b/Templates/Standard/Images/02.gif differ diff --git a/Templates/Standard/Images/03.gif b/Templates/Standard/Images/03.gif new file mode 100755 index 0000000..722f291 Binary files /dev/null and b/Templates/Standard/Images/03.gif differ diff --git a/Templates/Standard/Images/04.gif b/Templates/Standard/Images/04.gif new file mode 100755 index 0000000..e743522 Binary files /dev/null and b/Templates/Standard/Images/04.gif differ diff --git a/Templates/Standard/Images/05.gif b/Templates/Standard/Images/05.gif new file mode 100755 index 0000000..55c4337 Binary files /dev/null and b/Templates/Standard/Images/05.gif differ diff --git a/Templates/Standard/Images/06.gif b/Templates/Standard/Images/06.gif new file mode 100755 index 0000000..bc81f14 Binary files /dev/null and b/Templates/Standard/Images/06.gif differ diff --git a/Templates/Standard/Images/07.gif b/Templates/Standard/Images/07.gif new file mode 100755 index 0000000..a11c68e Binary files /dev/null and b/Templates/Standard/Images/07.gif differ diff --git a/Templates/Standard/Images/08.gif b/Templates/Standard/Images/08.gif new file mode 100755 index 0000000..469d886 Binary files /dev/null and b/Templates/Standard/Images/08.gif differ diff --git a/Templates/Standard/Images/09.gif b/Templates/Standard/Images/09.gif new file mode 100755 index 0000000..b2b6c96 Binary files /dev/null and b/Templates/Standard/Images/09.gif differ diff --git a/Templates/Standard/Images/10.gif b/Templates/Standard/Images/10.gif new file mode 100755 index 0000000..fdbe321 Binary files /dev/null and b/Templates/Standard/Images/10.gif differ diff --git a/Templates/Standard/Images/11.gif b/Templates/Standard/Images/11.gif new file mode 100755 index 0000000..0f57ec6 Binary files /dev/null and b/Templates/Standard/Images/11.gif differ diff --git a/Templates/Standard/Images/12.gif b/Templates/Standard/Images/12.gif new file mode 100755 index 0000000..55460fc Binary files /dev/null and b/Templates/Standard/Images/12.gif differ diff --git a/Templates/Standard/Images/rssbutton.gif b/Templates/Standard/Images/rssbutton.gif new file mode 100755 index 0000000..c9c8392 Binary files /dev/null and b/Templates/Standard/Images/rssbutton.gif differ diff --git a/Templates/Standard/Listing.Empty.html b/Templates/Standard/Listing.Empty.html new file mode 100755 index 0000000..ec72a5b --- /dev/null +++ b/Templates/Standard/Listing.Empty.html @@ -0,0 +1,2 @@ + +[RESX:NoArticles] \ No newline at end of file diff --git a/Templates/Standard/Listing.Featured.html b/Templates/Standard/Listing.Featured.html new file mode 100755 index 0000000..5f28270 --- /dev/null +++ b/Templates/Standard/Listing.Featured.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Templates/Standard/Listing.Footer.html b/Templates/Standard/Listing.Footer.html new file mode 100755 index 0000000..89c972c --- /dev/null +++ b/Templates/Standard/Listing.Footer.html @@ -0,0 +1,4 @@ + +[HASMULTIPLEPAGES] +[PAGER] +[/HASMULTIPLEPAGES] diff --git a/Templates/Standard/Listing.Header.html b/Templates/Standard/Listing.Header.html new file mode 100755 index 0000000..e69de29 diff --git a/Templates/Standard/Listing.Item.html b/Templates/Standard/Listing.Item.html new file mode 100755 index 0000000..9dbcca6 --- /dev/null +++ b/Templates/Standard/Listing.Item.html @@ -0,0 +1,32 @@ +
      + +
      +
      [PUBLISHSTARTDATE:dd]
      +
      +

      [EDIT][TITLE]

      + + +
      + [HASIMAGE]
      [IMAGETHUMB:100]
      [/HASIMAGE] + [HASSUMMARY][SUMMARY][/HASSUMMARY][HASNOSUMMARY][DETAILS:150][/HASNOSUMMARY] + [ISRSSITEM]

      [Read the rest of this article...]

      [/ISRSSITEM] + [ISNOTRSSITEM] + [HASMOREDETAIL:150] +

      [Read the rest of this article...]

      + [/HASMOREDETAIL:150][/ISNOTRSSITEM][TAGS] +
      + + [HASCATEGORIES] +
      + Posted in: [CATEGORIES] +
      + [/HASCATEGORIES] + +
      + Actions: + E-mail | + Permalink | + [HASCOMMENTSENABLED]Comments ([COMMENTCOUNT]) [ISSYNDICATIONENABLED]RSS comment feed[/ISSYNDICATIONENABLED] [/HASCOMMENTSENABLED] +
      + +
      diff --git a/Templates/Standard/Menu.Item.html b/Templates/Standard/Menu.Item.html new file mode 100755 index 0000000..fd0a277 --- /dev/null +++ b/Templates/Standard/Menu.Item.html @@ -0,0 +1,35 @@ + +
      + [ISSYNDICATIONENABLED] + + + 25 Latest Articles + + + [/ISSYNDICATIONENABLED] + [RESX:CurrentArticles] + | + [RESX:Archives] + | + [RESX:Search] + + [ISSUBMITTER] +
      + [RESX:MyArticles] + | + [RESX:CreateArticle] + [/ISSUBMITTER] + [ISAPPROVER] + | + [RESX:ApproveArticles] + [HASCOMMENTSENABLED] + | + [RESX:ApproveComments] + [/HASCOMMENTSENABLED] + [/ISAPPROVER] + [ISADMIN] + | + [RESX:AdminOptions] + [/ISADMIN] +
      + diff --git a/Templates/Standard/Print.Item.html b/Templates/Standard/Print.Item.html new file mode 100755 index 0000000..368ed52 --- /dev/null +++ b/Templates/Standard/Print.Item.html @@ -0,0 +1,45 @@ + +
      + +
      +
      [PUBLISHSTARTDATE:dd]
      +
      + + + +
      + [HASIMAGE]
      [IMAGETHUMB:100]
      [/HASIMAGE] + [PAGETEXT] +
      + + [HASMULTIPLEPAGES] +
      + Pages: [CURRENTPAGE] of [PAGECOUNT][HASPREVPAGE] [LINKPREVIOUS][/HASPREVPAGE][HASNEXTPAGE] [LINKNEXT][/HASNEXTPAGE] +
      + [/HASMULTIPLEPAGES] + + [HASCATEGORIES] +
      + Posted in: [CATEGORIES] +
      + [/HASCATEGORIES] + +
      + Actions: + E-mail | + Permalink | + [HASCOMMENTSENABLED]Comments ([COMMENTCOUNT]) RSS comment feed | [/HASCOMMENTSENABLED] + Kick it! | + DZone it! | + del.icio.us +
      + +
      + +[HASCOMMENTSENABLED] +
      +

      Comments

      + [HASCOMMENTS][COMMENTS][/HASCOMMENTS] + [HASNOCOMMENTS]There are currently no comments, be the first to post one.[/HASNOCOMMENTS] +
      +[/HASCOMMENTSENABLED] diff --git a/Templates/Standard/Related.Footer.html b/Templates/Standard/Related.Footer.html new file mode 100755 index 0000000..0b70308 --- /dev/null +++ b/Templates/Standard/Related.Footer.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/Templates/Standard/Related.Header.html b/Templates/Standard/Related.Header.html new file mode 100755 index 0000000..ebce010 --- /dev/null +++ b/Templates/Standard/Related.Header.html @@ -0,0 +1,2 @@ + +
      \ No newline at end of file diff --git a/Templates/Standard/Related.Item.html b/Templates/Standard/Related.Item.html new file mode 100755 index 0000000..6fd6988 --- /dev/null +++ b/Templates/Standard/Related.Item.html @@ -0,0 +1,3 @@ + +[TITLE] +[DETAILS:150]
      diff --git a/Templates/Standard/Rss.Comment.Footer.html b/Templates/Standard/Rss.Comment.Footer.html new file mode 100755 index 0000000..49cf466 --- /dev/null +++ b/Templates/Standard/Rss.Comment.Footer.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/Templates/Standard/Rss.Comment.Header.html b/Templates/Standard/Rss.Comment.Header.html new file mode 100755 index 0000000..a528d93 --- /dev/null +++ b/Templates/Standard/Rss.Comment.Header.html @@ -0,0 +1,6 @@ + + + [PORTALNAME] + [PORTALURL] + [PORTALEMAIL] + [PORTALEMAIL] diff --git a/Templates/Standard/Rss.Comment.Item.html b/Templates/Standard/Rss.Comment.Item.html new file mode 100755 index 0000000..7fb2076 --- /dev/null +++ b/Templates/Standard/Rss.Comment.Item.html @@ -0,0 +1,9 @@ + + [AUTHOR] + Comment by [AUTHOR] on '[TITLE]' + [COMMENTLINK] + [CREATEDATE] + [GUID] + [DESCRIPTION] + [COMMENTLINK] + \ No newline at end of file diff --git a/Templates/Standard/Rss.Footer.html b/Templates/Standard/Rss.Footer.html new file mode 100755 index 0000000..17b5ac2 --- /dev/null +++ b/Templates/Standard/Rss.Footer.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Templates/Standard/Rss.Header.html b/Templates/Standard/Rss.Header.html new file mode 100755 index 0000000..451ef4b --- /dev/null +++ b/Templates/Standard/Rss.Header.html @@ -0,0 +1,6 @@ + + + [PORTALNAME] + [PORTALURL] + RSS feeds for [PORTALNAME] + 60 \ No newline at end of file diff --git a/Templates/Standard/Rss.Item.html b/Templates/Standard/Rss.Item.html new file mode 100755 index 0000000..949be84 --- /dev/null +++ b/Templates/Standard/Rss.Item.html @@ -0,0 +1,13 @@ + + [COMMENTLINK] + [COMMENTCOUNT] + [COMMENTRSS] + [TRACKBACKLINK] + [TITLE] + [ARTICLELINK] + [DESCRIPTION] + [AUTHOR] + [PUBLISHDATE] + [GUID] + [HASENCLOSURE][/HASENCLOSURE] + diff --git a/Templates/Standard/Template.css b/Templates/Standard/Template.css new file mode 100755 index 0000000..bced75e --- /dev/null +++ b/Templates/Standard/Template.css @@ -0,0 +1,361 @@ +.article +{ + clear: both; + text-align: left; + margin-bottom : 25px; +} + +.articleHeadline h1 { + margin-bottom: 0px; + background-color:#F0F0F0; + border:1px dashed #C8C8C8; +} + +.articleAuthor { + margin-top:5px; +} + +.articleCalendar { + float: left; + margin-right: 6px; + width: 42px; + height: 42px; +} + +.articleCalendarIcon-01 { + background: url('images/01.gif'); +} + +.articleCalendarIcon-02 { + background: url('images/02.gif'); +} + +.articleCalendarIcon-03 { + background: url('images/03.gif'); +} + +.articleCalendarIcon-04 { + background: url('images/04.gif'); +} + +.articleCalendarIcon-05 { + background: url('images/05.gif'); +} + +.articleCalendarIcon-06 { + background: url('images/06.gif'); +} + +.articleCalendarIcon-07 { + background: url('images/07.gif'); +} + +.articleCalendarIcon-08 { + background: url('images/08.gif'); +} + +.articleCalendarIcon-09 { + background: url('images/09.gif'); +} + +.articleCalendarIcon-10 { + background: url('images/10.gif'); +} + +.articleCalendarIcon-11 { + background: url('images/11.gif'); +} + +.articleCalendarIcon-12 { + background: url('images/12.gif'); +} + +.articleCalendarDay { + font-family:Trebuchet MS,Verdana,Arial,Helvetica,sans-serif; + font-size:17px; + font-weight: bold; + color: #000; + width: 42px; + text-align:center; + padding-top: 15px; +} + +.articleEntry { + margin: 10px 5px; +} + +.articleRelated { + margin: 10px 5px; +} + +.articleRelated a { + display:block; + margin-top:5px; +} + +.articleImage { + margin : 2px 10px 4px 4px; + float : left; +} + +.articlePaging { + border-bottom:1px dotted #D8D8D8; + padding-bottom : 2px; + margin-bottom : 2px; +} + +.articleCategories { + border-bottom:1px dotted #D8D8D8; + margin-bottom:2px; + padding-bottom:2px; +} + +.related h2 +{ + margin-bottom: 0px; + background-color:#F0F0F0; + border:1px dashed #C8C8C8; + padding-left: 5px; +} + +.postRating h2 +{ + margin-bottom: 0px; + background-color:#F0F0F0; + border:1px dashed #C8C8C8; + padding-left: 5px; +} + +.articleComments { + text-align: left; +} + +.articleComments h2 { + margin-bottom: 0px; + background-color:#F0F0F0; + border:1px dashed #C8C8C8; + padding-left: 5px; +} + +.articleComment { + margin : 5px 0 0px 0; + padding : 5px; + min-height : 100px; + height:auto !important; + height:100px; +} + +.articleCommentGravatar { + margin : 2px 10px 4px 4px; + float : left; +} + +.articleCommentContent { + text-align: left; + padding:0px 5px 10px 5px; +} + +.articleCommentAuthor { +} + +.articleCommentDate { + border-bottom:1px dotted #D8D8D8; + margin-bottom:2px; + padding-bottom:2px; +} + +.articleImages { + text-align: left; +} + +.articleImages h2 { + margin-bottom: 0px; + background-color:#F0F0F0; + border:1px dashed #C8C8C8; + padding-left: 5px; +} + +.articleFiles { + text-align: left; +} + +.articleFiles h2 { + margin-bottom: 0px; + background-color:#F0F0F0; + border:1px dashed #C8C8C8; + padding-left: 5px; +} + +.postComment +{ + text-align: left; +} + +.postComment p, .postComment div +{ + padding:2px 10px; + margin: 0px; +} + +.postComment h2 +{ + margin-bottom: 0px; + background-color:#F0F0F0; + border:1px dashed #C8C8C8; + padding-left: 5px; +} + +.postComment input +{ + width: 150px; +} + +.postComment #notify input +{ + width: 20px; +} + +.postComment textarea +{ + width: 450px; + height: 150px; +} + +/* Photo Area */ + +.articleImageList li +{ + display: inline; + float: left; + margin-left:10px; + margin-right:10px; + margin-top:10px; +} + +/* File Area */ + +.articleFileList li +{ + display: inline; + float: left; + margin-left:10px; + margin-right:10px; + margin-top:10px; +} + +/** + * jQuery lightBox plugin + * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/) + * and adapted to me for use like a plugin from jQuery. + * @name jquery-lightbox-0.4.css + * @author Leandro Vieira Pinho - http://leandrovieira.com + * @version 0.4 + * @date November 17, 2007 + * @category jQuery plugin + * @copyright (c) 2007 Leandro Vieira Pinho (leandrovieira.com) + * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US + * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin + */ +#jquery-overlay { + position: absolute; + top: 0; + left: 0; + z-index: 3000; + width: 100%; + height: 500px; +} +#jquery-lightbox { + position: absolute; + top: 0; + left: 0; + width: 100%; + z-index: 5000; + text-align: center; + line-height: 0; +} +#jquery-lightbox a img { border: none; } +#lightbox-container-image-box { + position: relative; + background-color: #fff; + width: 250px; + height: 250px; + margin: 0 auto; +} +#lightbox-container-image { padding: 10px; } +#lightbox-loading { + position: absolute; + top: 40%; + left: 0%; + height: 25%; + width: 100%; + text-align: center; + line-height: 0; +} + +#lightbox-container-image-data-box { + background-color: #fff; + margin:0pt auto; + overflow: auto; + font-family:Verdana,Helvetica,sans-serif; + font-size:10px; + font-size-adjust:none; + font-style:normal; + font-variant:normal; + font-weight:normal; + line-height:1.4em; +} + +#lightbox-container-image-data { + padding: 0 10px; +} + +#lightbox-container-image-details { + float:left; + text-align:left; + width:70%; +} + +#lightbox-container-image-details-caption +{ + font-weight: bold; +} + +#lightbox-container-image-details-currentNumber +{ + clear:left; + display:block; +} + +#lightbox-container-image-details-currentNumber a, lightbox-container-image-details-currentNumber a:hover +{ + border-bottom:medium none; + color:#151410; + text-decoration:underline; +} + +#lightbox-container-image-details-nav { + clear:left; + display:block; + padding:0pt 0pt 10px; +} + +#lightbox-container-image-details-nav a, #lightbox-container-image-details-nav a:hover { + border-bottom:medium none; + color:#151410; + text-decoration:underline; +} + +#lightbox-container-image-details-nav-btnPrev +{ + margin:0pt 8px 0pt 0pt; +} + +#lightbox-image-details-close-btnClose { + float: right; +} + +#lightbox-image-details-close a, #lightbox-image-details-close a:hover { + border-bottom:medium none; + color:#151410; + text-decoration:underline; +} \ No newline at end of file diff --git a/Templates/Standard/View.Description.html b/Templates/Standard/View.Description.html new file mode 100755 index 0000000..17d701f --- /dev/null +++ b/Templates/Standard/View.Description.html @@ -0,0 +1 @@ +[SUMMARY:150] \ No newline at end of file diff --git a/Templates/Standard/View.Item.html b/Templates/Standard/View.Item.html new file mode 100755 index 0000000..c2c0b19 --- /dev/null +++ b/Templates/Standard/View.Item.html @@ -0,0 +1,78 @@ + +
      + +
      +
      [PUBLISHSTARTDATE:dd]
      +
      +

      [EDIT][TITLE]

      + + +
      + [PAGETEXT] + [HASCUSTOMFIELDS][CUSTOMFIELDS][/HASCUSTOMFIELDS] + [HASLINK] +

      [Read More...]

      + [/HASLINK] +
      + + [HASMULTIPLEPAGES] +
      + Pages: [CURRENTPAGE] of [PAGECOUNT][HASPREVPAGE] [LINKPREVIOUS][/HASPREVPAGE][HASNEXTPAGE] [LINKNEXT][/HASNEXTPAGE] +
      + [/HASMULTIPLEPAGES] + + [HASCATEGORIES] +
      + Posted in: [CATEGORIES] +
      + [/HASCATEGORIES] + +
      + Actions: + E-mail | + Permalink | + [HASCOMMENTSENABLED]Comments ([COMMENTCOUNT]) [ISSYNDICATIONENABLED]RSS comment feed[/ISSYNDICATIONENABLED] [/HASCOMMENTSENABLED] +
      + +
      + +[HASIMAGES] +
      +

      Related Images

      +
      [IMAGES]
      +
      +[/HASIMAGES] + +[HASFILES] +
      +

      Related Files

      + [FILES] +
      +[/HASFILES] + +[HASRELATED] + +[/HASRELATED] + +[ISRATEABLE] +
      +

      Post Rating

      + [POSTRATING] +
      +[/ISRATEABLE] + +[HASCOMMENTSENABLED] +
      +

      Comments

      + [HASCOMMENTS][COMMENTS][/HASCOMMENTS] + [HASNOCOMMENTS]There are currently no comments, be the first to post one![/HASNOCOMMENTS] +
      + +
      +

      Post Comment

      + [POSTCOMMENT] +
      +[/HASCOMMENTSENABLED] diff --git a/Templates/Standard/View.Keyword.html b/Templates/Standard/View.Keyword.html new file mode 100755 index 0000000..10a1b4b --- /dev/null +++ b/Templates/Standard/View.Keyword.html @@ -0,0 +1 @@ +[CATEGORIESNOLINK] [TAGSNOLINK] \ No newline at end of file diff --git a/Templates/Standard/View.PageHeader.Html b/Templates/Standard/View.PageHeader.Html new file mode 100755 index 0000000..e69de29 diff --git a/Templates/Standard/View.Title.Html b/Templates/Standard/View.Title.Html new file mode 100755 index 0000000..b7ee51a --- /dev/null +++ b/Templates/Standard/View.Title.Html @@ -0,0 +1 @@ +[TITLE] > [SITETITLE] \ No newline at end of file diff --git a/Tracking/Pingback.ashx b/Tracking/Pingback.ashx new file mode 100755 index 0000000..eabc830 --- /dev/null +++ b/Tracking/Pingback.ashx @@ -0,0 +1 @@ +<%@ WebHandler Language="VB" CodeBehind="Pingback.ashx.vb" Class="Ventrian.NewsArticles.Tracking.Pingback" %> diff --git a/Tracking/Trackback.aspx b/Tracking/Trackback.aspx new file mode 100755 index 0000000..f462211 --- /dev/null +++ b/Tracking/Trackback.aspx @@ -0,0 +1 @@ +<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Trackback.aspx.vb" Inherits="Ventrian.NewsArticles.Tracking.Trackback" %> \ No newline at end of file diff --git a/Uninstall.SqlDataProvider b/Uninstall.SqlDataProvider new file mode 100755 index 0000000..a9f2f6c Binary files /dev/null and b/Uninstall.SqlDataProvider differ diff --git a/Ventrian.NewsArticles.sln b/Ventrian.NewsArticles.sln new file mode 100755 index 0000000..d5bbfa9 --- /dev/null +++ b/Ventrian.NewsArticles.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ventrian.NewsArticles", "Ventrian.NewsArticles.vbproj", "{25F6A930-34CD-4730-8324-D234D4637898}" +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Ventrian.NewsArticles.SqlDataProvider", "Providers\DataProvider\SqlDataProvider\Ventrian.NewsArticles.SqlDataProvider.vbproj", "{D1901326-AD43-466F-942D-AA796EA58D8E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {25F6A930-34CD-4730-8324-D234D4637898}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {25F6A930-34CD-4730-8324-D234D4637898}.Debug|Any CPU.Build.0 = Debug|Any CPU + {25F6A930-34CD-4730-8324-D234D4637898}.Release|Any CPU.ActiveCfg = Release|Any CPU + {25F6A930-34CD-4730-8324-D234D4637898}.Release|Any CPU.Build.0 = Release|Any CPU + {D1901326-AD43-466F-942D-AA796EA58D8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D1901326-AD43-466F-942D-AA796EA58D8E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D1901326-AD43-466F-942D-AA796EA58D8E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D1901326-AD43-466F-942D-AA796EA58D8E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Ventrian.NewsArticles.v11.suo b/Ventrian.NewsArticles.v11.suo new file mode 100755 index 0000000..f358f8d Binary files /dev/null and b/Ventrian.NewsArticles.v11.suo differ diff --git a/Ventrian.NewsArticles.vbproj b/Ventrian.NewsArticles.vbproj new file mode 100755 index 0000000..9fbfe53 --- /dev/null +++ b/Ventrian.NewsArticles.vbproj @@ -0,0 +1,1006 @@ + + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {25F6A930-34CD-4730-8324-D234D4637898} + {349c5851-65df-11da-9384-00065b846f21};{F184B08F-C81C-45F6-A57F-5ABD9991F28F} + Library + + + Ventrian.NewsArticles + Off + + + 3.5 + + + v3.5 + false + + + + + + + + true + full + true + true + ..\..\bin\ + Ventrian.xml + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355 + + + + + pdbonly + false + true + true + bin\ + Ventrian.xml + 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355 + + + + + + + False + ..\..\..\..\DotNetNuke482\Website\Bin\DotNetNuke.dll + + + False + ..\..\bin\DotNetNuke.Web.Client.dll + + + + + + + + + + + + + + + + + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + Handler.ashx + + + + + + + + + + + Rsd.ashx + + + ASPXCodeBehind + + + ASPXCodeBehind + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Component + + + + Component + + + + + + + + + + + + + SWFUploaderFiles.ashx + + + UploadFiles.ascx + + + UploadFiles.ascx + ASPXCodeBehind + + + Listing.ascx + + + Listing.ascx + ASPXCodeBehind + + + PostComment.ascx + + + PostComment.ascx + ASPXCodeBehind + + + PostRating.ascx + + + PostRating.ascx + ASPXCodeBehind + + + SWFUploader.ashx + + + UploadImages.ascx + + + UploadImages.ascx + ASPXCodeBehind + + + LatestComments.ascx + + + LatestComments.ascx + ASPXCodeBehind + + + LatestCommentsOptions.ascx + + + LatestCommentsOptions.ascx + ASPXCodeBehind + + + + + ucEditCategory.ascx + + + ucEditCategory.ascx + ASPXCodeBehind + + + ucEditComment.ascx + + + ucEditComment.ascx + ASPXCodeBehind + + + ucImportFeed.ascx + + + ucImportFeed.ascx + ASPXCodeBehind + + + ucImportFeeds.ascx + + + ucImportFeeds.ascx + ASPXCodeBehind + + + ViewTag.ascx + + + ViewTag.ascx + ASPXCodeBehind + + + NewsSearch.ascx + + + NewsSearch.ascx + ASPXCodeBehind + + + NewsSearchOptions.ascx + + + NewsSearchOptions.ascx + ASPXCodeBehind + + + ucEditCustomField.ascx + + + ucEditCustomField.ascx + ASPXCodeBehind + + + ucEditCustomFields.ascx + + + ucEditCustomFields.ascx + ASPXCodeBehind + + + ucEditTag.ascx + + + ucEditTag.ascx + ASPXCodeBehind + + + ucEditTags.ascx + + + ucEditTags.ascx + ASPXCodeBehind + + + ViewSearch.ascx + + + ViewSearch.ascx + ASPXCodeBehind + + + ImageHandler.ashx + + + LatestArticles.ascx + + + LatestArticles.ascx + ASPXCodeBehind + + + LatestArticlesOptions.ascx + + + LatestArticlesOptions.ascx + ASPXCodeBehind + + + + True + Application.myapp + + + True + True + Resources.resx + + + True + Settings.settings + True + + + NewsArchives.ascx + + + NewsArchives.ascx + ASPXCodeBehind + + + NewsArchivesOptions.ascx + + + NewsArchivesOptions.ascx + ASPXCodeBehind + + + NewsArticles.ascx + + + NewsArticles.ascx + ASPXCodeBehind + + + Print.aspx + + + Print.aspx + ASPXCodeBehind + + + + Rss.aspx + + + Rss.aspx + ASPXCodeBehind + + + RssComments.aspx + + + ASPXCodebehind + RssComments.aspx + + + ucAdminOptions.ascx + + + ucAdminOptions.ascx + ASPXCodeBehind + + + ucApproveArticles.ascx + + + ucApproveArticles.ascx + ASPXCodeBehind + + + ucApproveComments.ascx + + + ucApproveComments.ascx + ASPXCodeBehind + + + ViewArchive.ascx + + + ViewArchive.ascx + ASPXCodeBehind + + + ViewArticle.ascx + + + ViewArticle.ascx + ASPXCodeBehind + + + ViewAuthor.ascx + + + ViewAuthor.ascx + ASPXCodeBehind + + + Archives.ascx + + + Archives.ascx + ASPXCodeBehind + + + ViewCategory.ascx + + + ViewCategory.ascx + ASPXCodeBehind + + + ucEditCategories.ascx + + + ucEditCategories.ascx + ASPXCodeBehind + + + ucEditPage.ascx + + + ucEditPage.ascx + ASPXCodeBehind + + + ucEditPages.ascx + + + ucEditPages.ascx + ASPXCodeBehind + + + ucEditPageSortOrder.ascx + + + ucEditPageSortOrder.ascx + ASPXCodeBehind + + + ucEmailTemplates.ascx + + + ucEmailTemplates.ascx + ASPXCodeBehind + + + ucHeader.ascx + + + ucHeader.ascx + ASPXCodeBehind + + + ucMyArticles.ascx + + + ucMyArticles.ascx + ASPXCodeBehind + + + ViewCurrent.ascx + + + ViewCurrent.ascx + ASPXCodeBehind + + + ucNotAuthenticated.ascx + + + ucNotAuthenticated.ascx + ASPXCodeBehind + + + ucNotAuthorized.ascx + + + ucNotAuthorized.ascx + ASPXCodeBehind + + + ucSubmitNews.ascx + + + ucSubmitNews.ascx + ASPXCodeBehind + + + ucSubmitNewsComplete.ascx + + + ucSubmitNewsComplete.ascx + ASPXCodeBehind + + + ucTemplateEditor.ascx + + + ucTemplateEditor.ascx + ASPXCodeBehind + + + ucViewOptions.ascx + + + ucViewOptions.ascx + ASPXCodeBehind + + + True + True + Reference.map + + + + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + PingBackProxy.vb + Designer + + + PingProxy.vb + Designer + + + Designer + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + Designer + + + + + + + + + + + + + + MSDiscoCodeGenerator + Reference.vb + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Dynamic + Web References\wsStoryFeed\ + http://localhost/dotnetnuke482test/DesktopModules/Smart-Thinker%2520-%2520UserProfile/StoryFeed.asmx + + + + + MySettings + Ventrian_NewsArticles_wsStoryFeed_StoryFeedWS + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + + False + True + 55764 + / + http://localhost/DotNetNuke455 + True + http://localhost/DotNetNuke455 + False + False + + + False + + + + + \ No newline at end of file diff --git a/Ventrian.NewsArticles.vbproj.user b/Ventrian.NewsArticles.vbproj.user new file mode 100755 index 0000000..b8e4aa5 --- /dev/null +++ b/Ventrian.NewsArticles.vbproj.user @@ -0,0 +1,28 @@ + + + + + + + + + CurrentPage + True + False + False + False + + + + + + + + + False + True + + + + + \ No newline at end of file diff --git a/ViewArchive.ascx b/ViewArchive.ascx new file mode 100755 index 0000000..844d442 --- /dev/null +++ b/ViewArchive.ascx @@ -0,0 +1,11 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ViewArchive.ascx.vb" Inherits="Ventrian.NewsArticles.ViewArchive" %> +<%@ Register TagPrefix="Ventrian" TagName="Header" Src="ucHeader.ascx" %> +<%@ Register TagPrefix="Ventrian" TagName="Listing" Src="Controls\Listing.ascx"%> + +
      +

      + +

      +
      + + diff --git a/ViewArchive.ascx.designer.vb b/ViewArchive.ascx.designer.vb new file mode 100755 index 0000000..9ea7d76 --- /dev/null +++ b/ViewArchive.ascx.designer.vb @@ -0,0 +1,53 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ViewArchive + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''lblArchive control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblArchive As Global.System.Web.UI.WebControls.Label + + ''' + '''Listing1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Listing1 As Global.Ventrian.NewsArticles.Controls.Listing + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ViewArchive.ascx.vb b/ViewArchive.ascx.vb new file mode 100755 index 0000000..5bc6660 --- /dev/null +++ b/ViewArchive.ascx.vb @@ -0,0 +1,116 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2008 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Portals +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ViewArchive + Inherits NewsArticleModuleBase + +#Region " Constants " + + Private Const PARAM_YEAR As String = "Year" + Private Const PARAM_MONTH As String = "Month" + +#End Region + +#Region " Private Members " + + Private _year As Integer = Null.NullInteger + Private _month As Integer = Null.NullInteger + +#End Region + +#Region " Private Methods " + + Private Sub BindArchiveName() + + If (_month = Null.NullInteger AndAlso _year = Null.NullInteger) Then + ' No archive to view. + Response.Redirect(NavigateURL(), True) + End If + + If (_year = Null.NullInteger) Then + ' No archive to view. + Response.Redirect(NavigateURL(), True) + End If + + If (_month <> Null.NullInteger) Then + Dim entriesFrom As String = Localization.GetString("MonthYearEntries", LocalResourceFile) + Dim objDate As DateTime = New DateTime(_year, _month, 1) + If (entriesFrom.Contains("{0}") And entriesFrom.Contains("{1}")) Then + lblArchive.Text = String.Format(entriesFrom, objDate.ToString("MMMM"), objDate.ToString("yyyy")) + Else + If (entriesFrom.Contains("{0}")) Then + lblArchive.Text = String.Format(entriesFrom, objDate.ToString("MMMM")) + Else + lblArchive.Text = objDate.ToString("MMMM yyyy") + End If + End If + Me.BasePage.Title = objDate.ToString("MMMM yyyy") & " " & Localization.GetString("Archive", Me.LocalResourceFile) & " | " & Me.BasePage.Title + + Else + Dim entriesFrom As String = Localization.GetString("YearEntries", LocalResourceFile) + If (entriesFrom.Contains("{0}")) Then + lblArchive.Text = String.Format(entriesFrom, _year.ToString()) + Else + lblArchive.Text = _year.ToString() + End If + + Me.BasePage.Title = _year.ToString & " " & Localization.GetString("Archive", Me.LocalResourceFile) & " | " & Me.BasePage.Title + End If + + End Sub + + Private Sub ReadQueryString() + + If (Request(PARAM_YEAR) <> "" AndAlso IsNumeric(Request(PARAM_YEAR))) Then + _year = Convert.ToInt32(Request(PARAM_YEAR)) + End If + + If (Request(PARAM_MONTH) <> "" AndAlso IsNumeric(Request(PARAM_MONTH))) Then + _month = Convert.ToInt32(Request(PARAM_MONTH)) + End If + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Try + + ReadQueryString() + BindArchiveName() + + Listing1.Month = _month + Listing1.Year = _year + Listing1.ShowExpired = True + Listing1.MaxArticles = Null.NullInteger + Listing1.IsIndexed = False + + Listing1.BindListing() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ViewArticle.ascx b/ViewArticle.ascx new file mode 100755 index 0000000..bee8d82 --- /dev/null +++ b/ViewArticle.ascx @@ -0,0 +1,17 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ViewArticle.ascx.vb" Inherits="Ventrian.NewsArticles.ViewArticle" %> +<%@ Register TagPrefix="Ventrian" TagName="Header" Src="ucHeader.ascx" %> + + + + + + + \ No newline at end of file diff --git a/ViewArticle.ascx.designer.vb b/ViewArticle.ascx.designer.vb new file mode 100755 index 0000000..6107fe5 --- /dev/null +++ b/ViewArticle.ascx.designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ViewArticle + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''litPingback control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents litPingback As Global.System.Web.UI.WebControls.Literal + + ''' + '''litRDF control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents litRDF As Global.System.Web.UI.WebControls.Literal + + ''' + '''phArticle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phArticle As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ViewArticle.ascx.vb b/ViewArticle.ascx.vb new file mode 100755 index 0000000..ebb90ff --- /dev/null +++ b/ViewArticle.ascx.vb @@ -0,0 +1,411 @@ +Imports Ventrian.NewsArticles.Components.Common +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities + +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Security +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization + +Imports System.Text +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ViewArticle + Inherits NewsArticleModuleBase + +#Region " Private Members " + + Private _articleID As Integer = Null.NullInteger + Private _pageID As Integer = Null.NullInteger + +#End Region + +#Region " Private Methods " + + Private Sub BindArticle() + + If (_articleID = Null.NullInteger) Then + Response.Redirect(NavigateURL(), True) + End If + + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(_articleID) + + If (objArticle Is Nothing) Then + ' Article doesn't exist. + Response.Redirect(NavigateURL(), True) + End If + + Dim includeCategory As Boolean = False + If (ArticleSettings.CategoryBreadcrumb And Request("CategoryID") <> "") Then + includeCategory = True + End If + + Dim targetUrl As String = "" + If (_pageID <> Null.NullInteger) Then + Dim objPageController As New PageController() + Dim objPages As ArrayList = objPageController.GetPageList(objArticle.ArticleID) + + Dim pageFound As Boolean = False + For Each objPage As PageInfo In objPages + If (objPage.PageID = _pageID) Then + pageFound = True + End If + Next + If (pageFound = False) Then + ' redirect + Response.Status = "301 Moved Permanently" + Response.AddHeader("Location", Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False)) + Response.End() + End If + + targetUrl = Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False, "PageID=" & _pageID.ToString()) + Else + targetUrl = Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False) + End If + + If (ArticleSettings.UseCanonicalLink) Then + Dim litCanonical As New Literal + litCanonical.Text = "" + Me.BasePage.Header.Controls.Add(litCanonical) + End If + + If (objArticle.ModuleID <> Me.ModuleId) Then + ' Article in the wrong ModuleID + Response.Redirect(NavigateURL(), True) + End If + + ' Check Article Security + If (objArticle.IsSecure) Then + If (ArticleSettings.IsSecureEnabled = False) Then + If (ArticleSettings.SecureUrl <> "") Then + Dim url As String = Request.Url.ToString().Replace(AddHTTP(Request.Url.Host), "") + If (ArticleSettings.SecureUrl.IndexOf("?") <> -1) Then + Response.Redirect((ArticleSettings.SecureUrl & "&returnurl=" & Server.UrlEncode(url)).Replace("[ARTICLEID]", objArticle.ArticleID.ToString()), True) + Else + Response.Redirect((ArticleSettings.SecureUrl & "?returnurl=" & Server.UrlEncode(url)).Replace("[ARTICLEID]", objArticle.ArticleID.ToString()), True) + End If + Else + Response.Redirect(NavigateURL(Me.TabId), True) + End If + End If + End If + + ' Is Article Published? + If (objArticle.Status = StatusType.AwaitingApproval Or objArticle.Status = StatusType.Draft Or (objArticle.StartDate > DateTime.Now And ArticleSettings.ShowPending = False)) Then + If Not (ArticleSettings.IsAdmin() Or ArticleSettings.IsApprover() Or Me.UserId = objArticle.AuthorID) Then + Response.Redirect(NavigateURL(Me.TabId), True) + End If + End If + + If (objArticle.IsSecure) Then + If (ArticleSettings.SecureUrl <> "") Then + If (objArticleController.SecureCheck(PortalId, _articleID, UserId) = False And IsEditable = False And UserInfo.IsSuperUser = False And UserInfo.IsInRole("Administrators") = False) Then + Dim url As String = Request.Url.ToString().Replace(AddHTTP(Request.Url.Host), "") + If (ArticleSettings.SecureUrl.IndexOf("?") <> -1) Then + Response.Redirect((ArticleSettings.SecureUrl & "&returnurl=" & Server.UrlEncode(url)).Replace("[ARTICLEID]", objArticle.ArticleID.ToString()), True) + Else + Response.Redirect((ArticleSettings.SecureUrl & "?returnurl=" & Server.UrlEncode(url)).Replace("[ARTICLEID]", objArticle.ArticleID.ToString()), True) + End If + End If + End If + End If + + ' Permission to view category? + Dim objCategoryController As New CategoryController + Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(ModuleId, Null.NullInteger) + + Dim objArticleCategories As ArrayList = objArticleController.GetArticleCategories(objArticle.ArticleID) + For Each objArticleCategory As CategoryInfo In objArticleCategories + For Each objCategory As CategoryInfo In objCategories + If (objCategory.CategoryID = objArticleCategory.CategoryID) Then + If (objCategory.InheritSecurity = False) Then + If (Request.IsAuthenticated) Then + + If (objCategory.CategorySecurityType = CategorySecurityType.Loose) Then + Dim doCheck As Boolean = True + ' Ensure there are no inherit security + For Each objCategoryOther As CategoryInfo In objArticleCategories + For Each objCategoryOther2 As CategoryInfo In objCategories + If (objCategoryOther.CategoryID = objCategoryOther2.CategoryID) Then + If (objCategoryOther2.InheritSecurity) Then + doCheck = False + Exit For + End If + End If + Next + Next + + If (doCheck) Then + If (Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + If (PortalSecurity.IsInRoles(Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString()) = False) Then + Response.Redirect(NavigateURL(Me.TabId), True) + End If + End If + End If + Else + If (Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + If (PortalSecurity.IsInRoles(Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString()) = False) Then + Response.Redirect(NavigateURL(Me.TabId), True) + End If + End If + End If + Else + If (objCategory.CategorySecurityType = CategorySecurityType.Loose) Then + Dim doCheck As Boolean = True + ' Ensure there are no inherit security + For Each objCategoryOther As CategoryInfo In objArticleCategories + For Each objCategoryOther2 As CategoryInfo In objCategories + If (objCategoryOther.CategoryID = objCategoryOther2.CategoryID) Then + If (objCategoryOther2.InheritSecurity) Then + doCheck = False + Exit For + End If + End If + Next + Next + + If (doCheck) Then + Response.Redirect(NavigateURL(Me.TabId), True) + End If + Else + Response.Redirect(NavigateURL(Me.TabId), True) + End If + End If + End If + End If + Next + Next + + ' Check module security + Dim objModuleController As New ModuleController + Dim objModule As ModuleInfo = objModuleController.GetModule(objArticle.ModuleID, Me.TabId) + + If Not (objModule Is Nothing) Then + If (DotNetNuke.Security.PortalSecurity.IsInRoles(objModule.AuthorizedViewRoles) = False) Then + Response.Redirect(NavigateURL(Me.TabId), True) + End If + End If + + ' Increment View Count + Dim cookie As HttpCookie = Request.Cookies("Article" & _articleID.ToString()) + If (cookie Is Nothing) Then + + objArticle.NumberOfViews = objArticle.NumberOfViews + 1 + objArticleController.UpdateArticleCount(objArticle.ArticleID, objArticle.NumberOfViews) + + cookie = New HttpCookie("Article" & _articleID.ToString()) + cookie.Value = "1" + cookie.Expires = DateTime.Now.AddMinutes(20) + Context.Response.Cookies.Add(cookie) + + End If + + Dim objLayoutController As New LayoutController(Me) + If (ArticleSettings.CategoryBreadcrumb & Request("CategoryID") <> "") Then + objLayoutController.IncludeCategory = True + End If + + Dim objLayoutItem As LayoutInfo = LayoutController.GetLayout(Me, LayoutType.View_Item_Html) + objLayoutController.ProcessArticleItem(phArticle.Controls, objLayoutItem.Tokens, objArticle) + + If (objArticle.MetaTitle <> "") Then + Me.BasePage.Title = objArticle.MetaTitle + Else + Dim objLayoutTitle As LayoutInfo = LayoutController.GetLayout(Me, LayoutType.View_Title_Html) + If (objLayoutTitle.Template <> "") Then + Dim phPageTitle As New PlaceHolder() + objLayoutController.ProcessArticleItem(phPageTitle.Controls, objLayoutTitle.Tokens, objArticle) + Me.BasePage.Title = RenderControlToString(phPageTitle) + End If + End If + + If (ArticleSettings.UniquePageTitles) Then + If (_pageID <> Null.NullInteger) Then + Me.BasePage.Title = Me.BasePage.Title & " " & _pageID.ToString() + End If + End If + + If (objArticle.MetaDescription <> "") Then + Me.BasePage.Description = objArticle.MetaDescription + Else + Dim objLayoutDescription As LayoutInfo = LayoutController.GetLayout(Me, LayoutType.View_Description_Html) + If (objLayoutDescription.Template <> "") Then + Dim phPageDescription As New PlaceHolder() + objLayoutController.ProcessArticleItem(phPageDescription.Controls, objLayoutDescription.Tokens, objArticle) + Me.BasePage.Description = RenderControlToString(phPageDescription) + End If + End If + + If (objArticle.MetaKeywords <> "") Then + Me.BasePage.KeyWords = objArticle.MetaKeywords + Else + Dim objLayoutKeyword As LayoutInfo = LayoutController.GetLayout(Me, LayoutType.View_Keyword_Html) + If (objLayoutKeyword.Template <> "") Then + Dim phPageKeyword As New PlaceHolder() + objLayoutController.ProcessArticleItem(phPageKeyword.Controls, objLayoutKeyword.Tokens, objArticle) + Me.BasePage.KeyWords = RenderControlToString(phPageKeyword) + End If + End If + + If (objArticle.PageHeadText <> "") Then + Dim litPageHeadText As New Literal() + litPageHeadText.Text = objArticle.PageHeadText + Me.BasePage.Header.Controls.Add(litPageHeadText) + End If + + Dim objLayoutPageHeader As LayoutInfo = LayoutController.GetLayout(Me, LayoutType.View_PageHeader_Html) + If (objLayoutPageHeader.Template <> "") Then + Dim phPageHeaderTitle As New PlaceHolder() + objLayoutController.ProcessArticleItem(phPageHeaderTitle.Controls, objLayoutPageHeader.Tokens, objArticle) + Me.BasePage.Header.Controls.Add(phPageHeaderTitle) + End If + + End Sub + + Private Sub ReadQueryString() + + If (ArticleSettings.UrlModeType = Components.Types.UrlModeType.Shorterned) Then + Try + If (IsNumeric(Request(ArticleSettings.ShortenedID))) Then + _articleID = Convert.ToInt32(Request(ArticleSettings.ShortenedID)) + End If + Catch + End Try + End If + + If (IsNumeric(Request("ArticleID"))) Then + _articleID = Convert.ToInt32(Request("ArticleID")) + End If + + If (IsNumeric(Request("PageID"))) Then + _pageID = Convert.ToInt32(Request("PageID")) + End If + + End Sub + + Private Function RenderControlToString(ByVal ctrl As Control) As String + + Dim sb As New StringBuilder() + Dim tw As New IO.StringWriter(sb) + Dim hw As New HtmlTextWriter(tw) + + ctrl.RenderControl(hw) + + Return sb.ToString() + + End Function + +#End Region + +#Region " Protected Methods " + + Protected Function GetArticleID() As String + + Return _articleID.ToString() + + End Function + + Protected Function GetLocalizedValue(ByVal key As String) As String + + Return Localization.GetString(key, Me.LocalResourceFile) + + End Function + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Initialization(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Try + ReadQueryString() + BindArticle() + + If (Request("CategoryID") <> "" AndAlso IsNumeric(Request("CategoryID"))) Then + Dim _categoryID As Integer = Convert.ToInt32(Request("CategoryID")) + + Dim objCategoryController As New CategoryController + Dim objCategoriesAll As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(Me.ModuleId, Null.NullInteger, ArticleSettings.CategorySortType) + + For Each objCategory As CategoryInfo In objCategoriesAll + If (objCategory.CategoryID = _categoryID) Then + + If (ArticleSettings.FilterSingleCategory = objCategory.CategoryID) Then + Exit For + End If + + Dim path As String = "" + If (ArticleSettings.CategoryBreadcrumb) Then + Dim objTab As New DotNetNuke.Entities.Tabs.TabInfo + objTab.TabName = objCategory.Name + objTab.Url = Common.GetCategoryLink(TabId, ModuleId, objCategory.CategoryID.ToString(), objCategory.Name, ArticleSettings.LaunchLinks, ArticleSettings) + PortalSettings.ActiveTab.BreadCrumbs.Add(objTab) + + Dim parentID As Integer = objCategory.ParentID + Dim parentCount As Integer = 0 + + While parentID <> Null.NullInteger + For Each objParentCategory As CategoryInfo In objCategoriesAll + If (objParentCategory.CategoryID = parentID) Then + If (ArticleSettings.FilterSingleCategory = objParentCategory.CategoryID) Then + parentID = Null.NullInteger + Exit For + End If + Dim objParentTab As New DotNetNuke.Entities.Tabs.TabInfo + objParentTab.TabID = 10000 + objParentCategory.CategoryID + objParentTab.TabName = objParentCategory.Name + objParentTab.Url = Common.GetCategoryLink(TabId, ModuleId, objParentCategory.CategoryID.ToString(), objParentCategory.Name, ArticleSettings.LaunchLinks, ArticleSettings) + PortalSettings.ActiveTab.BreadCrumbs.Insert(PortalSettings.ActiveTab.BreadCrumbs.Count - 1 - parentCount, objParentTab) + + If (path.Length = 0) Then + path = " > " & objParentCategory.Name + Else + path = " > " & objParentCategory.Name & path + End If + + parentCount = parentCount + 1 + parentID = objParentCategory.ParentID + End If + Next + End While + End If + + If (ArticleSettings.IncludeInPageName) Then + HttpContext.Current.Items.Add("NA1-CategoryName", objCategory.Name) + End If + + Exit For + End If + Next + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub Page_PreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + + Try + + LoadStyleSheet() + + If (HttpContext.Current.Items.Contains("NA1-CategoryName")) Then + PortalSettings.ActiveTab.TabName = HttpContext.Current.Items("NA1-CategoryName").ToString() + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ViewAuthor.ascx b/ViewAuthor.ascx new file mode 100755 index 0000000..94d6e38 --- /dev/null +++ b/ViewAuthor.ascx @@ -0,0 +1,9 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ViewAuthor.ascx.vb" Inherits="Ventrian.NewsArticles.ViewAuthor" %> +<%@ Register TagPrefix="Ventrian" TagName="Header" Src="ucHeader.ascx" %> +<%@ Register TagPrefix="Ventrian" TagName="Listing" Src="Controls/Listing.ascx"%> + +
      +

      +
      + + diff --git a/ViewAuthor.ascx.designer.vb b/ViewAuthor.ascx.designer.vb new file mode 100755 index 0000000..a3ad5d8 --- /dev/null +++ b/ViewAuthor.ascx.designer.vb @@ -0,0 +1,53 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ViewAuthor + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''lblAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblAuthor As Global.System.Web.UI.WebControls.Label + + ''' + '''Listing1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Listing1 As Global.Ventrian.NewsArticles.Controls.Listing + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ViewAuthor.ascx.vb b/ViewAuthor.ascx.vb new file mode 100755 index 0000000..74b6824 --- /dev/null +++ b/ViewAuthor.ascx.vb @@ -0,0 +1,126 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Users +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ViewAuthor + Inherits NewsArticleModuleBase + +#Region " Constants " + + Private Const PARAM_AUTHOR_ID As String = "AuthorID" + +#End Region + +#Region " Private Members " + + Private _authorID As Integer = Null.NullInteger + +#End Region + +#Region " Private Methods " + + Private Sub BindAuthorName() + + If (_authorID = Null.NullInteger) Then + ' Author not specified + Response.Redirect(NavigateURL(), True) + End If + + Dim objUserController As New UserController + Dim objUser As UserInfo = objUserController.GetUser(Me.PortalId, _authorID) + + If (objUser IsNot Nothing) Then + + If (objUser.PortalID <> Me.PortalId) Then + 'Author does not belong to this portal + Response.Redirect(NavigateURL(), True) + End If + + Dim name As String = "" + Select Case ArticleSettings.DisplayMode + Case DisplayType.FirstName + name = objUser.FirstName + Exit Select + + Case DisplayType.FullName + name = objUser.DisplayName + Exit Select + + Case DisplayType.LastName + name = objUser.LastName + Exit Select + + Case DisplayType.UserName + name = objUser.Username + Exit Select + End Select + + Dim entriesFrom As String = Localization.GetString("AuthorEntries", LocalResourceFile) + + If (entriesFrom.Contains("{0}")) Then + lblAuthor.Text = String.Format(entriesFrom, name) + Else + lblAuthor.Text = name + End If + + Me.BasePage.Title = name & " | " & PortalSettings.PortalName + Me.BasePage.Description = lblAuthor.Text + + Else + + ' Author not found. + Response.Redirect(NavigateURL(), True) + + End If + + End Sub + + Private Sub ReadQueryString() + + If (Request(PARAM_AUTHOR_ID) <> "" AndAlso IsNumeric(Request(PARAM_AUTHOR_ID))) Then + _authorID = Convert.ToInt32(Request(PARAM_AUTHOR_ID)) + End If + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Try + + ReadQueryString() + BindAuthorName() + + Listing1.Author = _authorID + Listing1.ShowExpired = True + Listing1.MaxArticles = Null.NullInteger + Listing1.IsIndexed = False + + Listing1.BindListing() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ViewCategory.ascx b/ViewCategory.ascx new file mode 100755 index 0000000..e89cd07 --- /dev/null +++ b/ViewCategory.ascx @@ -0,0 +1,7 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ViewCategory.ascx.vb" Inherits="Ventrian.NewsArticles.ViewCategory" %> +<%@ Register TagPrefix="Ventrian" TagName="Header" Src="ucHeader.ascx" %> +<%@ Register TagPrefix="Ventrian" TagName="Listing" Src="Controls/Listing.ascx"%> + + + + diff --git a/ViewCategory.ascx.designer.vb b/ViewCategory.ascx.designer.vb new file mode 100755 index 0000000..2bd70fe --- /dev/null +++ b/ViewCategory.ascx.designer.vb @@ -0,0 +1,53 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ViewCategory + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''phCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phCategory As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''Listing1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Listing1 As Global.Ventrian.NewsArticles.Controls.Listing + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ViewCategory.ascx.vb b/ViewCategory.ascx.vb new file mode 100755 index 0000000..cd8a775 --- /dev/null +++ b/ViewCategory.ascx.vb @@ -0,0 +1,1001 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization +Imports DotNetNuke.Security + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ViewCategory + Inherits NewsArticleModuleBase + +#Region " Constants " + + Private Const PARAM_CATEGORY_ID As String = "CategoryID" + +#End Region + +#Region " Private Members " + + Private _layoutController As LayoutController + Private _objCategoriesAll As List(Of CategoryInfo) + Private _categoryID As Integer = Null.NullInteger + +#End Region + +#Region " Private Methods " + + Private Sub BindCategory() + + If (_categoryID = Null.NullInteger) Then + ' Category not specified + Return + End If + + Dim objCategoryController As New CategoryController + Dim objCategory As CategoryInfo = objCategoryController.GetCategory(_categoryID, ModuleId) + + If Not (objCategory Is Nothing) Then + + If (objCategory.ModuleID <> Me.ModuleId) Then + ' Category does not belong to this module. + Response.Redirect(NavigateURL(), True) + End If + + ProcessCategory(objCategory, phCategory.Controls) + + Else + + Response.Redirect(NavigateURL(), True) + + End If + + End Sub + + Private Sub ProcessCategoryChild(ByVal objCategory As CategoryInfo, ByRef objPlaceHolder As ControlCollection, ByVal moduleKey As String, ByVal templateArray As String(), ByVal level As Integer) + + For iPtr As Integer = 0 To templateArray.Length - 1 Step 2 + + objPlaceHolder.Add(New LiteralControl(_layoutController.ProcessImages(templateArray(iPtr).ToString()))) + + If iPtr < templateArray.Length - 1 Then + Select Case templateArray(iPtr + 1) + + Case "ARTICLECOUNT" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID(moduleKey & "-" & iPtr.ToString()) + objLiteral.Text = objCategory.NumberOfArticles.ToString() + objPlaceHolder.Add(objLiteral) + + Case "CATEGORYID" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID(moduleKey & "-" & iPtr.ToString()) + objLiteral.Text = objCategory.CategoryID.ToString() + objPlaceHolder.Add(objLiteral) + + Case "DEPTHABS" + For Each objCategoryItem As CategoryInfo In _objCategoriesAll + If (objCategoryItem.CategoryID = objCategory.CategoryID) Then + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID(moduleKey & "-" & iPtr.ToString()) + objLiteral.Text = objCategoryItem.Level.ToString() + objPlaceHolder.Add(objLiteral) + End If + Next + + Case "DEPTHREL" + For Each objCategoryItem As CategoryInfo In _objCategoriesAll + If (objCategoryItem.CategoryID = objCategory.CategoryID) Then + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID(moduleKey & "-" & iPtr.ToString()) + objLiteral.Text = (objCategoryItem.Level - level).ToString() + objPlaceHolder.Add(objLiteral) + End If + Next + + Case "DESCRIPTION" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID(moduleKey & "-" & iPtr.ToString()) + objLiteral.Text = Server.HtmlDecode(objCategory.Description) + objPlaceHolder.Add(objLiteral) + + Case "HASIMAGE" + If (objCategory.Image = "") Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/HASIMAGE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASIMAGE" + ' Do Nothing + + Case "HASNOIMAGE" + If (objCategory.Image <> "") Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/HASNOIMAGE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASNOIMAGE" + ' Do Nothing + + Case "IMAGE" + If (objCategory.Image <> "") Then + + If (objCategory.Image.Split("="c).Length = 2) Then + If (IsNumeric(objCategory.Image.Split("="c)(1))) Then + Dim objFileController As New DotNetNuke.Services.FileSystem.FileController() + Dim objFile As DotNetNuke.Services.FileSystem.FileInfo = objFileController.GetFileById(Convert.ToInt32(objCategory.Image.Split("="c)(1)), PortalId) + + If (objFile IsNot Nothing) Then + Dim objImage As New Image + objImage.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objImage.ImageUrl = PortalSettings.HomeDirectory & objFile.Folder & objFile.FileName + objPlaceHolder.Add(objImage) + End If + End If + + End If + + End If + + Case "IMAGELINK" + If (objCategory.Image <> "") Then + + If (objCategory.Image.Split("="c).Length = 2) Then + If (IsNumeric(objCategory.Image.Split("="c)(1))) Then + Dim objFileController As New DotNetNuke.Services.FileSystem.FileController() + Dim objFile As DotNetNuke.Services.FileSystem.FileInfo = objFileController.GetFileById(Convert.ToInt32(objCategory.Image.Split("="c)(1)), PortalId) + + If (objFile IsNot Nothing) Then + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = PortalSettings.HomeDirectory & objFile.Folder & objFile.FileName + objPlaceHolder.Add(objLiteral) + End If + End If + + End If + + End If + + + Case "LINK" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID(moduleKey & "-" & iPtr.ToString()) + objLiteral.Text = Common.GetCategoryLink(TabId, ModuleId, objCategory.CategoryID.ToString(), objCategory.Name, ArticleSettings.LaunchLinks, ArticleSettings) + objPlaceHolder.Add(objLiteral) + + Case "METADESCRIPTION" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID(moduleKey & "-" & iPtr.ToString()) + objLiteral.Text = objCategory.MetaDescription.ToString() + objPlaceHolder.Add(objLiteral) + + Case "NAME" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID(moduleKey & "-" & iPtr.ToString()) + objLiteral.Text = objCategory.Name + objPlaceHolder.Add(objLiteral) + + Case "RSSLINK" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID(moduleKey & "-" & iPtr.ToString()) + objLiteral.Text = Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/RSS.aspx?TabID=" & TabId.ToString() & "&ModuleID=" & ModuleId.ToString() & "&CategoryID=" & objCategory.CategoryID.ToString()) + objPlaceHolder.Add(objLiteral) + + Case "ORDER" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID(moduleKey & "-" & iPtr.ToString()) + objLiteral.Text = objCategory.SortOrder.ToString() + objPlaceHolder.Add(objLiteral) + + Case "VIEWS" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID(moduleKey & "-" & iPtr.ToString()) + objLiteral.Text = objCategory.NumberOfViews.ToString() + objPlaceHolder.Add(objLiteral) + + Case Else + If (templateArray(iPtr + 1).ToUpper().StartsWith("DESCRIPTION:")) Then + + Dim description As String = Server.HtmlDecode(objCategory.Description) + If (IsNumeric(templateArray(iPtr + 1).Substring(12, templateArray(iPtr + 1).Length - 12))) Then + Dim length As Integer = Convert.ToInt32(templateArray(iPtr + 1).Substring(12, templateArray(iPtr + 1).Length - 12)) + If (StripHtml(Server.HtmlDecode(objCategory.Description)).TrimStart().Length > length) Then + description = Left(StripHtml(Server.HtmlDecode(objCategory.Description)).TrimStart(), length) & "..." + Else + description = Left(StripHtml(Server.HtmlDecode(objCategory.Description)).TrimStart(), length) + End If + End If + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID(moduleKey & "-" & iPtr.ToString()) + objLiteral.Text = description + objPlaceHolder.Add(objLiteral) + Exit Select + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("IFORDER:")) Then + Dim depth As String = templateArray(iPtr + 1).Substring(8, templateArray(iPtr + 1).Length - 8) + Dim isOrder As Boolean = False + For Each item As String In depth.Split(","c) + If (IsNumeric(item)) Then + If (objCategory.SortOrder = Convert.ToInt32(item)) Then + isOrder = True + End If + End If + Next + + Dim endToken As String = "/" & templateArray(iPtr + 1) + If (isOrder = False) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("IFNOTORDER:")) Then + Dim depth As String = templateArray(iPtr + 1).Substring(11, templateArray(iPtr + 1).Length - 11) + Dim isOrder As Boolean = False + For Each item As String In depth.Split(","c) + If (IsNumeric(item)) Then + If (objCategory.SortOrder = Convert.ToInt32(item)) Then + isOrder = True + End If + End If + Next + + Dim endToken As String = "/" & templateArray(iPtr + 1) + If (isOrder = True) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + + + If (templateArray(iPtr + 1).ToUpper().StartsWith("IMAGETHUMB:")) Then + + If (objCategory.Image <> "") Then + + If (objCategory.Image.Split("="c).Length = 2) Then + If (IsNumeric(objCategory.Image.Split("="c)(1))) Then + Dim objFileController As New DotNetNuke.Services.FileSystem.FileController() + Dim objFile As DotNetNuke.Services.FileSystem.FileInfo = objFileController.GetFileById(Convert.ToInt32(objCategory.Image.Split("="c)(1)), PortalId) + + If (objFile IsNot Nothing) Then + + Dim val As String = templateArray(iPtr + 1).Substring(11, templateArray(iPtr + 1).Length - 11) + If (val.IndexOf(":"c) = -1) Then + Dim length As Integer = Convert.ToInt32(val) + + Dim objImage As New Image + If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then + objImage.ImageUrl = Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory & objFile.Folder) & "&FileName=" & Server.UrlEncode(objFile.FileName) & "&PortalID=" & PortalId.ToString() & "&q=1") + Else + objImage.ImageUrl = Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory & objFile.Folder) & "&FileName=" & Server.UrlEncode(objFile.FileName) & "&PortalID=" & PortalId.ToString() & "&q=1&s=1") + End If + objImage.EnableViewState = False + objPlaceHolder.Add(objImage) + + Else + + Dim arr() As String = val.Split(":"c) + + Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0)) + Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1)) + + Dim objImage As New Image + If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then + objImage.ImageUrl = Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory & objFile.Folder) & "&FileName=" & Server.UrlEncode(objFile.FileName) & "&PortalID=" & PortalId.ToString() & "&q=1") + Else + objImage.ImageUrl = Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory & objFile.Folder) & "&FileName=" & Server.UrlEncode(objFile.FileName) & "&PortalID=" & PortalId.ToString() & "&q=1&s=1") + End If + objImage.EnableViewState = False + objPlaceHolder.Add(objImage) + + End If + + End If + End If + End If + End If + + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("ISDEPTHABS:")) Then + Dim depth As String = templateArray(iPtr + 1).Substring(11, templateArray(iPtr + 1).Length - 11) + Dim isDepth As Boolean = False + For Each item As String In depth.Split(","c) + If (IsNumeric(item)) Then + For Each objCategoryItem As CategoryInfo In _objCategoriesAll + If (objCategoryItem.CategoryID = objCategory.CategoryID) Then + If (objCategoryItem.Level = Convert.ToInt32(item)) Then + isDepth = True + End If + End If + Next + End If + Next + + Dim endToken As String = "/" & templateArray(iPtr + 1) + If (isDepth = False) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("ISDEPTHREL:")) Then + Dim depth As String = templateArray(iPtr + 1).Substring(11, templateArray(iPtr + 1).Length - 11) + Dim isDepth As Boolean = False + For Each item As String In depth.Split(","c) + If (IsNumeric(item)) Then + For Each objCategoryItem As CategoryInfo In _objCategoriesAll + If (objCategoryItem.CategoryID = objCategory.CategoryID) Then + If ((objCategoryItem.Level - level) = Convert.ToInt32(item)) Then + isDepth = True + End If + End If + Next + End If + Next + + Dim endToken As String = "/" & templateArray(iPtr + 1) + If (isDepth = False) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("ISNOTDEPTHABS:")) Then + Dim depth As String = templateArray(iPtr + 1).Substring(14, templateArray(iPtr + 1).Length - 14) + Dim isDepth As Boolean = False + For Each item As String In depth.Split(","c) + If (IsNumeric(item)) Then + For Each objCategoryItem As CategoryInfo In _objCategoriesAll + If (objCategoryItem.CategoryID = objCategory.CategoryID) Then + If (objCategoryItem.Level = Convert.ToInt32(item)) Then + isDepth = True + End If + End If + Next + End If + Next + + Dim endToken As String = "/" & templateArray(iPtr + 1) + If (isDepth = True) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("ISNOTDEPTHREL:")) Then + Dim depth As String = templateArray(iPtr + 1).Substring(14, templateArray(iPtr + 1).Length - 14) + Dim isDepth As Boolean = False + For Each item As String In depth.Split(","c) + If (IsNumeric(item)) Then + For Each objCategoryItem As CategoryInfo In _objCategoriesAll + If (objCategoryItem.CategoryID = objCategory.CategoryID) Then + If ((objCategoryItem.Level - level) = Convert.ToInt32(item)) Then + isDepth = True + End If + End If + Next + End If + Next + + Dim endToken As String = "/" & templateArray(iPtr + 1) + If (isDepth = True) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + + End Select + End If + Next + + End Sub + + Private Sub ProcessCategory(ByVal objCategory As CategoryInfo, ByRef objPlaceHolder As ControlCollection) + + _layoutController = New LayoutController(Me) + Dim layoutCategory As LayoutInfo = LayoutController.GetLayout(Me, LayoutType.Category_Html) + Dim layoutCategoryChild As LayoutInfo = LayoutController.GetLayout(Me, LayoutType.Category_Child_Html) + Dim templateArray As String() = layoutCategory.Tokens + + Dim objCategoryController As New CategoryController + Dim objParentCategory As CategoryInfo = Nothing + + If (objCategory.ParentID <> Null.NullInteger) Then + objParentCategory = objCategoryController.GetCategory(objCategory.ParentID, ModuleId) + End If + + Dim objCategoriesChildren As List(Of CategoryInfo) = objCategoryController.GetCategories(Me.ModuleId, objCategory.CategoryID) + + For iPtr As Integer = 0 To templateArray.Length - 1 Step 2 + + objPlaceHolder.Add(New LiteralControl(_layoutController.ProcessImages(templateArray(iPtr).ToString()))) + + If iPtr < templateArray.Length - 1 Then + Select Case templateArray(iPtr + 1) + + Case "ARTICLECOUNT" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = objCategory.NumberOfArticles.ToString() + objPlaceHolder.Add(objLiteral) + + Case "CATEGORYLABEL" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + Dim entriesFrom As String = Localization.GetString("CategoryEntries", LocalResourceFile) + If (entriesFrom.Contains("{0}")) Then + objLiteral.Text = String.Format(entriesFrom, objCategory.Name) + Else + objLiteral.Text = objCategory.Name + End If + objPlaceHolder.Add(objLiteral) + + Case "CATEGORYID" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = objCategory.CategoryID.ToString() + objPlaceHolder.Add(objLiteral) + + Case "CHILDCATEGORIES" + If (objCategoriesChildren.Count > 0) Then + For Each objCategoryItem As CategoryInfo In _objCategoriesAll + If (objCategoryItem.CategoryID = objCategory.CategoryID) Then + Dim i As Integer = 0 + For Each objCategoryChild As CategoryInfo In objCategoriesChildren + ProcessCategoryChild(objCategoryChild, objPlaceHolder, "ChildCategory-" & i.ToString() & "-" & iPtr.ToString(), layoutCategoryChild.Tokens, objCategoryItem.Level) + i = i + 1 + Next + End If + Next + End If + + Case "DESCRIPTION" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = Server.HtmlDecode(objCategory.Description) + objPlaceHolder.Add(objLiteral) + + Case "HASCHILDCATEGORIES" + If (objCategoriesChildren.Count = 0) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/HASCHILDCATEGORIES") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASCHILDCATEGORIES" + ' Do Nothing + + Case "HASNOCHILDCATEGORIES" + If (objCategoriesChildren.Count > 0) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/HASNOCHILDCATEGORIES") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASNOCHILDCATEGORIES" + ' Do Nothing + + Case "HASNOPARENT" + If (objParentCategory IsNot Nothing) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/HASNOPARENT") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASNOPARENT" + ' Do Nothing + + Case "HASPARENT" + If (objParentCategory Is Nothing) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/HASPARENT") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASPARENT" + ' Do Nothing + + Case "HASIMAGE" + If (objCategory.Image = "") Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/HASIMAGE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASIMAGE" + ' Do Nothing + + Case "HASNOIMAGE" + If (objCategory.Image <> "") Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = "/HASNOIMAGE") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/HASNOIMAGE" + ' Do Nothing + + Case "IMAGE" + If (objCategory.Image <> "") Then + + If (objCategory.Image.Split("="c).Length = 2) Then + If (IsNumeric(objCategory.Image.Split("="c)(1))) Then + Dim objFileController As New DotNetNuke.Services.FileSystem.FileController() + Dim objFile As DotNetNuke.Services.FileSystem.FileInfo = objFileController.GetFileById(Convert.ToInt32(objCategory.Image.Split("="c)(1)), PortalId) + + If (objFile IsNot Nothing) Then + Dim objImage As New Image + objImage.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objImage.ImageUrl = PortalSettings.HomeDirectory & objFile.Folder & objFile.FileName + objPlaceHolder.Add(objImage) + End If + End If + + End If + + End If + + Case "IMAGELINK" + If (objCategory.Image <> "") Then + + If (objCategory.Image.Split("="c).Length = 2) Then + If (IsNumeric(objCategory.Image.Split("="c)(1))) Then + Dim objFileController As New DotNetNuke.Services.FileSystem.FileController() + Dim objFile As DotNetNuke.Services.FileSystem.FileInfo = objFileController.GetFileById(Convert.ToInt32(objCategory.Image.Split("="c)(1)), PortalId) + + If (objFile IsNot Nothing) Then + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = PortalSettings.HomeDirectory & objFile.Folder & objFile.FileName + objPlaceHolder.Add(objLiteral) + End If + End If + + End If + + End If + + Case "LINK" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = Common.GetCategoryLink(TabId, ModuleId, objCategory.CategoryID.ToString(), objCategory.Name, ArticleSettings.LaunchLinks, ArticleSettings) + objPlaceHolder.Add(objLiteral) + + Case "METADESCRIPTION" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = objCategory.MetaDescription.ToString() + objPlaceHolder.Add(objLiteral) + + Case "NAME" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = objCategory.Name + objPlaceHolder.Add(objLiteral) + + Case "PARENTDESCRIPTION" + If (objParentCategory IsNot Nothing) Then + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = Server.HtmlDecode(objParentCategory.Description) + objPlaceHolder.Add(objLiteral) + End If + + Case "PARENTLINK" + If (objParentCategory IsNot Nothing) Then + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = Common.GetCategoryLink(TabId, ModuleId, objParentCategory.CategoryID.ToString(), objParentCategory.Name, ArticleSettings.LaunchLinks, ArticleSettings) + objPlaceHolder.Add(objLiteral) + End If + + Case "PARENTNAME" + If (objParentCategory IsNot Nothing) Then + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = objParentCategory.Name + objPlaceHolder.Add(objLiteral) + End If + + Case "RSSLINK" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/RSS.aspx?TabID=" & TabId.ToString() & "&ModuleID=" & ModuleId.ToString() & "&CategoryID=" & objCategory.CategoryID.ToString()) + objPlaceHolder.Add(objLiteral) + + Case "VIEWS" + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = objCategory.NumberOfViews.ToString() + objPlaceHolder.Add(objLiteral) + + Case Else + If (templateArray(iPtr + 1).ToUpper().StartsWith("CHILDCATEGORIES:")) Then + Dim count As String = templateArray(iPtr + 1).Substring(16, templateArray(iPtr + 1).Length - 16) + If (IsNumeric(count)) Then + Dim relativeLevel As Integer = Null.NullInteger + For Each objCategoryItem As CategoryInfo In _objCategoriesAll + If (objCategoryItem.CategoryID = objCategory.CategoryID) Then + relativeLevel = objCategoryItem.Level + End If + Next + + Dim level As Integer = Null.NullInteger + Dim i As Integer = 0 + For Each objCategoryItem As CategoryInfo In _objCategoriesAll + If (level <> Null.NullInteger AndAlso objCategoryItem.Level <= level) Then + Exit For + End If + If (objCategoryItem.CategoryID = objCategory.CategoryID) Then + level = objCategoryItem.Level + Else + If (level <> Null.NullInteger) Then + If (objCategoryItem.Level > level And ((objCategoryItem.Level - relativeLevel) <= Convert.ToInt32(count))) Then + ProcessCategoryChild(objCategoryItem, objPlaceHolder, "ChildCategory" & i.ToString() & "-" & iPtr.ToString(), layoutCategoryChild.Tokens(), relativeLevel) + i = i + 1 + End If + End If + End If + Next + End If + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("DESCRIPTION:")) Then + + Dim description As String = Server.HtmlDecode(objCategory.Description) + If (IsNumeric(templateArray(iPtr + 1).Substring(12, templateArray(iPtr + 1).Length - 12))) Then + Dim length As Integer = Convert.ToInt32(templateArray(iPtr + 1).Substring(12, templateArray(iPtr + 1).Length - 12)) + If (StripHtml(Server.HtmlDecode(objCategory.Description)).TrimStart().Length > length) Then + description = Left(StripHtml(Server.HtmlDecode(objCategory.Description)).TrimStart(), length) & "..." + Else + description = Left(StripHtml(Server.HtmlDecode(objCategory.Description)).TrimStart(), length) + End If + End If + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = description + objPlaceHolder.Add(objLiteral) + Exit Select + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("ISDEPTHABS:")) Then + Dim depth As String = templateArray(iPtr + 1).Substring(11, templateArray(iPtr + 1).Length - 11) + Dim isDepth As Boolean = False + For Each item As String In depth.Split(","c) + If (IsNumeric(item)) Then + For Each objCategoryItem As CategoryInfo In _objCategoriesAll + If (objCategoryItem.CategoryID = objCategory.CategoryID) Then + If (objCategoryItem.Level = Convert.ToInt32(item)) Then + isDepth = True + End If + End If + Next + End If + Next + + Dim endToken As String = "/" & templateArray(iPtr + 1) + If (isDepth = False) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("ISNOTDEPTHABS:")) Then + Dim depth As String = templateArray(iPtr + 1).Substring(14, templateArray(iPtr + 1).Length - 14) + Dim isDepth As Boolean = False + For Each item As String In depth.Split(","c) + If (IsNumeric(item)) Then + For Each objCategoryItem As CategoryInfo In _objCategoriesAll + If (objCategoryItem.CategoryID = objCategory.CategoryID) Then + If (objCategoryItem.Level = Convert.ToInt32(item)) Then + isDepth = True + End If + End If + Next + End If + Next + + Dim endToken As String = "/" & templateArray(iPtr + 1) + If (isDepth = True) Then + While (iPtr < templateArray.Length - 1) + If (templateArray(iPtr + 1) = endToken) Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("IMAGETHUMB:")) Then + + If (objCategory.Image <> "") Then + + If (objCategory.Image.Split("="c).Length = 2) Then + If (IsNumeric(objCategory.Image.Split("="c)(1))) Then + Dim objFileController As New DotNetNuke.Services.FileSystem.FileController() + Dim objFile As DotNetNuke.Services.FileSystem.FileInfo = objFileController.GetFileById(Convert.ToInt32(objCategory.Image.Split("="c)(1)), PortalId) + + If (objFile IsNot Nothing) Then + + Dim val As String = templateArray(iPtr + 1).Substring(11, templateArray(iPtr + 1).Length - 11) + If (val.IndexOf(":"c) = -1) Then + Dim length As Integer = Convert.ToInt32(val) + + Dim objImage As New Image + If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then + objImage.ImageUrl = Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory & objFile.Folder) & "&FileName=" & Server.UrlEncode(objFile.FileName) & "&PortalID=" & PortalId.ToString() & "&q=1") + Else + objImage.ImageUrl = Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory & objFile.Folder) & "&FileName=" & Server.UrlEncode(objFile.FileName) & "&PortalID=" & PortalId.ToString() & "&q=1&s=1") + End If + objImage.EnableViewState = False + objPlaceHolder.Add(objImage) + + Else + + Dim arr() As String = val.Split(":"c) + + Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0)) + Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1)) + + Dim objImage As New Image + If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then + objImage.ImageUrl = Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory & objFile.Folder) & "&FileName=" & Server.UrlEncode(objFile.FileName) & "&PortalID=" & PortalId.ToString() & "&q=1") + Else + objImage.ImageUrl = Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory & objFile.Folder) & "&FileName=" & Server.UrlEncode(objFile.FileName) & "&PortalID=" & PortalId.ToString() & "&q=1&s=1") + End If + objImage.EnableViewState = False + objPlaceHolder.Add(objImage) + + End If + + End If + End If + End If + End If + + End If + + If (templateArray(iPtr + 1).ToUpper().StartsWith("PARENTDESCRIPTION:")) Then + + If (objParentCategory IsNot Nothing) Then + Dim description As String = Server.HtmlDecode(objParentCategory.Description) + If (IsNumeric(templateArray(iPtr + 1).Substring(18, templateArray(iPtr + 1).Length - 18))) Then + Dim length As Integer = Convert.ToInt32(templateArray(iPtr + 1).Substring(18, templateArray(iPtr + 1).Length - 18)) + If (StripHtml(Server.HtmlDecode(objParentCategory.Description)).TrimStart().Length > length) Then + description = Left(StripHtml(Server.HtmlDecode(objParentCategory.Description)).TrimStart(), length) & "..." + Else + description = Left(StripHtml(Server.HtmlDecode(objParentCategory.Description)).TrimStart(), length) + End If + End If + + Dim objLiteral As New Literal + objLiteral.ID = Globals.CreateValidID("Category-" & iPtr.ToString()) + objLiteral.Text = description + objPlaceHolder.Add(objLiteral) + Exit Select + End If + End If + + End Select + End If + + Next + + End Sub + + Private Sub ReadQueryString() + + If (Request(PARAM_CATEGORY_ID) <> "" AndAlso IsNumeric(Request(PARAM_CATEGORY_ID))) Then + _categoryID = Convert.ToInt32(Request(PARAM_CATEGORY_ID)) + Else + If (ArticleSettings.FilterSingleCategory <> Null.NullInteger) Then + _categoryID = ArticleSettings.FilterSingleCategory + End If + End If + + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Try + + ReadQueryString() + + Dim objCategoryController As New CategoryController + _objCategoriesAll = objCategoryController.GetCategoriesAll(Me.ModuleId, Null.NullInteger, ArticleSettings.CategorySortType) + + If (Request("articleType") <> "" AndAlso Request("articleType").ToLower() = "categoryview") Then + + For Each objCategory As CategoryInfo In _objCategoriesAll + If (objCategory.CategoryID = _categoryID) Then + + If (ArticleSettings.FilterSingleCategory = objCategory.CategoryID) Then + Exit For + End If + + Dim path As String = "" + If (ArticleSettings.CategoryBreadcrumb) Then + Dim objTab As New DotNetNuke.Entities.Tabs.TabInfo + objTab.TabName = objCategory.Name + objTab.Url = Common.GetCategoryLink(TabId, ModuleId, objCategory.CategoryID.ToString(), objCategory.Name, ArticleSettings.LaunchLinks, ArticleSettings) + PortalSettings.ActiveTab.BreadCrumbs.Add(objTab) + + Dim parentID As Integer = objCategory.ParentID + Dim parentCount As Integer = 0 + + While parentID <> Null.NullInteger + For Each objParentCategory As CategoryInfo In _objCategoriesAll + If (objParentCategory.CategoryID = parentID) Then + If (ArticleSettings.FilterSingleCategory = objParentCategory.CategoryID) Then + parentID = Null.NullInteger + Exit For + End If + Dim objParentTab As New DotNetNuke.Entities.Tabs.TabInfo + objParentTab.TabID = 10000 + objParentCategory.CategoryID + objParentTab.TabName = objParentCategory.Name + objParentTab.Url = Common.GetCategoryLink(TabId, ModuleId, objParentCategory.CategoryID.ToString(), objParentCategory.Name, ArticleSettings.LaunchLinks, ArticleSettings) + PortalSettings.ActiveTab.BreadCrumbs.Insert(PortalSettings.ActiveTab.BreadCrumbs.Count - 1 - parentCount, objParentTab) + + If (path.Length = 0) Then + path = " > " & objParentCategory.Name + Else + path = " > " & objParentCategory.Name & path + End If + + parentCount = parentCount + 1 + parentID = objParentCategory.ParentID + End If + Next + End While + End If + + If (Request("articleType") <> "" AndAlso Request("articleType").ToLower() = "categoryview") Then + If (PortalSettings.ActiveTab.Title.Length = 0) Then + Me.BasePage.Title = Server.HtmlEncode(PortalSettings.PortalName & " > " & PortalSettings.ActiveTab.TabName & path & " > " & objCategory.Name) + Else + Me.BasePage.Title = Server.HtmlEncode(PortalSettings.ActiveTab.Title & path & " > " & objCategory.Name) + End If + + If (objCategory.MetaTitle <> "") Then + Me.BasePage.Title = objCategory.MetaTitle + End If + If (objCategory.MetaDescription <> "") Then + Me.BasePage.Description = objCategory.MetaDescription + End If + If (objCategory.MetaKeywords <> "") Then + Me.BasePage.KeyWords = objCategory.MetaKeywords + End If + + End If + + If (ArticleSettings.IncludeInPageName) Then + HttpContext.Current.Items.Add("NA-CategoryName", objCategory.Name) + End If + + Exit For + End If + Next + + End If + + BindCategory() + + Dim categories() As Integer = {_categoryID} + Listing1.FilterCategories = categories + If (ArticleSettings.FilterSingleCategory <> Null.NullInteger) Then + Listing1.ShowExpired = False + Else + Listing1.ShowExpired = True + End If + Listing1.MaxArticles = Null.NullInteger + Listing1.ShowMessage = False + + If (ArticleSettings.CategoryBreadcrumb AndAlso Request("CategoryID") <> "") Then + Listing1.IncludeCategory = True + End If + + Listing1.BindListing() + Listing1.BindArticles = False + Listing1.IsIndexed = False + + 'Listing1.BindListing() + + 'ucHeader1.ProcessMenu() + 'ucHeader2.ProcessMenu() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + End Sub + + Private Sub Page_PreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + + Try + + If (HttpContext.Current.Items.Contains("NA-CategoryName")) Then + PortalSettings.ActiveTab.TabName = HttpContext.Current.Items("NA-CategoryName").ToString() + End If + + Catch ex As Exception + + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ViewCurrent.ascx b/ViewCurrent.ascx new file mode 100755 index 0000000..c92a9ac --- /dev/null +++ b/ViewCurrent.ascx @@ -0,0 +1,6 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ViewCurrent.ascx.vb" Inherits="Ventrian.NewsArticles.ViewCurrent" %> +<%@ Register TagPrefix="Ventrian" TagName="Header" Src="ucHeader.ascx" %> +<%@ Register TagPrefix="Ventrian" TagName="Listing" Src="Controls/Listing.ascx"%> + + + \ No newline at end of file diff --git a/ViewCurrent.ascx.designer.vb b/ViewCurrent.ascx.designer.vb new file mode 100755 index 0000000..774e520 --- /dev/null +++ b/ViewCurrent.ascx.designer.vb @@ -0,0 +1,44 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ViewCurrent + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''ucListing1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucListing1 As Global.Ventrian.NewsArticles.Controls.Listing + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ViewCurrent.ascx.vb b/ViewCurrent.ascx.vb new file mode 100755 index 0000000..c773300 --- /dev/null +++ b/ViewCurrent.ascx.vb @@ -0,0 +1,18 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2008 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Services.Exceptions + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ViewCurrent + Inherits NewsArticleModuleBase + + End Class + +End Namespace \ No newline at end of file diff --git a/ViewSearch.ascx b/ViewSearch.ascx new file mode 100755 index 0000000..0b9c050 --- /dev/null +++ b/ViewSearch.ascx @@ -0,0 +1,13 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ViewSearch.ascx.vb" Inherits="Ventrian.NewsArticles.ViewSearch" %> +<%@ Register TagPrefix="Ventrian" TagName="Header" Src="ucHeader.ascx" %> +<%@ Register TagPrefix="Ventrian" TagName="Listing" Src="Controls/Listing.ascx"%> + +
      +

      + + + + +
      + + diff --git a/ViewSearch.ascx.designer.vb b/ViewSearch.ascx.designer.vb new file mode 100755 index 0000000..e85a6b2 --- /dev/null +++ b/ViewSearch.ascx.designer.vb @@ -0,0 +1,80 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ViewSearch + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''lblSearch control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblSearch As Global.System.Web.UI.WebControls.Label + + ''' + '''pnlSearch control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pnlSearch As Global.System.Web.UI.WebControls.Panel + + ''' + '''txtSearch control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtSearch As Global.System.Web.UI.WebControls.TextBox + + ''' + '''btnSearch control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents btnSearch As Global.System.Web.UI.WebControls.Button + + ''' + '''Listing1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Listing1 As Global.Ventrian.NewsArticles.Controls.Listing + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ViewSearch.ascx.vb b/ViewSearch.ascx.vb new file mode 100755 index 0000000..25199be --- /dev/null +++ b/ViewSearch.ascx.vb @@ -0,0 +1,135 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization +Imports DotNetNuke.Security + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ViewSearch + Inherits NewsArticleModuleBase + +#Region " Constants " + + Private Const PARAM_SEARCH_ID As String = "Search" + +#End Region + +#Region " Private Members " + + Private _searchText As String = Null.NullString + +#End Region + +#Region " Private Methods " + + Private Sub BindSearch() + + Me.BasePage.Title = "Search | " & Me.BasePage.Title + + If (_searchText = "") Then + lblSearch.Text = Localization.GetString("SearchArticles", Me.LocalResourceFile) + Listing1.BindArticles = False + Return + Else + Dim articlesFor As String = Localization.GetString("ArticlesFor", Me.LocalResourceFile) + If (articlesFor.Contains("{0}")) Then + lblSearch.Text = String.Format(articlesFor, _searchText) + Else + lblSearch.Text = articlesFor + End If + txtSearch.Text = _searchText + Listing1.SearchText = _searchText + Listing1.BindArticles = True + Listing1.BindListing() + Listing1.BindArticles = False + Return + End If + + End Sub + + Private Sub ReadQueryString() + + If (Request(PARAM_SEARCH_ID) <> "") Then + _searchText = Server.UrlDecode(Request(PARAM_SEARCH_ID)) + Dim objSecurity As New PortalSecurity + _searchText = objSecurity.InputFilter(_searchText, PortalSecurity.FilterFlag.NoScripting) + _searchText = StripTags(_searchText) + End If + + End Sub + + Function StripTags(ByVal html As String) As String + ' Remove HTML tags. + Return Regex.Replace(html, "<.*?>", "") + End Function + + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Try + + Dim enumerator As IDictionaryEnumerator = HttpContext.Current.Cache.GetEnumerator() + Dim itemsToRemove As New List(Of String)() + + While enumerator.MoveNext() + If enumerator.Key.ToString().ToLower().Contains("ventrian-newsarticles-categories-" & ModuleId.ToString()) Then + itemsToRemove.Add(enumerator.Key.ToString()) + End If + End While + + For Each itemToRemove As String In itemsToRemove + DataCache.RemoveCache(itemToRemove.Replace("DNN_", "")) + Next + + enumerator = HttpContext.Current.Cache.GetEnumerator() + While enumerator.MoveNext() + If enumerator.Key.ToString().ToLower().Contains("ventrian-newsarticles-categories-" & ModuleId.ToString()) Then + Response.Write(enumerator.Key.ToString() & "
      ") + End If + End While + ReadQueryString() + Listing1.ShowExpired = True + Listing1.MaxArticles = Null.NullInteger + Listing1.IsIndexed = False + + BindSearch() + Page.SetFocus(txtSearch) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSearch.Click + + Try + + If (txtSearch.Text.Trim() <> "") Then + Dim objSecurity As New PortalSecurity + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "Search", ArticleSettings, "Search=" & Server.UrlEncode(objSecurity.InputFilter(txtSearch.Text, PortalSecurity.FilterFlag.NoScripting))), True) + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ViewTag.ascx b/ViewTag.ascx new file mode 100755 index 0000000..1eed063 --- /dev/null +++ b/ViewTag.ascx @@ -0,0 +1,9 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ViewTag.ascx.vb" Inherits="Ventrian.NewsArticles.ViewTag" %> +<%@ Register TagPrefix="Ventrian" TagName="Header" Src="ucHeader.ascx" %> +<%@ Register TagPrefix="Ventrian" TagName="Listing" Src="Controls/Listing.ascx"%> + +
      +

      +
      + + diff --git a/ViewTag.ascx.designer.vb b/ViewTag.ascx.designer.vb new file mode 100755 index 0000000..467fc9e --- /dev/null +++ b/ViewTag.ascx.designer.vb @@ -0,0 +1,53 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ViewTag + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''lblTag control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblTag As Global.System.Web.UI.WebControls.Label + + ''' + '''Listing1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Listing1 As Global.Ventrian.NewsArticles.Controls.Listing + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ViewTag.ascx.vb b/ViewTag.ascx.vb new file mode 100755 index 0000000..89b1bb3 --- /dev/null +++ b/ViewTag.ascx.vb @@ -0,0 +1,104 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ViewTag + Inherits NewsArticleModuleBase + +#Region " Constants " + + Private Const PARAM_TAG As String = "Tag" + +#End Region + +#Region " Private Members " + + Private _tag As String = Null.NullString + +#End Region + +#Region " Private Methods " + + Private Sub BindTag() + + If (_tag = Null.NullString) Then + ' Author not specified + Response.Redirect(NavigateURL(), True) + End If + + Dim objTagController As New TagController + Dim objTag As TagInfo = objTagController.Get(Me.ModuleId, _tag.ToLower()) + + If (objTag IsNot Nothing) Then + + Dim entriesFrom As String = Localization.GetString("TagEntries", LocalResourceFile) + + If (entriesFrom.Contains("{0}")) Then + lblTag.Text = String.Format(entriesFrom, _tag) + Else + lblTag.Text = _tag + End If + + Me.BasePage.Title = _tag & " | " & PortalSettings.PortalName + Me.BasePage.Description = entriesFrom + + ' We never want to index the tag pages. + + + Else + + ' Author not found. + Response.Redirect(NavigateURL(), True) + + End If + + End Sub + + Private Sub ReadQueryString() + + If (Request(PARAM_TAG) <> "") Then + _tag = Server.UrlDecode(Request(PARAM_TAG)) + End If + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Try + + ReadQueryString() + BindTag() + + Listing1.Tag = _tag + Listing1.ShowExpired = True + Listing1.MaxArticles = Null.NullInteger + Listing1.IsIndexed = False + + Listing1.BindListing() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/Web References/wsStoryFeed/Reference.map b/Web References/wsStoryFeed/Reference.map new file mode 100755 index 0000000..6ed1313 --- /dev/null +++ b/Web References/wsStoryFeed/Reference.map @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Web References/wsStoryFeed/Reference.vb b/Web References/wsStoryFeed/Reference.vb new file mode 100755 index 0000000..4ad4606 --- /dev/null +++ b/Web References/wsStoryFeed/Reference.vb @@ -0,0 +1,208 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.17929 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict Off +Option Explicit On + +Imports System +Imports System.ComponentModel +Imports System.Diagnostics +Imports System.Web.Services +Imports System.Web.Services.Protocols +Imports System.Xml.Serialization + +' +'This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.17929. +' +Namespace wsStoryFeed + + ''' + _ + Partial Public Class StoryFeedWS + Inherits System.Web.Services.Protocols.SoapHttpClientProtocol + + Private AddActionOperationCompleted As System.Threading.SendOrPostCallback + + Private AddActionIfNotExistsOperationCompleted As System.Threading.SendOrPostCallback + + Private useDefaultCredentialsSetExplicitly As Boolean + + ''' + Public Sub New() + MyBase.New + Me.Url = Global.My.MySettings.Default.Ventrian_NewsArticles_wsStoryFeed_StoryFeedWS + If (Me.IsLocalFileSystemWebService(Me.Url) = true) Then + Me.UseDefaultCredentials = true + Me.useDefaultCredentialsSetExplicitly = false + Else + Me.useDefaultCredentialsSetExplicitly = true + End If + End Sub + + Public Shadows Property Url() As String + Get + Return MyBase.Url + End Get + Set + If (((Me.IsLocalFileSystemWebService(MyBase.Url) = true) _ + AndAlso (Me.useDefaultCredentialsSetExplicitly = false)) _ + AndAlso (Me.IsLocalFileSystemWebService(value) = false)) Then + MyBase.UseDefaultCredentials = false + End If + MyBase.Url = value + End Set + End Property + + Public Shadows Property UseDefaultCredentials() As Boolean + Get + Return MyBase.UseDefaultCredentials + End Get + Set + MyBase.UseDefaultCredentials = value + Me.useDefaultCredentialsSetExplicitly = true + End Set + End Property + + ''' + Public Event AddActionCompleted As AddActionCompletedEventHandler + + ''' + Public Event AddActionIfNotExistsCompleted As AddActionIfNotExistsCompletedEventHandler + + ''' + _ + Public Function AddAction(ByVal actionType As Integer, ByVal relatedID As Integer, ByVal actionText As String, ByVal createdByUserID As Integer, ByVal key As String) As Integer + Dim results() As Object = Me.Invoke("AddAction", New Object() {actionType, relatedID, actionText, createdByUserID, key}) + Return CType(results(0),Integer) + End Function + + ''' + Public Overloads Sub AddActionAsync(ByVal actionType As Integer, ByVal relatedID As Integer, ByVal actionText As String, ByVal createdByUserID As Integer, ByVal key As String) + Me.AddActionAsync(actionType, relatedID, actionText, createdByUserID, key, Nothing) + End Sub + + ''' + Public Overloads Sub AddActionAsync(ByVal actionType As Integer, ByVal relatedID As Integer, ByVal actionText As String, ByVal createdByUserID As Integer, ByVal key As String, ByVal userState As Object) + If (Me.AddActionOperationCompleted Is Nothing) Then + Me.AddActionOperationCompleted = AddressOf Me.OnAddActionOperationCompleted + End If + Me.InvokeAsync("AddAction", New Object() {actionType, relatedID, actionText, createdByUserID, key}, Me.AddActionOperationCompleted, userState) + End Sub + + Private Sub OnAddActionOperationCompleted(ByVal arg As Object) + If (Not (Me.AddActionCompletedEvent) Is Nothing) Then + Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEventArgs = CType(arg,System.Web.Services.Protocols.InvokeCompletedEventArgs) + RaiseEvent AddActionCompleted(Me, New AddActionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)) + End If + End Sub + + ''' + _ + Public Function AddActionIfNotExists(ByVal actionType As Integer, ByVal relatedID As Integer, ByVal actionText As String, ByVal createdByUserID As Integer, ByVal addIfNotExistsOnly As Boolean, ByVal key As String) As Integer + Dim results() As Object = Me.Invoke("AddActionIfNotExists", New Object() {actionType, relatedID, actionText, createdByUserID, addIfNotExistsOnly, key}) + Return CType(results(0),Integer) + End Function + + ''' + Public Overloads Sub AddActionIfNotExistsAsync(ByVal actionType As Integer, ByVal relatedID As Integer, ByVal actionText As String, ByVal createdByUserID As Integer, ByVal addIfNotExistsOnly As Boolean, ByVal key As String) + Me.AddActionIfNotExistsAsync(actionType, relatedID, actionText, createdByUserID, addIfNotExistsOnly, key, Nothing) + End Sub + + ''' + Public Overloads Sub AddActionIfNotExistsAsync(ByVal actionType As Integer, ByVal relatedID As Integer, ByVal actionText As String, ByVal createdByUserID As Integer, ByVal addIfNotExistsOnly As Boolean, ByVal key As String, ByVal userState As Object) + If (Me.AddActionIfNotExistsOperationCompleted Is Nothing) Then + Me.AddActionIfNotExistsOperationCompleted = AddressOf Me.OnAddActionIfNotExistsOperationCompleted + End If + Me.InvokeAsync("AddActionIfNotExists", New Object() {actionType, relatedID, actionText, createdByUserID, addIfNotExistsOnly, key}, Me.AddActionIfNotExistsOperationCompleted, userState) + End Sub + + Private Sub OnAddActionIfNotExistsOperationCompleted(ByVal arg As Object) + If (Not (Me.AddActionIfNotExistsCompletedEvent) Is Nothing) Then + Dim invokeArgs As System.Web.Services.Protocols.InvokeCompletedEventArgs = CType(arg,System.Web.Services.Protocols.InvokeCompletedEventArgs) + RaiseEvent AddActionIfNotExistsCompleted(Me, New AddActionIfNotExistsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)) + End If + End Sub + + ''' + Public Shadows Sub CancelAsync(ByVal userState As Object) + MyBase.CancelAsync(userState) + End Sub + + Private Function IsLocalFileSystemWebService(ByVal url As String) As Boolean + If ((url Is Nothing) _ + OrElse (url Is String.Empty)) Then + Return false + End If + Dim wsUri As System.Uri = New System.Uri(url) + If ((wsUri.Port >= 1024) _ + AndAlso (String.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) = 0)) Then + Return true + End If + Return false + End Function + End Class + + ''' + _ + Public Delegate Sub AddActionCompletedEventHandler(ByVal sender As Object, ByVal e As AddActionCompletedEventArgs) + + ''' + _ + Partial Public Class AddActionCompletedEventArgs + Inherits System.ComponentModel.AsyncCompletedEventArgs + + Private results() As Object + + Friend Sub New(ByVal results() As Object, ByVal exception As System.Exception, ByVal cancelled As Boolean, ByVal userState As Object) + MyBase.New(exception, cancelled, userState) + Me.results = results + End Sub + + ''' + Public ReadOnly Property Result() As Integer + Get + Me.RaiseExceptionIfNecessary + Return CType(Me.results(0),Integer) + End Get + End Property + End Class + + ''' + _ + Public Delegate Sub AddActionIfNotExistsCompletedEventHandler(ByVal sender As Object, ByVal e As AddActionIfNotExistsCompletedEventArgs) + + ''' + _ + Partial Public Class AddActionIfNotExistsCompletedEventArgs + Inherits System.ComponentModel.AsyncCompletedEventArgs + + Private results() As Object + + Friend Sub New(ByVal results() As Object, ByVal exception As System.Exception, ByVal cancelled As Boolean, ByVal userState As Object) + MyBase.New(exception, cancelled, userState) + Me.results = results + End Sub + + ''' + Public ReadOnly Property Result() As Integer + Get + Me.RaiseExceptionIfNecessary + Return CType(Me.results(0),Integer) + End Get + End Property + End Class +End Namespace diff --git a/Web References/wsStoryFeed/StoryFeed.disco b/Web References/wsStoryFeed/StoryFeed.disco new file mode 100755 index 0000000..eed1961 --- /dev/null +++ b/Web References/wsStoryFeed/StoryFeed.disco @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Web References/wsStoryFeed/StoryFeed.wsdl b/Web References/wsStoryFeed/StoryFeed.wsdl new file mode 100755 index 0000000..b696fcc --- /dev/null +++ b/Web References/wsStoryFeed/StoryFeed.wsdl @@ -0,0 +1,120 @@ + + + Smart-Thinker UserProfile StoryFeed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Adds a Story to the Story Feed + + + + + Adds a Story to the Story Feed only if the RelatedID, CreatedID and ActionText do not already exist) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Smart-Thinker UserProfile StoryFeed + + + + + + + + \ No newline at end of file diff --git a/icon_comment.gif b/icon_comment.gif new file mode 100755 index 0000000..50ea05e Binary files /dev/null and b/icon_comment.gif differ diff --git a/icon_xml.gif b/icon_xml.gif new file mode 100755 index 0000000..ecb0957 Binary files /dev/null and b/icon_xml.gif differ diff --git a/module.css b/module.css new file mode 100755 index 0000000..dfbf47c --- /dev/null +++ b/module.css @@ -0,0 +1,108 @@ +/* Uploader Styles */ + +.pa_photolist li +{ + display: inline; + float: left; + margin-left: 10px; + margin-bottom: 10px; +} + +.progressWrapper +{ + width: 357px; + overflow: hidden; + background-color: #000; +} + +.progressContainer { + margin: 1px; + padding: 4px; + + border: solid 1px #E8E8E8; + background-color: #F7F7F7; + + overflow: hidden; +} + +.progressBarInProgress, +.progressBarComplete, +.progressBarError { + font-size: 0px; + width: 0%; + height: 2px; + background-color: blue; + text-align: left; + margin-top: 2px; + float: left; +} +.progressBarComplete { + width: 100%; + background-color: green; + visibility: hidden; +} +.progressBarError { + width: 100%; + background-color: red; + visibility: hidden; +} +.progressBarStatus { + margin-top: 2px; + text-align: left; + white-space: nowrap; +} +a.progressCancel, +a.progressCancel:link, +a.progressCancel:active, +a.progressCancel:visited, +a.progressCancel:hover +{ + font-size: 0px; + display: block; + height: 14px; + width: 14px; + + background-image: url(Images/Uploader/cancelbutton.gif); + background-repeat: no-repeat; + background-position: -14px 0px; + float: right; +} +a.progressCancel:hover +{ + background-position: 0px 0px; +} + +#ColorPickerDiv +{ + display: block; + display: none; + position: relative; + border: 1px solid #777; + background: #fff +} + +#ColorPickerDiv TD.color +{ + cursor: pointer; + font-size: xx-small; + font-family: 'Arial' , 'Microsoft Sans Serif'; +} +#ColorPickerDiv TD.color label +{ + cursor: pointer; +} + +.ColorPickerDivSample +{ + margin: 0px 0px 0px 4px; + border: solid 1px #000; + padding: 0px 10px; + position: relative; + cursor: pointer; +} + + +#tabs-myarticles +{ + padding-top: 10px; +} \ No newline at end of file diff --git a/ucAdminOptions.ascx b/ucAdminOptions.ascx new file mode 100755 index 0000000..e0c54ff --- /dev/null +++ b/ucAdminOptions.ascx @@ -0,0 +1,92 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucAdminOptions.ascx.vb" Inherits="Ventrian.NewsArticles.ucAdminOptions" %> +<%@ Register TagPrefix="Ventrian" TagName="Header" Src="ucHeader.ascx" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + +
      + +
      + + + +
      + +
      + + + +
      + +
      + + + +
      + +
      + + + +
      + +
      + + + +
      + +
      + + + +
      + +
      + + + diff --git a/ucAdminOptions.ascx.designer.vb b/ucAdminOptions.ascx.designer.vb new file mode 100755 index 0000000..111cf7b --- /dev/null +++ b/ucAdminOptions.ascx.designer.vb @@ -0,0 +1,179 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucAdminOptions + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''lblMainOptions control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblMainOptions As Global.System.Web.UI.WebControls.Label + + ''' + '''lblMainOptionsDescription control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblMainOptionsDescription As Global.System.Web.UI.WebControls.Label + + ''' + '''lblCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCategories As Global.System.Web.UI.WebControls.Label + + ''' + '''lblCategoriesDescription control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCategoriesDescription As Global.System.Web.UI.WebControls.Label + + ''' + '''lblCustomFields control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCustomFields As Global.System.Web.UI.WebControls.Label + + ''' + '''lblCustomFieldsDescription control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCustomFieldsDescription As Global.System.Web.UI.WebControls.Label + + ''' + '''lblImportFeeds control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblImportFeeds As Global.System.Web.UI.WebControls.Label + + ''' + '''lblImportFeedsDescription control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblImportFeedsDescription As Global.System.Web.UI.WebControls.Label + + ''' + '''lblTags control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblTags As Global.System.Web.UI.WebControls.Label + + ''' + '''lblTagsDescription control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblTagsDescription As Global.System.Web.UI.WebControls.Label + + ''' + '''lblEmailTemplates control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblEmailTemplates As Global.System.Web.UI.WebControls.Label + + ''' + '''lblEmailTemplatesDescription control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblEmailTemplatesDescription As Global.System.Web.UI.WebControls.Label + + ''' + '''trSiteTemplates control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trSiteTemplates As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''lblSiteTemplates control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblSiteTemplates As Global.System.Web.UI.WebControls.Label + + ''' + '''lblSiteTemplatesDescription control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblSiteTemplatesDescription As Global.System.Web.UI.WebControls.Label + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''cmdImport control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdImport As Global.System.Web.UI.WebControls.LinkButton + End Class +End Namespace diff --git a/ucAdminOptions.ascx.vb b/ucAdminOptions.ascx.vb new file mode 100755 index 0000000..67605c4 --- /dev/null +++ b/ucAdminOptions.ascx.vb @@ -0,0 +1,233 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Security +Imports DotNetNuke.Services.Exceptions +Imports System.Xml + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucAdminOptions + Inherits NewsArticleModuleBase + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + trSiteTemplates.Visible = Me.UserInfo.IsSuperUser + If (Settings.Contains(ArticleConstants.PERMISSION_SITE_TEMPLATES_SETTING)) Then + If (Settings(ArticleConstants.PERMISSION_SITE_TEMPLATES_SETTING).ToString() <> "") Then + trSiteTemplates.Visible = PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_SITE_TEMPLATES_SETTING).ToString()) + End If + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + Protected Sub cmdImport_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdImport.Click + + Dim file As String = PortalSettings.HomeDirectoryMapPath & "import.xml" + + Dim doc As New XmlDocument + doc.Load(file) + + Dim nsMgr As New XmlNamespaceManager(doc.NameTable) + nsMgr.AddNamespace("wp", "http://wordpress.org/export/1.2/") + nsMgr.AddNamespace("content", "http://purl.org/rss/1.0/modules/content/") + + Dim nodeRoot As XmlNode = doc.DocumentElement + + Dim objCategoriesNodes As XmlNodeList = nodeRoot.SelectNodes("/rss/channel/wp:category", nsMgr) + + Dim objCategoryController As New CategoryController() + + For Each objCategoryNode As XmlNode In objCategoriesNodes + + Dim objName As XmlNode = objCategoryNode.SelectSingleNode("wp:cat_name", nsMgr) + + Dim objCategoryInfo As New CategoryInfo + + objCategoryInfo.CategoryID = Null.NullInteger + objCategoryInfo.ModuleID = ModuleId + objCategoryInfo.ParentID = Null.NullInteger + objCategoryInfo.Name = objName.InnerText + objCategoryInfo.Description = "" + objCategoryInfo.InheritSecurity = True + objCategoryInfo.CategorySecurityType = 0 + + objCategoryInfo.MetaTitle = "" + objCategoryInfo.MetaDescription = "" + objCategoryInfo.MetaKeywords = "" + + objCategoryController.AddCategory(objCategoryInfo) + + Next + + Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(ModuleId, Null.NullInteger) + + Dim objTagNodes As XmlNodeList = nodeRoot.SelectNodes("/rss/channel/wp:tag", nsMgr) + + Dim objTagController As New TagController() + + For Each objTagNode As XmlNode In objTagNodes + + Dim objName As XmlNode = objTagNode.SelectSingleNode("wp:tag_name", nsMgr) + + Dim objTag As New TagInfo + + objTag.ModuleID = Me.ModuleId + objTag.Name = objName.InnerText + objTag.NameLowered = objName.InnerText.ToLower() + + objTagController.Add(objTag) + + Next + + Dim objTags As ArrayList = objTagController.List(ModuleId, Null.NullInteger) + + Dim objArticleNodes As XmlNodeList = nodeRoot.SelectNodes("/rss/channel/item", nsMgr) + + Dim objArticleController As New ArticleController() + + For Each objArticleNode As XmlNode In objArticleNodes + + Dim objPostType As XmlNode = objArticleNode.SelectSingleNode("wp:post_type", nsMgr) + Dim objStatus As XmlNode = objArticleNode.SelectSingleNode("wp:status", nsMgr) + + If (objPostType.InnerText = "post" And objStatus.InnerText <> "draft") Then + + Dim objTitle As XmlNode = objArticleNode.SelectSingleNode("title", nsMgr) + + Dim objContent As XmlNode = objArticleNode.SelectSingleNode("content:encoded", nsMgr) + + Dim objPostID As XmlNode = objArticleNode.SelectSingleNode("wp:post_id", nsMgr) + Dim objPostDate As XmlNode = objArticleNode.SelectSingleNode("wp:post_date", nsMgr) + Dim dt As DateTime = DateTime.Parse(objPostDate.InnerText) + + Dim objArticle As New ArticleInfo + + objArticle.Title = objTitle.InnerText + objArticle.CreatedDate = dt + objArticle.StartDate = dt + + objArticle.Status = StatusType.Published + objArticle.CommentCount = 0 + objArticle.FileCount = 0 + objArticle.RatingCount = 0 + objArticle.Rating = 0 + objArticle.ShortUrl = "" + objArticle.MetaTitle = "" + objArticle.MetaDescription = "" + objArticle.MetaKeywords = "" + objArticle.PageHeadText = "" + objArticle.IsFeatured = False + objArticle.IsSecure = False + objArticle.LastUpdate = DateTime.Now + objArticle.LastUpdateID = Me.UserId + objArticle.ModuleID = Me.ModuleId + objArticle.AuthorID = Me.UserId + + objArticle.ArticleID = objArticleController.AddArticle(objArticle) + + Dim objPageController As New PageController() + Dim objPage As New PageInfo + objPage.PageText = objContent.InnerText + objPage.ArticleID = objArticle.ArticleID + objPage.Title = objArticle.Title + objPageController.AddPage(objPage) + + Dim objCategoryNodes As XmlNodeList = objArticleNode.SelectNodes("category", nsMgr) + + For Each objCategoryNode As XmlNode In objCategoryNodes + Select Case objCategoryNode.Attributes("domain").InnerText + + Case "post_tag" + + For Each objTag As TagInfo In objTags + If (objTag.Name.ToLower() = objCategoryNode.InnerText.ToLower()) Then + objTagController.Add(objArticle.ArticleID, objTag.TagID) + Exit For + End If + Next + Exit Select + + Case "category" + For Each objCategory As CategoryInfo In objCategories + If (objCategory.Name.ToLower() = objCategoryNode.InnerText.ToLower()) Then + objArticleController.AddArticleCategory(objArticle.ArticleID, objCategory.CategoryID) + Exit For + End If + Next + Exit Select + + End Select + Next + + Dim objCommentNodes As XmlNodeList = objArticleNode.SelectNodes("wp:comment", nsMgr) + + For Each objCommentNode As XmlNode In objCommentNodes + + Dim objAuthor As XmlNode = objCommentNode.SelectSingleNode("wp:comment_author", nsMgr) + Dim objAuthorEmail As XmlNode = objCommentNode.SelectSingleNode("wp:comment_author_email", nsMgr) + Dim objAuthorUrl As XmlNode = objCommentNode.SelectSingleNode("wp:comment_author_url", nsMgr) + Dim objAuthorIP As XmlNode = objCommentNode.SelectSingleNode("wp:comment_author_IP", nsMgr) + Dim objCommentContent As XmlNode = objCommentNode.SelectSingleNode("wp:comment_content", nsMgr) + Dim objCommentDate As XmlNode = objCommentNode.SelectSingleNode("wp:comment_date", nsMgr) + Dim dtComment As DateTime = DateTime.Parse(objCommentDate.InnerText) + + Dim objComment As New CommentInfo + objComment.ArticleID = objArticle.ArticleID + objComment.UserID = Null.NullInteger + objComment.AnonymousName = objAuthor.InnerText + objComment.AnonymousEmail = objAuthorEmail.InnerText + objComment.AnonymousURL = objAuthorUrl.InnerText + objComment.Comment = FilterInput(objCommentContent.InnerText) + objComment.RemoteAddress = objAuthorIP.InnerText + objComment.NotifyMe = False + objComment.Type = 0 + objComment.IsApproved = True + objComment.ApprovedBy = Me.UserId + objComment.CreatedDate = dtComment + + Dim objCommentController As New CommentController + objComment.CommentID = objCommentController.AddComment(objComment) + + objArticle.CommentCount = objArticle.CommentCount + 1 + objArticleController.UpdateArticle(objArticle) + Next + + End If + + Next + + End Sub + + Private Function FilterInput(ByVal stringToFilter As String) As String + + Dim objPortalSecurity As New PortalSecurity + + stringToFilter = objPortalSecurity.InputFilter(stringToFilter, PortalSecurity.FilterFlag.NoScripting) + + stringToFilter = Replace(stringToFilter, Chr(13), "") + stringToFilter = Replace(stringToFilter, ControlChars.Lf, "
      ") + + Return stringToFilter + + End Function + + End Class + +End Namespace \ No newline at end of file diff --git a/ucApproveArticles.ascx b/ucApproveArticles.ascx new file mode 100755 index 0000000..f72debf --- /dev/null +++ b/ucApproveArticles.ascx @@ -0,0 +1,60 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucApproveArticles.ascx.vb" Inherits="Ventrian.NewsArticles.ucApproveArticles" %> +<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.UI.WebControls" Assembly="DotNetNuke" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + +

      + + + + + + + + + + + + + + + + + <%#GetAdjustedCreateDate(Container.DataItem)%> + + + + + + + + + + <%#GetAdjustedPublishDate(Container.DataItem)%> + + + + + + + + + + <%#DataBinder.Eval(Container.DataItem, "Title")%> + + + + + + + + + + + + + +

      +   + +

      + diff --git a/ucApproveArticles.ascx.designer.vb b/ucApproveArticles.ascx.designer.vb new file mode 100755 index 0000000..c9f74fb --- /dev/null +++ b/ucApproveArticles.ascx.designer.vb @@ -0,0 +1,89 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucApproveArticles + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''lblMyArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblMyArticles As Global.System.Web.UI.WebControls.Label + + ''' + '''grdArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents grdArticles As Global.System.Web.UI.WebControls.DataGrid + + ''' + '''lblNoArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblNoArticles As Global.System.Web.UI.WebControls.Label + + ''' + '''ctlPagingControl control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ctlPagingControl As Global.DotNetNuke.UI.WebControls.PagingControl + + ''' + '''cmdApproveSelected control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdApproveSelected As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdApproveAll control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdApproveAll As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''Header1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Header1 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucApproveArticles.ascx.vb b/ucApproveArticles.ascx.vb new file mode 100755 index 0000000..eb8ed17 --- /dev/null +++ b/ucApproveArticles.ascx.vb @@ -0,0 +1,365 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Entities.Users +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Security.Roles +Imports Ventrian.NewsArticles.Components.Social + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucApproveArticles + Inherits NewsArticleModuleBase + +#Region " Private Properties " + + Private ReadOnly Property CurrentPage() As Integer + Get + If (Request("Page") = Null.NullString And Request("CurrentPage") = Null.NullString) Then + Return 1 + Else + Try + If (Request("Page") <> Null.NullString) Then + Return Convert.ToInt32(Request("Page")) + Else + Return Convert.ToInt32(Request("CurrentPage")) + End If + Catch + Return 1 + End Try + End If + End Get + End Property + +#End Region + +#Region " Private Methods " + + Private Function IsInRole(ByVal roleName As String, ByVal roles As String()) As Boolean + + For Each role As String In roles + If (roleName = role) Then + Return True + End If + Next + + Return False + + End Function + + Private Sub BindArticles() + + Dim count As Integer = 0 + + Dim objArticleController As New ArticleController + + DotNetNuke.Services.Localization.Localization.LocalizeDataGrid(grdArticles, Me.LocalResourceFile) + + grdArticles.DataSource = objArticleController.GetArticleList(Me.ModuleId, Null.NullDate, Null.NullDate, Nothing, Null.NullBoolean, Nothing, Null.NullInteger, CurrentPage, 20, "StartDate", "DESC", False, Null.NullBoolean, Null.NullString, Null.NullInteger, True, True, Null.NullBoolean, Null.NullBoolean, False, False, Null.NullString, Nothing, False, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, count) + grdArticles.DataBind() + + If (grdArticles.Items.Count = 0) Then + lblNoArticles.Visible = True + lblNoArticles.Text = DotNetNuke.Services.Localization.Localization.GetString("NoArticlesMessage.Text", LocalResourceFile) + grdArticles.Visible = False + + ctlPagingControl.Visible = False + Else + lblNoArticles.Visible = False + grdArticles.Visible = True + + ctlPagingControl.Visible = True + ctlPagingControl.TotalRecords = count + ctlPagingControl.PageSize = 20 + ctlPagingControl.CurrentPage = CurrentPage + ctlPagingControl.QuerystringParams = GetParams() + ctlPagingControl.TabID = TabId + ctlPagingControl.EnableViewState = False + End If + + End Sub + + Private Function GetParams() As String + + Dim params As String = "" + + If (Request("ctl") <> "") Then + If (Request("ctl").ToLower = "approvearticles") Then + params += "ctl=" & Request("ctl") & "&mid=" & ModuleId.ToString() + End If + End If + + If (Request("articleType") <> "") Then + If (Request("articleType").ToString().ToLower = "approvearticles") Then + params += "articleType=" & Request("articleType") + End If + End If + + Return params + + End Function + + Private Sub NotifyAuthor(ByVal objArticle As ArticleInfo) + + If (Settings.Contains(ArticleConstants.NOTIFY_APPROVAL_SETTING)) Then + If (Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_APPROVAL_SETTING))) Then + Dim objUserController As New UserController + Dim objUser As UserInfo = objUserController.GetUser(Me.PortalId, objArticle.AuthorID) + + Dim objEmailTemplateController As New EmailTemplateController + If Not (objUser Is Nothing) Then + objEmailTemplateController.SendFormattedEmail(Me.ModuleId, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), objArticle, EmailTemplateType.ArticleApproved, objUser.Membership.Email, ArticleSettings) + End If + + End If + End If + + End Sub + + Private Sub CheckSecurity() + + If (Request.IsAuthenticated = False) Then + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "NotAuthenticated", ArticleSettings), True) + End If + + If (ArticleSettings.IsApprover) Then + Return + End If + + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "NotAuthorized", ArticleSettings), True) + + End Sub + +#End Region + +#Region " Protected Methods " + + Protected Function GetAdjustedCreateDate(ByVal objItem As Object) As String + + Dim objArticle As ArticleInfo = CType(objItem, ArticleInfo) + Return objArticle.CreatedDate.ToString("d") & " " & objArticle.CreatedDate.ToString("t") + + End Function + + Protected Function GetAdjustedPublishDate(ByVal objItem As Object) As String + + Dim objArticle As ArticleInfo = CType(objItem, ArticleInfo) + Return objArticle.StartDate.ToString("d") & " " & objArticle.StartDate.ToString("t") + + End Function + + Protected Function GetArticleLink(ByVal objItem As Object) As String + + Dim objArticle As ArticleInfo = CType(objItem, ArticleInfo) + Return Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False) + + End Function + + Protected Function GetEditUrl(ByVal articleID As String) As String + If (ArticleSettings.LaunchLinks) Then + Return Common.GetModuleLink(Me.TabId, Me.ModuleId, "Edit", ArticleSettings, "ArticleID=" & articleID, "returnurl=" & Server.UrlEncode(Request.Url.ToString())) + Else + Return Common.GetModuleLink(Me.TabId, Me.ModuleId, "SubmitNews", ArticleSettings, "ArticleID=" & articleID, "returnurl=" & Server.UrlEncode(Request.Url.ToString())) + End If + End Function + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + CheckSecurity() + + If IsPostBack = False Then + BindArticles() + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdApproveSelected_OnClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdApproveSelected.Click + + Try + + Dim objArticleController As New ArticleController + + For i As Integer = 0 To grdArticles.Items.Count - 1 + + Dim currentItem As DataGridItem = grdArticles.Items(i) + + If Not (currentItem.FindControl("chkArticle") Is Nothing) Then + Dim chkArticle As CheckBox = CType(currentItem.FindControl("chkArticle"), CheckBox) + + If (chkArticle.Checked) Then + Dim objArticle As ArticleInfo = objArticleController.GetArticle(Convert.ToInt32(grdArticles.DataKeys(i))) + + objArticle.Status = StatusType.Published + objArticleController.UpdateArticle(objArticle) + + NotifyAuthor(objArticle) + + If (ArticleSettings.EnableAutoTrackback) Then + Dim objNotifications As New Tracking.Notification + objNotifications.NotifyExternalSites(objArticle, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), Me.PortalSettings.PortalName) + End If + + If (ArticleSettings.EnableNotificationPing) Then + Dim objNotifications As New Tracking.Notification + objNotifications.NotifyWeblogs(AddHTTP(NavigateURL()), Me.PortalSettings.PortalName) + End If + + If (ArticleSettings.JournalIntegration) Then + Dim objJournal As New Journal + objJournal.AddArticleToJournal(objArticle, PortalId, TabId, Me.UserId, Null.NullInteger, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False)) + End If + + If (ArticleSettings.JournalIntegrationGroups) Then + + Dim objCategories As ArrayList = objArticleController.GetArticleCategories(objArticle.ArticleID) + + If (objCategories.Count > 0) Then + + Dim objRoleController As New RoleController() + + Dim objRoles As ArrayList = objRoleController.GetRoles() + For Each objRole As RoleInfo In objRoles + Dim roleAccess As Boolean = False + + If (objRole.SecurityMode = SecurityMode.SocialGroup Or objRole.SecurityMode = SecurityMode.Both) Then + + For Each objCategory As CategoryInfo In objCategories + + If (objCategory.InheritSecurity = False) Then + + If (objCategory.CategorySecurityType = CategorySecurityType.Loose) Then + roleAccess = False + Exit For + Else + If (Settings.Contains(objCategory.CategoryID.ToString() & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + If (IsInRole(objRole.RoleName, Settings(objCategory.CategoryID.ToString() & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString().Split(";"c))) Then + roleAccess = True + End If + End If + End If + + End If + + Next + + End If + + If (roleAccess) Then + Dim objJournal As New Journal + objJournal.AddArticleToJournal(objArticle, PortalId, TabId, Me.UserId, objRole.RoleID, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False)) + End If + + Next + + End If + + End If + + If (ArticleSettings.EnableSmartThinkerStoryFeed) Then + Dim objStoryFeed As New wsStoryFeed.StoryFeedWS + objStoryFeed.Url = DotNetNuke.Common.Globals.AddHTTP(Request.ServerVariables("HTTP_HOST") & Me.ResolveUrl("~/DesktopModules/Smart-Thinker%20-%20UserProfile/StoryFeed.asmx")) + + Dim val As String = GetSharedResource("StoryFeed-AddArticle") + + val = val.Replace("[AUTHOR]", objArticle.AuthorDisplayName) + val = val.Replace("[AUTHORID]", objArticle.AuthorID.ToString()) + val = val.Replace("[ARTICLELINK]", Common.GetArticleLink(objArticle, Me.PortalSettings.ActiveTab, ArticleSettings, False)) + val = val.Replace("[ARTICLETITLE]", objArticle.Title) + + Try + objStoryFeed.AddAction(80, objArticle.ArticleID, val, objArticle.AuthorID, "VE6457624576460436531768") + Catch + End Try + End If + + If (ArticleSettings.EnableActiveSocialFeed) Then + If (ArticleSettings.ActiveSocialSubmitKey <> "") Then + If IO.File.Exists(HttpContext.Current.Server.MapPath("~/bin/active.modules.social.dll")) Then + Dim ai As Object = Nothing + Dim asm As System.Reflection.Assembly + Dim ac As Object = Nothing + Try + asm = System.Reflection.Assembly.Load("Active.Modules.Social") + ac = asm.CreateInstance("Active.Modules.Social.API.Journal") + If Not ac Is Nothing Then + ac.AddProfileItem(New Guid(ArticleSettings.ActiveSocialSubmitKey), objArticle.AuthorID, Common.GetArticleLink(objArticle, Me.PortalSettings.ActiveTab, ArticleSettings, False), objArticle.Title, objArticle.Summary, objArticle.Body, 1, "") + End If + Catch ex As Exception + End Try + End If + End If + End If + + End If + + End If + + Next + + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "ApproveArticles", ArticleSettings), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdApproveAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdApproveAll.Click + + Try + + Dim objArticleController As New ArticleController + + For i As Integer = 0 To grdArticles.Items.Count - 1 + + Dim currentItem As DataGridItem = grdArticles.Items(i) + Dim objArticle As ArticleInfo = objArticleController.GetArticle(Convert.ToInt32(grdArticles.DataKeys(i))) + + objArticle.Status = StatusType.Published + objArticleController.UpdateArticle(objArticle) + + NotifyAuthor(objArticle) + + If (ArticleSettings.EnableAutoTrackback) Then + Dim objNotifications As New Tracking.Notification + objNotifications.NotifyExternalSites(objArticle, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), Me.PortalSettings.PortalName) + End If + + If (ArticleSettings.EnableNotificationPing) Then + Dim objNotifications As New Tracking.Notification + objNotifications.NotifyWeblogs(AddHTTP(NavigateURL()), Me.PortalSettings.PortalName) + End If + + Next + + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "ApproveArticles", ArticleSettings), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/ucApproveComments.ascx b/ucApproveComments.ascx new file mode 100755 index 0000000..b50f796 --- /dev/null +++ b/ucApproveComments.ascx @@ -0,0 +1,72 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucApproveComments.ascx.vb" Inherits="Ventrian.NewsArticles.ucApproveComments" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
       
      + <%#GetTitle(Container.DataItem)%><%# GetAuthor(Container.DataItem) %><%#GetWebsite(Container.DataItem)%><%#DataBinder.Eval(Container.DataItem, "CreatedDate", "{0:d}")%><%#DataBinder.Eval(Container.DataItem, "RemoteAddress")%>
      Comment: <%#DataBinder.Eval(Container.DataItem, "Comment")%>

      + +
      + +

      + +   + +

      + diff --git a/ucApproveComments.ascx.designer.vb b/ucApproveComments.ascx.designer.vb new file mode 100755 index 0000000..8e2d9ed --- /dev/null +++ b/ucApproveComments.ascx.designer.vb @@ -0,0 +1,71 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucApproveComments + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''rptApproveComments control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents rptApproveComments As Global.System.Web.UI.WebControls.Repeater + + ''' + '''lblNoComments control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblNoComments As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdApprove control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdApprove As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdReject control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdReject As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''Header1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Header1 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucApproveComments.ascx.vb b/ucApproveComments.ascx.vb new file mode 100755 index 0000000..68527a8 --- /dev/null +++ b/ucApproveComments.ascx.vb @@ -0,0 +1,386 @@ +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports Ventrian.NewsArticles.Components.Social + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucApproveComments + Inherits NewsArticleModuleBase + +#Region " Private Methods " + + Private Sub BindComments() + + Dim objCommentController As New CommentController + rptApproveComments.DataSource = objCommentController.GetCommentList(Me.ModuleId, Null.NullInteger, False, SortDirection.Ascending, Null.NullInteger) + rptApproveComments.DataBind() + + If (rptApproveComments.Items.Count = 0) Then + rptApproveComments.Visible = False + lblNoComments.Visible = True + End If + + End Sub + + Private Sub CheckSecurity() + + If (Request.IsAuthenticated = False) Then + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "NotAuthenticated", ArticleSettings), True) + End If + + If (ArticleSettings.IsApprover) Then + Return + End If + + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "NotAuthorized", ArticleSettings), True) + + End Sub + + Private Sub NotifyAuthor(ByVal objComment As CommentInfo) + + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(objComment.ArticleID) + + If Not (objArticle Is Nothing) Then + Dim objEmailTemplateController As New EmailTemplateController + + Try + ' Don't send it to the author if it's their own comment. + If (objArticle.AuthorID <> objComment.UserID) Then + objEmailTemplateController.SendFormattedEmail(Me.ModuleId, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentNotification, ArticleSettings) + End If + Catch ex As Exception + Dim objEventLog As New DotNetNuke.Services.Log.EventLog.EventLogController + + Dim objUserController As New DotNetNuke.Entities.Users.UserController + Dim objUser As DotNetNuke.Entities.Users.UserInfo = objUserController.GetUser(Me.PortalId, objArticle.AuthorID) + + Dim sendTo As String = "" + If Not (objUser Is Nothing) Then + sendTo = objUser.Membership.Email + End If + objEventLog.AddLog("News Articles Email Failure", "Failure to send [Author Comment] to '" & sendTo & "' from '" & Me.PortalSettings.Email, PortalSettings, -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT) + End Try + + End If + + End Sub + +#End Region + +#Region " Protected Methods " + + Protected Function GetAuthor(ByVal obj As Object) As String + + Dim objComment As CommentInfo = CType(obj, CommentInfo) + If Not (objComment Is Nothing) Then + If (objComment.UserID <> Null.NullInteger) Then + Return objComment.AuthorUserName + Else + Return objComment.AnonymousName + End If + Else + Return "" + End If + + End Function + + Protected Function GetArticleUrl(ByVal obj As Object) As String + + Dim objComment As CommentInfo = CType(obj, CommentInfo) + If Not (objComment Is Nothing) Then + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(objComment.ArticleID) + + If (objArticle IsNot Nothing) Then + Return Common.GetArticleLink(objArticle, Me.PortalSettings.ActiveTab, Me.ArticleSettings, False) + End If + End If + + Return "" + + End Function + + Protected Function GetEditCommentUrl(ByVal commentID As String) As String + + Return Common.GetModuleLink(TabId, ModuleId, "EditComment", ArticleSettings, "CommentID=" & commentID, "ReturnUrl=" & Server.UrlEncode(Request.RawUrl)) + + End Function + + Protected Function GetTitle(ByVal obj As Object) As String + + Dim objComment As CommentInfo = CType(obj, CommentInfo) + If Not (objComment Is Nothing) Then + + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(objComment.ArticleID) + + If (objArticle IsNot Nothing) Then + Return objArticle.Title + End If + End If + + Return "" + + End Function + + Protected Function GetWebsite(ByVal obj As Object) As String + + Dim objComment As CommentInfo = CType(obj, CommentInfo) + If Not (objComment Is Nothing) Then + If (objComment.AnonymousURL <> "") Then + Return "" & objComment.AnonymousURL & "" + End If + End If + Return "" + + End Function + +#End Region + +#Region " Event Handlers " + + Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + + Try + + CheckSecurity() + + If (Page.IsPostBack = False) Then + BindComments() + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub rptApproveComments_OnItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptApproveComments.ItemDataBound + + If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then + + Dim objComment As CommentInfo = CType(e.Item.DataItem, CommentInfo) + If (objComment IsNot Nothing) Then + Dim chkSelected As CheckBox = CType(e.Item.FindControl("chkSelected"), CheckBox) + chkSelected.Attributes.Add("CommentID", objComment.CommentID.ToString()) + End If + + End If + + End Sub + + Protected Sub cmdApprove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdApprove.Click + + For Each item As RepeaterItem In rptApproveComments.Items + If (item.ItemType = ListItemType.Item Or item.ItemType = ListItemType.AlternatingItem) Then + Dim chkSelected As CheckBox = CType(item.FindControl("chkSelected"), CheckBox) + If Not (chkSelected Is Nothing) Then + If (chkSelected.Checked) Then + Dim commentID As Integer = Convert.ToInt32(chkSelected.Attributes("CommentID").ToString()) + Dim objCommentController As New CommentController() + Dim objComment As CommentInfo = objCommentController.GetComment(commentID) + If Not (objComment Is Nothing) Then + objComment.IsApproved = True + objComment.ApprovedBy = Me.UserId + objCommentController.UpdateComment(objComment) + + Dim objEmailTemplateController As New EmailTemplateController() + If (ArticleSettings.NotifyAuthorOnApproval) Then + NotifyAuthor(objComment) + End If + + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(objComment.ArticleID) + + If Not (objArticle Is Nothing) Then + + If (ArticleSettings.EnableActiveSocialFeed And objComment.UserID <> Null.NullInteger) Then + If (ArticleSettings.ActiveSocialCommentKey <> "") Then + If IO.File.Exists(HttpContext.Current.Server.MapPath("~/bin/active.modules.social.dll")) Then + Dim ai As Object = Nothing + Dim asm As System.Reflection.Assembly + Dim ac As Object = Nothing + Try + asm = System.Reflection.Assembly.Load("Active.Modules.Social") + ac = asm.CreateInstance("Active.Modules.Social.API.Journal") + If Not ac Is Nothing Then + ac.AddProfileItem(New Guid(ArticleSettings.ActiveSocialCommentKey), objComment.UserID, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), objArticle.Title, objComment.Comment, objComment.Comment, 1, "") + End If + Catch ex As Exception + End Try + End If + End If + End If + + If (Request.IsAuthenticated) Then + If (ArticleSettings.JournalIntegration) Then + Dim objJournal As New Journal + objJournal.AddCommentToJournal(objArticle, objComment, PortalId, TabId, UserId, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False)) + End If + End If + + If (ArticleSettings.EnableSmartThinkerStoryFeed And objComment.UserID <> Null.NullInteger) Then + Dim objStoryFeed As New wsStoryFeed.StoryFeedWS + objStoryFeed.Url = DotNetNuke.Common.Globals.AddHTTP(Request.ServerVariables("HTTP_HOST") & Me.ResolveUrl("~/DesktopModules/Smart-Thinker%20-%20UserProfile/StoryFeed.asmx")) + + Dim val As String = GetSharedResource("StoryFeed-AddComment") + + Dim delimStr As String = "[]" + Dim delimiter As Char() = delimStr.ToCharArray() + Dim layoutArray As String() = val.Split(delimiter) + + Dim valResult As String = "" + + For iPtr As Integer = 0 To layoutArray.Length - 1 Step 2 + + valResult = valResult & layoutArray(iPtr) + + If iPtr < layoutArray.Length - 1 Then + Select Case layoutArray(iPtr + 1) + + Case "ARTICLEID" + valResult = valResult & objComment.ArticleID.ToString() + + Case "AUTHORID" + valResult = valResult & objComment.UserID.ToString() + + Case "AUTHOR" + If (objComment.UserID = Null.NullInteger) Then + valResult = valResult & objComment.AnonymousName + Else + valResult = valResult & objComment.AuthorDisplayName + End If + + Case "ARTICLELINK" + valResult = valResult & Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False) + + Case "ARTICLETITLE" + valResult = valResult & objArticle.Title + + Case "ISANONYMOUS" + If (objComment.UserID <> Null.NullInteger) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISANONYMOUS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISANONYMOUS" + ' Do Nothing + + Case "ISNOTANONYMOUS" + If (objComment.UserID <> Null.NullInteger) Then + While (iPtr < layoutArray.Length - 1) + If (layoutArray(iPtr + 1) = "/ISNOTANONYMOUS") Then + Exit While + End If + iPtr = iPtr + 1 + End While + End If + + Case "/ISNOTANONYMOUS" + ' Do Nothing + + End Select + End If + Next + + Try + objStoryFeed.AddAction(81, objComment.CommentID, valResult, objComment.UserID, "VE6457624576460436531768") + Catch + End Try + + End If + + If (ArticleSettings.NotifyEmailOnComment <> "") Then + For Each email As String In ArticleSettings.NotifyEmailOnComment.Split(Convert.ToChar(";")) + If (email <> "") Then + objEmailTemplateController.SendFormattedEmail(Me.ModuleId, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentNotification, ArticleSettings, email) + End If + Next + End If + + If (ArticleSettings.NotifyAuthorOnApproval) Then + objEmailTemplateController.SendFormattedEmail(Me.ModuleId, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentApproved, ArticleSettings) + End If + + Dim objMailList As New Hashtable + + Dim objComments As List(Of CommentInfo) = objCommentController.GetCommentList(Me.ModuleId, objComment.ArticleID, True, SortDirection.Ascending, Null.NullInteger) + + For Each objNotifyComment As CommentInfo In objComments + If (objNotifyComment.CommentID <> objComment.CommentID And objNotifyComment.NotifyMe) Then + If (objNotifyComment.UserID = Null.NullInteger) Then + If (objNotifyComment.AnonymousEmail <> "") Then + Try + If (objMailList.Contains(objNotifyComment.AnonymousEmail) = False) Then + objEmailTemplateController.SendFormattedEmail(Me.ModuleId, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentNotification, ArticleSettings, objNotifyComment.AnonymousEmail) + objMailList.Add(objNotifyComment.AnonymousEmail, objNotifyComment.AnonymousEmail) + End If + Catch ex As Exception + Dim objEventLog As New DotNetNuke.Services.Log.EventLog.EventLogController + objEventLog.AddLog("News Articles Email Failure", "Failure to send [Anon Comment] to '" & objNotifyComment.AnonymousEmail & "' from '" & Me.PortalSettings.Email, PortalSettings, -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT) + End Try + End If + Else + If (objNotifyComment.AuthorEmail <> "") Then + Try + If (objNotifyComment.UserID <> objComment.UserID) Then + If (objMailList.Contains(objNotifyComment.UserID.ToString()) = False) Then + objEmailTemplateController.SendFormattedEmail(Me.ModuleId, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentNotification, ArticleSettings, objNotifyComment.AuthorEmail) + objMailList.Add(objNotifyComment.UserID.ToString(), objNotifyComment.UserID.ToString()) + End If + End If + Catch ex As Exception + Dim objEventLog As New DotNetNuke.Services.Log.EventLog.EventLogController + objEventLog.AddLog("News Articles Email Failure", "Failure to send [Author Comment] to '" & objNotifyComment.AuthorEmail & "' from '" & Me.PortalSettings.Email, PortalSettings, -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT) + End Try + End If + End If + + End If + Next + End If + + End If + End If + End If + End If + Next + + Response.Redirect(Request.RawUrl, True) + + End Sub + + Protected Sub cmdReject_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdReject.Click + + For Each item As RepeaterItem In rptApproveComments.Items + If (item.ItemType = ListItemType.Item Or item.ItemType = ListItemType.AlternatingItem) Then + Dim chkSelected As CheckBox = CType(item.FindControl("chkSelected"), CheckBox) + If Not (chkSelected Is Nothing) Then + If (chkSelected.Checked) Then + Dim commentID As Integer = Convert.ToInt32(chkSelected.Attributes("CommentID").ToString()) + Dim objCommentController As New CommentController() + Dim objComment As CommentInfo = objCommentController.GetComment(commentID) + If Not (objComment Is Nothing) Then + objCommentController.DeleteComment(objComment.CommentID, objComment.ArticleID) + End If + End If + End If + End If + Next + + Response.Redirect(Request.RawUrl, True) + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucEditCategories.ascx b/ucEditCategories.ascx new file mode 100755 index 0000000..d9475f9 --- /dev/null +++ b/ucEditCategories.ascx @@ -0,0 +1,85 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucEditCategories.ascx.vb" Inherits="Ventrian.NewsArticles.ucEditCategories" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="HelpButton" Src="~/controls/HelpButtonControl.ascx" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + +
      + + + + + + + + + +
      + + + + + + + + +
      + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + Move Category +
      +
      + + + +
      + + + +
       
      + Actions +
      +
      + + + +
      + + + +
      +
      +
      +
      + +

      +   +

      + diff --git a/ucEditCategories.ascx.designer.vb b/ucEditCategories.ascx.designer.vb new file mode 100755 index 0000000..7867739 --- /dev/null +++ b/ucEditCategories.ascx.designer.vb @@ -0,0 +1,206 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditCategories + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''plParentCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plParentCategory As Global.System.Web.UI.UserControl + + ''' + '''drpParentCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpParentCategory As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plChildCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plChildCategories As Global.System.Web.UI.UserControl + + ''' + '''lblNoCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblNoCategories As Global.System.Web.UI.WebControls.Label + + ''' + '''pnlSortOrder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pnlSortOrder As Global.System.Web.UI.WebControls.Panel + + ''' + '''lstChildCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstChildCategories As Global.System.Web.UI.WebControls.ListBox + + ''' + '''lblCategoryUpdated control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCategoryUpdated As Global.System.Web.UI.WebControls.Label + + ''' + '''lblMoveCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblMoveCategory As Global.System.Web.UI.WebControls.Label + + ''' + '''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 + + ''' + '''hbtnUpHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents hbtnUpHelp As Global.System.Web.UI.UserControl + + ''' + '''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 + + ''' + '''hbtnDownHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents hbtnDownHelp As Global.System.Web.UI.UserControl + + ''' + '''lblActions control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblActions As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdEdit control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdEdit As Global.System.Web.UI.WebControls.ImageButton + + ''' + '''hbtnEditHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents hbtnEditHelp As Global.System.Web.UI.UserControl + + ''' + '''cmdView control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdView As Global.System.Web.UI.WebControls.ImageButton + + ''' + '''hbtnViewHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents hbtnViewHelp As Global.System.Web.UI.UserControl + + ''' + '''cmdUpdateSortOrder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdUpdateSortOrder As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdAddNewCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdAddNewCategory As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucEditCategories.ascx.vb b/ucEditCategories.ascx.vb new file mode 100755 index 0000000..f7229c6 --- /dev/null +++ b/ucEditCategories.ascx.vb @@ -0,0 +1,201 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditCategories + Inherits NewsArticleModuleBase + +#Region " Private Methods " + + Private Sub BindCategories() + + Dim objCategoryController As New CategoryController + + lstChildCategories.DataSource = objCategoryController.GetCategoriesAll(ModuleId, Convert.ToInt32(drpParentCategory.SelectedValue), Nothing, Null.NullInteger, 1, False, ArticleSettings.CategorySortType) + lstChildCategories.DataBind() + + If (lstChildCategories.Items.Count = 0) Then + pnlSortOrder.Visible = False + cmdUpdateSortOrder.Visible = False + lblNoCategories.Visible = True + Else + pnlSortOrder.Visible = True + cmdUpdateSortOrder.Visible = True + lblNoCategories.Visible = False + End If + + End Sub + + Private Sub BindParentCategories() + + Dim objCategoryController As New CategoryController + + drpParentCategory.DataSource = objCategoryController.GetCategoriesAll(ModuleId, Null.NullInteger, ArticleSettings.CategorySortType) + drpParentCategory.DataBind() + + drpParentCategory.Items.Insert(0, New ListItem(Localization.GetString("NoParentCategory", Me.LocalResourceFile), "-1")) + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + If (IsPostBack = False) Then + BindParentCategories() + BindCategories() + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdAddNewCategory_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddNewCategory.Click + + Try + + If (drpParentCategory.SelectedValue <> "-1") Then + Response.Redirect(EditArticleUrl("EditCategory", "ParentID=" & drpParentCategory.SelectedValue), True) + Else + Response.Redirect(EditArticleUrl("EditCategory"), True) + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub cmdUpdateSortOrder_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdUpdateSortOrder.Click + + Dim objCategoryController As New CategoryController + + Dim index As Integer = 0 + For Each item As ListItem In lstChildCategories.Items + Dim objCategory As CategoryInfo = objCategoryController.GetCategory(Convert.ToInt32(item.Value), ModuleId) + + If Not (objCategory Is Nothing) Then + objCategory.SortOrder = index + objCategoryController.UpdateCategory(objCategory) + index = index + 1 + End If + Next + + lblCategoryUpdated.Visible = True + + Dim currentCategory As String = drpParentCategory.SelectedValue + BindParentCategories() + If (drpParentCategory.Items.FindByValue(currentCategory) IsNot Nothing) Then + drpParentCategory.SelectedValue = currentCategory + End If + + End Sub + + Protected Sub drpParentCategory_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles drpParentCategory.SelectedIndexChanged + + Try + + BindCategories() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub cmdUp_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cmdUp.Click + + Try + + If (lstChildCategories.Items.Count > 1) Then + If (lstChildCategories.SelectedIndex > 0) Then + Dim objListItem As New ListItem + + objListItem.Value = lstChildCategories.SelectedItem.Value + objListItem.Text = lstChildCategories.SelectedItem.Text + + Dim index As Integer = lstChildCategories.SelectedIndex + + lstChildCategories.Items.RemoveAt(index) + lstChildCategories.Items.Insert(index - 1, objListItem) + lstChildCategories.SelectedIndex = index - 1 + End If + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub cmdDown_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cmdDown.Click + + Try + + If (lstChildCategories.Items.Count > 1) Then + If (lstChildCategories.SelectedIndex < (lstChildCategories.Items.Count - 1)) Then + Dim objListItem As New ListItem + + objListItem.Value = lstChildCategories.SelectedItem.Value + objListItem.Text = lstChildCategories.SelectedItem.Text + + Dim index As Integer = lstChildCategories.SelectedIndex + + lstChildCategories.Items.RemoveAt(index) + lstChildCategories.Items.Insert(index + 1, objListItem) + lstChildCategories.SelectedIndex = index + 1 + End If + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub cmdEdit_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cmdEdit.Click + + If (lstChildCategories.Items.Count > 0) Then + If Not (lstChildCategories.SelectedItem Is Nothing) Then + Response.Redirect(EditArticleUrl("EditCategory", "CategoryID=" & lstChildCategories.SelectedValue), True) + End If + End If + + End Sub + + Protected Sub cmdView_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cmdView.Click + + If (lstChildCategories.Items.Count > 0) Then + If Not (lstChildCategories.SelectedItem Is Nothing) Then + Dim objCategoryController As New CategoryController() + Dim objCategory As CategoryInfo = objCategoryController.GetCategory(Convert.ToInt32(lstChildCategories.SelectedValue), ModuleId) + + If (objCategory IsNot Nothing) Then + Response.Redirect(Common.GetCategoryLink(TabId, ModuleId, objCategory.CategoryID.ToString(), objCategory.Name, ArticleSettings.LaunchLinks, ArticleSettings), True) + End If + End If + End If + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/ucEditCategory.ascx b/ucEditCategory.ascx new file mode 100755 index 0000000..cbc3bb6 --- /dev/null +++ b/ucEditCategory.ascx @@ -0,0 +1,153 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucEditCategory.ascx.vb" Inherits="Ventrian.NewsArticles.ucEditCategory" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="TextEditor" Src="~/controls/TextEditor.ascx"%> +<%@ Register TagPrefix="dnn" TagName="URL" Src="~/controls/URLControl.ascx" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + +
      + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + +
      + + +
      +
      +
      + +
      +
      + + + + + + + + + + + + + + +
      + +
      + + + + + + <%# DataBinder.Eval(Container.DataItem, "Text") %> + + + + +   +   + + + + + + + +   +   + + + + + + + +
      + +
      +
      +
      + + + + + + + + + + + + + + +
      + +
      + +
      + +
      +
      +
      +
      +

      + +   + +   + +

      + diff --git a/ucEditCategory.ascx.designer.vb b/ucEditCategory.ascx.designer.vb new file mode 100755 index 0000000..2a36f07 --- /dev/null +++ b/ucEditCategory.ascx.designer.vb @@ -0,0 +1,350 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditCategory + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''pnlSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pnlSettings As Global.System.Web.UI.WebControls.Panel + + ''' + '''dshCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshCategory As Global.System.Web.UI.UserControl + + ''' + '''tblCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblCategory As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblCategoryHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCategoryHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''plParent control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plParent As Global.System.Web.UI.UserControl + + ''' + '''drpParentCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpParentCategory As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''valInvalidParentCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valInvalidParentCategory As Global.System.Web.UI.WebControls.CustomValidator + + ''' + '''plName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plName As Global.System.Web.UI.UserControl + + ''' + '''txtName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtName As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valName As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''plDescription control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plDescription As Global.System.Web.UI.UserControl + + ''' + '''txtDescription control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtDescription As DotNetNuke.UI.UserControls.TextEditor + + ''' + '''plCategoryImage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plCategoryImage As Global.System.Web.UI.UserControl + + ''' + '''ctlIcon control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ctlIcon As DotNetNuke.UI.UserControls.UrlControl + + ''' + '''dshSecurity control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshSecurity As Global.System.Web.UI.UserControl + + ''' + '''tblSecurity control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblSecurity As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plInheritSecurity control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plInheritSecurity As Global.System.Web.UI.UserControl + + ''' + '''chkInheritSecurity control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkInheritSecurity As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''trPermissions control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trPermissions As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plPermissions control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plPermissions As Global.System.Web.UI.UserControl + + ''' + '''grdCategoryPermissions control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents grdCategoryPermissions As Global.System.Web.UI.WebControls.DataGrid + + ''' + '''trSecurityMode control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trSecurityMode As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plSecurityMode control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSecurityMode As Global.System.Web.UI.UserControl + + ''' + '''lstSecurityMode control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstSecurityMode As Global.System.Web.UI.WebControls.RadioButtonList + + ''' + '''dshMeta control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshMeta As Global.System.Web.UI.UserControl + + ''' + '''tblMeta control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblMeta As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plMetaTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plMetaTitle As Global.System.Web.UI.UserControl + + ''' + '''txtMetaTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtMetaTitle As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plMetaDescription control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plMetaDescription As Global.System.Web.UI.UserControl + + ''' + '''txtMetaDescription control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtMetaDescription As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plMetaKeyWords control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plMetaKeyWords As Global.System.Web.UI.UserControl + + ''' + '''txtMetaKeyWords control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtMetaKeyWords As Global.System.Web.UI.WebControls.TextBox + + ''' + '''cmdUpdate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdUpdate As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdCancel control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdCancel As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdDelete control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdDelete As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucEditCategory.ascx.vb b/ucEditCategory.ascx.vb new file mode 100755 index 0000000..220ea6f --- /dev/null +++ b/ucEditCategory.ascx.vb @@ -0,0 +1,366 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization +Imports DotNetNuke.Security.Roles +Imports DotNetNuke.Entities.Modules + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditCategory + Inherits NewsArticleModuleBase + +#Region " Private Members " + + Private _categoryID As Integer = Null.NullInteger + +#End Region + +#Region " Private Methods " + + Private Sub ReadQueryString() + + If (IsNumeric(Request("CategoryID"))) Then + _categoryID = Convert.ToInt32(Request("CategoryID")) + End If + + End Sub + + Private Sub BindCategory() + + If (_categoryID = Null.NullInteger) Then + cmdDelete.Visible = False + trPermissions.Visible = False + trSecurityMode.Visible = False + chkInheritSecurity.Checked = True + lstSecurityMode.SelectedIndex = 0 + Return + End If + + Dim objCategoryController As CategoryController = New CategoryController + Dim objCategoryInfo As CategoryInfo = objCategoryController.GetCategory(_categoryID, ModuleId) + + If Not (objCategoryInfo Is Nothing) Then + If (drpParentCategory.Items.FindByValue(objCategoryInfo.ParentID.ToString()) IsNot Nothing) Then + drpParentCategory.SelectedValue = objCategoryInfo.ParentID.ToString() + End If + txtName.Text = objCategoryInfo.Name + txtDescription.Text = objCategoryInfo.Description + ctlIcon.Url = objCategoryInfo.Image + cmdDelete.Visible = True + chkInheritSecurity.Checked = objCategoryInfo.InheritSecurity + trPermissions.Visible = Not chkInheritSecurity.Checked + trSecurityMode.Visible = Not chkInheritSecurity.Checked + lstSecurityMode.SelectedValue = Convert.ToInt32(objCategoryInfo.CategorySecurityType).ToString() + + txtMetaTitle.Text = objCategoryInfo.MetaTitle + txtMetaDescription.Text = objCategoryInfo.MetaDescription + txtMetaKeyWords.Text = objCategoryInfo.MetaKeywords + End If + + End Sub + + Private Sub BindParentCategories() + + Dim objCategoryController As New CategoryController() + drpParentCategory.DataSource = objCategoryController.GetCategoriesAll(Me.ModuleId, Null.NullInteger, ArticleSettings.CategorySortType) + drpParentCategory.DataBind() + + drpParentCategory.Items.Insert(0, New ListItem(Localization.GetString("NoParentCategory", Me.LocalResourceFile), Null.NullInteger.ToString())) + + If (Request("ParentID") <> "") Then + If (drpParentCategory.Items.FindByValue(Request("ParentID")) IsNot Nothing) Then + drpParentCategory.SelectedValue = Request("ParentID") + End If + End If + + End Sub + + Private Sub BindRoles() + + Dim objRole As New RoleController + Dim availableRoles As New ArrayList + Dim roles As ArrayList = objRole.GetPortalRoles(PortalId) + + If Not roles Is Nothing Then + For Each Role As RoleInfo In roles + availableRoles.Add(New ListItem(Role.RoleName, Role.RoleName)) + Next + End If + + grdCategoryPermissions.DataSource = availableRoles + grdCategoryPermissions.DataBind() + + End Sub + + Private Sub BindSecurityMode() + + For Each value As Integer In System.Enum.GetValues(GetType(CategorySecurityType)) + Dim li As New ListItem + li.Value = value + li.Text = Localization.GetString(System.Enum.GetName(GetType(CategorySecurityType), value), Me.LocalResourceFile) + lstSecurityMode.Items.Add(li) + Next + + End Sub + + Private Function IsInRole(ByVal roleName As String, ByVal roles As String()) As Boolean + + For Each role As String In roles + If (roleName = role) Then + Return True + End If + Next + + Return False + + End Function + + Private Sub SaveCategory() + + Dim objCategoryInfo As New CategoryInfo + + objCategoryInfo.CategoryID = _categoryID + objCategoryInfo.ModuleID = ModuleId + objCategoryInfo.ParentID = Convert.ToInt32(drpParentCategory.SelectedValue) + objCategoryInfo.Name = txtName.Text + objCategoryInfo.Description = txtDescription.Text + objCategoryInfo.Image = ctlIcon.Url + objCategoryInfo.InheritSecurity = chkInheritSecurity.Checked + objCategoryInfo.CategorySecurityType = lstSecurityMode.SelectedValue + + objCategoryInfo.MetaTitle = txtMetaTitle.Text + objCategoryInfo.MetaDescription = txtMetaDescription.Text + objCategoryInfo.MetaKeywords = txtMetaKeyWords.Text + + Dim objCategoryController As New CategoryController + + If (objCategoryInfo.CategoryID = Null.NullInteger) Then + Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategories(ModuleId, objCategoryInfo.ParentID) + + objCategoryInfo.SortOrder = 0 + If (objCategories.Count > 0) Then + objCategoryInfo.SortOrder = CType(objCategories(objCategories.Count - 1), CategoryInfo).SortOrder + 1 + End If + objCategoryInfo.CategoryID = objCategoryController.AddCategory(objCategoryInfo) + Else + Dim objCategoryOld As CategoryInfo = objCategoryController.GetCategory(objCategoryInfo.CategoryID, ModuleId) + + If (objCategoryOld IsNot Nothing) Then + objCategoryInfo.SortOrder = objCategoryOld.SortOrder + If (objCategoryInfo.ParentID <> objCategoryOld.ParentID) Then + Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategories(ModuleId, objCategoryInfo.ParentID) + If (objCategories.Count > 0) Then + objCategoryInfo.SortOrder = CType(objCategories(objCategories.Count - 1), CategoryInfo).SortOrder + 1 + End If + End If + End If + objCategoryController.UpdateCategory(objCategoryInfo) + End If + + Dim viewRoles As String = "" + Dim submitRoles As String = "" + + For Each item As DataGridItem In grdCategoryPermissions.Items + Dim role As String = grdCategoryPermissions.DataKeys(item.ItemIndex).ToString() + + Dim chkView As CheckBox = CType(item.FindControl("chkView"), CheckBox) + If (chkView.Checked) Then + If (viewRoles = "") Then + viewRoles = role + Else + viewRoles = viewRoles & ";" & role + End If + End If + + Dim chkSubmit As CheckBox = CType(item.FindControl("chkSubmit"), CheckBox) + If (chkSubmit.Checked) Then + If (submitRoles = "") Then + submitRoles = role + Else + submitRoles = submitRoles & ";" & role + End If + End If + Next + + Dim objModuleController As New ModuleController() + objModuleController.UpdateModuleSetting(Me.ModuleId, objCategoryInfo.CategoryID.ToString() & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING, viewRoles) + objModuleController.UpdateModuleSetting(Me.ModuleId, objCategoryInfo.CategoryID.ToString() & "-" & ArticleConstants.PERMISSION_CATEGORY_SUBMIT_SETTING, submitRoles) + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + ReadQueryString() + + If (IsPostBack = False) Then + BindSecurityMode() + BindRoles() + BindParentCategories() + BindCategory() + Page.SetFocus(txtName) + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click + + Try + + If (Page.IsValid) Then + + SaveCategory() + + Response.Redirect(EditArticleUrl("EditCategories"), True) + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click + + Try + + Response.Redirect(EditArticleUrl("EditCategories"), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelete.Click + + Try + + Dim objCategoryController As New CategoryController + Dim objCategory As CategoryInfo = objCategoryController.GetCategory(_categoryID, ModuleId) + + If (objCategory IsNot Nothing) Then + + Dim objChildCategories As List(Of CategoryInfo) = objCategoryController.GetCategories(Me.ModuleId, _categoryID) + + For Each objChildCategory As CategoryInfo In objChildCategories + objChildCategory.ParentID = objCategory.ParentID + objCategoryController.UpdateCategory(objChildCategory) + Next + + objCategoryController.DeleteCategory(_categoryID, ModuleId) + + End If + + Response.Redirect(EditArticleUrl("EditCategories"), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub valInvalidParentCategory_ServerValidate(ByVal source As System.Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles valInvalidParentCategory.ServerValidate + + Try + + If (_categoryID = Null.NullInteger Or drpParentCategory.SelectedValue = "-1") Then + args.IsValid = True + Return + End If + + Dim objCategoryController As New CategoryController + Dim objCategory As CategoryInfo = objCategoryController.GetCategory(Convert.ToInt32(drpParentCategory.SelectedValue), ModuleId) + + While Not objCategory Is Nothing + If (_categoryID = objCategory.CategoryID) Then + args.IsValid = False + Return + End If + objCategory = objCategoryController.GetCategory(objCategory.ParentID, objCategory.ModuleID) + End While + + args.IsValid = True + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub grdCategoryPermissions_ItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdCategoryPermissions.ItemDataBound + + Try + + If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then + Dim objListItem As ListItem = CType(e.Item.DataItem, ListItem) + + If Not (objListItem Is Nothing) Then + + Dim role As String = CType(e.Item.DataItem, ListItem).Value + + Dim chkView As CheckBox = CType(e.Item.FindControl("chkView"), CheckBox) + Dim chkSubmit As CheckBox = CType(e.Item.FindControl("chkSubmit"), CheckBox) + + If (objListItem.Value = PortalSettings.AdministratorRoleName.ToString()) Then + chkView.Enabled = False + chkView.Checked = True + chkSubmit.Enabled = False + chkSubmit.Checked = True + Else + If (_categoryID <> Null.NullInteger) Then + If (Settings.Contains(_categoryID.ToString() & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + chkView.Checked = IsInRole(role, Settings(_categoryID.ToString() & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString().Split(";"c)) + End If + If (Settings.Contains(_categoryID.ToString() & "-" & ArticleConstants.PERMISSION_CATEGORY_SUBMIT_SETTING)) Then + chkSubmit.Checked = IsInRole(role, Settings(_categoryID.ToString() & "-" & ArticleConstants.PERMISSION_CATEGORY_SUBMIT_SETTING).ToString().Split(";"c)) + End If + End If + End If + + End If + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub chkInheritSecurity_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles chkInheritSecurity.CheckedChanged + + Try + + trPermissions.Visible = Not chkInheritSecurity.Checked + trSecurityMode.Visible = Not chkInheritSecurity.Checked + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucEditComment.ascx b/ucEditComment.ascx new file mode 100755 index 0000000..5853507 --- /dev/null +++ b/ucEditComment.ascx @@ -0,0 +1,71 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucEditComment.ascx.vb" Inherits="Ventrian.NewsArticles.ucEditComment" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %> +<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.UI.WebControls" Assembly="DotNetNuke" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + +
      + + + + + +
      + + + +
      + + + + +
      +
      +
      + +

      + +   + +   + +

      diff --git a/ucEditComment.ascx.designer.vb b/ucEditComment.ascx.designer.vb new file mode 100755 index 0000000..3a23f31 --- /dev/null +++ b/ucEditComment.ascx.designer.vb @@ -0,0 +1,215 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditComment + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''pnlSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pnlSettings As Global.System.Web.UI.WebControls.Panel + + ''' + '''dshEditComment control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshEditComment As Global.System.Web.UI.UserControl + + ''' + '''tblEditComment control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblEditComment As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''trName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trName As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plName As Global.System.Web.UI.UserControl + + ''' + '''txtName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtName As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valName As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''trEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trEmail As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEmail As Global.System.Web.UI.UserControl + + ''' + '''txtEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtEmail As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valEmail As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''valEmailIsValid control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valEmailIsValid As Global.System.Web.UI.WebControls.RegularExpressionValidator + + ''' + '''trUrl control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trUrl As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plUrl control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plUrl As Global.System.Web.UI.UserControl + + ''' + '''txtURL control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtURL As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plComment control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plComment As Global.System.Web.UI.UserControl + + ''' + '''txtComment control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtComment As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valComment control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valComment As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''cmdUpdate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdUpdate As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdCancel control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdCancel As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdDelete control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdDelete As Global.System.Web.UI.WebControls.LinkButton + End Class +End Namespace diff --git a/ucEditComment.ascx.vb b/ucEditComment.ascx.vb new file mode 100755 index 0000000..ff854b0 --- /dev/null +++ b/ucEditComment.ascx.vb @@ -0,0 +1,192 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2010 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Security + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditComment + Inherits NewsArticleModuleBase + +#Region " Private Members " + + Private _commentID As Integer = Null.NullInteger + Private _returnUrl As String = Null.NullString + +#End Region + +#Region " Private Methods " + + Private Sub BindComment() + + If (_commentID = Null.NullInteger) Then + Response.Redirect(NavigateURL(), True) + End If + + Dim objCommentController As New CommentController() + Dim objComment As CommentInfo = objCommentController.GetComment(_commentID) + + If (ArticleSettings.IsAdmin() = False And ArticleSettings.IsApprover() = False) Then + + Dim objArticleController As New ArticleController() + Dim objArticle As ArticleInfo = objArticleController.GetArticle(objComment.ArticleID) + + If (objArticle Is Nothing) Then + Response.Redirect(NavigateURL(), True) + End If + + If (objArticle.AuthorID <> Me.UserId) Then + Response.Redirect(NavigateURL(), True) + End If + + End If + + If (objComment.UserID <> Null.NullInteger) Then + trName.Visible = False + trEmail.Visible = False + trUrl.Visible = False + Else + txtName.Text = objComment.AnonymousName + txtEmail.Text = objComment.AnonymousEmail + txtURL.Text = objComment.AnonymousURL + End If + + txtComment.Text = objComment.Comment.Replace("
      ", vbCrLf) + + End Sub + + Private Function FilterInput(ByVal stringToFilter As String) As String + + Dim objPortalSecurity As New PortalSecurity + + stringToFilter = objPortalSecurity.InputFilter(stringToFilter, PortalSecurity.FilterFlag.NoScripting) + + stringToFilter = Replace(stringToFilter, Chr(13), "") + stringToFilter = Replace(stringToFilter, ControlChars.Lf, "
      ") + + Return stringToFilter + + End Function + + Private Sub ReadQueryString() + + If (IsNumeric(Request("CommentID"))) Then + _commentID = Convert.ToInt32(Request("CommentID")) + End If + + If (Request("ReturnUrl") <> "") Then + _returnUrl = Request("ReturnUrl") + End If + + End Sub + +#End Region + +#Region " Event Handlers " + + Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + + Try + + ReadQueryString() + + If IsPostBack = False Then + BindComment() + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub cmdUpdate_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdUpdate.Click + + Try + + If (Page.IsValid) Then + + + Dim objCommentController As New CommentController() + Dim objComment As CommentInfo = objCommentController.GetComment(_commentID) + + If (objComment IsNot Nothing) Then + + If (objComment.UserID = Null.NullInteger) Then + objComment.AnonymousName = txtName.Text + objComment.AnonymousEmail = txtEmail.Text + objComment.AnonymousURL = txtURL.Text + End If + + objComment.Comment = FilterInput(txtComment.Text) + objCommentController.UpdateComment(objComment) + + End If + + If (_returnUrl <> "") Then + Response.Redirect(_returnUrl, True) + Else + Response.Redirect(NavigateURL(), True) + End If + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub cmdCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdCancel.Click + + Try + + If (_returnUrl <> "") Then + Response.Redirect(_returnUrl, True) + Else + Response.Redirect(NavigateURL(), True) + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub cmdDelete_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdDelete.Click + + Try + + Dim objCommentController As New CommentController() + Dim objComment As CommentInfo = objCommentController.GetComment(_commentID) + + If (objComment IsNot Nothing) Then + objCommentController.DeleteComment(_commentID, objComment.ArticleID) + End If + + If (_returnUrl <> "") Then + Response.Redirect(_returnUrl, True) + Else + Response.Redirect(NavigateURL(), True) + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + + End Class + +End Namespace \ No newline at end of file diff --git a/ucEditCustomField.ascx b/ucEditCustomField.ascx new file mode 100755 index 0000000..43b06f0 --- /dev/null +++ b/ucEditCustomField.ascx @@ -0,0 +1,141 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucEditCustomField.ascx.vb" Inherits="Ventrian.NewsArticles.ucEditCustomField" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + +
      + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + + +
      + + +
      + +
      + +
      + + + + + + +
      + +
      + +
      + + +
      +
      + + + + + + + + + + + + + + + + + + + + + +
      +
      + +
      + +
      + +
      +
      +
      +

      + +   + +   + +

      +
      \ No newline at end of file diff --git a/ucEditCustomField.ascx.designer.vb b/ucEditCustomField.ascx.designer.vb new file mode 100755 index 0000000..18a2728 --- /dev/null +++ b/ucEditCustomField.ascx.designer.vb @@ -0,0 +1,404 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditCustomField + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''dshCustomFieldDetails control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshCustomFieldDetails As Global.System.Web.UI.UserControl + + ''' + '''tblCustomFieldDetails control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblCustomFieldDetails As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblCustomFieldDetailsHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCustomFieldDetailsHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''plName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plName As Global.System.Web.UI.UserControl + + ''' + '''txtName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtName As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valName As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''plCaption control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plCaption As Global.System.Web.UI.UserControl + + ''' + '''txtCaption control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtCaption As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valCaption control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valCaption As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''plCaptionHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plCaptionHelp As Global.System.Web.UI.UserControl + + ''' + '''txtCaptionHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtCaptionHelp As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plFieldType control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plFieldType As Global.System.Web.UI.UserControl + + ''' + '''drpFieldType control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpFieldType As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''trFieldElements control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trFieldElements As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plFieldElements control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plFieldElements As Global.System.Web.UI.UserControl + + ''' + '''lstFieldElementType control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstFieldElementType As Global.System.Web.UI.WebControls.RadioButtonList + + ''' + '''pnlFieldElements control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pnlFieldElements As Global.System.Web.UI.WebControls.Panel + + ''' + '''txtFieldElements control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtFieldElements As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valFieldElements control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valFieldElements As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''lblFieldElementHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblFieldElementHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''plDefaultValue control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plDefaultValue As Global.System.Web.UI.UserControl + + ''' + '''txtDefaultValue control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtDefaultValue As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plVisible control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plVisible As Global.System.Web.UI.UserControl + + ''' + '''chkVisible control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkVisible As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''trMaximumLength control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trMaximumLength As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plMaximumLength control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plMaximumLength As Global.System.Web.UI.UserControl + + ''' + '''txtMaximumLength control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtMaximumLength As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valMaximumLengthIsNumber control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valMaximumLengthIsNumber As Global.System.Web.UI.WebControls.CompareValidator + + ''' + '''phRequired control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phRequired As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''dshRequiredDetails control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshRequiredDetails As Global.System.Web.UI.UserControl + + ''' + '''tblRequiredDetails control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblRequiredDetails As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblRequiredDetails control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblRequiredDetails As Global.System.Web.UI.WebControls.Label + + ''' + '''plRequired control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plRequired As Global.System.Web.UI.UserControl + + ''' + '''chkRequired control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkRequired As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plValidationType control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plValidationType As Global.System.Web.UI.UserControl + + ''' + '''drpValidationType control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpValidationType As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''trRegex control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trRegex As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plRegex control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plRegex As Global.System.Web.UI.UserControl + + ''' + '''txtRegex control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtRegex As Global.System.Web.UI.WebControls.TextBox + + ''' + '''cmdUpdate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdUpdate As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdCancel control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdCancel As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdDelete control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdDelete As Global.System.Web.UI.WebControls.LinkButton + End Class +End Namespace diff --git a/ucEditCustomField.ascx.vb b/ucEditCustomField.ascx.vb new file mode 100755 index 0000000..1d6b816 --- /dev/null +++ b/ucEditCustomField.ascx.vb @@ -0,0 +1,298 @@ +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization + +Imports Ventrian.NewsArticles.Components.CustomFields + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditCustomField + Inherits NewsArticleModuleBase + +#Region " Private Members " + + Private _customFieldID As Integer = Null.NullInteger + +#End Region + +#Region " Private Methods " + + Private Sub AdjustFieldElements() + + Dim objFieldType As CustomFieldType = CType(System.Enum.Parse(GetType(CustomFieldValidationType), drpFieldType.SelectedIndex.ToString()), CustomFieldType) + + Select Case objFieldType + + Case CustomFieldType.CheckBox + phRequired.Visible = True + trMaximumLength.Visible = False + trFieldElements.Visible = False + + Case CustomFieldType.DropDownList + phRequired.Visible = True + trMaximumLength.Visible = False + trFieldElements.Visible = True + + Case CustomFieldType.MultiCheckBox + phRequired.Visible = True + trMaximumLength.Visible = False + trFieldElements.Visible = True + + Case CustomFieldType.MultiLineTextBox + phRequired.Visible = True + trMaximumLength.Visible = True + trFieldElements.Visible = False + + Case CustomFieldType.OneLineTextBox + phRequired.Visible = True + trMaximumLength.Visible = True + trFieldElements.Visible = False + + Case CustomFieldType.RadioButton + phRequired.Visible = True + trMaximumLength.Visible = False + trFieldElements.Visible = True + + Case CustomFieldType.RichTextBox + phRequired.Visible = True + trMaximumLength.Visible = False + trFieldElements.Visible = False + + End Select + + End Sub + + Private Sub AdjustValidationType() + + If (drpValidationType.SelectedValue = CType(CustomFieldValidationType.Regex, Integer).ToString()) Then + trRegex.Visible = True + Else + trRegex.Visible = False + End If + + End Sub + + Private Sub BindCustomField() + + If (_customFieldID = Null.NullInteger) Then + + AdjustFieldElements() + AdjustValidationType() + cmdDelete.Visible = False + + Else + + Dim objCustomFieldController As New CustomFieldController + Dim objCustomFieldInfo As CustomFieldInfo = objCustomFieldController.Get(_customFieldID) + + If Not (objCustomFieldInfo Is Nothing) Then + + txtName.Text = objCustomFieldInfo.Name + txtCaption.Text = objCustomFieldInfo.Caption + txtCaptionHelp.Text = objCustomFieldInfo.CaptionHelp + If Not (drpFieldType.Items.FindByValue(objCustomFieldInfo.FieldType.ToString()) Is Nothing) Then + drpFieldType.SelectedValue = objCustomFieldInfo.FieldType.ToString() + End If + txtFieldElements.Text = objCustomFieldInfo.FieldElements + AdjustFieldElements() + + txtDefaultValue.Text = objCustomFieldInfo.DefaultValue + chkVisible.Checked = objCustomFieldInfo.IsVisible + If (objCustomFieldInfo.Length <> Null.NullInteger) Then + txtMaximumLength.Text = objCustomFieldInfo.Length.ToString() + End If + + chkRequired.Checked = objCustomFieldInfo.IsRequired + If Not (drpValidationType.Items.FindByValue(CType(objCustomFieldInfo.ValidationType, Integer).ToString()) Is Nothing) Then + drpValidationType.SelectedValue = CType(objCustomFieldInfo.ValidationType, Integer).ToString() + End If + txtRegex.Text = objCustomFieldInfo.RegularExpression + AdjustValidationType() + + End If + + End If + + + End Sub + + Private Sub BindFieldTypes() + + For Each value As Integer In System.Enum.GetValues(GetType(CustomFieldType)) + Dim li As New ListItem + li.Value = System.Enum.GetName(GetType(CustomFieldType), value) + li.Text = Localization.GetString(System.Enum.GetName(GetType(CustomFieldType), value), Me.LocalResourceFile) + drpFieldType.Items.Add(li) + Next + + End Sub + + Private Sub BindValidationTypes() + + For Each value As Integer In System.Enum.GetValues(GetType(CustomFieldValidationType)) + Dim li As New ListItem + li.Value = value.ToString() + li.Text = Localization.GetString(System.Enum.GetName(GetType(CustomFieldValidationType), value), Me.LocalResourceFile) + drpValidationType.Items.Add(li) + Next + + End Sub + + Private Sub ReadQueryString() + + If Not (Request("CustomFieldID") Is Nothing) Then + _customFieldID = Convert.ToInt32(Request("CustomFieldID")) + End If + + End Sub + +#End Region + +#Region " Event Handlers " + + Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + + Try + + ReadQueryString() + + If (Page.IsPostBack = False) Then + + BindFieldTypes() + BindValidationTypes() + BindCustomField() + + Page.SetFocus(txtName) + cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" & Localization.GetString("Confirmation", LocalResourceFile) & "');") + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click + + Try + + If (Page.IsValid) Then + + Dim objCustomFieldController As New CustomFieldController + Dim objCustomFieldInfo As New CustomFieldInfo + + objCustomFieldInfo.ModuleID = Me.ModuleId + + objCustomFieldInfo.Name = txtName.Text + objCustomFieldInfo.Caption = txtCaption.Text + objCustomFieldInfo.CaptionHelp = txtCaptionHelp.Text + objCustomFieldInfo.FieldType = CType(System.Enum.Parse(GetType(CustomFieldType), drpFieldType.SelectedIndex.ToString()), CustomFieldType) + objCustomFieldInfo.FieldElements = txtFieldElements.Text + + objCustomFieldInfo.DefaultValue = txtDefaultValue.Text + objCustomFieldInfo.IsVisible = chkVisible.Checked + If (txtMaximumLength.Text.Trim() = "") Then + objCustomFieldInfo.Length = Null.NullInteger + Else + objCustomFieldInfo.Length = Convert.ToInt32(txtMaximumLength.Text) + If (objCustomFieldInfo.Length <= 0) Then + objCustomFieldInfo.Length = Null.NullInteger + End If + End If + + objCustomFieldInfo.IsRequired = chkRequired.Checked + objCustomFieldInfo.ValidationType = CType(System.Enum.Parse(GetType(CustomFieldValidationType), drpValidationType.SelectedIndex.ToString()), CustomFieldValidationType) + objCustomFieldInfo.RegularExpression = txtRegex.Text + + If (_customFieldID = Null.NullInteger) Then + + Dim objCustomFields As ArrayList = objCustomFieldController.List(Me.ModuleId) + + If (objCustomFields.Count = 0) Then + objCustomFieldInfo.SortOrder = 0 + Else + objCustomFieldInfo.SortOrder = CType(objCustomFields(objCustomFields.Count - 1), CustomFieldInfo).SortOrder + 1 + End If + + objCustomFieldController.Add(objCustomFieldInfo) + + Else + + Dim objCustomFieldInfoOld As CustomFieldInfo = objCustomFieldController.Get(_customFieldID) + + objCustomFieldInfo.SortOrder = objCustomFieldInfoOld.SortOrder + objCustomFieldInfo.CustomFieldID = _customFieldID + objCustomFieldController.Update(objCustomFieldInfo) + + End If + + Response.Redirect(EditUrl("EditCustomFields"), True) + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + + Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click + + Try + + Response.Redirect(EditUrl("EditCustomFields"), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelete.Click + + Try + + Dim objCustomFieldController As New CustomFieldController + objCustomFieldController.Delete(Me.ModuleId, _customFieldID) + + Response.Redirect(EditUrl("EditCustomFields"), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub drpFieldType_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drpFieldType.SelectedIndexChanged + + Try + + AdjustFieldElements() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub drpValidationType_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drpValidationType.SelectedIndexChanged + + Try + + AdjustValidationType() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucEditCustomFields.ascx b/ucEditCustomFields.ascx new file mode 100755 index 0000000..59e7034 --- /dev/null +++ b/ucEditCustomFields.ascx @@ -0,0 +1,40 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucEditCustomFields.ascx.vb" Inherits="Ventrian.NewsArticles.ucEditCustomFields" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + +
      + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      +
      +
      +
      +
      +

      + +

      + diff --git a/ucEditCustomFields.ascx.designer.vb b/ucEditCustomFields.ascx.designer.vb new file mode 100755 index 0000000..e138280 --- /dev/null +++ b/ucEditCustomFields.ascx.designer.vb @@ -0,0 +1,53 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditCustomFields + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''grdCustomFields control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents grdCustomFields As Global.System.Web.UI.WebControls.DataGrid + + ''' + '''lblNoCustomFields control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblNoCustomFields As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdAddCustomField control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdAddCustomField As Global.System.Web.UI.WebControls.LinkButton + End Class +End Namespace diff --git a/ucEditCustomFields.ascx.vb b/ucEditCustomFields.ascx.vb new file mode 100755 index 0000000..480ebfa --- /dev/null +++ b/ucEditCustomFields.ascx.vb @@ -0,0 +1,157 @@ +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Localization + +Imports Ventrian.NewsArticles.Components.CustomFields + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditCustomFields + Inherits NewsArticleModuleBase + +#Region " Private Members " + + Dim _customFields As ArrayList + +#End Region + +#Region " Private Methods " + + Private Sub BindCustomFields() + + Localization.LocalizeDataGrid(grdCustomFields, Me.LocalResourceFile) + + Dim objCustomFieldController As New CustomFieldController() + + _customFields = objCustomFieldController.List(Me.ModuleId) + grdCustomFields.DataSource = _customFields + + grdCustomFields.DataBind() + + If (grdCustomFields.Items.Count = 0) Then + grdCustomFields.Visible = False + lblNoCustomFields.Visible = True + Else + grdCustomFields.Visible = True + lblNoCustomFields.Visible = False + End If + + End Sub + +#End Region + +#Region " Protected Methods " + + Protected Function GetCustomFieldEditUrl(ByVal customFieldID As String) As String + + Return EditArticleUrl("EditCustomField", "CustomFieldID=" & customFieldID) + + End Function + +#End Region + +#Region " Event Handlers " + + Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + + If (Page.IsPostBack = False) Then + BindCustomFields() + End If + + End Sub + + Protected Sub cmdAddCustomField_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdAddCustomField.Click + + Response.Redirect(EditArticleUrl("EditCustomField"), True) + + End Sub + + Private Sub grdCustomFields_ItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdCustomFields.ItemDataBound + + If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then + + Dim btnUp As ImageButton = CType(e.Item.FindControl("btnUp"), ImageButton) + Dim btnDown As ImageButton = CType(e.Item.FindControl("btnDown"), ImageButton) + + Dim objCustomField As CustomFieldInfo = CType(e.Item.DataItem, CustomFieldInfo) + + If Not (btnUp Is Nothing And btnDown Is Nothing) Then + + If (objCustomField.CustomFieldID = CType(_customFields(0), CustomFieldInfo).CustomFieldID) Then + btnUp.Visible = False + End If + + If (objCustomField.CustomFieldID = CType(_customFields(_customFields.Count - 1), CustomFieldInfo).CustomFieldID) Then + btnDown.Visible = False + End If + + btnUp.CommandArgument = objCustomField.CustomFieldID.ToString() + btnUp.CommandName = "Up" + + btnDown.CommandArgument = objCustomField.CustomFieldID.ToString() + btnDown.CommandName = "Down" + + End If + + End If + + End Sub + + Private Sub grdCustomFields_ItemCommand(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdCustomFields.ItemCommand + + Dim objCustomFieldController As New CustomFieldController + _customFields = objCustomFieldController.List(Me.ModuleId) + + Dim customFieldID As Integer = Convert.ToInt32(e.CommandArgument) + + For i As Integer = 0 To _customFields.Count - 1 + + Dim objCustomField As CustomFieldInfo = CType(_customFields(i), CustomFieldInfo) + + If (customFieldID = objCustomField.CustomFieldID) Then + + If (e.CommandName = "Up") Then + + Dim objCustomFieldToSwap As CustomFieldInfo = CType(_customFields(i - 1), CustomFieldInfo) + + Dim sortOrder As Integer = objCustomField.SortOrder + Dim sortOrderPrevious As Integer = objCustomFieldToSwap.SortOrder + + objCustomField.SortOrder = sortOrderPrevious + objCustomFieldToSwap.SortOrder = sortOrder + + objCustomFieldController.Update(objCustomField) + objCustomFieldController.Update(objCustomFieldToSwap) + + End If + + + If (e.CommandName = "Down") Then + + Dim objCustomFieldToSwap As CustomFieldInfo = CType(_customFields(i + 1), CustomFieldInfo) + + Dim sortOrder As Integer = objCustomField.SortOrder + Dim sortOrderNext As Integer = objCustomFieldToSwap.SortOrder + + objCustomField.SortOrder = sortOrderNext + objCustomFieldToSwap.SortOrder = sortOrder + + objCustomFieldController.Update(objCustomField) + objCustomFieldController.Update(objCustomFieldToSwap) + + End If + + End If + + Next + + Response.Redirect(Request.RawUrl, True) + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucEditPage.ascx b/ucEditPage.ascx new file mode 100755 index 0000000..875aa07 --- /dev/null +++ b/ucEditPage.ascx @@ -0,0 +1,53 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucEditPage.ascx.vb" Inherits="Ventrian.NewsArticles.ucEditPage" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="TextEditor" Src="~/controls/TextEditor.ascx"%> + +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + + + + + + +
      + + + + + + + + + + + + + + + + + + + + +
      + + + + +
      +
      + +
      +
      +
      +

      + +   + +   + +

      + + diff --git a/ucEditPage.ascx.designer.vb b/ucEditPage.ascx.designer.vb new file mode 100755 index 0000000..67e2923 --- /dev/null +++ b/ucEditPage.ascx.designer.vb @@ -0,0 +1,152 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditPage + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''pnlSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pnlSettings As Global.System.Web.UI.WebControls.Panel + + ''' + '''dshPage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshPage As Global.System.Web.UI.UserControl + + ''' + '''tblPage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblPage As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblPageSettingsHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblPageSettingsHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''plTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTitle As Global.System.Web.UI.UserControl + + ''' + '''txtTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtTitle As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valTitle As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''plSummary control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSummary As Global.System.Web.UI.UserControl + + ''' + '''txtSummary control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtSummary As Global.System.Web.UI.UserControl + + ''' + '''valSummary control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valSummary As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''cmdUpdate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdUpdate As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdCancel control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdCancel As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdDelete control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdDelete As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucEditPage.ascx.vb b/ucEditPage.ascx.vb new file mode 100755 index 0000000..c9c43ab --- /dev/null +++ b/ucEditPage.ascx.vb @@ -0,0 +1,199 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.UI.UserControls + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditPage + Inherits NewsArticleModuleBase + +#Region " Private Properties " + + Private ReadOnly Property Summary() As TextEditor + Get + Return CType(txtSummary, TextEditor) + End Get + End Property + +#End Region + +#Region " Private Members " + + Private _pageID As Integer = Null.NullInteger + Private _articleID As Integer = Null.NullInteger + +#End Region + +#Region " Private Methods " + + Private Sub ReadQueryString() + + If (IsNumeric(Request("ArticleID"))) Then + _articleID = Convert.ToInt32(Request("ArticleID")) + End If + + If (IsNumeric(Request("PageID"))) Then + _pageID = Convert.ToInt32(Request("PageID")) + End If + + + End Sub + + Private Sub CheckSecurity() + + If (HasEditRights(_articleID, Me.ModuleId, Me.TabId) = False) Then + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "NotAuthorized", ArticleSettings), True) + End If + + End Sub + + Private Sub BindPage() + + If (_pageID = Null.NullInteger) Then + + cmdDelete.Visible = False + Else + + cmdDelete.Visible = True + cmdDelete.Attributes.Add("onClick", "javascript:return confirm('Are You Sure You Wish To Delete This Item ?');") + + Dim objPageController As New PageController + Dim objPage As PageInfo = objPageController.GetPage(_pageID) + + If Not (objPage Is Nothing) Then + txtTitle.Text = objPage.Title + Summary.Text = objPage.PageText + End If + + End If + + End Sub + + Private Sub SetTextEditor() + + Summary.Width = Unit.Parse(ArticleSettings.TextEditorWidth) + Summary.Height = Unit.Parse(ArticleSettings.TextEditorHeight) + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + ReadQueryString() + CheckSecurity() + + If (IsPostBack = False) Then + + BindPage() + SetTextEditor() + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click + + Try + + If (Page.IsValid) Then + + Dim objPageController As PageController = New PageController + + Dim objPage As PageInfo = New PageInfo + + If (_pageID <> Null.NullInteger) Then + + objPage = objPageController.GetPage(_pageID) + + Else + + objPage = CType(CBO.InitializeObject(objPage, GetType(PageInfo)), PageInfo) + + End If + + objPage.Title = txtTitle.Text + objPage.PageText = Summary.Text + objPage.ArticleID = _articleID + + If (_pageID = Null.NullInteger) Then + + objPageController.AddPage(objPage) + + Else + + If (objPage.SortOrder = 0) Then + Dim objArticleController As New ArticleController() + Dim objArticle As ArticleInfo = objArticleController.GetArticle(_articleID) + + If (objArticle IsNot Nothing) Then + If (objArticle.Title <> objPage.Title) Then + objArticle.Title = objPage.Title + objArticleController.UpdateArticle(objArticle) + End If + End If + End If + + objPageController.UpdatePage(objPage) + + End If + + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "EditPages", ArticleSettings, "ArticleID=" & _articleID.ToString()), True) + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelete.Click + + Try + + Dim objPageController As New PageController + objPageController.DeletePage(_pageID) + + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "EditPages", ArticleSettings, "ArticleID=" & _articleID.ToString()), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click + + Try + + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "EditPages", ArticleSettings, "ArticleID=" & _articleID.ToString()), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucEditPageSortOrder.ascx b/ucEditPageSortOrder.ascx new file mode 100755 index 0000000..f76142b --- /dev/null +++ b/ucEditPageSortOrder.ascx @@ -0,0 +1,57 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucEditPageSortOrder.ascx.vb" Inherits="Ventrian.NewsArticles.ucEditPageSortOrder" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + + + + + + +
      + + + + + + + + + + + +
      + + + + + + +
      + + + + + + + + + + + +
      + +
      + +
      +
      +
      +
      +
      +

      + +   + +

      + + \ No newline at end of file diff --git a/ucEditPageSortOrder.ascx.designer.vb b/ucEditPageSortOrder.ascx.designer.vb new file mode 100755 index 0000000..032ae93 --- /dev/null +++ b/ucEditPageSortOrder.ascx.designer.vb @@ -0,0 +1,125 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditPageSortOrder + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''pnlSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pnlSettings As Global.System.Web.UI.WebControls.Panel + + ''' + '''dshPage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshPage As Global.System.Web.UI.UserControl + + ''' + '''tblSortOrder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblSortOrder As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblSortOrderHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblSortOrderHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''plSortOrder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSortOrder As Global.System.Web.UI.UserControl + + ''' + '''lstSortOrder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstSortOrder As Global.System.Web.UI.WebControls.ListBox + + ''' + '''upBtn control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents upBtn As Global.System.Web.UI.WebControls.ImageButton + + ''' + '''downBtn control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents downBtn As Global.System.Web.UI.WebControls.ImageButton + + ''' + '''cmdUpdate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdUpdate As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdCancel control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdCancel As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucEditPageSortOrder.ascx.vb b/ucEditPageSortOrder.ascx.vb new file mode 100755 index 0000000..4d8beb6 --- /dev/null +++ b/ucEditPageSortOrder.ascx.vb @@ -0,0 +1,175 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditPageSortOrder + Inherits NewsArticleModuleBase + +#Region " Private Members " + + Private _articleID As Integer + +#End Region + +#Region " Private Methods " + + Private Sub ReadQueryString() + + If (IsNumeric(Request("ArticleID"))) Then + _articleID = Convert.ToInt32(Request("ArticleID")) + End If + + End Sub + + Private Sub CheckSecurity() + + If (HasEditRights(_articleID, Me.ModuleId, Me.TabId) = False) Then + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "NotAuthorized", ArticleSettings), True) + End If + + End Sub + + Private Sub BindOrder() + + Dim objPageController As PageController = New PageController + + lstSortOrder.DataSource = objPageController.GetPageList(_articleID) + lstSortOrder.DataBind() + + If (lstSortOrder.Items.Count = 0) Then + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "EditPages", ArticleSettings, "ArticleID=" & _articleID.ToString()), True) + End If + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + ReadQueryString() + + If (IsPostBack = False) Then + + CheckSecurity() + BindOrder() + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click + + Try + + Dim objPageController As PageController = New PageController + + For i As Integer = 0 To lstSortOrder.Items.Count - 1 + + Dim objPage As PageInfo = objPageController.GetPage(Convert.ToInt32(lstSortOrder.Items(i).Value)) + objPage.SortOrder = i + objPageController.UpdatePage(objPage) + + Next + + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "EditPages", ArticleSettings, "ArticleID=" & _articleID.ToString()), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click + + Try + + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "EditPages", ArticleSettings, "ArticleID=" & _articleID.ToString()), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub upBtn_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles upBtn.Click + + Try + + If (lstSortOrder.SelectedIndex <> -1) Then + + If (lstSortOrder.SelectedIndex <> 0) Then + + Dim tempIndex As Integer = lstSortOrder.SelectedIndex + + Dim newListItem As ListItem = New ListItem + + newListItem.Text = lstSortOrder.SelectedItem.Text + newListItem.Value = lstSortOrder.SelectedItem.Value + + lstSortOrder.Items.RemoveAt(tempIndex) + + lstSortOrder.Items.Insert(tempIndex - 1, newListItem) + lstSortOrder.SelectedIndex = tempIndex - 1 + + End If + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub downBtn_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles downBtn.Click + + Try + + If (lstSortOrder.SelectedIndex <> -1) Then + + If (lstSortOrder.SelectedIndex <> lstSortOrder.Items.Count - 1) Then + + Dim tempIndex As Integer = lstSortOrder.SelectedIndex + + Dim newListItem As ListItem = New ListItem + + newListItem.Text = lstSortOrder.SelectedItem.Text + newListItem.Value = lstSortOrder.SelectedItem.Value + + lstSortOrder.Items.RemoveAt(tempIndex) + + lstSortOrder.Items.Insert(tempIndex + 1, newListItem) + lstSortOrder.SelectedIndex = tempIndex + 1 + + End If + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + End Class + +End Namespace \ No newline at end of file diff --git a/ucEditPages.ascx b/ucEditPages.ascx new file mode 100755 index 0000000..6359a90 --- /dev/null +++ b/ucEditPages.ascx @@ -0,0 +1,28 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucEditPages.ascx.vb" Inherits="Ventrian.NewsArticles.ucEditPages" %> +<%@ Import Namespace="DotNetNuke.Common" %> +<%@ Import Namespace="DotNetNuke.Common.Utilities" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + + + + + + + + + + + + + + + + +

      + + + + +

      + + \ No newline at end of file diff --git a/ucEditPages.ascx.designer.vb b/ucEditPages.ascx.designer.vb new file mode 100755 index 0000000..7c43f5b --- /dev/null +++ b/ucEditPages.ascx.designer.vb @@ -0,0 +1,98 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditPages + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''lblTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblTitle As Global.System.Web.UI.WebControls.Label + + ''' + '''grdPages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents grdPages As Global.System.Web.UI.WebControls.DataGrid + + ''' + '''lblNoPages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblNoPages As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdAddPage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdAddPage As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdSortOrder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdSortOrder As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdSummary control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdSummary As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdSubmitApproval control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdSubmitApproval As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucEditPages.ascx.vb b/ucEditPages.ascx.vb new file mode 100755 index 0000000..1c7c9a5 --- /dev/null +++ b/ucEditPages.ascx.vb @@ -0,0 +1,215 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditPages + Inherits NewsArticleModuleBase + +#Region " Private Members " + + Private _articleID As Integer + +#End Region + +#Region " Private Methods " + + Private Sub ReadQueryString() + + If (IsNumeric(Request("ArticleID"))) Then + _articleID = Convert.ToInt32(Request("ArticleID")) + End If + + + End Sub + + Private Sub CheckSecurity() + + If (HasEditRights(_articleID, Me.ModuleId, Me.TabId) = False) Then + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "NotAuthorized", ArticleSettings), True) + End If + + End Sub + + Private Sub BindArticle() + + If (_articleID = Null.NullInteger) Then + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "NotAuthorized", ArticleSettings), True) + End If + + Dim objArticleController As ArticleController = New ArticleController + + Dim objArticle As ArticleInfo = objArticleController.GetArticle(_articleID) + + If (objArticle Is Nothing) Then + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "NotAuthorized", ArticleSettings), True) + End If + + lblTitle.Text = String.Format(DotNetNuke.Services.Localization.Localization.GetString("EditPages.Text", LocalResourceFile), objArticle.Title) + + If (objArticle.IsDraft) Then + cmdSubmitApproval.Visible = True + cmdSubmitApproval.Attributes.Add("onClick", "javascript:return confirm('" & DotNetNuke.Services.Localization.Localization.GetString("SubmitApproval.Text", LocalResourceFile) & "');") + Else + cmdSubmitApproval.Visible = False + End If + + End Sub + + Private Sub BindPages() + + Dim objPageController As PageController = New PageController + + DotNetNuke.Services.Localization.Localization.LocalizeDataGrid(grdPages, Me.LocalResourceFile) + + grdPages.DataSource = objPageController.GetPageList(_articleID) + grdPages.DataBind() + + If (grdPages.Items.Count > 0) Then + grdPages.Visible = True + lblNoPages.Visible = False + Else + grdPages.Visible = False + lblNoPages.Visible = True + lblNoPages.Text = DotNetNuke.Services.Localization.Localization.GetString("NoPagesMessage.Text", LocalResourceFile) + End If + + End Sub + +#End Region + +#Region " Protected Methods " + + Protected Function GetEditPageUrl(ByVal articleID As String, ByVal pageID As String) As String + + Return Common.GetModuleLink(TabId, ModuleId, "EditPage", ArticleSettings, "ArticleID=" & articleID, "PageID=" & pageID) + + End Function + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Try + + ReadQueryString() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + CheckSecurity() + BindPages() + + If (IsPostBack = False) Then + BindArticle() + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdAddPage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddPage.Click + + Try + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "EditPage", ArticleSettings, "ArticleID=" & _articleID.ToString()), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdSortOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSortOrder.Click + + Try + + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "EditSortOrder", ArticleSettings, "ArticleID=" & _articleID.ToString()), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdSummary_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSummary.Click + + Try + + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "SubmitNews", ArticleSettings, "ArticleID=" & _articleID.ToString()), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdSubmitApproval_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmitApproval.Click + + Try + + Dim objLogController As New DotNetNuke.Services.Log.EventLog.EventLogController + + Dim objController As New ArticleController + Dim objArticle As ArticleInfo = objController.GetArticle(_articleID) + + If Not (objArticle Is Nothing) Then + objArticle.Status = StatusType.AwaitingApproval + objController.UpdateArticle(objArticle) + + If (Settings.Contains(ArticleConstants.NOTIFY_SUBMISSION_SETTING)) Then + If (Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_SUBMISSION_SETTING)) = True) Then + Dim objEmailTemplateController As New EmailTemplateController + Dim emails As String = objEmailTemplateController.GetApproverDistributionList(ModuleId) + + For Each email As String In emails.Split(Convert.ToChar(";")) + If (email <> "") Then + objEmailTemplateController.SendFormattedEmail(Me.ModuleId, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), objArticle, EmailTemplateType.ArticleSubmission, email, ArticleSettings) + End If + Next + End If + End If + + If (Settings.Contains(ArticleConstants.NOTIFY_SUBMISSION_SETTING_EMAIL)) Then + If (Settings(ArticleConstants.NOTIFY_SUBMISSION_SETTING_EMAIL).ToString() <> "") Then + Dim objEmailTemplateController As New EmailTemplateController + objEmailTemplateController.SendFormattedEmail(Me.ModuleId, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), objArticle, EmailTemplateType.ArticleSubmission, Settings(ArticleConstants.NOTIFY_SUBMISSION_SETTING_EMAIL).ToString(), ArticleSettings) + End If + End If + + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "SubmitNewsComplete", ArticleSettings, "ArticleID=" & _articleID.ToString()), True) + + Else + ProcessModuleLoadException(Me, New Exception("Unable to Retrieve Article to Submit for Approval")) + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucEditTag.ascx b/ucEditTag.ascx new file mode 100755 index 0000000..54268ec --- /dev/null +++ b/ucEditTag.ascx @@ -0,0 +1,44 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucEditTag.ascx.vb" Inherits="Ventrian.NewsArticles.ucEditTag" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + + + + + +
      + + + + + + + + + + + +
      +
      + + +
      +
      +
      +

      + +   + +   + +

      diff --git a/ucEditTag.ascx.designer.vb b/ucEditTag.ascx.designer.vb new file mode 100755 index 0000000..dea361e --- /dev/null +++ b/ucEditTag.ascx.designer.vb @@ -0,0 +1,116 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditTag + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''pnlSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pnlSettings As Global.System.Web.UI.WebControls.Panel + + ''' + '''dshTag control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshTag As Global.System.Web.UI.UserControl + + ''' + '''tblTag control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblTag As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblTagSettingsHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblTagSettingsHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''plName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plName As Global.System.Web.UI.UserControl + + ''' + '''txtName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtName As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valName As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''cmdUpdate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdUpdate As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdCancel control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdCancel As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdDelete control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdDelete As Global.System.Web.UI.WebControls.LinkButton + End Class +End Namespace diff --git a/ucEditTag.ascx.vb b/ucEditTag.ascx.vb new file mode 100755 index 0000000..8d3c28b --- /dev/null +++ b/ucEditTag.ascx.vb @@ -0,0 +1,148 @@ +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditTag + Inherits NewsArticleModuleBase + + +#Region " Private Members " + + Private _tagID As Integer = Null.NullInteger + Private _photoCount As Integer = 0 + Private _albumCount As Integer = 0 + +#End Region + +#Region " Private Methods " + + Private Sub ReadQueryString() + + If Not (Request("TagID") Is Nothing) Then + _tagID = Convert.ToInt32(Request("TagID")) + End If + + End Sub + + Private Sub BindTag() + + If (_tagID = Null.NullInteger) Then + + cmdDelete.Visible = False + + Else + + cmdDelete.Visible = True + cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" & Localization.GetString("Confirmation", LocalResourceFile) & "');") + + Dim objTagController As New TagController + Dim objTag As TagInfo = objTagController.Get(_tagID) + + If Not (objTag Is Nothing) Then + txtName.Text = objTag.Name + End If + + End If + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + ReadQueryString() + + If (IsPostBack = False) Then + + BindTag() + txtName.Focus() + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click + + + Try + + If (Page.IsValid) Then + + Dim objTagController As New TagController + + Dim objTag As TagInfo = objTagController.Get(ModuleId, txtName.Text) + If (objTag Is Nothing) Then + objTag = New TagInfo + + If (_tagID <> Null.NullInteger) Then + objTag = objTagController.Get(_tagID) + Else + objTag = CType(CBO.InitializeObject(objTag, GetType(TagInfo)), TagInfo) + End If + + objTag.ModuleID = Me.ModuleId + objTag.Name = txtName.Text + objTag.NameLowered = txtName.Text.ToLower() + + If (_tagID = Null.NullInteger) Then + objTagController.Add(objTag) + Else + objTagController.Update(objTag) + End If + End If + + Response.Redirect(EditUrl("EditTags"), True) + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelete.Click + + Try + + Dim objTagController As New TagController + objTagController.DeleteArticleTagByTag(_tagID) + objTagController.Delete(_tagID) + + Response.Redirect(EditUrl("EditTags"), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click + + Try + + Response.Redirect(EditUrl("EditTags"), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucEditTags.ascx b/ucEditTags.ascx new file mode 100755 index 0000000..d12f999 --- /dev/null +++ b/ucEditTags.ascx @@ -0,0 +1,20 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucEditTags.ascx.vb" Inherits="Ventrian.NewsArticles.ucEditTags" %> +<%@ Import Namespace="DotNetNuke.Common" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + + + + + + + + + + + + + + +

      + +

      diff --git a/ucEditTags.ascx.designer.vb b/ucEditTags.ascx.designer.vb new file mode 100755 index 0000000..541b88c --- /dev/null +++ b/ucEditTags.ascx.designer.vb @@ -0,0 +1,53 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditTags + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''grdTags control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents grdTags As Global.System.Web.UI.WebControls.DataGrid + + ''' + '''lblNoTags control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblNoTags As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdAddTag control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdAddTag As Global.System.Web.UI.WebControls.LinkButton + End Class +End Namespace diff --git a/ucEditTags.ascx.vb b/ucEditTags.ascx.vb new file mode 100755 index 0000000..5f67871 --- /dev/null +++ b/ucEditTags.ascx.vb @@ -0,0 +1,60 @@ +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEditTags + Inherits NewsArticleModuleBase + +#Region " Private Methods " + + Private Sub BindTags() + + Dim objTagController As New TagController + + Localization.LocalizeDataGrid(grdTags, Me.LocalResourceFile) + + grdTags.DataSource = objTagController.List(Me.ModuleId, Null.NullInteger) + grdTags.DataBind() + + If (grdTags.Items.Count > 0) Then + grdTags.Visible = True + lblNoTags.Visible = False + Else + grdTags.Visible = False + lblNoTags.Visible = True + lblNoTags.Text = Localization.GetString("NoTagsMessage.Text", LocalResourceFile) + End If + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + BindTags() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdAddTag_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddTag.Click + + Response.Redirect(EditUrl("EditTag"), True) + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucEmailTemplates.ascx b/ucEmailTemplates.ascx new file mode 100755 index 0000000..0b70987 --- /dev/null +++ b/ucEmailTemplates.ascx @@ -0,0 +1,225 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucEmailTemplates.ascx.vb" Inherits="Ventrian.NewsArticles.ucEmailTemplates" %> + +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="TextEditor" Src="~/controls/TextEditor.ascx"%> + +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + +
      + +
      + + +
      + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      [USERNAME] + +
      [EMAIL] + +
      [DISPLAYNAME] + +
      [FIRSTNAME] + +
      [LASTNAME] + +
      [FULLNAME] + +
      [PORTALNAME] + +
      [CREATEDATE] + +
      [POSTDATE] + +
      [TITLE] + +
      [SUMMARY] + +
      [LINK] + +

      [DISPLAYNAME] + +
      [EMAIL] + +
      [USERNAME] + +
      [FIRSTNAME] + +
      [LASTNAME] + +
      [FULLNAME] + +
      [PORTALNAME] + +
      [POSTDATE] + +
      [TITLE] + +
      [COMMENT] + +
      [LINK] + +
      +
      +
      +

      + +   + +

      + + diff --git a/ucEmailTemplates.ascx.designer.vb b/ucEmailTemplates.ascx.designer.vb new file mode 100755 index 0000000..1dfa4c0 --- /dev/null +++ b/ucEmailTemplates.ascx.designer.vb @@ -0,0 +1,395 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEmailTemplates + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''pnlSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pnlSettings As Global.System.Web.UI.WebControls.Panel + + ''' + '''dshEmailTemplates control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshEmailTemplates As Global.System.Web.UI.UserControl + + ''' + '''tblEmailTemplates control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblEmailTemplates As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblEmailTemplatesHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblEmailTemplatesHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''plName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plName As Global.System.Web.UI.UserControl + + ''' + '''drpTemplate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpTemplate As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plSubject control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSubject As Global.System.Web.UI.UserControl + + ''' + '''txtSubject control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtSubject As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valSubject control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valSubject As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''plTemplate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTemplate As Global.System.Web.UI.UserControl + + ''' + '''txtTemplate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtTemplate As Global.System.Web.UI.WebControls.TextBox + + ''' + '''dshEmailTemplateHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshEmailTemplateHelp As Global.System.Web.UI.UserControl + + ''' + '''tblEmailTemplateHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblEmailTemplateHelp As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblTemplateArticleHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblTemplateArticleHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''lblUserName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblUserName As Global.System.Web.UI.WebControls.Label + + ''' + '''lblEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblEmail As Global.System.Web.UI.WebControls.Label + + ''' + '''lblDisplayName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblDisplayName As Global.System.Web.UI.WebControls.Label + + ''' + '''lblFirstName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblFirstName As Global.System.Web.UI.WebControls.Label + + ''' + '''lblLastName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblLastName As Global.System.Web.UI.WebControls.Label + + ''' + '''lblFullName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblFullName As Global.System.Web.UI.WebControls.Label + + ''' + '''lblPortalName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblPortalName As Global.System.Web.UI.WebControls.Label + + ''' + '''lblCreateDate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCreateDate As Global.System.Web.UI.WebControls.Label + + ''' + '''lblPostDate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblPostDate As Global.System.Web.UI.WebControls.Label + + ''' + '''lblTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblTitle As Global.System.Web.UI.WebControls.Label + + ''' + '''lblSummary control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblSummary As Global.System.Web.UI.WebControls.Label + + ''' + '''lblLink control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblLink As Global.System.Web.UI.WebControls.Label + + ''' + '''lblTemplateCommentHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblTemplateCommentHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''lblCommentDisplayName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCommentDisplayName As Global.System.Web.UI.WebControls.Label + + ''' + '''lblCommentEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCommentEmail As Global.System.Web.UI.WebControls.Label + + ''' + '''lblCommentUserName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCommentUserName As Global.System.Web.UI.WebControls.Label + + ''' + '''lblCommentFirstName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCommentFirstName As Global.System.Web.UI.WebControls.Label + + ''' + '''lblCommentLastName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCommentLastName As Global.System.Web.UI.WebControls.Label + + ''' + '''lblCommentFullName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCommentFullName As Global.System.Web.UI.WebControls.Label + + ''' + '''lblPortalName2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblPortalName2 As Global.System.Web.UI.WebControls.Label + + ''' + '''lblCommentPostDate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCommentPostDate As Global.System.Web.UI.WebControls.Label + + ''' + '''lblTitle2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblTitle2 As Global.System.Web.UI.WebControls.Label + + ''' + '''lblComment control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblComment As Global.System.Web.UI.WebControls.Label + + ''' + '''lblCommentLink control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCommentLink As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdUpdate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdUpdate As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdCancel control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdCancel As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucEmailTemplates.ascx.vb b/ucEmailTemplates.ascx.vb new file mode 100755 index 0000000..e18f5df --- /dev/null +++ b/ucEmailTemplates.ascx.vb @@ -0,0 +1,106 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Services.Exceptions + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucEmailTemplates + Inherits NewsArticleModuleBase + +#Region " Private Methods " + + Private Sub BindTemplateTypes() + + drpTemplate.DataSource = System.Enum.GetValues(GetType(EmailTemplateType)) + drpTemplate.DataBind() + + End Sub + + Private Sub BindTemplate() + + Dim objTemplateController As New EmailTemplateController + + Dim objTemplate As EmailTemplateInfo = objTemplateController.Get(Me.ModuleId, CType(System.Enum.Parse(GetType(EmailTemplateType), drpTemplate.SelectedValue), EmailTemplateType)) + + If Not (objTemplate Is Nothing) Then + + txtSubject.Text = objTemplate.Subject + txtTemplate.Text = objTemplate.Template + + End If + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + If (IsPostBack = False) Then + BindTemplateTypes() + BindTemplate() + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub drpTemplate_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drpTemplate.SelectedIndexChanged + + Try + + BindTemplate() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click + + Try + + Dim objTemplateController As New EmailTemplateController + + Dim objTemplate As EmailTemplateInfo = objTemplateController.Get(Me.ModuleId, CType(System.Enum.Parse(GetType(EmailTemplateType), drpTemplate.SelectedValue), EmailTemplateType)) + + objTemplate.Subject = txtSubject.Text + objTemplate.Template = txtTemplate.Text + + objTemplateController.Update(objTemplate) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click + + Try + + Response.Redirect(EditArticleUrl("AdminOptions"), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucHeader.ascx b/ucHeader.ascx new file mode 100755 index 0000000..22cc00a --- /dev/null +++ b/ucHeader.ascx @@ -0,0 +1,2 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucHeader.ascx.vb" Inherits="Ventrian.NewsArticles.ucHeader" %> + \ No newline at end of file diff --git a/ucHeader.ascx.designer.vb b/ucHeader.ascx.designer.vb new file mode 100755 index 0000000..eec2bf8 --- /dev/null +++ b/ucHeader.ascx.designer.vb @@ -0,0 +1,26 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucHeader + + ''' + '''plhControls control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plhControls As Global.System.Web.UI.WebControls.PlaceHolder + End Class +End Namespace diff --git a/ucHeader.ascx.vb b/ucHeader.ascx.vb new file mode 100755 index 0000000..24e4238 --- /dev/null +++ b/ucHeader.ascx.vb @@ -0,0 +1,104 @@ +Imports DotNetNuke.Services.Exceptions +Imports Ventrian.NewsArticles.Components.Types + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucHeader + Inherits NewsArticleControlBase + +#Region " Private Members " + + Private _selectedMenu As MenuOptionType = MenuOptionType.CurrentArticles + Private _menuPosition As MenuPositionType = MenuPositionType.Top + Private _processMenu As Boolean = False + +#End Region + +#Region " Public Properties " + + Public WriteOnly Property MenuPosition() As String + Set(ByVal value As String) + Select Case value.ToLower() + + Case "top" + _menuPosition = MenuPositionType.Top + Return + + Case "bottom" + _menuPosition = MenuPositionType.Bottom + Return + + End Select + End Set + End Property + + Public WriteOnly Property SelectedMenu() As String + Set(ByVal value As String) + Select Case Value.ToLower() + + Case "adminoptions" + _selectedMenu = MenuOptionType.AdminOptions + Return + + Case "approvearticles" + _selectedMenu = MenuOptionType.ApproveArticles + Return + + Case "approvecomments" + _selectedMenu = MenuOptionType.ApproveComments + Return + + Case "categories" + _selectedMenu = MenuOptionType.Categories + Return + + Case "currentarticles" + _selectedMenu = MenuOptionType.CurrentArticles + Return + + Case "myarticles" + _selectedMenu = MenuOptionType.MyArticles + Return + + Case "search" + _selectedMenu = MenuOptionType.Search + Return + + Case "syndication" + _selectedMenu = MenuOptionType.Syndication + Return + + Case "submitarticle" + _selectedMenu = MenuOptionType.SubmitArticle + Return + + End Select + End Set + End Property + +#End Region + +#Region " Event Handlers " + + Private Sub Page_PreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + + Try + + If (_processMenu = False And _menuPosition = ArticleModuleBase.ArticleSettings.MenuPosition) Then + TokenProcessor.ProcessMenu(plhControls.Controls, ArticleModuleBase, _selectedMenu) + _processMenu = True + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/ucImportFeed.ascx b/ucImportFeed.ascx new file mode 100755 index 0000000..25b0321 --- /dev/null +++ b/ucImportFeed.ascx @@ -0,0 +1,120 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucImportFeed.ascx.vb" Inherits="Ventrian.NewsArticles.ucImportFeed" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + + + + + +
      + + + + + + + + + + + + + + + + + + + + + +
      +
      + + +
      + + +
      + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + +
      + + + +
      + +
      + + + + + + + + +
      + + + +
      +
      +
      +

      + +   + +   + +

      diff --git a/ucImportFeed.ascx.designer.vb b/ucImportFeed.ascx.designer.vb new file mode 100755 index 0000000..b728f7b --- /dev/null +++ b/ucImportFeed.ascx.designer.vb @@ -0,0 +1,341 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucImportFeed + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''pnlSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pnlSettings As Global.System.Web.UI.WebControls.Panel + + ''' + '''dshFeed control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshFeed As Global.System.Web.UI.UserControl + + ''' + '''tblFeed control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblFeed As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblFeedSettingsHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblFeedSettingsHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''plTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTitle As Global.System.Web.UI.UserControl + + ''' + '''txtTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtTitle As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valTitle As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''plUrl control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plUrl As Global.System.Web.UI.UserControl + + ''' + '''txtUrl control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtUrl As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valUrl control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valUrl As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''plIsActive control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plIsActive As Global.System.Web.UI.UserControl + + ''' + '''chkIsActive control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkIsActive As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''dshArticleSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshArticleSettings As Global.System.Web.UI.UserControl + + ''' + '''tblArticle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblArticle As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plArticleSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plArticleSettings As Global.System.Web.UI.WebControls.Label + + ''' + '''plAutoFeature control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plAutoFeature As Global.System.Web.UI.UserControl + + ''' + '''chkAutoFeature control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkAutoFeature As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plAutoExpire control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plAutoExpire As Global.System.Web.UI.UserControl + + ''' + '''txtAutoExpire control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtAutoExpire As Global.System.Web.UI.WebControls.TextBox + + ''' + '''drpAutoExpire control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpAutoExpire As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plDateMode control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plDateMode As Global.System.Web.UI.UserControl + + ''' + '''lstDateMode control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstDateMode As Global.System.Web.UI.WebControls.RadioButtonList + + ''' + '''plAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plAuthor As Global.System.Web.UI.UserControl + + ''' + '''lblAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblAuthor As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdSelectAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdSelectAuthor As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''pnlAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pnlAuthor As Global.System.Web.UI.WebControls.Panel + + ''' + '''txtAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtAuthor As Global.System.Web.UI.WebControls.TextBox + + ''' + '''lblAuthorUsername control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblAuthorUsername As Global.System.Web.UI.WebControls.Label + + ''' + '''valAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valAuthor As Global.System.Web.UI.WebControls.CustomValidator + + ''' + '''plCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plCategories As Global.System.Web.UI.UserControl + + ''' + '''lstCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstCategories As Global.System.Web.UI.WebControls.ListBox + + ''' + '''lblCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCategories As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdUpdate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdUpdate As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdCancel control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdCancel As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdDelete control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdDelete As Global.System.Web.UI.WebControls.LinkButton + End Class +End Namespace diff --git a/ucImportFeed.ascx.vb b/ucImportFeed.ascx.vb new file mode 100755 index 0000000..e4ad273 --- /dev/null +++ b/ucImportFeed.ascx.vb @@ -0,0 +1,286 @@ +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization + +Imports DotNetNuke.Entities.Users + + +Imports Ventrian.NewsArticles.Base +Imports Ventrian.NewsArticles.Import + +Namespace Ventrian.NewsArticles + + Partial Public Class ucImportFeed + Inherits NewsArticleModuleBase + +#Region " Private Members " + + Private _feedID As Integer = Null.NullInteger + +#End Region + +#Region " Private Methods " + + Private Sub BindAutoExpiry() + + For Each value As Integer In System.Enum.GetValues(GetType(FeedExpiryType)) + Dim li As New ListItem + li.Value = value.ToString() + li.Text = Localization.GetString(System.Enum.GetName(GetType(FeedExpiryType), value), Me.LocalResourceFile) + drpAutoExpire.Items.Add(li) + Next + + End Sub + + Private Sub BindCategories() + + Dim objCategoryController As CategoryController = New CategoryController + + lstCategories.DataSource = objCategoryController.GetCategoriesAll(ModuleId, Null.NullInteger, ArticleSettings.CategorySortType) + lstCategories.DataBind() + + Me.lstCategories.Height = Unit.Parse(ArticleSettings.CategorySelectionHeight.ToString()) + + End Sub + + Private Sub BindDateModes() + + For Each value As Integer In System.Enum.GetValues(GetType(FeedDateMode)) + Dim li As New ListItem + li.Value = value.ToString() + li.Text = Localization.GetString(System.Enum.GetName(GetType(FeedDateMode), value), Me.LocalResourceFile) + lstDateMode.Items.Add(li) + Next + + End Sub + + Private Sub BindFeed() + + If (_feedID = Null.NullInteger) Then + + chkIsActive.Checked = True + lblAuthor.Text = Me.UserInfo.Username + lstDateMode.SelectedValue = Convert.ToInt32(FeedDateMode.ImportDate).ToString() + drpAutoExpire.SelectedValue = Null.NullInteger.ToString() + cmdDelete.Visible = False + + Else + + cmdDelete.Visible = True + cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" & Localization.GetString("Confirmation", LocalResourceFile) & "');") + + Dim objFeedController As New FeedController + Dim objFeed As FeedInfo = objFeedController.Get(_feedID) + + If Not (objFeed Is Nothing) Then + txtTitle.Text = objFeed.Title + txtUrl.Text = objFeed.Url + chkAutoFeature.Checked = objFeed.AutoFeature + chkIsActive.Checked = objFeed.IsActive + lstDateMode.SelectedValue = Convert.ToInt32(objFeed.DateMode).ToString() + If (objFeed.AutoExpire <> Null.NullInteger) Then + txtAutoExpire.Text = objFeed.AutoExpire.ToString() + End If + drpAutoExpire.SelectedValue = Convert.ToInt32(objFeed.AutoExpireUnit).ToString() + + Dim objUser As UserInfo = UserController.GetUser(PortalId, objFeed.UserID, True) + If (objUser IsNot Nothing) Then + lblAuthor.Text = objUser.Username + Else + lblAuthor.Text = Me.UserInfo.Username + End If + + For Each objCategory As CategoryInfo In objFeed.Categories + For Each li As ListItem In lstCategories.Items + If (li.Value = objCategory.CategoryID.ToString()) Then + li.Selected = True + End If + Next + Next + Else + Response.Redirect(EditUrl("ImportFeeds"), True) + End If + + End If + + End Sub + + Private Sub ReadQueryString() + + If Not (Request("FeedID") Is Nothing) Then + _feedID = Convert.ToInt32(Request("FeedID")) + End If + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + ReadQueryString() + + If (IsPostBack = False) Then + + BindAutoExpiry() + BindCategories() + BindDateModes() + BindFeed() + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click + + + Try + + If (Page.IsValid) Then + + Dim objFeedController As New FeedController + + Dim objFeed As New FeedInfo + + If (_feedID <> Null.NullInteger) Then + objFeed = objFeedController.Get(_feedID) + Else + objFeed = CType(CBO.InitializeObject(objFeed, GetType(FeedInfo)), FeedInfo) + End If + + objFeed.ModuleID = Me.ModuleId + objFeed.Title = txtTitle.Text + objFeed.Url = txtUrl.Text + objFeed.AutoFeature = chkAutoFeature.Checked + objFeed.IsActive = chkIsActive.Checked + objFeed.DateMode = CType(System.Enum.Parse(GetType(FeedDateMode), lstDateMode.SelectedValue), FeedDateMode) + objFeed.AutoExpire = Null.NullInteger + If (txtAutoExpire.Text <> "") Then + If (IsNumeric(txtAutoExpire.Text)) Then + If (Convert.ToInt32(txtAutoExpire.Text) > 0) Then + objFeed.AutoExpire = Convert.ToInt32(txtAutoExpire.Text) + End If + End If + End If + objFeed.AutoExpireUnit = CType(System.Enum.Parse(GetType(FeedExpiryType), drpAutoExpire.SelectedValue), FeedExpiryType) + + If (pnlAuthor.Visible) Then + Dim objUser As UserInfo = UserController.GetUserByName(Me.PortalId, txtAuthor.Text) + + If (objUser IsNot Nothing) Then + objFeed.UserID = objUser.UserID + Else + objFeed.UserID = Me.UserId + End If + Else + Dim objUser As UserInfo = UserController.GetUserByName(Me.PortalId, lblAuthor.Text) + + If (objUser IsNot Nothing) Then + objFeed.UserID = objUser.UserID + Else + objFeed.UserID = Me.UserId + End If + End If + + Dim objCategories As New List(Of CategoryInfo) + For Each li As ListItem In lstCategories.Items + If (li.Selected) Then + Dim objCategory As New CategoryInfo + objCategory.CategoryID = Convert.ToInt32(li.Value) + objCategories.Add(objCategory) + End If + Next + objFeed.Categories = objCategories + + If (_feedID = Null.NullInteger) Then + objFeedController.Add(objFeed) + Else + objFeedController.Update(objFeed) + End If + + Response.Redirect(EditUrl("ImportFeeds"), True) + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelete.Click + + Try + + Dim objFeedController As New FeedController + objFeedController.Delete(_feedID) + + Response.Redirect(EditUrl("ImportFeeds"), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click + + Try + + Response.Redirect(EditUrl("ImportFeeds"), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub cmdSelectAuthor_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdSelectAuthor.Click + + Try + + cmdSelectAuthor.Visible = False + lblAuthor.Visible = False + + pnlAuthor.Visible = True + txtAuthor.Text = lblAuthor.Text + txtAuthor.Focus() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub valAuthor_ServerValidate(ByVal source As System.Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles valAuthor.ServerValidate + + Try + + args.IsValid = False + + If (txtAuthor.Text <> "") Then + Dim objUser As UserInfo = UserController.GetUserByName(Me.PortalId, txtAuthor.Text) + + If (objUser IsNot Nothing) Then + args.IsValid = True + End If + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucImportFeeds.ascx b/ucImportFeeds.ascx new file mode 100755 index 0000000..0338cfb --- /dev/null +++ b/ucImportFeeds.ascx @@ -0,0 +1,147 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucImportFeeds.ascx.vb" Inherits="Ventrian.NewsArticles.ucImportFeeds" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> +<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> + + + + + + + + + + + + + + + + + +

      + +

      + +
      + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + +
      + + + + Seconds + Minutes + Hours + Days +
      + + + + Seconds + Minutes + Hours + Days +
      + +
      +

      + +   + +

      +
      +
      + + + + + + + + +
      +
      + + + + + + + + + + + +
      + + <%# DataBinder.Eval(Container.DataItem,"TypeFullName")%> + +
      + + + +
      +
      + + + + + + + + + + + + + S: <%# DataBinder.Eval(Container.DataItem,"StartDate")%> +
      + E: <%# DataBinder.Eval(Container.DataItem,"EndDate")%> +
      + N: <%# DataBinder.Eval(Container.DataItem,"NextStart")%> +
      +
      +
      +
      +
      +
      +
      + \ No newline at end of file diff --git a/ucImportFeeds.ascx.designer.vb b/ucImportFeeds.ascx.designer.vb new file mode 100755 index 0000000..4e37719 --- /dev/null +++ b/ucImportFeeds.ascx.designer.vb @@ -0,0 +1,251 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucImportFeeds + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''grdFeeds control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents grdFeeds As Global.System.Web.UI.WebControls.DataGrid + + ''' + '''lblNoFeeds control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblNoFeeds As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdAddFeed control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdAddFeed As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''phScheduler control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phScheduler As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''dshSchedulerSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshSchedulerSettings As Global.System.Web.UI.UserControl + + ''' + '''tblSchedulerSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblSchedulerSettings As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblSchedulerSettingsHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblSchedulerSettingsHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''plSchedulerEnabled control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSchedulerEnabled As Global.System.Web.UI.UserControl + + ''' + '''chkEnabled control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnabled As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plTimeLapse control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTimeLapse As Global.System.Web.UI.UserControl + + ''' + '''txtTimeLapse control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtTimeLapse As Global.System.Web.UI.WebControls.TextBox + + ''' + '''drpTimeLapseMeasurement control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpTimeLapseMeasurement As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plRetryTimeLapse control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plRetryTimeLapse As Global.System.Web.UI.UserControl + + ''' + '''txtRetryTimeLapse control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtRetryTimeLapse As Global.System.Web.UI.WebControls.TextBox + + ''' + '''drpRetryTimeLapseMeasurement control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpRetryTimeLapseMeasurement As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plDeleteArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plDeleteArticles As Global.System.Web.UI.UserControl + + ''' + '''chkDeleteArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkDeleteArticles As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''cmdUpdate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdUpdate As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdCancel control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdCancel As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''dshSchedulerHistory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshSchedulerHistory As Global.System.Web.UI.UserControl + + ''' + '''tblSchedulerHistory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblSchedulerHistory As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblSchedulerHistoryHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblSchedulerHistoryHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''lblNoHistory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblNoHistory As Global.System.Web.UI.WebControls.Label + + ''' + '''dgScheduleHistory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dgScheduleHistory As Global.System.Web.UI.WebControls.DataGrid + + ''' + '''lblScheduler control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblScheduler As Global.System.Web.UI.WebControls.Label + End Class +End Namespace diff --git a/ucImportFeeds.ascx.vb b/ucImportFeeds.ascx.vb new file mode 100755 index 0000000..16b0595 --- /dev/null +++ b/ucImportFeeds.ascx.vb @@ -0,0 +1,264 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization +Imports DotNetNuke.Services.Scheduling +Imports DotNetNuke.UI.UserControls + +Imports Ventrian.NewsArticles.Import +Imports DotNetNuke.Entities.Modules + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucImportFeeds + Inherits NewsArticleModuleBase + +#Region " Private Methods " + + Private Sub BindFeeds() + + Dim objFeedController As New FeedController + + Localization.LocalizeDataGrid(grdFeeds, Me.LocalResourceFile) + + grdFeeds.DataSource = objFeedController.GetFeedList(ModuleId, False) + grdFeeds.DataBind() + + If (grdFeeds.Items.Count > 0) Then + grdFeeds.Visible = True + lblNoFeeds.Visible = False + Else + grdFeeds.Visible = False + lblNoFeeds.Visible = True + lblNoFeeds.Text = Localization.GetString("NoFeedsMessage.Text", LocalResourceFile) + End If + + End Sub + + Private Sub BindHistory() + + Dim typeName As String = "Ventrian.NewsArticles.Import.RssImportJob, Ventrian.NewsArticles" + Dim objSchedule As ScheduleItem = SchedulingProvider.Instance().GetSchedule(typeName, Null.NullString) + + If (objSchedule IsNot Nothing) Then + + Dim arrSchedule As ArrayList = SchedulingProvider.Instance.GetScheduleHistory(objSchedule.ScheduleID) + + If (arrSchedule.Count > 0) Then + + arrSchedule.Sort(New ScheduleHistorySortStartDate) + + 'Localize Grid + Localization.LocalizeDataGrid(dgScheduleHistory, Me.LocalResourceFile) + + dgScheduleHistory.DataSource = arrSchedule + dgScheduleHistory.DataBind() + + lblNoHistory.Visible = False + dgScheduleHistory.Visible = True + Else + lblNoHistory.Visible = True + dgScheduleHistory.Visible = False + End If + + Else + + lblNoHistory.Visible = True + dgScheduleHistory.Visible = False + + End If + + End Sub + + Private Sub BindSchedulerSettings() + + Dim typeName As String = "Ventrian.NewsArticles.Import.RssImportJob, Ventrian.NewsArticles" + + Dim objSchedule As ScheduleItem = SchedulingProvider.Instance().GetSchedule(typeName, Null.NullString) + + If (objSchedule IsNot Nothing) Then + chkEnabled.Checked = objSchedule.Enabled + + txtTimeLapse.Text = objSchedule.TimeLapse.ToString() + If (drpTimeLapseMeasurement.Items.FindByValue(objSchedule.TimeLapseMeasurement) IsNot Nothing) Then + drpTimeLapseMeasurement.SelectedValue = objSchedule.TimeLapseMeasurement + Else + drpTimeLapseMeasurement.SelectedValue = "m" + End If + + txtRetryTimeLapse.Text = objSchedule.RetryTimeLapse.ToString() + If (drpRetryTimeLapseMeasurement.Items.FindByValue(objSchedule.RetryTimeLapseMeasurement) IsNot Nothing) Then + drpRetryTimeLapseMeasurement.SelectedValue = objSchedule.RetryTimeLapseMeasurement + Else + drpRetryTimeLapseMeasurement.SelectedValue = "m" + End If + Else + txtTimeLapse.Text = "30" + drpTimeLapseMeasurement.SelectedValue = "m" + + txtRetryTimeLapse.Text = "60" + drpRetryTimeLapseMeasurement.SelectedValue = "m" + End If + + Dim objModuleController As New ModuleController + If (Settings.Contains("NewsArticles-Import-Clear-" & Me.ModuleId)) Then + chkDeleteArticles.Checked = Convert.ToBoolean(Settings("NewsArticles-Import-Clear-" & Me.ModuleId).ToString()) + Else + chkDeleteArticles.Checked = False + End If + + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + phScheduler.Visible = Me.UserInfo.IsSuperUser + + + If (IsPostBack = False) Then + + BindFeeds() + + If (phScheduler.Visible) Then + BindSchedulerSettings() + BindHistory() + Else + Dim typeName As String = "Ventrian.NewsArticles.Import.RssImportJob, Ventrian.NewsArticles" + Dim objSchedule As ScheduleItem = SchedulingProvider.Instance().GetSchedule(typeName, Null.NullString) + + If (objSchedule IsNot Nothing) Then + If (objSchedule.Enabled) Then + lblScheduler.Visible = False + Else + lblScheduler.Text = Localization.GetString("SchedulerNotEnabled", Me.LocalResourceFile) + lblScheduler.Visible = True + End If + Else + lblScheduler.Text = Localization.GetString("SchedulerNotEnabled", Me.LocalResourceFile) + lblScheduler.Visible = True + End If + End If + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + + Protected Sub cmdAddFeed_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdAddFeed.Click + + Try + + Response.Redirect(EditUrl("ImportFeed"), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub cmdUpdate_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdUpdate.Click + + Try + + Dim typeName As String = "Ventrian.NewsArticles.Import.RssImportJob, Ventrian.NewsArticles" + + Dim objSchedule As ScheduleItem = SchedulingProvider.Instance().GetSchedule(typeName, Null.NullString) + + If (objSchedule IsNot Nothing) Then + + objSchedule.Enabled = chkEnabled.Checked + + If (IsNumeric(txtTimeLapse.Text)) Then + objSchedule.TimeLapse = Convert.ToInt32(txtTimeLapse.Text) + Else + objSchedule.TimeLapse = 30 + End If + objSchedule.TimeLapseMeasurement = drpTimeLapseMeasurement.SelectedValue + + If (IsNumeric(txtTimeLapse.Text)) Then + objSchedule.RetryTimeLapse = Convert.ToInt32(txtRetryTimeLapse.Text) + Else + objSchedule.RetryTimeLapse = 60 + End If + objSchedule.RetryTimeLapseMeasurement = drpRetryTimeLapseMeasurement.SelectedValue + + SchedulingProvider.Instance().UpdateSchedule(objSchedule) + + Else + + objSchedule = New ScheduleItem() + + objSchedule.TypeFullName = typeName + objSchedule.Enabled = chkEnabled.Checked + + If (IsNumeric(txtTimeLapse.Text)) Then + objSchedule.TimeLapse = Convert.ToInt32(txtTimeLapse.Text) + Else + objSchedule.TimeLapse = 30 + End If + objSchedule.TimeLapseMeasurement = drpTimeLapseMeasurement.SelectedValue + + If (IsNumeric(txtTimeLapse.Text)) Then + objSchedule.RetryTimeLapse = Convert.ToInt32(txtRetryTimeLapse.Text) + Else + objSchedule.RetryTimeLapse = 60 + End If + objSchedule.RetryTimeLapseMeasurement = drpRetryTimeLapseMeasurement.SelectedValue + + objSchedule.RetainHistoryNum = 10 + objSchedule.AttachToEvent = "" + objSchedule.CatchUpEnabled = False + objSchedule.Enabled = chkEnabled.Checked + objSchedule.ObjectDependencies = "" + objSchedule.Servers = "" + + objSchedule.ScheduleID = SchedulingProvider.Instance().AddSchedule(objSchedule) + + End If + + Dim objModuleController As New ModuleController + objModuleController.UpdateModuleSetting(Me.ModuleId, "NewsArticles-Import-Clear-" & Me.ModuleId, chkDeleteArticles.Checked.ToString()) + SchedulingProvider.Instance().AddScheduleItemSetting(objSchedule.ScheduleID, "NewsArticles-Import-Clear-" & Me.ModuleId, chkDeleteArticles.Checked.ToString()) + + Response.Redirect(EditUrl("AdminOptions"), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + End Sub + + Protected Sub cmdCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdCancel.Click + + Try + + Response.Redirect(EditUrl("AdminOptions"), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucMyArticles.ascx b/ucMyArticles.ascx new file mode 100755 index 0000000..739d418 --- /dev/null +++ b/ucMyArticles.ascx @@ -0,0 +1,58 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucMyArticles.ascx.vb" Inherits="Ventrian.NewsArticles.ucMyArticles" %> +<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.UI.WebControls" Assembly="DotNetNuke" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> +<%@ Register TagPrefix="Ventrian" TagName="Listing" Src="Controls/Listing.ascx"%> + + + +
      +
      + +
      + + + + + + + + + ">" alt="Edit" width="16" height="16"/> + + + + <%= LocalizeString("Title.Header") %> + + <%#Eval("Title")%> + + + + + + <%= LocalizeString("CreatedDate.Header") %> + + <%#GetAdjustedCreateDate(Container.DataItem)%> + + + + + <%= LocalizeString("PublishDate.Header") %> + + <%#GetAdjustedPublishDate(Container.DataItem)%> + + + + + + + +
      <%= LocalizeString("NoArticlesMessage") %>
      +
      +
      +
      + + diff --git a/ucMyArticles.ascx.designer.vb b/ucMyArticles.ascx.designer.vb new file mode 100755 index 0000000..34e3ad2 --- /dev/null +++ b/ucMyArticles.ascx.designer.vb @@ -0,0 +1,71 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucMyArticles + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''chkShowAll control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkShowAll As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''grdMyArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents grdMyArticles As Global.System.Web.UI.WebControls.DataGrid + + ''' + '''ctlPagingControl control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ctlPagingControl As Global.DotNetNuke.UI.WebControls.PagingControl + + ''' + '''phNoArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phNoArticles As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''Header1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Header1 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucMyArticles.ascx.vb b/ucMyArticles.ascx.vb new file mode 100755 index 0000000..2929ada --- /dev/null +++ b/ucMyArticles.ascx.vb @@ -0,0 +1,292 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2005-2012 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucMyArticles + Inherits NewsArticleModuleBase + + Private Enum StatusType + + Draft = 1 + Unapproved = 2 + Approved = 3 + + End Enum + + Private _status As StatusType = StatusType.Draft + +#Region " Private Properties " + + Private ReadOnly Property CurrentPage() As Integer + Get + If (Request("Page") = Null.NullString And Request("CurrentPage") = Null.NullString) Then + Return 1 + Else + Try + If (Request("Page") <> Null.NullString) Then + Return Convert.ToInt32(Request("Page")) + Else + Return Convert.ToInt32(Request("CurrentPage")) + End If + Catch + Return 1 + End Try + End If + End Get + End Property + +#End Region + +#Region " Private Methods " + + Private Sub ReadQueryString() + + If (Request("Status") <> "") Then + Select Case Request("Status").ToLower() + Case "2" + _status = StatusType.Unapproved + Exit Select + Case "3" + _status = StatusType.Approved + Exit Select + End Select + End If + + End Sub + + Private Sub BindSelection() + + If (ArticleSettings.IsApprover Or ArticleSettings.IsAdmin) Then + If (Request("ShowAll") <> "") Then + chkShowAll.Checked = True + End If + Else + chkShowAll.Visible = False + End If + + End Sub + + Private Sub BindArticles() + + Dim objArticleController As ArticleController = New ArticleController + + Localization.LocalizeDataGrid(grdMyArticles, Me.LocalResourceFile) + + Dim count As Integer = 0 + Dim authorID As Integer = Me.UserId + If (chkShowAll.Checked) Then + authorID = Null.NullInteger + End If + + grdMyArticles.DataSource = objArticleController.GetArticleList(Me.ModuleId, Null.NullDate, Null.NullDate, Nothing, Null.NullBoolean, Nothing, Null.NullInteger, CurrentPage, 10, ArticleSettings.SortBy, ArticleSettings.SortDirection, False, True, Null.NullString, authorID, True, True, Null.NullBoolean, Null.NullBoolean, False, False, Null.NullString, Nothing, False, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, count) + + Select Case _status + + Case StatusType.Draft + grdMyArticles.DataSource = objArticleController.GetArticleList(Me.ModuleId, Null.NullDate, Null.NullDate, Nothing, Null.NullBoolean, Nothing, Null.NullInteger, CurrentPage, 10, ArticleSettings.SortBy, ArticleSettings.SortDirection, False, True, Null.NullString, authorID, True, True, Null.NullBoolean, Null.NullBoolean, False, False, Null.NullString, Nothing, False, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, count) + Exit Select + Case StatusType.Unapproved + grdMyArticles.DataSource = objArticleController.GetArticleList(Me.ModuleId, Null.NullDate, Null.NullDate, Nothing, Null.NullBoolean, Nothing, Null.NullInteger, CurrentPage, 10, ArticleSettings.SortBy, ArticleSettings.SortDirection, False, False, Null.NullString, authorID, True, True, Null.NullBoolean, Null.NullBoolean, False, False, Null.NullString, Nothing, False, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, count) + Exit Select + Case StatusType.Approved + grdMyArticles.DataSource = objArticleController.GetArticleList(Me.ModuleId, Null.NullDate, Null.NullDate, Nothing, Null.NullBoolean, Nothing, Null.NullInteger, CurrentPage, 10, ArticleSettings.SortBy, ArticleSettings.SortDirection, True, False, Null.NullString, authorID, True, True, Null.NullBoolean, Null.NullBoolean, False, False, Null.NullString, Nothing, False, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, count) + Exit Select + + End Select + + grdMyArticles.DataBind() + + If (grdMyArticles.Items.Count = 0) Then + phNoArticles.Visible = True + grdMyArticles.Visible = False + + ctlPagingControl.Visible = False + Else + phNoArticles.Visible = False + grdMyArticles.Visible = True + + If (count > 10) Then + ctlPagingControl.Visible = True + ctlPagingControl.TotalRecords = count + ctlPagingControl.PageSize = 10 + ctlPagingControl.CurrentPage = CurrentPage + ctlPagingControl.QuerystringParams = GetParams() + ctlPagingControl.TabID = TabId + ctlPagingControl.EnableViewState = False + End If + + grdMyArticles.Columns(0).Visible = IsEditable + End If + + End Sub + + Private Sub CheckSecurity() + + If (ArticleSettings.IsSubmitter = False) Then + Response.Redirect(NavigateURL(), True) + End If + + If (Request("ShowAll") <> "") Then + If ((ArticleSettings.IsApprover Or ArticleSettings.IsAdmin) = False) Then + Response.Redirect(NavigateURL(), True) + End If + End If + + End Sub + + Private Function GetParams() As String + + Dim params As String = "" + + If (Request("ctl") <> "") Then + If (Request("ctl").ToLower() = "myarticles") Then + params += "ctl=" & Request("ctl") & "&mid=" & ModuleId.ToString() + End If + End If + + If (Request("articleType") <> "") Then + If (Request("articleType").ToString().ToLower() = "myarticles") Then + params += "articleType=" & Request("articleType") + End If + End If + + If (Request("Status") <> "") Then + params += "&Status=" & Convert.ToInt32(_status).ToString() + End If + + If (Request("ShowAll") <> "") Then + params += "&ShowAll=" & Request("ShowAll") + End If + + Return params + + End Function + +#End Region + +#Region " Protected Methods " + + Protected Function GetAdjustedCreateDate(ByVal objItem As Object) As String + + Dim objArticle As ArticleInfo = CType(objItem, ArticleInfo) + Return objArticle.CreatedDate.ToString("d") & " " & objArticle.CreatedDate.ToString("t") + + End Function + + Protected Function GetAdjustedPublishDate(ByVal objItem As Object) As String + + Dim objArticle As ArticleInfo = CType(objItem, ArticleInfo) + Return objArticle.StartDate.ToString("d") & " " & objArticle.StartDate.ToString("t") + + End Function + + Protected Function GetArticleLink(ByVal objItem As Object) As String + + Dim objArticle As ArticleInfo = CType(objItem, ArticleInfo) + Return Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False) + + End Function + + Protected Function GetEditUrl(ByVal articleID As String) As String + If (ArticleSettings.LaunchLinks) Then + Return Common.GetModuleLink(Me.TabId, Me.ModuleId, "Edit", ArticleSettings, "ArticleID=" & articleID) + Else + Return Common.GetModuleLink(Me.TabId, Me.ModuleId, "SubmitNews", ArticleSettings, "ArticleID=" & articleID) + End If + End Function + + Protected Function GetModuleLink(ByVal key As String, ByVal status As Integer) As String + + If (status = 1) Then + Return Common.GetModuleLink(TabId, ModuleId, "MyArticles", ArticleSettings) + Else + Return Common.GetModuleLink(TabId, ModuleId, "MyArticles", ArticleSettings, "Status=" & status.ToString()) + End If + + End Function + + Public Shadows ReadOnly Property IsEditable() As Boolean + Get + If (_status = StatusType.Draft) Then + Return True + Else + If (ArticleSettings.IsApprover Or ArticleSettings.IsAutoApprover) Then + Return True + End If + End If + + End Get + End Property + + Protected Function IsSelected(ByVal status As Integer) + + If (status = _status) Then + Return "ui-tabs-selected ui-state-active" + Else + Return "" + End If + + End Function + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + CheckSecurity() + ReadQueryString() + + If (IsPostBack = False) Then + BindSelection() + BindArticles() + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Protected Sub chkShowAll_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles chkShowAll.CheckedChanged + + Try + + If (chkShowAll.Checked) Then + If (_status <> StatusType.Draft) Then + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "MyArticles", ArticleSettings, "ShowAll=1", "Status=" & Convert.ToInt32(_status).ToString()), True) + Else + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "MyArticles", ArticleSettings, "ShowAll=1"), True) + End If + Else + If (_status <> StatusType.Draft) Then + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "MyArticles", ArticleSettings, "Status=" & Convert.ToInt32(_status).ToString()), True) + Else + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "MyArticles", ArticleSettings), True) + End If + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucNotAuthenticated.ascx b/ucNotAuthenticated.ascx new file mode 100755 index 0000000..2c69881 --- /dev/null +++ b/ucNotAuthenticated.ascx @@ -0,0 +1,13 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucNotAuthenticated.ascx.vb" Inherits="Ventrian.NewsArticles.ucNotAuthenticated" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + +

      + + diff --git a/ucNotAuthenticated.ascx.designer.vb b/ucNotAuthenticated.ascx.designer.vb new file mode 100755 index 0000000..db2fc36 --- /dev/null +++ b/ucNotAuthenticated.ascx.designer.vb @@ -0,0 +1,62 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucNotAuthenticated + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''lblAuthenticated control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblAuthenticated As Global.System.Web.UI.WebControls.Label + + ''' + '''lblLogin control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblLogin As Global.System.Web.UI.WebControls.Label + + ''' + '''lblHomePage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblHomePage As Global.System.Web.UI.WebControls.Label + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucNotAuthenticated.ascx.vb b/ucNotAuthenticated.ascx.vb new file mode 100755 index 0000000..6f36072 --- /dev/null +++ b/ucNotAuthenticated.ascx.vb @@ -0,0 +1,58 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Services.Exceptions + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucNotAuthenticated + Inherits NewsArticleModuleBase + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + + End Sub + +#End Region + +#Region " Public Methods " + + Protected Function GetLoginUrl() As String + + Try + + If PortalSettings.LoginTabId <> Null.NullInteger Then + + ' User Defined Tab + ' + Return Page.ResolveUrl("~/Default.aspx?tabid=" & PortalSettings.LoginTabId.ToString) + + Else + + ' Admin Tab + ' + Return Page.ResolveUrl("~/Default.aspx?tabid=" & PortalSettings.ActiveTab.TabID & "&ctl=Login") + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + Return "" + + End Function + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucNotAuthorized.ascx b/ucNotAuthorized.ascx new file mode 100755 index 0000000..04e33b9 --- /dev/null +++ b/ucNotAuthorized.ascx @@ -0,0 +1,10 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucNotAuthorized.ascx.vb" Inherits="Ventrian.NewsArticles.ucNotAuthorized" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + +

      + + diff --git a/ucNotAuthorized.ascx.designer.vb b/ucNotAuthorized.ascx.designer.vb new file mode 100755 index 0000000..6d61249 --- /dev/null +++ b/ucNotAuthorized.ascx.designer.vb @@ -0,0 +1,53 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucNotAuthorized + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''lblAuthorized control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblAuthorized As Global.System.Web.UI.WebControls.Label + + ''' + '''lblHomePage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblHomePage As Global.System.Web.UI.WebControls.Label + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucNotAuthorized.ascx.vb b/ucNotAuthorized.ascx.vb new file mode 100755 index 0000000..384f2b4 --- /dev/null +++ b/ucNotAuthorized.ascx.vb @@ -0,0 +1,24 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucNotAuthorized + Inherits NewsArticleModuleBase + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucSubmitNews.ascx b/ucSubmitNews.ascx new file mode 100755 index 0000000..b2dff06 --- /dev/null +++ b/ucSubmitNews.ascx @@ -0,0 +1,338 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucSubmitNews.ascx.vb" Inherits="Ventrian.NewsArticles.ucSubmitNews" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="URL" Src="~/controls/URLControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="TextEditor" Src="~/controls/TextEditor.ascx"%> +<%@ Register Assembly="Ventrian.NewsArticles" Namespace="Ventrian.NewsArticles.Components.Validators" TagPrefix="Ventrian" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> +<%@ Register TagPrefix="article" TagName="UploadFiles" Src="Controls/UploadFiles.ascx" %> +<%@ Register TagPrefix="article" TagName="UploadImages" Src="Controls/UploadImages.ascx" %> + +<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %> + + + + + + + +
      +
      + + + + + + + + + + + +
      In this section, you can specify your content.
      + + + + + + + + + + + + + + + + + +
      + +
      + +
      + + +
      + +
      +
      +
      +
      + + + + + + + + + + + +
      In this section, you can specify your content.
      + + + + + + + + + + + + + + +
      + + +
      + +
      + + +
      + + + + + + + + + + + +
      + +
      +
      + + + +
      + + + + + +
      + + +
      +
      + +
      + + + + + + + + + + + + + + + + + + +
      + +
      + +
      + +
      + +
      +
      + +
      + + + + + + +
      + + + + + + + + + +
      + + + + + + +
      +
      +
      +
      +
      +
      +
      + + + + + + + + + + +
      In this section, you can organize your content.
      + + + + + + + + + +
      + + +
      +
      + +
      +
      +
      +
      + + + + + + + + + + +
      In this section, you can specify how and when your content is published.
      + + + + + + + + + + + + + + + + + + + + + +
      + + + + + + + + +
      + +
      + +
      + + Calendar + + +  :  +
      + + Calendar + +  :  +
      +
      +
      +
      + + + + + + + + + +
      In this section, you can perform actions relating to the content.
      + + + + + + + + +
      + +
      +          +
      +
      + + + diff --git a/ucSubmitNews.ascx.designer.vb b/ucSubmitNews.ascx.designer.vb new file mode 100755 index 0000000..bee8470 --- /dev/null +++ b/ucSubmitNews.ascx.designer.vb @@ -0,0 +1,1124 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucSubmitNews + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''phMirrorText control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phMirrorText As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''lblMirrorText control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblMirrorText As Global.System.Web.UI.WebControls.Label + + ''' + '''phMirror control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phMirror As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''dshMirror control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshMirror As Global.System.Web.UI.UserControl + + ''' + '''tblMirror control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblMirror As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblMirrorHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblMirrorHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''Image1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Image1 As Global.System.Web.UI.WebControls.Image + + ''' + '''plMirrorArticle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plMirrorArticle As Global.System.Web.UI.UserControl + + ''' + '''chkMirrorArticle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkMirrorArticle As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''trMirrorModule control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trMirrorModule As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plMirrorModule control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plMirrorModule As Global.System.Web.UI.UserControl + + ''' + '''drpMirrorModule control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpMirrorModule As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''trMirrorArticle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trMirrorArticle As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plMirrorArticleSelect control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plMirrorArticleSelect As Global.System.Web.UI.UserControl + + ''' + '''drpMirrorArticle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpMirrorArticle As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''valMirrorArticle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valMirrorArticle As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''trMirrorAutoUpdate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trMirrorAutoUpdate As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plMirrorAutoUpdate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plMirrorAutoUpdate As Global.System.Web.UI.UserControl + + ''' + '''chkMirrorAutoUpdate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkMirrorAutoUpdate As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''phCreate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phCreate As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''dshCreate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshCreate As Global.System.Web.UI.UserControl + + ''' + '''tblCreate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblCreate As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblCreateHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblCreateHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''imgSpacer1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents imgSpacer1 As Global.System.Web.UI.WebControls.Image + + ''' + '''plTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTitle As Global.System.Web.UI.UserControl + + ''' + '''txtTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtTitle As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valTitle As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''plBody control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plBody As Global.System.Web.UI.UserControl + + ''' + '''txtDetails control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtDetails As Global.System.Web.UI.UserControl + + ''' + '''valBody control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valBody As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''phAttachment control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phAttachment As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''dshAttachment control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshAttachment As Global.System.Web.UI.UserControl + + ''' + '''tblAttachment control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblAttachment As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''trLink control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trLink As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plLink control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plLink As Global.System.Web.UI.UserControl + + ''' + '''ctlUrlLink control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ctlUrlLink As Global.System.Web.UI.UserControl + + ''' + '''trNewWindow control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trNewWindow As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plNewWindow control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plNewWindow As Global.System.Web.UI.UserControl + + ''' + '''chkNewWindow control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkNewWindow As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''ucUploadFiles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucUploadFiles As Global.Ventrian.NewsArticles.Controls.UploadFiles + + ''' + '''ucUploadImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucUploadImages As Global.Ventrian.NewsArticles.Controls.UploadImages + + ''' + '''phExcerpt control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phExcerpt As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''dshExcerpt control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshExcerpt As Global.System.Web.UI.UserControl + + ''' + '''tblExcerpt control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblExcerpt As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''txtExcerptBasic control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtExcerptBasic As Global.System.Web.UI.WebControls.TextBox + + ''' + '''txtExcerptRich control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtExcerptRich As Global.System.Web.UI.UserControl + + ''' + '''phMeta control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phMeta As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''dshMeta control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshMeta As Global.System.Web.UI.UserControl + + ''' + '''tblMeta control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblMeta As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plMetaTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plMetaTitle As Global.System.Web.UI.UserControl + + ''' + '''txtMetaTitle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtMetaTitle As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plMetaDescription control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plMetaDescription As Global.System.Web.UI.UserControl + + ''' + '''txtMetaDescription control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtMetaDescription As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plMetaKeyWords control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plMetaKeyWords As Global.System.Web.UI.UserControl + + ''' + '''txtMetaKeyWords control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtMetaKeyWords As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plPageHeadText control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plPageHeadText As Global.System.Web.UI.UserControl + + ''' + '''txtPageHeadText control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtPageHeadText As Global.System.Web.UI.WebControls.TextBox + + ''' + '''phCustomFields control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phCustomFields As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''dshCustomFields control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshCustomFields As Global.System.Web.UI.UserControl + + ''' + '''tblCustomFields control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblCustomFields As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''rptCustomFields control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents rptCustomFields As Global.System.Web.UI.WebControls.Repeater + + ''' + '''phOrganize control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phOrganize As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''dshOrganize control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshOrganize As Global.System.Web.UI.UserControl + + ''' + '''tblOrganize control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblOrganize As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plOrganizeHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plOrganizeHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''imgSpacer2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents imgSpacer2 As Global.System.Web.UI.WebControls.Image + + ''' + '''trCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trCategories As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plCategories As Global.System.Web.UI.UserControl + + ''' + '''lstCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstCategories As Global.System.Web.UI.WebControls.ListBox + + ''' + '''valCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valCategory As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''trTags control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trTags As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plTags control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTags As Global.System.Web.UI.UserControl + + ''' + '''txtTags control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtTags As Global.System.Web.UI.WebControls.TextBox + + ''' + '''lblTags control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblTags As Global.System.Web.UI.WebControls.Label + + ''' + '''phPublish control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phPublish As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''dshPublish control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshPublish As Global.System.Web.UI.UserControl + + ''' + '''tblPublish control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblPublish As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plPublishHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plPublishHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''imgSpacer3 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents imgSpacer3 As Global.System.Web.UI.WebControls.Image + + ''' + '''trAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trAuthor As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plAuthor As Global.System.Web.UI.UserControl + + ''' + '''lblAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblAuthor As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdSelectAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdSelectAuthor As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''ddlAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ddlAuthor As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''pnlAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pnlAuthor As Global.System.Web.UI.WebControls.Panel + + ''' + '''txtAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtAuthor As Global.System.Web.UI.WebControls.TextBox + + ''' + '''lblAuthorUsername control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblAuthorUsername As Global.System.Web.UI.WebControls.Label + + ''' + '''valAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valAuthor As Global.System.Web.UI.WebControls.CustomValidator + + ''' + '''trFeatured control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trFeatured As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plFeatured control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plFeatured As Global.System.Web.UI.UserControl + + ''' + '''chkFeatured control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkFeatured As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''trSecure control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trSecure As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plSecure control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSecure As Global.System.Web.UI.UserControl + + ''' + '''chkSecure control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkSecure As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''trPublish control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trPublish As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plStartDate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plStartDate As Global.System.Web.UI.UserControl + + ''' + '''txtPublishDate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtPublishDate As Global.System.Web.UI.WebControls.TextBox + + ''' + '''cmdPublishCalendar control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdPublishCalendar As Global.System.Web.UI.WebControls.HyperLink + + ''' + '''valPublishDateRequired control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valPublishDateRequired As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''valPublishDate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valPublishDate As Global.System.Web.UI.WebControls.CompareValidator + + ''' + '''txtPublishHour control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtPublishHour As Global.System.Web.UI.WebControls.TextBox + + ''' + '''txtPublishMinute control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtPublishMinute As Global.System.Web.UI.WebControls.TextBox + + ''' + '''trExpiry control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trExpiry As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plEndDate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEndDate As Global.System.Web.UI.UserControl + + ''' + '''txtExpiryDate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtExpiryDate As Global.System.Web.UI.WebControls.TextBox + + ''' + '''cmdExpiryCalendar control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdExpiryCalendar As Global.System.Web.UI.WebControls.HyperLink + + ''' + '''valExpiryDate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valExpiryDate As Global.System.Web.UI.WebControls.CompareValidator + + ''' + '''txtExpiryHour control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtExpiryHour As Global.System.Web.UI.WebControls.TextBox + + ''' + '''txtExpiryMinute control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtExpiryMinute As Global.System.Web.UI.WebControls.TextBox + + ''' + '''dshAction control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshAction As Global.System.Web.UI.UserControl + + ''' + '''tblAction control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblAction As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plAction control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plAction As Global.System.Web.UI.WebControls.Label + + ''' + '''imgSpacer4 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents imgSpacer4 As Global.System.Web.UI.WebControls.Image + + ''' + '''plStatus control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plStatus As Global.System.Web.UI.UserControl + + ''' + '''drpStatus control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpStatus As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''cmdSaveArticle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdSaveArticle As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdPublishArticle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdPublishArticle As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdAddEditPages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdAddEditPages As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdCancel control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdCancel As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdDelete control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdDelete As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''valMessageBox control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valMessageBox As Global.System.Web.UI.WebControls.ValidationSummary + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucSubmitNews.ascx.vb b/ucSubmitNews.ascx.vb new file mode 100755 index 0000000..1ce2319 --- /dev/null +++ b/ucSubmitNews.ascx.vb @@ -0,0 +1,2213 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Entities.Users +Imports DotNetNuke.Security +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization +Imports DotNetNuke.UI.UserControls +Imports DotNetNuke.Security.Roles +Imports Ventrian.NewsArticles.Components.Social +Imports Ventrian.NewsArticles.Components.CustomFields +Imports DotNetNuke.Entities.Portals +Imports DotNetNuke.Entities.Tabs +Imports DotNetNuke.Services.FileSystem +Imports DotNetNuke.Security.Permissions +Imports System.IO + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucSubmitNews + Inherits NewsArticleModuleBase + +#Region " Private Members " + + Private _articleID As Integer = Null.NullInteger + Private _returnUrl As String = Null.NullString + Private _richTextValues As New NameValueCollection + +#End Region + +#Region " Private Properties " + + Private Property PublishDate(ByVal defaultHour As Integer, ByVal defaultMinute As Integer) As DateTime + Get + Dim year As Integer = Convert.ToDateTime(txtPublishDate.Text).Year + Dim month As Integer = Convert.ToDateTime(txtPublishDate.Text).Month + Dim day As Integer = Convert.ToDateTime(txtPublishDate.Text).Day + + Dim hour As Integer = defaultHour + If (IsNumeric(txtPublishHour.Text)) Then + If (hour >= 0 And hour <= 23) Then + hour = Convert.ToInt32(txtPublishHour.Text) + End If + End If + + Dim minute As Integer = defaultMinute + If (IsNumeric(txtPublishMinute.Text)) Then + If (minute >= 0 And minute <= 60) Then + minute = Convert.ToInt32(txtPublishMinute.Text) + End If + End If + + Return New DateTime(year, month, day, hour, minute, 0) + End Get + Set(ByVal Value As DateTime) + txtPublishHour.Text = Value.Hour.ToString() + txtPublishMinute.Text = Value.Minute.ToString() + txtPublishDate.Text = New DateTime(Value.Year, Value.Month, Value.Day).ToShortDateString() + End Set + End Property + + Private Property ExpiryDate(ByVal defaultHour As Integer, ByVal defaultMinute As Integer) As DateTime + Get + If (txtExpiryDate.Text.Length = 0) Then + Return Null.NullDate + End If + + Dim year As Integer = Convert.ToDateTime(txtExpiryDate.Text).Year + Dim month As Integer = Convert.ToDateTime(txtExpiryDate.Text).Month + Dim day As Integer = Convert.ToDateTime(txtExpiryDate.Text).Day + + Dim hour As Integer = defaultHour + If (IsNumeric(txtExpiryHour.Text)) Then + If (hour >= 0 And hour <= 23) Then + hour = Convert.ToInt32(txtExpiryHour.Text) + End If + End If + + Dim minute As Integer = defaultMinute + If (IsNumeric(txtExpiryMinute.Text)) Then + If (minute >= 0 And minute <= 60) Then + minute = Convert.ToInt32(txtExpiryMinute.Text) + End If + End If + + Return New DateTime(year, month, day, hour, minute, 0) + End Get + Set(ByVal Value As DateTime) + If (Value = Null.NullDate) Then + txtExpiryDate.Text = "" + Return + End If + txtExpiryHour.Text = Value.Hour.ToString() + txtExpiryMinute.Text = Value.Minute.ToString() + txtExpiryDate.Text = New DateTime(Value.Year, Value.Month, Value.Day).ToShortDateString() + End Set + End Property + + Private ReadOnly Property Details() As TextEditor + Get + Return CType(txtDetails, TextEditor) + End Get + End Property + + Private ReadOnly Property UrlLink() As UrlControl + Get + Return CType(ctlUrlLink, UrlControl) + End Get + End Property + + Private ReadOnly Property ExcerptRich() As DotNetNuke.UI.UserControls.TextEditor + Get + Return CType(txtExcerptRich, TextEditor) + End Get + End Property + +#End Region + +#Region " Private Methods " + + Private Function IsInRole(ByVal roleName As String, ByVal roles As String()) As Boolean + + For Each role As String In roles + If (roleName = role) Then + Return True + End If + Next + + Return False + + End Function + + Private Sub BindArticle() + + If (_articleID <> Null.NullInteger) Then + + Dim objArticleController As ArticleController = New ArticleController + + Dim objArticle As ArticleInfo = objArticleController.GetArticle(_articleID) + + lblAuthor.Text = objArticle.AuthorDisplayName + txtTitle.Text = objArticle.Title + If (ArticleSettings.TextEditorSummaryMode = Components.Types.TextEditorModeType.Basic) Then + txtExcerptBasic.Text = objArticle.Summary.Replace("<br />", vbCrLf) + Else + ExcerptRich.Text = objArticle.Summary + End If + chkFeatured.Checked = objArticle.IsFeatured + chkSecure.Checked = objArticle.IsSecure + + txtMetaTitle.Text = objArticle.MetaTitle + txtMetaDescription.Text = objArticle.MetaDescription + txtMetaKeyWords.Text = objArticle.MetaKeywords + txtPageHeadText.Text = objArticle.PageHeadText + + If Not (drpStatus.Items.FindByValue(objArticle.Status.ToString()) Is Nothing) Then + drpStatus.SelectedValue = objArticle.Status.ToString() + End If + + PublishDate(objArticle.StartDate.Hour, objArticle.EndDate.Minute) = objArticle.StartDate + + If Not (objArticle.EndDate = Null.NullDate) Then + ExpiryDate(objArticle.EndDate.Hour, objArticle.EndDate.Minute) = objArticle.EndDate + End If + + If (ArticleSettings.IsImagesEnabled) Then + If Not (objArticle.ImageUrl = Null.NullString) Then + If (objArticle.ImageUrl.ToLower().StartsWith("http://") Or objArticle.ImageUrl.ToLower().StartsWith("https://")) Then + If (ArticleSettings.EnableExternalImages) Then + ucUploadImages.ImageExternalUrl = objArticle.ImageUrl + End If + End If + End If + End If + + UrlLink.Url = objArticle.Url + chkNewWindow.Checked = objArticle.IsNewWindow + + Dim categories As ArrayList = objArticleController.GetArticleCategories(_articleID) + For Each category As CategoryInfo In categories + Dim li As ListItem = lstCategories.Items.FindByValue(category.CategoryID.ToString()) + If Not (li Is Nothing) Then + li.Selected = True + End If + Next + txtTags.Text = objArticle.Tags + + Dim objPageController As New PageController + Dim pages As ArrayList = objPageController.GetPageList(_articleID) + If (pages.Count > 0) Then + Details.Text = CType(pages(0), PageInfo).PageText + End If + + cmdDelete.Visible = True + cmdDelete.OnClientClick = "return confirm('" & DotNetNuke.Services.Localization.Localization.GetString("Delete.Text", LocalResourceFile) & "');" + + Dim objMirrorArticleController As New MirrorArticleController + Dim objMirrorArticleInfo As MirrorArticleInfo = objMirrorArticleController.GetMirrorArticle(_articleID) + + If (objMirrorArticleInfo IsNot Nothing) Then + + phMirrorText.Visible = True + If (objMirrorArticleInfo.AutoUpdate) Then + lblMirrorText.Text = Localization.GetString("MirrorTextUpdate", Me.LocalResourceFile) + + If (lblMirrorText.Text.IndexOf("{0}") <> -1) Then + lblMirrorText.Text = lblMirrorText.Text.Replace("{0}", objMirrorArticleInfo.PortalName) + End If + + phCreate.Visible = False + phOrganize.Visible = False + phPublish.Visible = False + + cmdPublishArticle.Visible = False + cmdAddEditPages.Visible = False + Else + lblMirrorText.Text = Localization.GetString("MirrorText", Me.LocalResourceFile) + + If (lblMirrorText.Text.IndexOf("{0}") <> -1) Then + lblMirrorText.Text = lblMirrorText.Text.Replace("{0}", objMirrorArticleInfo.PortalName) + End If + End If + + End If + + Dim objMirrorArticleLinked As ArrayList = objMirrorArticleController.GetMirrorArticleList(_articleID) + + If (objMirrorArticleLinked.Count > 0) Then + + phMirrorText.Visible = True + lblMirrorText.Text = Localization.GetString("MirrorTextLinked", Me.LocalResourceFile) + + If (lblMirrorText.Text.IndexOf("{0}") <> -1) Then + lblMirrorText.Text = lblMirrorText.Text.Replace("{0}", objMirrorArticleLinked.Count.ToString()) + End If + + End If + + Else + + chkFeatured.Checked = ArticleSettings.IsAutoFeatured + chkSecure.Checked = ArticleSettings.IsAutoSecured + If (ArticleSettings.AuthorDefault <> Null.NullInteger) Then + Dim objUser As UserInfo = UserController.GetUser(PortalId, ArticleSettings.AuthorDefault, True) + + If (objUser IsNot Nothing) Then + lblAuthor.Text = objUser.Username + Else + lblAuthor.Text = Me.UserInfo.Username + End If + Else + lblAuthor.Text = Me.UserInfo.Username + End If + PublishDate(DateTime.Now.Hour, DateTime.Now.Minute) = DateTime.Now + cmdDelete.Visible = False + + If (Settings.Contains(ArticleConstants.DEFAULT_CATEGORIES_SETTING)) Then + If Not (Settings(ArticleConstants.DEFAULT_CATEGORIES_SETTING).ToString = Null.NullString) Then + Dim categories As String() = Settings(ArticleConstants.DEFAULT_CATEGORIES_SETTING).ToString().Split(Char.Parse(",")) + + For Each category As String In categories + If Not (lstCategories.Items.FindByValue(category) Is Nothing) Then + lstCategories.Items.FindByValue(category).Selected = True + End If + Next + End If + End If + + End If + + End Sub + + Private Sub BindCategories() + + Dim objCategoryController As CategoryController = New CategoryController + + Dim objCategoriesSelected As New List(Of CategoryInfo) + Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(ModuleId, Null.NullInteger, ArticleSettings.CategorySortType) + + If (ArticleSettings.CategoryFilterSubmit) Then + If (ArticleSettings.FilterSingleCategory <> Null.NullInteger) Then + Dim objSelectedCategories As New List(Of CategoryInfo)() + For Each objCategory As CategoryInfo In objCategories + If (objCategory.CategoryID = ArticleSettings.FilterSingleCategory) Then + objSelectedCategories.Add(objCategory) + Exit For + End If + Next + objCategories = objSelectedCategories + End If + + If (ArticleSettings.FilterCategories IsNot Nothing) Then + If (ArticleSettings.FilterCategories.Length > 0) Then + Dim objSelectedCategories As New List(Of CategoryInfo)() + For Each i As Integer In ArticleSettings.FilterCategories + For Each objCategory As CategoryInfo In objCategories + If (objCategory.CategoryID = i) Then + objSelectedCategories.Add(objCategory) + Exit For + End If + Next + Next + objCategories = objSelectedCategories + End If + End If + End If + + For Each objCategory As CategoryInfo In objCategories + If (objCategory.InheritSecurity) Then + objCategoriesSelected.Add(objCategory) + Else + If (Request.IsAuthenticated) Then + If (Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_SUBMIT_SETTING)) Then + If (PortalSecurity.IsInRoles(Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_SUBMIT_SETTING).ToString())) Then + objCategoriesSelected.Add(objCategory) + End If + End If + End If + End If + Next + + lstCategories.DataSource = objCategoriesSelected + lstCategories.DataBind() + + If (Settings.Contains(ArticleConstants.REQUIRE_CATEGORY)) Then + valCategory.Enabled = Convert.ToBoolean(Settings(ArticleConstants.REQUIRE_CATEGORY).ToString()) + End If + + End Sub + + Private Sub BindCustomFields() + + Dim objCustomFieldController As New CustomFieldController() + Dim objCustomFields As ArrayList = objCustomFieldController.List(Me.ModuleId) + + If (objCustomFields.Count = 0) Then + phCustomFields.Visible = False + Else + phCustomFields.Visible = True + rptCustomFields.DataSource = objCustomFields + rptCustomFields.DataBind() + End If + + End Sub + + Private Sub BindStatus() + + For Each value As Integer In System.Enum.GetValues(GetType(StatusType)) + Dim li As New ListItem + li.Value = System.Enum.GetName(GetType(StatusType), value) + li.Text = Localization.GetString(System.Enum.GetName(GetType(StatusType), value), Me.LocalResourceFile) + drpStatus.Items.Add(li) + Next + + End Sub + + Private Sub CheckSecurity() + + If (HasEditRights(_articleID, Me.ModuleId, Me.TabId) = False) Then + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "NotAuthorized", ArticleSettings), True) + End If + + End Sub + + Public Function GetAuthorList(ByVal moduleID As Integer) As ArrayList + + Dim moduleSettings As Hashtable = DotNetNuke.Entities.Portals.PortalSettings.GetModuleSettings(moduleID) + Dim distributionList As String = "" + Dim userList As New ArrayList + + If (moduleSettings.Contains(ArticleConstants.PERMISSION_SUBMISSION_SETTING)) Then + + Dim roles As String = moduleSettings(ArticleConstants.PERMISSION_SUBMISSION_SETTING).ToString() + Dim rolesArray() As String = roles.Split(Convert.ToChar(";")) + Dim userIDs As New Hashtable + + For Each role As String In rolesArray + If (role.Length > 0) Then + + Dim objRoleController As New DotNetNuke.Security.Roles.RoleController + Dim objRole As DotNetNuke.Security.Roles.RoleInfo = objRoleController.GetRoleByName(PortalSettings.PortalId, role) + + If Not (objRole Is Nothing) Then + Dim objUsers As ArrayList = objRoleController.GetUserRolesByRoleName(PortalSettings.PortalId, objRole.RoleName) + For Each objUser As DotNetNuke.Entities.Users.UserRoleInfo In objUsers + If (userIDs.Contains(objUser.UserID) = False) Then + Dim objUserController As DotNetNuke.Entities.Users.UserController = New DotNetNuke.Entities.Users.UserController + Dim objSelectedUser As DotNetNuke.Entities.Users.UserInfo = objUserController.GetUser(PortalSettings.PortalId, objUser.UserID) + If Not (objSelectedUser Is Nothing) Then + If (objSelectedUser.Email.Length > 0) Then + userIDs.Add(objUser.UserID, objUser.UserID) + userList.Add(objSelectedUser) + End If + End If + End If + Next + End If + End If + Next + + End If + + Return userList + + End Function + + Private Sub PopulateAuthorList() + + ddlAuthor.DataSource = GetAuthorList(Me.ModuleId) + ddlAuthor.DataBind() + ddlAuthor.Items.Insert(0, New ListItem(Localization.GetString("SelectAuthor.Text", Me.LocalResourceFile), "-1")) + + End Sub + + Private Sub ReadQueryString() + + If (Request("ArticleID") <> "") Then + If (IsNumeric(Request("ArticleID"))) Then + _articleID = Convert.ToInt32(Request("ArticleID")) + End If + End If + + If (Request("ReturnUrl") <> "") Then + _returnUrl = Request("ReturnUrl") + End If + + End Sub + + Private Function SaveArticle() As Integer + + If (_articleID <> Null.NullInteger) Then + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(_articleID) + + If Not (objArticle Is Nothing) Then + Return SaveArticle(objArticle.Status) + End If + Else + Return SaveArticle(StatusType.Draft) + End If + + End Function + + Private Function SaveArticle(ByVal status As StatusType) As Integer + + Dim objArticleController As ArticleController = New ArticleController + Dim objArticle As ArticleInfo = New ArticleInfo + + Dim statusChanged As Boolean = False + Dim publishArticle As Boolean = False + + If (_articleID = Null.NullInteger) Then + If (pnlAuthor.Visible = False) Then + Dim objUser As UserInfo = UserController.GetUserByName(Me.PortalId, lblAuthor.Text) + + If (objUser IsNot Nothing) Then + objArticle.AuthorID = objUser.UserID + Else + objArticle.AuthorID = Me.UserId + End If + Else + Dim objUser As UserInfo = UserController.GetUserByName(Me.PortalId, txtAuthor.Text) + + If (objUser IsNot Nothing) Then + objArticle.AuthorID = objUser.UserID + Else + objArticle.AuthorID = Me.UserId + End If + End If + + If (ddlAuthor.Visible) Then + objArticle.AuthorID = Convert.ToInt32(ddlAuthor.SelectedValue) + End If + objArticle.CreatedDate = DateTime.Now + objArticle.Status = StatusType.Draft + objArticle.CommentCount = 0 + objArticle.RatingCount = 0 + objArticle.Rating = 0 + objArticle.ShortUrl = "" + Else + objArticle = objArticleController.GetArticle(_articleID) + objArticleController.DeleteArticleCategories(_articleID) + + If (objArticle.Status <> StatusType.Published And status = StatusType.Published) Then + ' Article now approved, notify if not an Approver. + If (objArticle.AuthorID <> Me.UserId) Then + statusChanged = True + End If + End If + + If (pnlAuthor.Visible) Then + Dim objUser As UserInfo = UserController.GetUserByName(Me.PortalId, txtAuthor.Text) + + If (objUser IsNot Nothing) Then + objArticle.AuthorID = objUser.UserID + End If + End If + + If (ddlAuthor.Visible) Then + objArticle.AuthorID = Convert.ToInt32(ddlAuthor.SelectedValue) + End If + End If + + objArticle.MetaTitle = txtMetaTitle.Text.Trim() + objArticle.MetaDescription = txtMetaDescription.Text.Trim() + objArticle.MetaKeywords = txtMetaKeyWords.Text.Trim() + objArticle.PageHeadText = txtPageHeadText.Text.Trim() + + If (chkMirrorArticle.Checked And drpMirrorArticle.Items.Count > 0) Then + Dim objLinkedArticle As ArticleInfo = objArticleController.GetArticle(Convert.ToInt32(drpMirrorArticle.SelectedValue)) + + If (objLinkedArticle IsNot Nothing) Then + objArticle.Title = objLinkedArticle.Title + objArticle.Summary = objLinkedArticle.Summary + objArticle.Url = objLinkedArticle.Url + objArticle.IsNewWindow = objLinkedArticle.IsNewWindow + objArticle.ImageUrl = objLinkedArticle.ImageUrl + + objArticle.MetaTitle = objLinkedArticle.MetaTitle + objArticle.MetaDescription = objLinkedArticle.MetaDescription + objArticle.MetaKeywords = objLinkedArticle.MetaKeywords + objArticle.PageHeadText = objLinkedArticle.PageHeadText + End If + Else + objArticle.Title = txtTitle.Text + If (ArticleSettings.TextEditorSummaryMode = Components.Types.TextEditorModeType.Basic) Then + objArticle.Summary = txtExcerptBasic.Text.Replace(vbCrLf, "<br />") + Else + If (ExcerptRich.Text <> "" AndAlso StripHtml(ExcerptRich.Text).Length > 0 AndAlso ExcerptRich.Text <> "<p>&#160;</p>") Then + objArticle.Summary = ExcerptRich.Text + Else + objArticle.Summary = Null.NullString + End If + End If + objArticle.Url = UrlLink.Url + objArticle.IsNewWindow = chkNewWindow.Checked + If (ArticleSettings.IsImagesEnabled = True) Then + objArticle.ImageUrl = ucUploadImages.ImageExternalUrl + End If + End If + + objArticle.IsFeatured = chkFeatured.Checked + objArticle.IsSecure = chkSecure.Checked + objArticle.LastUpdate = DateTime.Now + objArticle.LastUpdateID = Me.UserId + objArticle.ModuleID = Me.ModuleId + + objArticle.Status = status + + If (objArticle.StartDate <> Null.NullDate) Then + objArticle.StartDate = PublishDate(objArticle.StartDate.Hour, objArticle.StartDate.Minute) + Else + objArticle.StartDate = PublishDate(DateTime.Now.Hour, DateTime.Now.Minute) + End If + + If (ExpiryDate(0, 0) = Null.NullDate) Then + objArticle.EndDate = Null.NullDate + Else + If (objArticle.EndDate <> Null.NullDate) Then + objArticle.EndDate = ExpiryDate(objArticle.EndDate.Hour, objArticle.EndDate.Minute) + Else + objArticle.EndDate = ExpiryDate(0, 0) + End If + End If + + If (_articleID = Null.NullInteger) Then + objArticle.ArticleID = objArticleController.AddArticle(objArticle) + ucUploadImages.UpdateImages(objArticle.ArticleID) + ucUploadFiles.UpdateFiles(objArticle.ArticleID) + objArticleController.UpdateArticle(objArticle) + + If (chkMirrorArticle.Checked And drpMirrorArticle.Items.Count > 0) Then + + ' Mirrored Article + Dim objMirrorArticleInfo As New MirrorArticleInfo + + objMirrorArticleInfo.ArticleID = objArticle.ArticleID + objMirrorArticleInfo.LinkedArticleID = Convert.ToInt32(drpMirrorArticle.SelectedValue) + objMirrorArticleInfo.LinkedPortalID = Convert.ToInt32(drpMirrorModule.SelectedValue.Split("-"c)(0)) + objMirrorArticleInfo.AutoUpdate = chkMirrorAutoUpdate.Checked + + Dim objMirrorArticleController As New MirrorArticleController() + objMirrorArticleController.AddMirrorArticle(objMirrorArticleInfo) + + 'Copy Files + Dim folderLinked As String = "" + + Dim objModuleController As New ModuleController() + Dim objSettingsLinked As Hashtable = objModuleController.GetModuleSettings(drpMirrorModule.SelectedValue.Split("-"c)(1)) + + If (objSettingsLinked.ContainsKey(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING)) Then + If (IsNumeric(objSettingsLinked(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING))) Then + Dim folderID As Integer = Convert.ToInt32(objSettingsLinked(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING)) + Dim objFolderController As New FolderController + Dim objFolder As FolderInfo = objFolderController.GetFolderInfo(Convert.ToInt32(drpMirrorModule.SelectedValue.Split("-"c)(0)), folderID) + If (objFolder IsNot Nothing) Then + folderLinked = objFolder.FolderPath + End If + End If + End If + + Dim objPortalController As New PortalController + Dim objPortalLinked As PortalInfo = objPortalController.GetPortal(Convert.ToInt32(drpMirrorModule.SelectedValue.Split("-"c)(0))) + + Dim filePathLinked As String = objPortalLinked.HomeDirectoryMapPath & folderLinked.Replace("/", "\") + + Dim folder As String = "" + + Dim objSettings As Hashtable = objModuleController.GetModuleSettings(ModuleId) + + If (objSettings.ContainsKey(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING)) Then + If (IsNumeric(objSettings(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING))) Then + Dim folderID As Integer = Convert.ToInt32(objSettings(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING)) + Dim objFolderController As New FolderController + Dim objFolder As FolderInfo = objFolderController.GetFolderInfo(PortalId, folderID) + If (objFolder IsNot Nothing) Then + folder = objFolder.FolderPath + End If + End If + End If + + Dim objFileController As New FileController + Dim objFiles As List(Of FileInfo) = objFileController.GetFileList(objMirrorArticleInfo.LinkedArticleID, Null.NullString) + + For Each objFile As FileInfo In objFiles + + If (File.Exists(filePathLinked & objFile.FileName)) Then + + Dim finalCopyPath = filePathLinked & objFile.FileName + + Dim filePath As String = PortalSettings.HomeDirectoryMapPath & folder.Replace("/", "\") + + If Not (Directory.Exists(filePath)) Then + Directory.CreateDirectory(filePath) + End If + + If (File.Exists(filePath & objFile.FileName)) Then + For i As Integer = 1 To 100 + If (File.Exists(filePath & i.ToString() & "_" & objFile.FileName) = False) Then + objFile.FileName = i.ToString() & "_" & objFile.FileName + Exit For + End If + Next + End If + + File.Copy(finalCopyPath, filePath & objFile.FileName) + + objFile.ArticleID = objArticle.ArticleID + objFileController.Add(objFile) + + End If + + Next + + 'Copy Images + + Dim folderImagesLinked As String = "" + + If (objSettingsLinked.ContainsKey(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING)) Then + If (IsNumeric(objSettingsLinked(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING))) Then + Dim folderID As Integer = Convert.ToInt32(objSettingsLinked(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING)) + Dim objFolderController As New FolderController + Dim objFolder As FolderInfo = objFolderController.GetFolderInfo(Convert.ToInt32(drpMirrorModule.SelectedValue.Split("-"c)(0)), folderID) + If (objFolder IsNot Nothing) Then + folderImagesLinked = objFolder.FolderPath + End If + End If + End If + + Dim filePathImagesLinked As String = objPortalLinked.HomeDirectoryMapPath & folderImagesLinked.Replace("/", "\") + + Dim folderImages As String = "" + + If (objSettings.ContainsKey(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING)) Then + If (IsNumeric(objSettings(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING))) Then + Dim folderID As Integer = Convert.ToInt32(objSettings(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING)) + Dim objFolderController As New FolderController + Dim objFolder As FolderInfo = objFolderController.GetFolderInfo(PortalId, folderID) + If (objFolder IsNot Nothing) Then + folderImages = objFolder.FolderPath + End If + End If + End If + + Dim objImageController As New ImageController + Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objMirrorArticleInfo.LinkedArticleID, Null.NullString) + + For Each objImage As ImageInfo In objImages + + Dim objNewImage As ImageInfo = objImage.Clone + + If (File.Exists(filePathImagesLinked & objNewImage.FileName)) Then + + Dim finalCopyPath = filePathImagesLinked & objNewImage.FileName + + Dim filePath As String = PortalSettings.HomeDirectoryMapPath & folderImages.Replace("/", "\") + + If Not (Directory.Exists(filePath)) Then + Directory.CreateDirectory(filePath) + End If + + If (File.Exists(filePath & objNewImage.FileName)) Then + For i As Integer = 1 To 100 + If (File.Exists(filePath & i.ToString() & "_" & objNewImage.FileName) = False) Then + objNewImage.FileName = i.ToString() & "_" & objNewImage.FileName + Exit For + End If + Next + End If + + File.Copy(finalCopyPath, filePath & objNewImage.FileName) + + objNewImage.ImageID = Null.NullInteger + objNewImage.Folder = folderImages + objNewImage.ArticleID = objArticle.ArticleID + objImageController.Add(objNewImage) + + End If + + Next + + End If + + objArticleController.UpdateArticle(objArticle) + If (objArticle.Status = StatusType.Published) Then + publishArticle = True + End If + Else + objArticleController.UpdateArticle(objArticle) + If (statusChanged) Then + publishArticle = True + End If + End If + + SaveCategories(objArticle.ArticleID) + SaveTags(objArticle.ArticleID) + SaveDetails(objArticle.ArticleID, objArticle.Title) + SaveCustomFields(objArticle.ArticleID) + + ' Re-init. + objArticle = objArticleController.GetArticle(objArticle.ArticleID) + + If (publishArticle) Then + If (objArticle.IsApproved) Then + If (ArticleSettings.JournalIntegration) Then + Dim objJournal As New Journal + objJournal.AddArticleToJournal(objArticle, PortalId, TabId, Me.UserId, Null.NullInteger, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False)) + End If + + If (ArticleSettings.JournalIntegrationGroups) Then + + Dim objCategories As ArrayList = objArticleController.GetArticleCategories(objArticle.ArticleID) + + If (objCategories.Count > 0) Then + + Dim objRoleController As New RoleController() + + Dim objRoles As ArrayList = objRoleController.GetRoles() + For Each objRole As RoleInfo In objRoles + Dim roleAccess As Boolean = False + + If (objRole.SecurityMode = SecurityMode.SocialGroup Or objRole.SecurityMode = SecurityMode.Both) Then + + For Each objCategory As CategoryInfo In objCategories + + If (objCategory.InheritSecurity = False) Then + + If (objCategory.CategorySecurityType = CategorySecurityType.Loose) Then + roleAccess = False + Exit For + Else + If (Settings.Contains(objCategory.CategoryID.ToString() & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then + If (IsInRole(objRole.RoleName, Settings(objCategory.CategoryID.ToString() & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString().Split(";"c))) Then + roleAccess = True + End If + End If + End If + + End If + + Next + + End If + + If (roleAccess) Then + Dim objJournal As New Journal + objJournal.AddArticleToJournal(objArticle, PortalId, TabId, Me.UserId, objRole.RoleID, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False)) + End If + + Next + + End If + + End If + + ' Notify Smart Thinker + + If (ArticleSettings.EnableSmartThinkerStoryFeed) Then + Dim objStoryFeed As New wsStoryFeed.StoryFeedWS + objStoryFeed.Url = AddHTTP(Request.ServerVariables("HTTP_HOST") & Me.ResolveUrl("~/DesktopModules/Smart-Thinker%20-%20UserProfile/StoryFeed.asmx")) + + Dim val As String = GetSharedResource("StoryFeed-AddArticle") + + val = val.Replace("[AUTHOR]", objArticle.AuthorDisplayName) + val = val.Replace("[AUTHORID]", objArticle.AuthorID.ToString()) + val = val.Replace("[ARTICLELINK]", Common.GetArticleLink(objArticle, Me.PortalSettings.ActiveTab, ArticleSettings, False)) + val = val.Replace("[ARTICLETITLE]", objArticle.Title) + + Try + objStoryFeed.AddAction(80, _articleID, val, objArticle.AuthorID, "VE6457624576460436531768") + Catch + End Try + End If + + If (ArticleSettings.EnableActiveSocialFeed) Then + If (ArticleSettings.ActiveSocialSubmitKey <> "") Then + If IO.File.Exists(HttpContext.Current.Server.MapPath("~/bin/active.modules.social.dll")) Then + Dim ai As Object = Nothing + Dim asm As System.Reflection.Assembly + Dim ac As Object = Nothing + Try + asm = System.Reflection.Assembly.Load("Active.Modules.Social") + ac = asm.CreateInstance("Active.Modules.Social.API.Journal") + If Not ac Is Nothing Then + ac.AddProfileItem(New Guid(ArticleSettings.ActiveSocialSubmitKey), objArticle.AuthorID, Common.GetArticleLink(objArticle, Me.PortalSettings.ActiveTab, ArticleSettings, False), objArticle.Title, objArticle.Summary, objArticle.Body, 1, "") + End If + Catch ex As Exception + End Try + End If + End If + End If + + End If + End If + + If (_articleID <> Null.NullInteger And statusChanged = False) Then + + If (objArticle.Status = StatusType.Published) Then + ' Check to see if any articles have been linked + + Dim objEmailTemplateController As New EmailTemplateController + + Dim objMirrorArticleController As New MirrorArticleController + Dim objMirrorArticleLinked As ArrayList = objMirrorArticleController.GetMirrorArticleList(_articleID) + + Dim objEventLog As New DotNetNuke.Services.Log.EventLog.EventLogController + objEventLog.AddLog("Article Linked Update", objMirrorArticleLinked.Count.ToString(), PortalSettings, -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT) + + If (objMirrorArticleLinked.Count > 0) Then + + For Each objMirrorArticleInfo As MirrorArticleInfo In objMirrorArticleLinked + + Dim objArticleMirrored As ArticleInfo = objArticleController.GetArticle(objMirrorArticleInfo.ArticleID) + + If (objArticleMirrored IsNot Nothing) Then + + If (objArticleMirrored.AuthorEmail <> "") Then + objEmailTemplateController.SendFormattedEmail(Me.ModuleId, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), objArticle, EmailTemplateType.ArticleUpdateMirrored, objArticleMirrored.AuthorEmail, ArticleSettings) + End If + + If (objMirrorArticleInfo.AutoUpdate) Then + + objArticleMirrored.Title = objArticle.Title + objArticleMirrored.Summary = objArticle.Summary + + objArticleMirrored.Url = objArticle.Url + objArticleMirrored.IsNewWindow = objArticle.IsNewWindow + objArticleMirrored.ImageUrl = objArticle.ImageUrl + + objArticleMirrored.MetaTitle = objArticle.MetaTitle + objArticleMirrored.MetaDescription = objArticle.MetaDescription + objArticleMirrored.MetaKeywords = objArticle.MetaKeywords + objArticleMirrored.PageHeadText = objArticle.PageHeadText + + ' Save Custom Fields + Dim fieldsToUpdate As New Hashtable + + Dim objCustomValueController As New CustomValueController + Dim objCustomValues As List(Of CustomValueInfo) = objCustomValueController.List(objArticleMirrored.ArticleID) + + For Each objCustomValue As CustomValueInfo In objCustomValues + objCustomValueController.Delete(objArticleMirrored.ArticleID, objCustomValue.CustomFieldID) + Next + + Dim objCustomFieldController As New CustomFieldController + Dim objCustomFields As ArrayList = objCustomFieldController.List(ModuleId) + Dim objCustomFieldsLinked As ArrayList = objCustomFieldController.List(objArticleMirrored.ModuleID) + + For Each objCustomFieldLinked As CustomFieldInfo In objCustomFieldsLinked + For Each objCustomField As CustomFieldInfo In objCustomFields + + If (objCustomFieldLinked.Name.ToLower() = objCustomField.Name.ToLower()) Then + + If (objArticle.CustomList.Contains(objCustomField.CustomFieldID)) Then + fieldsToUpdate.Add(objCustomFieldLinked.CustomFieldID.ToString(), objArticle.CustomList(objCustomField.CustomFieldID).ToString()) + End If + + End If + + Next + Next + + For Each key As String In fieldsToUpdate.Keys + Dim val As String = fieldsToUpdate(key).ToString() + Dim objCustomValue As CustomValueInfo = New CustomValueInfo + objCustomValue.CustomFieldID = Convert.ToInt32(key) + objCustomValue.CustomValue = val + objCustomValue.ArticleID = objArticleMirrored.ArticleID + objCustomValueController.Add(objCustomValue) + Next + + ' Details + + Dim objPageController As PageController = New PageController + Dim currentPages As ArrayList = objPageController.GetPageList(objArticleMirrored.ArticleID) + + For Each objPage As PageInfo In currentPages + objPageController.DeletePage(objPage.PageID) + Next + + Dim pages As ArrayList = objPageController.GetPageList(objArticle.ArticleID) + + For Each objPage As PageInfo In pages + objPage.ArticleID = objArticleMirrored.ArticleID + objPage.PageID = Null.NullInteger + objPageController.AddPage(objPage) + Next + + ' Save Tags + + Dim objTagController As New TagController + objTagController.DeleteArticleTag(objArticleMirrored.ArticleID) + + Dim tagsCurrent As String = objArticle.Tags + + If (tagsCurrent <> "") Then + Dim tags As String() = tagsCurrent.Split(","c) + For Each tag As String In tags + If (tag <> "") Then + Dim objTag As TagInfo = objTagController.Get(objArticleMirrored.ModuleID, tag) + + If (objTag Is Nothing) Then + objTag = New TagInfo + objTag.Name = tag + objTag.NameLowered = tag.ToLower() + objTag.ModuleID = objArticleMirrored.ModuleID + objTag.TagID = objTagController.Add(objTag) + End If + + objTagController.Add(objArticleMirrored.ArticleID, objTag.TagID) + End If + Next + End If + + 'Copy Files + Dim folderLinked As String = "" + + Dim objModuleController As New ModuleController() + Dim objSettingsLinked As Hashtable = objModuleController.GetModuleSettings(objArticleMirrored.ModuleID) + + If (objSettingsLinked.ContainsKey(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING)) Then + If (IsNumeric(objSettingsLinked(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING))) Then + Dim folderID As Integer = Convert.ToInt32(objSettingsLinked(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING)) + Dim objFolderController As New FolderController + Dim objFolder As FolderInfo = objFolderController.GetFolderInfo(objArticleMirrored.ModuleID, folderID) + If (objFolder IsNot Nothing) Then + folderLinked = objFolder.FolderPath + End If + End If + End If + + Dim objPortalController As New PortalController + Dim objPortalLinked As PortalInfo = objPortalController.GetPortal(objMirrorArticleInfo.PortalID) + + Dim filePathLinked As String = objPortalLinked.HomeDirectoryMapPath & folderLinked.Replace("/", "\") + + Dim folder As String = "" + + Dim objSettings As Hashtable = objModuleController.GetModuleSettings(ModuleId) + + If (objSettings.ContainsKey(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING)) Then + If (IsNumeric(objSettings(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING))) Then + Dim folderID As Integer = Convert.ToInt32(objSettings(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING)) + Dim objFolderController As New FolderController + Dim objFolder As FolderInfo = objFolderController.GetFolderInfo(PortalId, folderID) + If (objFolder IsNot Nothing) Then + folder = objFolder.FolderPath + End If + End If + End If + + Dim objFileController As New FileController + Dim objFilesCurrent As List(Of FileInfo) = objFileController.GetFileList(objArticleMirrored.ArticleID, Null.NullString) + + For Each objFile As FileInfo In objFilesCurrent + objFileController.Delete(objFile.FileID) + Next + + Dim objFiles As List(Of FileInfo) = objFileController.GetFileList(objArticle.ArticleID, Null.NullString) + + For Each objFile As FileInfo In objFiles + + Dim finalCopyPath = PortalSettings.HomeDirectoryMapPath & folder.Replace("/", "\") & objFile.FileName + Dim filePath As String = objPortalLinked.HomeDirectoryMapPath & folderLinked.Replace("/", "\") & objFile.FileName + + If (File.Exists(finalCopyPath)) Then + + If Not (Directory.Exists(objPortalLinked.HomeDirectoryMapPath & folderLinked.Replace("/", "\"))) Then + Directory.CreateDirectory(objPortalLinked.HomeDirectoryMapPath & folderLinked.Replace("/", "\")) + End If + + If (File.Exists(filePath) = False) Then + File.Copy(finalCopyPath, filePath) + End If + + objFile.FileID = Null.NullInteger + objFile.ArticleID = objArticleMirrored.ArticleID + objFileController.Add(objFile) + + End If + + Next + + 'Copy Images + + Dim folderImagesLinked As String = "" + + If (objSettingsLinked.ContainsKey(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING)) Then + If (IsNumeric(objSettingsLinked(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING))) Then + Dim folderID As Integer = Convert.ToInt32(objSettingsLinked(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING)) + Dim objFolderController As New FolderController + Dim objFolder As FolderInfo = objFolderController.GetFolderInfo(objArticleMirrored.ModuleID, folderID) + If (objFolder IsNot Nothing) Then + folderImagesLinked = objFolder.FolderPath + End If + End If + End If + + Dim filePathImagesLinked As String = objPortalLinked.HomeDirectoryMapPath & folderImagesLinked.Replace("/", "\") + + Dim folderImages As String = "" + + If (objSettings.ContainsKey(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING)) Then + If (IsNumeric(objSettings(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING))) Then + Dim folderID As Integer = Convert.ToInt32(objSettings(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING)) + Dim objFolderController As New FolderController + Dim objFolder As FolderInfo = objFolderController.GetFolderInfo(PortalId, folderID) + If (objFolder IsNot Nothing) Then + folderImages = objFolder.FolderPath + End If + End If + End If + + Dim objImageController As New ImageController + Dim objImagesCurrent As List(Of ImageInfo) = objImageController.GetImageList(objArticleMirrored.ArticleID, Null.NullString) + + For Each objImage As ImageInfo In objImagesCurrent + objImageController.Delete(objImage.ImageID, _articleID, objImage.ImageGuid) + Next + + Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString) + + For Each objImage As ImageInfo In objImages + + Dim finalCopyPath = PortalSettings.HomeDirectoryMapPath & folderImages.Replace("/", "\") & objImage.FileName + Dim filePath As String = objPortalLinked.HomeDirectoryMapPath & folderImagesLinked.Replace("/", "\") & objImage.FileName + + If (File.Exists(finalCopyPath)) Then + + If Not (Directory.Exists(objPortalLinked.HomeDirectoryMapPath & folderImages.Replace("/", "\"))) Then + Directory.CreateDirectory(objPortalLinked.HomeDirectoryMapPath & folderImages.Replace("/", "\")) + End If + + If (File.Exists(filePath) = False) Then + File.Copy(finalCopyPath, filePath) + End If + + objImage.Folder = folderImages + objImage.ImageID = Null.NullInteger + objImage.ArticleID = objArticleMirrored.ArticleID + objImageController.Add(objImage) + + End If + + Next + + + ' Save + + objArticleController.UpdateArticle(objArticleMirrored) + + End If + + + End If + + Next + + End If + + End If + + End If + + If (statusChanged) Then + Common.NotifyAuthor(objArticle, Me.Settings, Me.ModuleId, PortalSettings.ActiveTab, Me.PortalId, ArticleSettings) + End If + + ArticleController.ClearArticleCache(objArticle.ArticleID) + + Return objArticle.ArticleID + + End Function + + Private Sub SaveCategories(ByVal articleID As Integer) + + Dim objArticleController As ArticleController = New ArticleController + + If (chkMirrorArticle.Checked And drpMirrorArticle.Items.Count > 0) Then + Dim objCategories As ArrayList = objArticleController.GetArticleCategories(Convert.ToInt32(drpMirrorArticle.SelectedValue)) + + For Each objCategory As CategoryInfo In objCategories + For Each item As ListItem In lstCategories.Items + If (objCategory.Name.ToLower() = item.Text.TrimStart("."c).ToLower()) Then + item.Selected = True + End If + Next + Next + End If + + For Each item As ListItem In lstCategories.Items + If (item.Selected) Then + objArticleController.AddArticleCategory(articleID, Int32.Parse(item.Value)) + End If + Next + + DataCache.RemoveCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & articleID.ToString()) + DataCache.RemoveCache(ArticleConstants.CACHE_CATEGORY_ARTICLE_NO_LINK & articleID.ToString()) + + End Sub + + Private Sub SaveTags(ByVal articleID As Integer) + + If (chkMirrorArticle.Checked And drpMirrorArticle.Items.Count > 0) Then + Dim objArticleController As New ArticleController() + Dim objLinkedArticle As ArticleInfo = objArticleController.GetArticle(Convert.ToInt32(drpMirrorArticle.SelectedValue)) + + If (objLinkedArticle IsNot Nothing) Then + txtTags.Text = objLinkedArticle.Tags + 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 + + objTagController.Add(articleID, objTag.TagID) + End If + Next + End If + + End Sub + + Private Sub SaveDetails(ByVal articleID As Integer, ByVal title As String) + + If (chkMirrorArticle.Checked And drpMirrorArticle.Items.Count > 0) Then + Dim objPageController As PageController = New PageController + Dim pages As ArrayList = objPageController.GetPageList(Convert.ToInt32(drpMirrorArticle.SelectedValue)) + + For Each objPage As PageInfo In pages + objPage.ArticleID = articleID + objPageController.AddPage(objPage) + Next + Else + Dim doUpdate As Boolean = True + If (phMirrorText.Visible = True) Then + Dim objMirrorArticleController As New MirrorArticleController + Dim objMirrorArticleInfo As MirrorArticleInfo = objMirrorArticleController.GetMirrorArticle(_articleID) + + If (objMirrorArticleInfo IsNot Nothing) Then + + If (objMirrorArticleInfo.AutoUpdate) Then + doUpdate = False + End If + End If + End If + + If (doUpdate) Then + If (Details.Text.Trim() <> "") Then + Dim objPageController As PageController = New PageController + Dim pages As ArrayList = objPageController.GetPageList(articleID) + + If (pages.Count > 0) Then + Dim objPage As PageInfo = CType(pages(0), PageInfo) + objPage.PageText = Details.Text + objPageController.UpdatePage(objPage) + Else + Dim objPage As New PageInfo + objPage.PageText = Details.Text + objPage.ArticleID = articleID + objPage.Title = txtTitle.Text + objPageController.AddPage(objPage) + End If + Else + Dim objPageController As PageController = New PageController + Dim pages As ArrayList = objPageController.GetPageList(articleID) + + If (pages.Count = 1) Then + objPageController.DeletePage(CType(pages(0), PageInfo).PageID) + End If + End If + End If + End If + + End Sub + + Private Sub SaveCustomFields(ByVal articleID As Integer) + + Dim fieldsToUpdate As New Hashtable + + Dim objCustomFieldController As New CustomFieldController() + Dim objCustomFields As ArrayList = objCustomFieldController.List(Me.ModuleId) + + If (phCustomFields.Visible) Then + + For Each item As RepeaterItem In rptCustomFields.Items + Dim phValue As PlaceHolder = CType(item.FindControl("phValue"), PlaceHolder) + + If Not (phValue Is Nothing) Then + If (phValue.Controls.Count > 0) Then + + Dim objControl As System.Web.UI.Control = phValue.Controls(0) + Dim customFieldID As Integer = Convert.ToInt32(objControl.ID) + + For Each objCustomField As CustomFieldInfo In objCustomFields + If (objCustomField.CustomFieldID = customFieldID) Then + Select Case objCustomField.FieldType + + Case CustomFieldType.OneLineTextBox + Dim objTextBox As TextBox = CType(objControl, TextBox) + fieldsToUpdate.Add(customFieldID.ToString(), objTextBox.Text) + + Case CustomFieldType.MultiLineTextBox + Dim objTextBox As TextBox = CType(objControl, TextBox) + fieldsToUpdate.Add(customFieldID.ToString(), objTextBox.Text) + + Case CustomFieldType.RichTextBox + Dim objTextBox As TextEditor = CType(objControl, TextEditor) + fieldsToUpdate.Add(customFieldID.ToString(), objTextBox.Text) + + Case CustomFieldType.DropDownList + Dim objDropDownList As DropDownList = CType(objControl, DropDownList) + If (objDropDownList.SelectedValue = "-1") Then + fieldsToUpdate.Add(customFieldID.ToString(), "") + Else + fieldsToUpdate.Add(customFieldID.ToString(), objDropDownList.SelectedValue) + End If + + Case CustomFieldType.CheckBox + Dim objCheckBox As CheckBox = CType(objControl, CheckBox) + fieldsToUpdate.Add(customFieldID.ToString(), objCheckBox.Checked.ToString()) + + Case CustomFieldType.MultiCheckBox + Dim objCheckBoxList As CheckBoxList = CType(objControl, CheckBoxList) + Dim values As String = "" + For Each objCheckBox As ListItem In objCheckBoxList.Items + If (objCheckBox.Selected) Then + If (values = "") Then + values = objCheckBox.Value + Else + values = values & "|" & objCheckBox.Value + End If + End If + Next + fieldsToUpdate.Add(customFieldID.ToString(), values) + + Case CustomFieldType.RadioButton + Dim objRadioButtonList As RadioButtonList = CType(objControl, RadioButtonList) + fieldsToUpdate.Add(customFieldID.ToString(), objRadioButtonList.SelectedValue) + + Case CustomFieldType.ColorPicker + Dim objTextBox As TextBox = CType(objControl, TextBox) + fieldsToUpdate.Add(customFieldID.ToString(), objTextBox.Text) + + End Select + + Exit For + End If + Next + + End If + End If + Next + + End If + + If (chkMirrorArticle.Checked And drpMirrorArticle.Items.Count > 0) Then + + Dim objArticleController As New ArticleController() + Dim objLinkedArticle As ArticleInfo = objArticleController.GetArticle(Convert.ToInt32(drpMirrorArticle.SelectedValue)) + + If (objLinkedArticle IsNot Nothing) Then + + Dim objCustomFieldsLinked As ArrayList = objCustomFieldController.List(Convert.ToInt32(drpMirrorModule.SelectedValue.Split("-"c)(1))) + + For Each objCustomFieldLinked As CustomFieldInfo In objCustomFieldsLinked + For Each objCustomField As CustomFieldInfo In objCustomFields + + If (objCustomFieldLinked.Name.ToLower() = objCustomField.Name.ToLower()) Then + + If (objLinkedArticle.CustomList.Contains(objCustomFieldLinked.CustomFieldID)) Then + fieldsToUpdate.Add(objCustomField.CustomFieldID.ToString(), objLinkedArticle.CustomList(objCustomFieldLinked.CustomFieldID).ToString()) + End If + + End If + + Next + Next + + End If + + End If + + For Each key As String In fieldsToUpdate.Keys + Dim val As String = fieldsToUpdate(key).ToString() + + Dim objCustomValueController As New CustomValueController + Dim objCustomValue As CustomValueInfo = objCustomValueController.GetByCustomField(articleID, Convert.ToInt32(key)) + + If (objCustomValue IsNot Nothing) Then + objCustomValueController.Delete(articleID, Convert.ToInt32(key)) + End If + + objCustomValue = New CustomValueInfo + objCustomValue.CustomFieldID = Convert.ToInt32(key) + objCustomValue.CustomValue = val + objCustomValue.ArticleID = articleID + objCustomValueController.Add(objCustomValue) + Next + + End Sub + + Private Sub SetVisibility() + + trCategories.Visible = ArticleSettings.IsCategoriesEnabled + + If (lstCategories.Items.Count = 0 Or trCategories.Visible = False) Then + Dim objTagController As New TagController() + Dim objTags As ArrayList = objTagController.List(Me.ModuleId, 10) + If (objTags.Count = 0) Then + phOrganize.Visible = False + End If + End If + + If (lstCategories.Items.Count = 0) Then + trCategories.Visible = False + End If + + phExcerpt.Visible = ArticleSettings.IsExcerptEnabled + phMeta.Visible = ArticleSettings.IsMetaEnabled + If (phCustomFields.Visible) Then + phCustomFields.Visible = ArticleSettings.IsCustomEnabled + End If + + trLink.Visible = ArticleSettings.IsLinkEnabled + trNewWindow.Visible = ArticleSettings.IsLinkEnabled + + phAttachment.Visible = (trLink.Visible Or trNewWindow.Visible) + + trFeatured.Visible = ArticleSettings.IsFeaturedEnabled + trSecure.Visible = ArticleSettings.IsSecureEnabled + trPublish.Visible = ArticleSettings.IsPublishEnabled + trExpiry.Visible = ArticleSettings.IsExpiryEnabled + + phPublish.Visible = (trAuthor.Visible Or trFeatured.Visible Or trSecure.Visible Or trPublish.Visible Or trExpiry.Visible) + + drpStatus.Enabled = ArticleSettings.IsApprover + + If (_articleID <> Null.NullInteger) Then + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(_articleID) + + If Not (objArticle Is Nothing) Then + Select Case objArticle.Status + Case StatusType.Draft + cmdSaveArticle.Visible = True + cmdPublishArticle.Visible = True + cmdAddEditPages.Visible = True + cmdDelete.Visible = True + Return + + Case StatusType.AwaitingApproval + cmdSaveArticle.Visible = True + cmdPublishArticle.Visible = False + cmdAddEditPages.Visible = True + cmdDelete.Visible = True + Return + + Case StatusType.Published + cmdSaveArticle.Visible = True + cmdPublishArticle.Visible = False + cmdAddEditPages.Visible = True + cmdDelete.Visible = True + Return + End Select + End If + Else + cmdSaveArticle.Visible = True + cmdPublishArticle.Visible = True + cmdAddEditPages.Visible = True + cmdDelete.Visible = False + End If + + End Sub + + Private Sub SetTextEditor() + + Me.txtExcerptBasic.Visible = (ArticleSettings.TextEditorSummaryMode = Components.Types.TextEditorModeType.Basic) + Me.txtExcerptRich.Visible = (ArticleSettings.TextEditorSummaryMode = Components.Types.TextEditorModeType.Rich) + + 'dshExcerpt.IsExpanded = ArticleSettings.ExpandSummary + 'dshMeta.IsExpanded = ArticleSettings.ExpandMetaInformation + + txtExcerptBasic.Width = Unit.Parse(ArticleSettings.TextEditorSummaryWidth) + Me.txtExcerptBasic.Height = Unit.Parse(ArticleSettings.TextEditorSummaryHeight) + Me.ExcerptRich.Width = Unit.Parse(ArticleSettings.TextEditorSummaryWidth) + Me.ExcerptRich.Height = Unit.Parse(ArticleSettings.TextEditorSummaryHeight) + + Me.Details.Width = Unit.Parse(ArticleSettings.TextEditorWidth) + Me.Details.Height = Unit.Parse(ArticleSettings.TextEditorHeight) + + Me.lstCategories.Height = Unit.Parse(ArticleSettings.CategorySelectionHeight.ToString()) + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init + + Try + + ReadQueryString() + + Dim script As String = "" & vbCrLf _ + & "" & vbCrLf + + Dim CSM As ClientScriptManager = Page.ClientScript + CSM.RegisterClientScriptBlock(Me.GetType, "ColorPicker", script) + + BindCustomFields() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + Try + + Dim objModuleController As ModuleController = New ModuleController + Dim objModule As ModuleInfo = objModuleController.GetModule(Me.ModuleId, Me.TabId) + + If Not (objModule Is Nothing) Then + trAuthor.Visible = (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Edit, "EDIT", ModuleConfiguration) Or ArticleSettings.IsApprover) + End If + + cmdExpiryCalendar.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtExpiryDate) + cmdPublishCalendar.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtPublishDate) + + CheckSecurity() + SetTextEditor() + + If (_articleID <> Null.NullInteger) Then + For Each key As String In _richTextValues + For Each item As RepeaterItem In rptCustomFields.Items + If Not (item.FindControl(key) Is Nothing) Then + Dim objTextBox As TextEditor = CType(item.FindControl(key), TextEditor) + objTextBox.Text = _richTextValues(key) + Exit For + End If + Next + Next + End If + + If IsPostBack = False Then + + BindStatus() + BindCategories() + SetVisibility() + BindArticle() + + If (ArticleSettings.ContentSharingPortals = "" Or _articleID <> Null.NullInteger) Then + phMirror.Visible = False + End If + + Page.SetFocus(txtTitle) + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub Page_PreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PreRender + + Try + + trNewWindow.Visible = (trLink.Visible And (UrlLink.UrlType <> "N")) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub rptCustomFields_OnItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptCustomFields.ItemDataBound + + If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then + + Dim objArticleController As New ArticleController() + Dim objArticle As ArticleInfo = Nothing + If (_articleID <> Null.NullInteger) Then + objArticle = objArticleController.GetArticle(_articleID) + End If + + Dim objCustomField As CustomFieldInfo = CType(e.Item.DataItem, CustomFieldInfo) + Dim phValue As PlaceHolder = CType(e.Item.FindControl("phValue"), PlaceHolder) + Dim phLabel As PlaceHolder = CType(e.Item.FindControl("phLabel"), PlaceHolder) + + Dim cmdHelp As LinkButton = CType(e.Item.FindControl("cmdHelp"), LinkButton) + Dim pnlHelp As Panel = CType(e.Item.FindControl("pnlHelp"), Panel) + Dim lblLabel As Label = CType(e.Item.FindControl("lblLabel"), Label) + Dim lblHelp As Label = CType(e.Item.FindControl("lblHelp"), Label) + Dim imgHelp As Image = CType(e.Item.FindControl("imgHelp"), Image) + + Dim trItem As HtmlControls.HtmlTableRow = CType(e.Item.FindControl("trItem"), HtmlControls.HtmlTableRow) + + If Not (phValue Is Nothing) Then + + DotNetNuke.UI.Utilities.DNNClientAPI.EnableMinMax(cmdHelp, pnlHelp, True, DotNetNuke.UI.Utilities.DNNClientAPI.MinMaxPersistanceType.None) + + If (objCustomField.IsRequired) Then + lblLabel.Text = objCustomField.Caption & "*:" + Else + lblLabel.Text = objCustomField.Caption & ":" + End If + lblHelp.Text = objCustomField.CaptionHelp + imgHelp.AlternateText = objCustomField.CaptionHelp + + Select Case (objCustomField.FieldType) + + Case CustomFieldType.OneLineTextBox + + Dim objTextBox As New TextBox + objTextBox.CssClass = "NormalTextBox" + objTextBox.ID = objCustomField.CustomFieldID.ToString() + If (objCustomField.Length <> Null.NullInteger AndAlso objCustomField.Length > 0) Then + objTextBox.MaxLength = objCustomField.Length + End If + If (objCustomField.DefaultValue <> "") Then + objTextBox.Text = objCustomField.DefaultValue + End If + If Not (objArticle Is Nothing) Then + If (objArticle.CustomList.Contains(objCustomField.CustomFieldID) And (Page.IsPostBack = False Or objTextBox.Enabled = False)) Then + objTextBox.Text = objArticle.CustomList(objCustomField.CustomFieldID).ToString() + End If + End If + objTextBox.Width = Unit.Pixel(300) + phValue.Controls.Add(objTextBox) + + If (objCustomField.IsRequired) Then + Dim valRequired As New RequiredFieldValidator + valRequired.ControlToValidate = objTextBox.ID + valRequired.ErrorMessage = Localization.GetString("valFieldRequired", Me.LocalResourceFile).Replace("[CUSTOMFIELD]", objCustomField.Name) + valRequired.CssClass = "NormalRed" + valRequired.Display = ValidatorDisplay.None + valRequired.SetFocusOnError = True + phValue.Controls.Add(valRequired) + End If + + If (objCustomField.ValidationType <> CustomFieldValidationType.None) Then + Dim valCompare As New CompareValidator + valCompare.ControlToValidate = objTextBox.ID + valCompare.CssClass = "NormalRed" + valCompare.Display = ValidatorDisplay.None + valCompare.SetFocusOnError = True + Select Case objCustomField.ValidationType + + Case CustomFieldValidationType.Currency + valCompare.Type = ValidationDataType.Double + valCompare.Operator = ValidationCompareOperator.DataTypeCheck + valCompare.ErrorMessage = Localization.GetString("valFieldCurrency", Me.LocalResourceFile).Replace("[CUSTOMFIELD]", objCustomField.Name) + phValue.Controls.Add(valCompare) + + Case CustomFieldValidationType.Date + valCompare.Type = ValidationDataType.Date + valCompare.Operator = ValidationCompareOperator.DataTypeCheck + valCompare.ErrorMessage = Localization.GetString("valFieldDate", Me.LocalResourceFile).Replace("[CUSTOMFIELD]", objCustomField.Name) + phValue.Controls.Add(valCompare) + + Dim objCalendar As New HyperLink + objCalendar.CssClass = "CommandButton" + objCalendar.Text = Localization.GetString("Calendar", Me.LocalResourceFile) + objCalendar.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(objTextBox) + phValue.Controls.Add(objCalendar) + + Case CustomFieldValidationType.Double + valCompare.Type = ValidationDataType.Double + valCompare.Operator = ValidationCompareOperator.DataTypeCheck + valCompare.ErrorMessage = Localization.GetString("valFieldDecimal", Me.LocalResourceFile).Replace("[CUSTOMFIELD]", objCustomField.Name) + phValue.Controls.Add(valCompare) + + Case CustomFieldValidationType.Integer + valCompare.Type = ValidationDataType.Integer + valCompare.Operator = ValidationCompareOperator.DataTypeCheck + valCompare.ErrorMessage = Localization.GetString("valFieldNumber", Me.LocalResourceFile).Replace("[CUSTOMFIELD]", objCustomField.Name) + phValue.Controls.Add(valCompare) + + Case CustomFieldValidationType.Email + Dim valRegular As New RegularExpressionValidator + valRegular.ControlToValidate = objTextBox.ID + valRegular.ValidationExpression = "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" + valRegular.ErrorMessage = Localization.GetString("valFieldEmail", Me.LocalResourceFile).Replace("[CUSTOMFIELD]", objCustomField.Name) + valRegular.CssClass = "NormalRed" + valRegular.Display = ValidatorDisplay.None + phValue.Controls.Add(valRegular) + + Case CustomFieldValidationType.Regex + If (objCustomField.RegularExpression <> "") Then + Dim valRegular As New RegularExpressionValidator + valRegular.ControlToValidate = objTextBox.ID + valRegular.ValidationExpression = objCustomField.RegularExpression + valRegular.ErrorMessage = Localization.GetString("valFieldRegex", Me.LocalResourceFile).Replace("[CUSTOMFIELD]", objCustomField.Name) + valRegular.CssClass = "NormalRed" + valRegular.Display = ValidatorDisplay.None + phValue.Controls.Add(valRegular) + End If + + End Select + End If + + Case CustomFieldType.MultiLineTextBox + + Dim objTextBox As New TextBox + objTextBox.TextMode = TextBoxMode.MultiLine + objTextBox.CssClass = "NormalTextBox" + objTextBox.ID = objCustomField.CustomFieldID.ToString() + objTextBox.Rows = 4 + If (objCustomField.Length <> Null.NullInteger AndAlso objCustomField.Length > 0) Then + objTextBox.MaxLength = objCustomField.Length + End If + If (objCustomField.DefaultValue <> "") Then + objTextBox.Text = objCustomField.DefaultValue + End If + If Not (objArticle Is Nothing) Then + If (objArticle.CustomList.Contains(objCustomField.CustomFieldID) And (Page.IsPostBack = False Or objTextBox.Enabled = False)) Then + objTextBox.Text = objArticle.CustomList(objCustomField.CustomFieldID).ToString() + End If + End If + objTextBox.Width = Unit.Pixel(300) + phValue.Controls.Add(objTextBox) + + If (objCustomField.IsRequired) Then + Dim valRequired As New RequiredFieldValidator + valRequired.ControlToValidate = objTextBox.ID + valRequired.ErrorMessage = Localization.GetString("valFieldRequired", Me.LocalResourceFile).Replace("[CUSTOMFIELD]", objCustomField.Name) + valRequired.CssClass = "NormalRed" + valRequired.Display = ValidatorDisplay.None + valRequired.SetFocusOnError = True + phValue.Controls.Add(valRequired) + End If + + Case CustomFieldType.RichTextBox + + Dim objTextBox As TextEditor = CType(Me.LoadControl("~/controls/TextEditor.ascx"), TextEditor) + objTextBox.ID = objCustomField.CustomFieldID.ToString() + If (objCustomField.DefaultValue <> "") Then + ' objTextBox.Text = objCustomField.DefaultValue + End If + If Not (objArticle Is Nothing) Then + If (objArticle.CustomList.Contains(objCustomField.CustomFieldID) And Page.IsPostBack = False) Then + ' There is a problem assigned values at init with the RTE, using ArrayList to assign later. + _richTextValues.Add(objCustomField.CustomFieldID.ToString(), objArticle.CustomList(objCustomField.CustomFieldID).ToString()) + End If + End If + objTextBox.Width = Unit.Pixel(300) + objTextBox.Height = Unit.Pixel(400) + + phValue.Controls.Add(objTextBox) + + If (objCustomField.IsRequired) Then + Dim valRequired As New RequiredFieldValidator + valRequired.ControlToValidate = objTextBox.ID + valRequired.ErrorMessage = Localization.GetString("valFieldRequired", Me.LocalResourceFile).Replace("[CUSTOMFIELD]", objCustomField.Name) + valRequired.CssClass = "NormalRed" + valRequired.SetFocusOnError = True + phValue.Controls.Add(valRequired) + End If + + Case CustomFieldType.DropDownList + + Dim objDropDownList As New DropDownList + objDropDownList.CssClass = "NormalTextBox" + objDropDownList.ID = objCustomField.CustomFieldID.ToString() + + Dim values As String() = objCustomField.FieldElements.Split(Convert.ToChar("|")) + For Each value As String In values + If (value <> "") Then + objDropDownList.Items.Add(value) + End If + Next + + Dim selectText As String = Localization.GetString("SelectValue", Me.LocalResourceFile) + selectText = selectText.Replace("[VALUE]", objCustomField.Caption) + objDropDownList.Items.Insert(0, New ListItem(selectText, "-1")) + + If (objCustomField.DefaultValue <> "") Then + If Not (objDropDownList.Items.FindByValue(objCustomField.DefaultValue) Is Nothing) Then + objDropDownList.SelectedValue = objCustomField.DefaultValue + End If + End If + + objDropDownList.Width = Unit.Pixel(300) + + If Not (objArticle Is Nothing) Then + If (objArticle.CustomList.Contains(objCustomField.CustomFieldID) And (Page.IsPostBack = False Or objDropDownList.Enabled = False)) Then + If Not (objDropDownList.Items.FindByValue(objArticle.CustomList(objCustomField.CustomFieldID).ToString()) Is Nothing) Then + objDropDownList.SelectedValue = objArticle.CustomList(objCustomField.CustomFieldID).ToString() + End If + End If + End If + phValue.Controls.Add(objDropDownList) + + If (objCustomField.IsRequired) Then + Dim valRequired As New RequiredFieldValidator + valRequired.ControlToValidate = objDropDownList.ID + valRequired.ErrorMessage = Localization.GetString("valFieldRequired", Me.LocalResourceFile).Replace("[CUSTOMFIELD]", objCustomField.Name) + valRequired.CssClass = "NormalRed" + valRequired.Display = ValidatorDisplay.None + valRequired.SetFocusOnError = True + valRequired.InitialValue = "-1" + phValue.Controls.Add(valRequired) + End If + + Case CustomFieldType.CheckBox + + Dim objCheckBox As New CheckBox + objCheckBox.CssClass = "Normal" + objCheckBox.ID = objCustomField.CustomFieldID.ToString() + If (objCustomField.DefaultValue <> "") Then + Try + objCheckBox.Checked = Convert.ToBoolean(objCustomField.DefaultValue) + Catch + End Try + End If + + If Not (objArticle Is Nothing) Then + If (objArticle.CustomList.Contains(objCustomField.CustomFieldID) And (Page.IsPostBack = False Or objCheckBox.Enabled = False)) Then + If (objArticle.CustomList(objCustomField.CustomFieldID).ToString() <> "") Then + Try + objCheckBox.Checked = Convert.ToBoolean(objArticle.CustomList(objCustomField.CustomFieldID).ToString()) + Catch + End Try + End If + End If + End If + phValue.Controls.Add(objCheckBox) + + Case CustomFieldType.MultiCheckBox + + Dim objCheckBoxList As New CheckBoxList + objCheckBoxList.CssClass = "Normal" + objCheckBoxList.ID = objCustomField.CustomFieldID.ToString() + objCheckBoxList.RepeatColumns = 4 + objCheckBoxList.RepeatDirection = RepeatDirection.Horizontal + objCheckBoxList.RepeatLayout = RepeatLayout.Table + + Dim values As String() = objCustomField.FieldElements.Split(Convert.ToChar("|")) + For Each value As String In values + objCheckBoxList.Items.Add(value) + Next + + If (objCustomField.DefaultValue <> "") Then + Dim vals As String() = objCustomField.DefaultValue.Split(Convert.ToChar("|")) + For Each val As String In vals + For Each item As ListItem In objCheckBoxList.Items + If (item.Value = val) Then + item.Selected = True + End If + Next + Next + End If + + If Not (objArticle Is Nothing) Then + If (objArticle.CustomList.Contains(objCustomField.CustomFieldID) And (Page.IsPostBack = False Or objCheckBoxList.Enabled = False)) Then + Dim vals As String() = objArticle.CustomList(objCustomField.CustomFieldID).ToString().Split(Convert.ToChar("|")) + For Each val As String In vals + For Each item As ListItem In objCheckBoxList.Items + If (item.Value = val) Then + item.Selected = True + End If + Next + Next + End If + End If + + phValue.Controls.Add(objCheckBoxList) + + Case CustomFieldType.RadioButton + + Dim objRadioButtonList As New RadioButtonList + objRadioButtonList.CssClass = "Normal" + objRadioButtonList.ID = objCustomField.CustomFieldID.ToString() + objRadioButtonList.RepeatDirection = RepeatDirection.Horizontal + objRadioButtonList.RepeatLayout = RepeatLayout.Table + objRadioButtonList.RepeatColumns = 4 + + Dim values As String() = objCustomField.FieldElements.Split(Convert.ToChar("|")) + For Each value As String In values + objRadioButtonList.Items.Add(value) + Next + + If (objCustomField.DefaultValue <> "") Then + If Not (objRadioButtonList.Items.FindByValue(objCustomField.DefaultValue) Is Nothing) Then + objRadioButtonList.SelectedValue = objCustomField.DefaultValue + End If + End If + + If Not (objArticle Is Nothing) Then + If (objArticle.CustomList.Contains(objCustomField.CustomFieldID) And (Page.IsPostBack = False Or objRadioButtonList.Enabled = False)) Then + If Not (objRadioButtonList.Items.FindByValue(objArticle.CustomList(objCustomField.CustomFieldID).ToString()) Is Nothing) Then + objRadioButtonList.SelectedValue = objArticle.CustomList(objCustomField.CustomFieldID).ToString() + End If + End If + End If + + phValue.Controls.Add(objRadioButtonList) + + If (objCustomField.IsRequired) Then + Dim valRequired As New RequiredFieldValidator + valRequired.ControlToValidate = objRadioButtonList.ID + valRequired.ErrorMessage = Localization.GetString("valFieldRequired", Me.LocalResourceFile).Replace("[CUSTOMFIELD]", objCustomField.Name) + valRequired.CssClass = "NormalRed" + valRequired.Display = ValidatorDisplay.None + valRequired.SetFocusOnError = True + phValue.Controls.Add(valRequired) + End If + + Case CustomFieldType.ColorPicker + + Dim objTextBox As New TextBox + objTextBox.CssClass = "NormalTextBox" + objTextBox.ID = objCustomField.CustomFieldID.ToString() + If (objCustomField.Length <> Null.NullInteger AndAlso objCustomField.Length > 0) Then + objTextBox.MaxLength = objCustomField.Length + End If + If (objCustomField.DefaultValue <> "") Then + objTextBox.Text = objCustomField.DefaultValue + End If + If Not (objArticle Is Nothing) Then + If (objArticle.CustomList.Contains(objCustomField.CustomFieldID) And (Page.IsPostBack = False Or objTextBox.Enabled = False)) Then + objTextBox.Text = objArticle.CustomList(objCustomField.CustomFieldID).ToString() + End If + End If + phValue.Controls.Add(objTextBox) + + If (objCustomField.IsRequired) Then + Dim valRequired As New RequiredFieldValidator + valRequired.ControlToValidate = objTextBox.ID + valRequired.ErrorMessage = Localization.GetString("valFieldRequired", Me.LocalResourceFile).Replace("[CUSTOMFIELD]", objCustomField.Name) + valRequired.CssClass = "NormalRed" + valRequired.Display = ValidatorDisplay.None + valRequired.SetFocusOnError = True + phValue.Controls.Add(valRequired) + End If + + Dim script As String = "" _ + & "" + + Dim CSM As ClientScriptManager = Page.ClientScript + CSM.RegisterClientScriptBlock(Me.GetType, "Picker" + objTextBox.ID, script) + + End Select + + End If + + End If + + End Sub + + Private Sub cmdSaveArticle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSaveArticle.Click + + Try + + If (Page.IsValid) Then + Dim objStatusType As StatusType = CType(System.Enum.Parse(GetType(StatusType), drpStatus.SelectedValue), StatusType) + Dim articleID As Integer = SaveArticle(objStatusType) + + If (objStatusType = StatusType.Draft) Then + Response.Redirect(Common.GetModuleLink(Me.TabId, Me.ModuleId, "MyArticles", ArticleSettings), True) + End If + + If (objStatusType = StatusType.AwaitingApproval) Then + + End If + + If (objStatusType = StatusType.Published) Then + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(articleID) + + If Not (objArticle Is Nothing) Then + If (_returnUrl <> "") Then + Response.Redirect(_returnUrl, True) + Else + Response.Redirect(Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), True) + End If + End If + End If + + If (_returnUrl <> "") Then + Response.Redirect(_returnUrl, True) + Else + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "", ArticleSettings), True) + End If + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdPublishArticle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPublishArticle.Click + + Try + + If (Page.IsValid) Then + If (ArticleSettings.IsApprover Or ArticleSettings.IsAutoApprover) Then + Dim articleID As Integer = SaveArticle(StatusType.Published) + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(articleID) + + If Not (objArticle Is Nothing) Then + Response.Redirect(Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), True) + Else + Response.Redirect(NavigateURL(), True) + End If + Else + Dim articleID As Integer = SaveArticle(StatusType.AwaitingApproval) + + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(articleID) + + If Not (objArticle Is Nothing) Then + If (Settings.Contains(ArticleConstants.NOTIFY_SUBMISSION_SETTING)) Then + If (Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_SUBMISSION_SETTING)) = True) Then + Dim objEmailTemplateController As New EmailTemplateController + Dim emails As String = objEmailTemplateController.GetApproverDistributionList(ModuleId) + + For Each email As String In emails.Split(Convert.ToChar(";")) + If (email <> "") Then + objEmailTemplateController.SendFormattedEmail(Me.ModuleId, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), objArticle, EmailTemplateType.ArticleSubmission, email, ArticleSettings) + End If + Next + End If + End If + + If (Settings.Contains(ArticleConstants.NOTIFY_SUBMISSION_SETTING_EMAIL)) Then + If (Settings(ArticleConstants.NOTIFY_SUBMISSION_SETTING_EMAIL).ToString() <> "") Then + Dim objEmailTemplateController As New EmailTemplateController + For Each email As String In Settings(ArticleConstants.NOTIFY_SUBMISSION_SETTING_EMAIL).ToString().Split(","c) + objEmailTemplateController.SendFormattedEmail(Me.ModuleId, Common.GetArticleLink(objArticle, PortalSettings.ActiveTab, ArticleSettings, False), objArticle, EmailTemplateType.ArticleSubmission, email, ArticleSettings) + Next + End If + End If + End If + + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "SubmitNewsComplete", ArticleSettings), True) + End If + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelete.Click + + Try + + Dim objArticleController As New ArticleController + objArticleController.DeleteArticle(_articleID, ModuleId) + If (_returnUrl <> "") Then + Response.Redirect(_returnUrl, True) + Else + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "", ArticleSettings), True) + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdAddEditPages_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddEditPages.Click + + Try + + If (Page.IsValid) Then + Dim articleID As Integer = SaveArticle() + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "EditPages", ArticleSettings, "ArticleID=" & articleID.ToString()), True) + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdSelectAuthor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSelectAuthor.Click + + Try + + cmdSelectAuthor.Visible = False + lblAuthor.Visible = False + + If (ArticleSettings.AuthorSelect = Components.Types.AuthorSelectType.ByDropdown) Then + PopulateAuthorList() + ddlAuthor.Visible = True + + If (_articleID <> Null.NullInteger) Then + + Dim objArticleController As New ArticleController + Dim objArticle As ArticleInfo = objArticleController.GetArticle(_articleID) + + If (objArticle IsNot Nothing) Then + If (ddlAuthor.Items.FindByValue(objArticle.AuthorID.ToString()) IsNot Nothing) Then + ddlAuthor.SelectedValue = objArticle.AuthorID.ToString() + End If + End If + Else + If (ArticleSettings.AuthorDefault) Then + If (ddlAuthor.Items.FindByValue(ArticleSettings.AuthorDefault) IsNot Nothing) Then + ddlAuthor.SelectedValue = ArticleSettings.AuthorDefault.ToString() + End If + End If + End If + Else + pnlAuthor.Visible = True + txtAuthor.Text = lblAuthor.Text + txtAuthor.Focus() + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click + + Try + If (_returnUrl <> "") Then + Response.Redirect(_returnUrl, True) + Else + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "", ArticleSettings), True) + End If + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub valAuthor_ServerValidate(ByVal source As System.Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles valAuthor.ServerValidate + + Try + + args.IsValid = False + + If (txtAuthor.Text <> "") Then + Dim objUser As UserInfo = UserController.GetUserByName(Me.PortalId, txtAuthor.Text) + + If (objUser IsNot Nothing) Then + args.IsValid = True + End If + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub chkMirrorArticle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkMirrorArticle.CheckedChanged + + Try + + phCreate.Visible = Not chkMirrorArticle.Checked + trMirrorModule.Visible = chkMirrorArticle.Checked + trMirrorArticle.Visible = chkMirrorArticle.Checked + trMirrorAutoUpdate.Visible = chkMirrorArticle.Checked + + If (chkMirrorArticle.Checked) Then + + drpMirrorModule.Items.Clear() + drpMirrorModule.DataSource = GetContentSharingPortals(ArticleSettings.ContentSharingPortals) + drpMirrorModule.DataBind() + + If (drpMirrorModule.Items.Count > 0) Then + + Dim objArticleController As New ArticleController() + drpMirrorArticle.DataSource = objArticleController.GetArticleList(Convert.ToInt32(drpMirrorModule.SelectedValue.Split("-"c)(1)), True, "StartDate") + drpMirrorArticle.DataBind() + + End If + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub drpMirrorModule_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drpMirrorModule.SelectedIndexChanged + + Try + + Dim objArticleController As New ArticleController() + drpMirrorArticle.DataSource = objArticleController.GetArticleList(Convert.ToInt32(drpMirrorModule.SelectedValue.Split("-"c)(1)), True, "StartDate") + drpMirrorArticle.DataBind() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Function GetContentSharingPortals(ByVal linkedPortals As String) As List(Of ContentSharingInfo) + + Dim objPortalController As New PortalController() + Dim objContentSharingPortals As New List(Of ContentSharingInfo) + + For Each element As String In linkedPortals.Split(","c) + + If (element.Split("-"c).Length = 3) Then + + Dim objContentSharing As New ContentSharingInfo + + objContentSharing.LinkedPortalID = Convert.ToInt32(element.Split("-")(0)) + objContentSharing.LinkedTabID = Convert.ToInt32(element.Split("-")(1)) + objContentSharing.LinkedModuleID = Convert.ToInt32(element.Split("-")(2)) + + Dim objTabController As New TabController + Dim objTab As TabInfo = objTabController.GetTab(objContentSharing.LinkedTabID, objContentSharing.LinkedPortalID, False) + + If (objTab IsNot Nothing) Then + objContentSharing.TabTitle = objTab.TabName + End If + + Dim objModuleController As New ModuleController + Dim objModule As ModuleInfo = objModuleController.GetModule(objContentSharing.LinkedModuleID, objContentSharing.LinkedTabID) + + If (objModule IsNot Nothing) Then + objContentSharing.ModuleTitle = objModule.ModuleTitle + objContentSharingPortals.Add(objContentSharing) + End If + + End If + + Next + + Return objContentSharingPortals + + End Function + +#End Region + + End Class + +End Namespace diff --git a/ucSubmitNewsComplete.ascx b/ucSubmitNewsComplete.ascx new file mode 100755 index 0000000..880295e --- /dev/null +++ b/ucSubmitNewsComplete.ascx @@ -0,0 +1,16 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucSubmitNewsComplete.ascx.vb" Inherits="ucSubmitNewsComplete" %> +<%@ Import Namespace="DotNetNuke.Common" %> +<%@ Import Namespace="DotNetNuke.Common.Utilities" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + + +

      + +
        +
      • +
      • +
      • +
      + + diff --git a/ucSubmitNewsComplete.ascx.designer.vb b/ucSubmitNewsComplete.ascx.designer.vb new file mode 100755 index 0000000..d6e99cb --- /dev/null +++ b/ucSubmitNewsComplete.ascx.designer.vb @@ -0,0 +1,71 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucSubmitNewsComplete + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''lblSubmitComplete control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblSubmitComplete As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdSubmitArticle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdSubmitArticle As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdViewMyArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdViewMyArticles As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdCurrentArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdCurrentArticles As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''Header1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Header1 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucSubmitNewsComplete.ascx.vb b/ucSubmitNewsComplete.ascx.vb new file mode 100755 index 0000000..ec93eec --- /dev/null +++ b/ucSubmitNewsComplete.ascx.vb @@ -0,0 +1,40 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports DotNetNuke.Common + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucSubmitNewsComplete + Inherits NewsArticleModuleBase + +#Region " Event Handlers " + + Private Sub cmdSubmitArticle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmitArticle.Click + + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "SubmitNews", ArticleSettings), True) + + End Sub + + Private Sub cmdViewMyArticles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdViewMyArticles.Click + + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "MyArticles", ArticleSettings), True) + + End Sub + + Private Sub cmdCurrentArticles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCurrentArticles.Click + + Response.Redirect(Common.GetModuleLink(TabId, ModuleId, "", ArticleSettings), True) + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/ucTemplateEditor.ascx b/ucTemplateEditor.ascx new file mode 100755 index 0000000..0370649 --- /dev/null +++ b/ucTemplateEditor.ascx @@ -0,0 +1,120 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucTemplateEditor.ascx.vb" Inherits="Ventrian.NewsArticles.ucTemplateEditor" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> +<%@ Register TagPrefix="dnn" TagName="TextEditor" Src="~/controls/TextEditor.ascx"%> +<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> + + + + + + +
      + + + + + + + + + + + + + + + + + + + + +
      +
      + +
      + + + Category.Child.Html + Category.Html + Comment.Item.Html + File.Header.Html + File.Item.Html + File.Footer.Html + Handout.Cover.Html + Handout.Header.Html + Handout.Item.Html + Handout.Footer.Html + Handout.End.Html + Image.Header.Html + Image.Item.Html + Image.Footer.Html + Listing.Header.Html + Listing.Item.Html + Listing.Featured.Html + Listing.Footer.Html + Listing.Empty.Html + Menu.Item.Html + Print.Item.Html + Related.Header.Html + Related.Item.Html + Related.Footer.Html + Rss.Header.Html + Rss.Item.Html + Rss.Footer.Html + Rss.Comment.Header.Html + Rss.Comment.Item.Html + Rss.Comment.Footer.Html + View.Item.Html + View.Title.Html + View.Description.Html + View.Keyword.Html + View.PageHeader.Html + Template.css +
      + +
      +
      + + + + + +
      +
      +
      + + + + + + + +
      + +   + + +
      +
      +

        +

      + + diff --git a/ucTemplateEditor.ascx.designer.vb b/ucTemplateEditor.ascx.designer.vb new file mode 100755 index 0000000..b94d728 --- /dev/null +++ b/ucTemplateEditor.ascx.designer.vb @@ -0,0 +1,233 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucTemplateEditor + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''lblUpdated control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblUpdated As Global.System.Web.UI.WebControls.Label + + ''' + '''pnlSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents pnlSettings As Global.System.Web.UI.WebControls.Panel + + ''' + '''dshSiteTemplates control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshSiteTemplates As Global.System.Web.UI.UserControl + + ''' + '''tblSiteTemplates control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblSiteTemplates As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblSiteTemplatesHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblSiteTemplatesHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''plTemplate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTemplate As Global.System.Web.UI.UserControl + + ''' + '''drpTemplate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpTemplate As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plFile control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plFile As Global.System.Web.UI.UserControl + + ''' + '''drpFile control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpFile As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plTemplateText control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTemplateText As Global.System.Web.UI.UserControl + + ''' + '''txtTemplate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtTemplate As Global.System.Web.UI.WebControls.TextBox + + ''' + '''dshTemplateHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshTemplateHelp As Global.System.Web.UI.UserControl + + ''' + '''tblSiteTemplateHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblSiteTemplateHelp As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblTemplateHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblTemplateHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''dshTemplateNew control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshTemplateNew As Global.System.Web.UI.UserControl + + ''' + '''tblTemplateNew control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblTemplateNew As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plNewTemplateName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plNewTemplateName As Global.System.Web.UI.UserControl + + ''' + '''txtNewTemplate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtNewTemplate As Global.System.Web.UI.WebControls.TextBox + + ''' + '''cmdCreate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdCreate As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''lblTemplateCreated control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblTemplateCreated As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdUpdate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdUpdate As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdCancel control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdCancel As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucTemplateEditor.ascx.vb b/ucTemplateEditor.ascx.vb new file mode 100755 index 0000000..2c70876 --- /dev/null +++ b/ucTemplateEditor.ascx.vb @@ -0,0 +1,219 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System.IO + +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Security + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucTemplateEditor + Inherits NewsArticleModuleBase + +#Region " Private Methods " + + Private Sub BindTemplates(ByVal selectedValue As String) + + drpTemplate.Items.Clear() + + Dim templateRoot As String = Me.MapPath("Templates") + If Directory.Exists(templateRoot) Then + Dim arrFolders() As String = Directory.GetDirectories(templateRoot) + For Each folder As String In arrFolders + Dim folderName As String = folder.Substring(folder.LastIndexOf("\") + 1) + Dim objListItem As ListItem = New ListItem + objListItem.Text = folderName + objListItem.Value = folderName + drpTemplate.Items.Add(objListItem) + Next + End If + + If Not (drpTemplate.Items.FindByValue(ArticleSettings.Template) Is Nothing) Then + drpTemplate.SelectedValue = ArticleSettings.Template + End If + + If (selectedValue <> "") Then + If Not (drpTemplate.Items.FindByValue(selectedValue) Is Nothing) Then + drpTemplate.SelectedValue = selectedValue + End If + End If + + End Sub + + Private Sub BindFile() + + Dim pathToTemplate As String = Me.MapPath("Templates/" & drpTemplate.SelectedItem.Text & "/") + Dim path As String = pathToTemplate & drpFile.SelectedItem.Text + + If (File.Exists(path) = False) Then + pathToTemplate = Me.MapPath("Templates/Standard/") + path = pathToTemplate & drpFile.SelectedItem.Text + End If + + If (File.Exists(path)) Then + Dim sr As StreamReader = New StreamReader(path) + Try + txtTemplate.Text = sr.ReadToEnd() + Catch ex As Exception + + Finally + If Not sr Is Nothing Then sr.Close() + End Try + Else + txtTemplate.Text = "" + End If + + End Sub + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + If (Me.UserInfo.IsSuperUser = False) Then + If (Settings.Contains(ArticleConstants.PERMISSION_SITE_TEMPLATES_SETTING)) Then + If (Settings(ArticleConstants.PERMISSION_SITE_TEMPLATES_SETTING).ToString() <> "") Then + If (PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_SITE_TEMPLATES_SETTING).ToString()) = False) Then + Response.Redirect(EditArticleUrl("AdminOptions"), True) + End If + Else + Response.Redirect(EditArticleUrl("AdminOptions"), True) + End If + Else + Response.Redirect(EditArticleUrl("AdminOptions"), True) + End If + End If + + If (Page.IsPostBack = False) Then + BindTemplates("") + BindFile() + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub drpTemplate_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drpTemplate.SelectedIndexChanged + + Try + + BindFile() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub drpFile_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drpFile.SelectedIndexChanged + + Try + + BindFile() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click + + Try + + Dim pathToTemplate As String = Me.MapPath("Templates/" & drpTemplate.SelectedItem.Text & "/") + Dim path As String = pathToTemplate & drpFile.SelectedItem.Text + + Dim sw As New StreamWriter(path) + Try + sw.Write(txtTemplate.Text) + Catch + Finally + If Not sw Is Nothing Then sw.Close() + End Try + + lblUpdated.Visible = True + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCreate.Click + + Try + + If (txtNewTemplate.Text <> "") Then + Dim pathToTemplate As String = Me.MapPath("Templates/" & txtNewTemplate.Text & "/") + System.IO.Directory.CreateDirectory(pathToTemplate) + + If (Directory.Exists(Me.MapPath("Templates/Standard/"))) Then + + Dim copyDirectory As DirectoryInfo = New DirectoryInfo(Me.MapPath("Templates/Standard/")) + Dim DestDir As DirectoryInfo = New DirectoryInfo(pathToTemplate) + + Dim ChildFile As System.IO.FileInfo + + For Each ChildFile In copyDirectory.GetFiles() + ChildFile.CopyTo(Path.Combine(DestDir.FullName, ChildFile.Name), True) + Next + + End If + + pathToTemplate = pathToTemplate & "Images/" + System.IO.Directory.CreateDirectory(pathToTemplate) + + If (Directory.Exists(Me.MapPath("Templates/Standard/Images/"))) Then + + Dim imagesDirectory As DirectoryInfo = New DirectoryInfo(Me.MapPath("Templates/Standard/Images/")) + Dim DestDir As DirectoryInfo = New DirectoryInfo(pathToTemplate) + + Dim ChildFile As System.IO.FileInfo + + For Each ChildFile In imagesDirectory.GetFiles() + ChildFile.CopyTo(Path.Combine(DestDir.FullName, ChildFile.Name), True) + Next + + End If + + + lblTemplateCreated.Visible = True + BindTemplates(txtNewTemplate.Text) + BindFile() + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click + + Try + + Response.Redirect(EditArticleUrl("AdminOptions"), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace \ No newline at end of file diff --git a/ucViewOptions.ascx b/ucViewOptions.ascx new file mode 100755 index 0000000..9b7cd5f --- /dev/null +++ b/ucViewOptions.ascx @@ -0,0 +1,1044 @@ +<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucViewOptions.ascx.vb" Inherits="Ventrian.NewsArticles.ucViewOptions" %> +<%@ Register TagPrefix="dnn" TagName="URL" Src="~/controls/URLControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> +<%@ Register TagPrefix="dnn" TagName="Skin" Src="~/controls/SkinControl.ascx" %> +<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Security.Permissions.Controls" Assembly="DotNetNuke" %> +<%@ Register TagPrefix="article" TagName="Header" Src="ucHeader.ascx" %> + + + + + +
      + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + +
      +
      + + + + + + + + + + + + + + + + + + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + + + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + +
      +
      + + + + + + + + + + + + + + +
      + + + +
      + + + + + + + + + + + + +
      +
      +
      + + + + + + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + +
      + +   + +
      + +
      + + +
      +
      + + + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + +
      + + + + +
      + + + +
      + + + +
      + +
      + + + +
      + + + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + +
      + + + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + +
      + +
      +
      + + + + + + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + +
      + + + + + + <%# DataBinder.Eval(Container.DataItem, "Text") %> + + + + +   +   + + + + + + + + +   +   + + + + + + + + +   +   + + + + + + + + +   +   + + + + + + + + +   +   + + + + + + + + +   +
      + +
      + + + +
      + + +   +   + + + + + + + + +   +   + + + + + + +
      +
      +
      + +
      + + + + + + <%# DataBinder.Eval(Container.DataItem, "Text") %> + + + + +   +
      + +
      + + + +
      + + +   +
      + +
      + + + +
      + + +   +
      + +
      + + + +
      + + +   +
      + +
      + + + +
      + + +   +
      + +
      + + + +
      + + +   +
      + +
      + + + +
      + + +   +
      + +
      + + + +
      + + +   +
      + +
      + + + +
      + + +   +
      + +
      + + + +
      +
      +
      + +
      + + + + + + <%# DataBinder.Eval(Container.DataItem, "Text") %> + + + + +   +
      + +
      + + + +
      +
      +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + +
      + + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + +
      + + + +
      +
      + + + + + + + + + + + + + + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + +
      + +
      + +
      +
      +
      +

      +    + +

      + + + + \ No newline at end of file diff --git a/ucViewOptions.ascx.designer.vb b/ucViewOptions.ascx.designer.vb new file mode 100755 index 0000000..7553520 --- /dev/null +++ b/ucViewOptions.ascx.designer.vb @@ -0,0 +1,2798 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Namespace Ventrian.NewsArticles + + Partial Public Class ucViewOptions + + ''' + '''ucHeader1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader1 As Global.Ventrian.NewsArticles.ucHeader + + ''' + '''dshBasic control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshBasic As Global.System.Web.UI.UserControl + + ''' + '''tblArticle control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblArticle As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblArticleSettingsHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblArticleSettingsHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''dshDetails control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshDetails As Global.System.Web.UI.UserControl + + ''' + '''tblDetails control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblDetails As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plEnableRatings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableRatings As Global.System.Web.UI.UserControl + + ''' + '''chkEnableRatingsAuthenticated control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnableRatingsAuthenticated As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plEnableAnonymousRatings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableAnonymousRatings As Global.System.Web.UI.UserControl + + ''' + '''chkEnableRatingsAnonymous control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnableRatingsAnonymous As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plEnableCoreSearch control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableCoreSearch As Global.System.Web.UI.UserControl + + ''' + '''chkEnableCoreSearch control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnableCoreSearch As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plEnableNotificationPing control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableNotificationPing As Global.System.Web.UI.UserControl + + ''' + '''chkEnableNotificationPing control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnableNotificationPing As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plEnableAutoTrackback control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableAutoTrackback As Global.System.Web.UI.UserControl + + ''' + '''chkEnableAutoTrackback control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnableAutoTrackback As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plEnableIncomingTrackback control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableIncomingTrackback As Global.System.Web.UI.UserControl + + ''' + '''chkEnableIncomingTrackback control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnableIncomingTrackback As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plLaunchLinks control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plLaunchLinks As Global.System.Web.UI.UserControl + + ''' + '''chkLaunchLinks control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkLaunchLinks As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plBubbleFeaturedArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plBubbleFeaturedArticles As Global.System.Web.UI.UserControl + + ''' + '''chkBubbleFeaturedArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkBubbleFeaturedArticles As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plProcessPostTokens control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plProcessPostTokens As Global.System.Web.UI.UserControl + + ''' + '''chkProcessPostTokens control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkProcessPostTokens As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plDisplayType control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plDisplayType As Global.System.Web.UI.UserControl + + ''' + '''drpDisplayType control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpDisplayType As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plArticlePageSize control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plArticlePageSize As Global.System.Web.UI.UserControl + + ''' + '''drpNumber control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpNumber As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plTemplate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTemplate As Global.System.Web.UI.UserControl + + ''' + '''drpTemplates control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpTemplates As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plTimeZone control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTimeZone As Global.System.Web.UI.UserControl + + ''' + '''drpTimeZone control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpTimeZone As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plSortBy control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSortBy As Global.System.Web.UI.UserControl + + ''' + '''drpSortBy control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpSortBy As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plSortDirection control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSortDirection As Global.System.Web.UI.UserControl + + ''' + '''drpSortDirection control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpSortDirection As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plMenuPosition control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plMenuPosition As Global.System.Web.UI.UserControl + + ''' + '''lstMenuPosition control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstMenuPosition As Global.System.Web.UI.WebControls.RadioButtonList + + ''' + '''dshArchive control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshArchive As Global.System.Web.UI.UserControl + + ''' + '''tblArchive control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblArchive As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''Label1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Label1 As Global.System.Web.UI.UserControl + + ''' + '''chkArchiveCurrentArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkArchiveCurrentArticles As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''Label2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Label2 As Global.System.Web.UI.UserControl + + ''' + '''chkArchiveCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkArchiveCategories As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''Label3 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Label3 As Global.System.Web.UI.UserControl + + ''' + '''chkArchiveAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkArchiveAuthor As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''Label4 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents Label4 As Global.System.Web.UI.UserControl + + ''' + '''chkArchiveMonth control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkArchiveMonth As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''dshCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshCategory As Global.System.Web.UI.UserControl + + ''' + '''tblCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblCategory As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plRequireCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plRequireCategory As Global.System.Web.UI.UserControl + + ''' + '''chkRequireCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkRequireCategory As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plDefaultCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plDefaultCategories As Global.System.Web.UI.UserControl + + ''' + '''lstDefaultCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstDefaultCategories As Global.System.Web.UI.WebControls.ListBox + + ''' + '''plCategorySelectionHeight control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plCategorySelectionHeight As Global.System.Web.UI.UserControl + + ''' + '''txtCategorySelectionHeight control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtCategorySelectionHeight As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valCategorySelectionHeight control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valCategorySelectionHeight As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''valCategorySelectionHeightIsValid control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valCategorySelectionHeightIsValid As Global.System.Web.UI.WebControls.CompareValidator + + ''' + '''plCategoryBreadcrumb control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plCategoryBreadcrumb As Global.System.Web.UI.UserControl + + ''' + '''chkCategoryBreadcrumb control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkCategoryBreadcrumb As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plCategoryName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plCategoryName As Global.System.Web.UI.UserControl + + ''' + '''chkCategoryName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkCategoryName As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plCategorySortOrder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plCategorySortOrder As Global.System.Web.UI.UserControl + + ''' + '''lstCategorySortOrder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstCategorySortOrder As Global.System.Web.UI.WebControls.RadioButtonList + + ''' + '''plCategoryFilterSubmit control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plCategoryFilterSubmit As Global.System.Web.UI.UserControl + + ''' + '''chkCategoryFilterSubmit control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkCategoryFilterSubmit As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''dshComments control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshComments As Global.System.Web.UI.UserControl + + ''' + '''tblComments control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblComments As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plEnableComments control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableComments As Global.System.Web.UI.UserControl + + ''' + '''chkEnableComments control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnableComments As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plEnableAnonymousComments control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableAnonymousComments As Global.System.Web.UI.UserControl + + ''' + '''chkEnableAnonymousComments control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnableAnonymousComments As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plEnableCommentModeration control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableCommentModeration As Global.System.Web.UI.UserControl + + ''' + '''chkEnableCommentModeration control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnableCommentModeration As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plUseCaptcha control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plUseCaptcha As Global.System.Web.UI.UserControl + + ''' + '''chkUseCaptcha control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkUseCaptcha As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plHideWebsite control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plHideWebsite As Global.System.Web.UI.UserControl + + ''' + '''chkHideWebsite control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkHideWebsite As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plRequireName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plRequireName As Global.System.Web.UI.UserControl + + ''' + '''chkRequireName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkRequireName As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plRequireEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plRequireEmail As Global.System.Web.UI.UserControl + + ''' + '''chkRequireEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkRequireEmail As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plNotifyDefault control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plNotifyDefault As Global.System.Web.UI.UserControl + + ''' + '''chkNotifyDefault control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkNotifyDefault As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plSortDirectionComments control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSortDirectionComments As Global.System.Web.UI.UserControl + + ''' + '''drpSortDirectionComments control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpSortDirectionComments As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plAkismetKey control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plAkismetKey As Global.System.Web.UI.UserControl + + ''' + '''txtAkismetKey control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtAkismetKey As Global.System.Web.UI.WebControls.TextBox + + ''' + '''phContentSharing control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents phContentSharing As Global.System.Web.UI.WebControls.PlaceHolder + + ''' + '''dshContentSharing control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshContentSharing As Global.System.Web.UI.UserControl + + ''' + '''tblContentSharing control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblContentSharing As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''lblContentSharing control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblContentSharing As Global.System.Web.UI.WebControls.Label + + ''' + '''plAddArticleInstances control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plAddArticleInstances As Global.System.Web.UI.UserControl + + ''' + '''drpContentSharingPortals control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpContentSharingPortals As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''cmdContentSharingAdd control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdContentSharingAdd As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''lblContentSharingNoneAvailable control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblContentSharingNoneAvailable As Global.System.Web.UI.WebControls.Label + + ''' + '''plAvailableArticleInstances control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plAvailableArticleInstances As Global.System.Web.UI.UserControl + + ''' + '''grdContentSharing control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents grdContentSharing As Global.System.Web.UI.WebControls.DataGrid + + ''' + '''lblNoContentSharing control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblNoContentSharing As Global.System.Web.UI.WebControls.Label + + ''' + '''dshFileSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshFileSettings As Global.System.Web.UI.UserControl + + ''' + '''tblFile control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblFile As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plDefaultFileFolder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plDefaultFileFolder As Global.System.Web.UI.UserControl + + ''' + '''drpDefaultFileFolder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpDefaultFileFolder As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''dshFilter control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshFilter As Global.System.Web.UI.UserControl + + ''' + '''tblFilter control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblFilter As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plMaxArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plMaxArticles As Global.System.Web.UI.UserControl + + ''' + '''txtMaxArticles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtMaxArticles As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valMaxArticlesIsValid control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valMaxArticlesIsValid As Global.System.Web.UI.WebControls.CompareValidator + + ''' + '''plMaxAge control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plMaxAge As Global.System.Web.UI.UserControl + + ''' + '''txtMaxAge control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtMaxAge As Global.System.Web.UI.WebControls.TextBox + + ''' + '''lblMaxAge control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblMaxAge As Global.System.Web.UI.WebControls.Label + + ''' + '''valMaxAgeType control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valMaxAgeType As Global.System.Web.UI.WebControls.CompareValidator + + ''' + '''plCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plCategories As Global.System.Web.UI.UserControl + + ''' + '''rdoAllCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents rdoAllCategories As Global.System.Web.UI.WebControls.RadioButton + + ''' + '''rdoSingleCategory control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents rdoSingleCategory As Global.System.Web.UI.WebControls.RadioButton + + ''' + '''drpCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpCategories As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''rdoMatchAny control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents rdoMatchAny As Global.System.Web.UI.WebControls.RadioButton + + ''' + '''rdoMatchAll control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents rdoMatchAll As Global.System.Web.UI.WebControls.RadioButton + + ''' + '''lstCategories control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstCategories As Global.System.Web.UI.WebControls.ListBox + + ''' + '''lblHoldCtrl control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblHoldCtrl As Global.System.Web.UI.WebControls.Label + + ''' + '''plShowPending control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plShowPending As Global.System.Web.UI.UserControl + + ''' + '''chkShowPending control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkShowPending As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plShowFeaturedOnly control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plShowFeaturedOnly As Global.System.Web.UI.UserControl + + ''' + '''chkShowFeaturedOnly control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkShowFeaturedOnly As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plShowNotFeaturedOnly control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plShowNotFeaturedOnly As Global.System.Web.UI.UserControl + + ''' + '''chkShowNotFeaturedOnly control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkShowNotFeaturedOnly As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plShowSecuredOnly control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plShowSecuredOnly As Global.System.Web.UI.UserControl + + ''' + '''chkShowSecuredOnly control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkShowSecuredOnly As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plShowNotSecuredOnly control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plShowNotSecuredOnly As Global.System.Web.UI.UserControl + + ''' + '''chkShowNotSecuredOnly control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkShowNotSecuredOnly As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''dshAuthorFilterSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshAuthorFilterSettings As Global.System.Web.UI.UserControl + + ''' + '''tblAuthorFilterSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblAuthorFilterSettings As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plAuthor As Global.System.Web.UI.UserControl + + ''' + '''lblAuthorFilter control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblAuthorFilter As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdSelectAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdSelectAuthor As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''ddlAuthor control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ddlAuthor As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plQueryStringFilter control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plQueryStringFilter As Global.System.Web.UI.UserControl + + ''' + '''chkQueryStringFilter control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkQueryStringFilter As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plQueryStringParam control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plQueryStringParam As Global.System.Web.UI.UserControl + + ''' + '''txtQueryStringParam control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtQueryStringParam As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plUsernameFilter control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plUsernameFilter As Global.System.Web.UI.UserControl + + ''' + '''chkUsernameFilter control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkUsernameFilter As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plUsernameParam control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plUsernameParam As Global.System.Web.UI.UserControl + + ''' + '''txtUsernameParam control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtUsernameParam As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plLoggedInUser control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plLoggedInUser As Global.System.Web.UI.UserControl + + ''' + '''chkLoggedInUser control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkLoggedInUser As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''dshForm control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshForm As Global.System.Web.UI.UserControl + + ''' + '''tblForm control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblForm As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plAuthorSelection control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plAuthorSelection As Global.System.Web.UI.UserControl + + ''' + '''lstAuthorSelection control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstAuthorSelection As Global.System.Web.UI.WebControls.RadioButtonList + + ''' + '''plAuthorDefault control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plAuthorDefault As Global.System.Web.UI.UserControl + + ''' + '''lblAuthorDefault control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblAuthorDefault As Global.System.Web.UI.WebControls.Label + + ''' + '''cmdSelectAuthorDefault control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdSelectAuthorDefault As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''drpAuthorDefault control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpAuthorDefault As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plExpandSummary control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plExpandSummary As Global.System.Web.UI.UserControl + + ''' + '''chkExpandSummary control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkExpandSummary As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plTextEditorWidth control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTextEditorWidth As Global.System.Web.UI.UserControl + + ''' + '''txtTextEditorWidth control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtTextEditorWidth As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valEditorWidth control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valEditorWidth As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''valEditorWidthIsValid control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valEditorWidthIsValid As Global.System.Web.UI.WebControls.CustomValidator + + ''' + '''plTextEditorHeight control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTextEditorHeight As Global.System.Web.UI.UserControl + + ''' + '''txtTextEditorHeight control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtTextEditorHeight As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valEditorHeight control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valEditorHeight As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''valEditorHeightIsvalid control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valEditorHeightIsvalid As Global.System.Web.UI.WebControls.CustomValidator + + ''' + '''plTextEditorSummaryMode control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTextEditorSummaryMode As Global.System.Web.UI.UserControl + + ''' + '''lstTextEditorSummaryMode control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstTextEditorSummaryMode As Global.System.Web.UI.WebControls.RadioButtonList + + ''' + '''plTextEditorSummaryWidth control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTextEditorSummaryWidth As Global.System.Web.UI.UserControl + + ''' + '''txtTextEditorSummaryWidth control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtTextEditorSummaryWidth As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valTextEditorSummaryWidth control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valTextEditorSummaryWidth As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''valTextEditorSummaryWidthIsValid control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valTextEditorSummaryWidthIsValid As Global.System.Web.UI.WebControls.CustomValidator + + ''' + '''plTextEditorSummaryHeight control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTextEditorSummaryHeight As Global.System.Web.UI.UserControl + + ''' + '''txtTextEditorSummaryHeight control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtTextEditorSummaryHeight As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valTextEditorSummaryHeight control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valTextEditorSummaryHeight As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''valTextEditorSummaryHeightIsValid control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valTextEditorSummaryHeightIsValid As Global.System.Web.UI.WebControls.CustomValidator + + ''' + '''dshImage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshImage As Global.System.Web.UI.UserControl + + ''' + '''tblImage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblImage As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plIncludeJQuery control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plIncludeJQuery As Global.System.Web.UI.UserControl + + ''' + '''chkIncludeJQuery control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkIncludeJQuery As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plJQueryPath control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plJQueryPath As Global.System.Web.UI.UserControl + + ''' + '''txtJQueryPath control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtJQueryPath As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plEnableImagesUpload control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableImagesUpload As Global.System.Web.UI.UserControl + + ''' + '''chkEnableImagesUpload control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnableImagesUpload As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plEnableImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableImages As Global.System.Web.UI.UserControl + + ''' + '''chkEnablePortalImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnablePortalImages As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plEnableImagesExternal control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableImagesExternal As Global.System.Web.UI.UserControl + + ''' + '''chkEnableExternalImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnableExternalImages As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plDefaultImageFolder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plDefaultImageFolder As Global.System.Web.UI.UserControl + + ''' + '''drpDefaultImageFolder control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpDefaultImageFolder As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plResizeImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plResizeImages As Global.System.Web.UI.UserControl + + ''' + '''chkResizeImages control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkResizeImages As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plImageMaxWidth control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plImageMaxWidth As Global.System.Web.UI.UserControl + + ''' + '''txtImageMaxWidth control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtImageMaxWidth As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valImageMaxWidth control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valImageMaxWidth As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''valImageMaxWidthIsNumber control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valImageMaxWidthIsNumber As Global.System.Web.UI.WebControls.CompareValidator + + ''' + '''plImageMaxHeight control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plImageMaxHeight As Global.System.Web.UI.UserControl + + ''' + '''txtImageMaxHeight control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtImageMaxHeight As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valImageMaxHeight control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valImageMaxHeight As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''valImageMaxHeightIsNumber control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valImageMaxHeightIsNumber As Global.System.Web.UI.WebControls.CompareValidator + + ''' + '''plThumbnailType control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plThumbnailType As Global.System.Web.UI.UserControl + + ''' + '''rdoThumbnailType control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents rdoThumbnailType As Global.System.Web.UI.WebControls.RadioButtonList + + ''' + '''plUseWatermark control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plUseWatermark As Global.System.Web.UI.UserControl + + ''' + '''chkUseWatermark control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkUseWatermark As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plWatermarkText control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plWatermarkText As Global.System.Web.UI.UserControl + + ''' + '''txtWatermarkText control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtWatermarkText As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plWatermarkImage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plWatermarkImage As Global.System.Web.UI.UserControl + + ''' + '''ctlWatermarkImage control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ctlWatermarkImage As DotNetNuke.UI.UserControls.UrlControl + + ''' + '''plWatermarkPosition control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plWatermarkPosition As Global.System.Web.UI.UserControl + + ''' + '''drpWatermarkPosition control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpWatermarkPosition As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''dshNotification control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshNotification As Global.System.Web.UI.UserControl + + ''' + '''tblNotification control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblNotification As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plNotifySubmission control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plNotifySubmission As Global.System.Web.UI.UserControl + + ''' + '''chkNotifySubmission control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkNotifySubmission As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plNotifySubmissionEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plNotifySubmissionEmail As Global.System.Web.UI.UserControl + + ''' + '''txtSubmissionEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtSubmissionEmail As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plNotifyApproval control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plNotifyApproval As Global.System.Web.UI.UserControl + + ''' + '''chkNotifyApproval control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkNotifyApproval As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plNotifyComment control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plNotifyComment As Global.System.Web.UI.UserControl + + ''' + '''chkNotifyComment control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkNotifyComment As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plNotifyCommentEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plNotifyCommentEmail As Global.System.Web.UI.UserControl + + ''' + '''txtNotifyCommentEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtNotifyCommentEmail As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plNotifyCommentApproval control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plNotifyCommentApproval As Global.System.Web.UI.UserControl + + ''' + '''chkNotifyCommentApproval control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkNotifyCommentApproval As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plNotifyCommentApprovalEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plNotifyCommentApprovalEmail As Global.System.Web.UI.UserControl + + ''' + '''txtNotifyCommentApprovalEmail control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtNotifyCommentApprovalEmail As Global.System.Web.UI.WebControls.TextBox + + ''' + '''dshRelated control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshRelated As Global.System.Web.UI.UserControl + + ''' + '''tblRelated control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblRelated As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plRelatedMode control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plRelatedMode As Global.System.Web.UI.UserControl + + ''' + '''lstRelatedMode control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstRelatedMode As Global.System.Web.UI.WebControls.RadioButtonList + + ''' + '''dshSecurity control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshSecurity As Global.System.Web.UI.UserControl + + ''' + '''tblSecurity control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblSecurity As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plRoleGroup control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plRoleGroup As Global.System.Web.UI.UserControl + + ''' + '''drpSecurityRoleGroups control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents drpSecurityRoleGroups As Global.System.Web.UI.WebControls.DropDownList + + ''' + '''plBasicSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plBasicSettings As Global.System.Web.UI.UserControl + + ''' + '''grdBasicPermissions control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents grdBasicPermissions As Global.System.Web.UI.WebControls.DataGrid + + ''' + '''plSecureUrl control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSecureUrl As Global.System.Web.UI.UserControl + + ''' + '''txtSecureUrl control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtSecureUrl As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plFormSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plFormSettings As Global.System.Web.UI.UserControl + + ''' + '''grdFormPermissions control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents grdFormPermissions As Global.System.Web.UI.WebControls.DataGrid + + ''' + '''lblFormSettingsHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblFormSettingsHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''trAdminSettings1 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trAdminSettings1 As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''plAdminSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plAdminSettings As Global.System.Web.UI.UserControl + + ''' + '''trAdminSettings2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents trAdminSettings2 As Global.System.Web.UI.HtmlControls.HtmlTableRow + + ''' + '''grdAdminPermissions control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents grdAdminPermissions As Global.System.Web.UI.WebControls.DataGrid + + ''' + '''dshSEOSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshSEOSettings As Global.System.Web.UI.UserControl + + ''' + '''tblSEO control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblSEO As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plTitleReplacement control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTitleReplacement As Global.System.Web.UI.UserControl + + ''' + '''lstTitleReplacement control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstTitleReplacement As Global.System.Web.UI.WebControls.RadioButtonList + + ''' + '''plAlwaysShowPageID control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plAlwaysShowPageID As Global.System.Web.UI.UserControl + + ''' + '''chkAlwaysShowPageID control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkAlwaysShowPageID As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plUrlMode control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plUrlMode As Global.System.Web.UI.UserControl + + ''' + '''lstUrlMode control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstUrlMode As Global.System.Web.UI.WebControls.RadioButtonList + + ''' + '''plShorternID control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plShorternID As Global.System.Web.UI.UserControl + + ''' + '''txtShorternID control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtShorternID As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valShorternID control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valShorternID As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''plUseCanonicalLink control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plUseCanonicalLink As Global.System.Web.UI.UserControl + + ''' + '''chkUseCanonicalLink control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkUseCanonicalLink As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plExpandMetaInformation control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plExpandMetaInformation As Global.System.Web.UI.UserControl + + ''' + '''chkExpandMetaInformation control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkExpandMetaInformation As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plUniquePageTitles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plUniquePageTitles As Global.System.Web.UI.UserControl + + ''' + '''chkUniquePageTitles control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkUniquePageTitles As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''dshSyndicationSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshSyndicationSettings As Global.System.Web.UI.UserControl + + ''' + '''tblSyndication control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblSyndication As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plEnableSyndication control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableSyndication As Global.System.Web.UI.UserControl + + ''' + '''chkEnableSyndication control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnableSyndication As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plEnableSyndicationEnclosures control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableSyndicationEnclosures As Global.System.Web.UI.UserControl + + ''' + '''chkEnableSyndicationEnclosures control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnableSyndicationEnclosures As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plSyndicationEnclosureType control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSyndicationEnclosureType As Global.System.Web.UI.UserControl + + ''' + '''lstSyndicationEnclosureType control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstSyndicationEnclosureType As Global.System.Web.UI.WebControls.RadioButtonList + + ''' + '''plEnableSyndicationHtml control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plEnableSyndicationHtml As Global.System.Web.UI.UserControl + + ''' + '''chkEnableSyndicationHtml control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkEnableSyndicationHtml As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plSyndicationLinkMode control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSyndicationLinkMode As Global.System.Web.UI.UserControl + + ''' + '''lstSyndicationLinkMode control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lstSyndicationLinkMode As Global.System.Web.UI.WebControls.RadioButtonList + + ''' + '''plSyndicationSummaryLength control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSyndicationSummaryLength As Global.System.Web.UI.UserControl + + ''' + '''txtSyndicationSummaryLength control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtSyndicationSummaryLength As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valSyndicationSummaryLength control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valSyndicationSummaryLength As Global.System.Web.UI.WebControls.CompareValidator + + ''' + '''lblSyndicationSummaryLengthHelp control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents lblSyndicationSummaryLengthHelp As Global.System.Web.UI.WebControls.Label + + ''' + '''plSyndicationMaxCount control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSyndicationMaxCount As Global.System.Web.UI.UserControl + + ''' + '''txtSyndicationMaxCount control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtSyndicationMaxCount As Global.System.Web.UI.WebControls.TextBox + + ''' + '''valSyndicationMaxCount control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valSyndicationMaxCount As Global.System.Web.UI.WebControls.RequiredFieldValidator + + ''' + '''valSyndicationMaxCountIsValid control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents valSyndicationMaxCountIsValid As Global.System.Web.UI.WebControls.CompareValidator + + ''' + '''plSyndicationImagePath control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSyndicationImagePath As Global.System.Web.UI.UserControl + + ''' + '''txtSyndicationImagePath control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtSyndicationImagePath As Global.System.Web.UI.WebControls.TextBox + + ''' + '''dshTwitterSettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dshTwitterSettings As Global.System.Web.UI.UserControl + + ''' + '''tblTwitter control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tblTwitter As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plTwitterName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plTwitterName As Global.System.Web.UI.UserControl + + ''' + '''txtTwitterName control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtTwitterName As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plBitLyLogin control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plBitLyLogin As Global.System.Web.UI.UserControl + + ''' + '''txtBitLyLogin control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtBitLyLogin As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plBitLyAPIKey control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plBitLyAPIKey As Global.System.Web.UI.UserControl + + ''' + '''txtBitLyAPIKey control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtBitLyAPIKey As Global.System.Web.UI.WebControls.TextBox + + ''' + '''dsh3rdPartySettings control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents dsh3rdPartySettings As Global.System.Web.UI.UserControl + + ''' + '''tbl3rdParty control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents tbl3rdParty As Global.System.Web.UI.HtmlControls.HtmlTable + + ''' + '''plJournalIntegration control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plJournalIntegration As Global.System.Web.UI.UserControl + + ''' + '''chkJournalIntegration control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkJournalIntegration As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plJournalIntegrationGroups control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plJournalIntegrationGroups As Global.System.Web.UI.UserControl + + ''' + '''chkJournalIntegrationGroups control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkJournalIntegrationGroups As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plActiveSocial control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plActiveSocial As Global.System.Web.UI.UserControl + + ''' + '''chkActiveSocial control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkActiveSocial As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''plActiveSocialSubmissionKey control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plActiveSocialSubmissionKey As Global.System.Web.UI.UserControl + + ''' + '''txtActiveSocialSubmissionKey control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtActiveSocialSubmissionKey As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plActiveSocialRateKey control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plActiveSocialRateKey As Global.System.Web.UI.UserControl + + ''' + '''txtActiveSocialRateKey control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtActiveSocialRateKey As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plActiveSocialCommentKey control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plActiveSocialCommentKey As Global.System.Web.UI.UserControl + + ''' + '''txtActiveSocialCommentKey control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents txtActiveSocialCommentKey As Global.System.Web.UI.WebControls.TextBox + + ''' + '''plSmartThinkerStoryFeed control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents plSmartThinkerStoryFeed As Global.System.Web.UI.UserControl + + ''' + '''chkSmartThinkerStoryFeed control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents chkSmartThinkerStoryFeed As Global.System.Web.UI.WebControls.CheckBox + + ''' + '''cmdUpdate control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdUpdate As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''cmdCancel control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents cmdCancel As Global.System.Web.UI.WebControls.LinkButton + + ''' + '''ucHeader2 control. + ''' + ''' + '''Auto-generated field. + '''To modify move field declaration from designer file to code-behind file. + ''' + Protected WithEvents ucHeader2 As Global.Ventrian.NewsArticles.ucHeader + End Class +End Namespace diff --git a/ucViewOptions.ascx.vb b/ucViewOptions.ascx.vb new file mode 100755 index 0000000..d42ae33 --- /dev/null +++ b/ucViewOptions.ascx.vb @@ -0,0 +1,1944 @@ +' +' News Articles for DotNetNuke - http://www.dotnetnuke.com +' Copyright (c) 2002-2007 +' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com ) +' + +Imports System.IO + +Imports DotNetNuke.Common.Utilities +Imports DotNetNuke.Entities.Modules +Imports DotNetNuke.Security.Roles +Imports DotNetNuke.Services.Exceptions +Imports DotNetNuke.Services.Localization + +Imports Ventrian.NewsArticles.Components.Types +Imports DotNetNuke.Services.FileSystem +Imports DotNetNuke.Entities.Portals + +Imports Ventrian.NewsArticles.Base + +Namespace Ventrian.NewsArticles + + Partial Public Class ucViewOptions + Inherits NewsArticleModuleBase + +#Region " Private Methods " + + Public Class ListItemComparer + Implements IComparer(Of ListItem) + + Public Function Compare(ByVal x As ListItem, ByVal y As ListItem) As Integer _ + Implements IComparer(Of ListItem).Compare + + Dim c As New CaseInsensitiveComparer + Return c.Compare(x.Text, y.Text) + End Function + End Class + + Public Shared Sub SortDropDown(ByVal cbo As DropDownList) + Dim lstListItems As New List(Of ListItem) + For Each li As ListItem In cbo.Items + lstListItems.Add(li) + Next + lstListItems.Sort(New ListItemComparer) + cbo.Items.Clear() + cbo.Items.AddRange(lstListItems.ToArray) + End Sub + +#Region " Private Methods - Load Types/Dropdowns " + + Private Sub BindRoleGroups() + + Dim objRole As New RoleController + + drpSecurityRoleGroups.DataSource = RoleController.GetRoleGroups(PortalId) + drpSecurityRoleGroups.DataBind() + drpSecurityRoleGroups.Items.Insert(0, New ListItem(Localization.GetString("AllGroups", Me.LocalResourceFile), "-1")) + + End Sub + + Private Sub BindRoles() + + Dim objRole As New RoleController + + Dim availableRoles As ArrayList = New ArrayList + Dim roles As ArrayList + If (drpSecurityRoleGroups.SelectedValue = "-1") Then + roles = objRole.GetPortalRoles(PortalId) + Else + roles = objRole.GetRolesByGroup(PortalId, Convert.ToInt32(drpSecurityRoleGroups.SelectedValue)) + End If + + If Not roles Is Nothing Then + For Each Role As RoleInfo In roles + availableRoles.Add(New ListItem(Role.RoleName, Role.RoleName)) + Next + End If + + grdBasicPermissions.DataSource = availableRoles + grdBasicPermissions.DataBind() + + grdFormPermissions.DataSource = availableRoles + grdFormPermissions.DataBind() + + grdAdminPermissions.DataSource = availableRoles + grdAdminPermissions.DataBind() + + End Sub + + Private Sub BindAuthorSelection() + + For Each value As Integer In System.Enum.GetValues(GetType(AuthorSelectType)) + Dim li As New ListItem + li.Value = System.Enum.GetName(GetType(AuthorSelectType), value) + li.Text = Localization.GetString(System.Enum.GetName(GetType(AuthorSelectType), value), Me.LocalResourceFile) + lstAuthorSelection.Items.Add(li) + Next + + End Sub + + Private Sub BindCategorySortOrder() + + For Each value As Integer In System.Enum.GetValues(GetType(CategorySortType)) + Dim li As New ListItem + li.Value = System.Enum.GetName(GetType(CategorySortType), value) + li.Text = Localization.GetString(System.Enum.GetName(GetType(CategorySortType), value), Me.LocalResourceFile) + lstCategorySortOrder.Items.Add(li) + Next + + End Sub + + Private Sub BindDisplayTypes() + + For Each value As Integer In System.Enum.GetValues(GetType(DisplayType)) + Dim li As New ListItem + li.Value = System.Enum.GetName(GetType(DisplayType), value) + li.Text = Localization.GetString(System.Enum.GetName(GetType(DisplayType), value), Me.LocalResourceFile) + drpDisplayType.Items.Add(li) + Next + + End Sub + + Private Sub BindRelatedTypes() + + For Each value As Integer In System.Enum.GetValues(GetType(RelatedType)) + Dim li As New ListItem + li.Value = System.Enum.GetName(GetType(RelatedType), value) + li.Text = Localization.GetString(System.Enum.GetName(GetType(RelatedType), value), Me.LocalResourceFile) + lstRelatedMode.Items.Add(li) + Next + + End Sub + + Private Sub BindFolders() + + Dim folders As List(Of IFolderInfo) = FolderManager.Instance.GetFolders(PortalId) + For Each folder As FolderInfo In folders + Dim FolderItem As New ListItem + If folder.FolderPath = Null.NullString Then + FolderItem.Text = Localization.GetString("Root", Me.LocalResourceFile) + Else + FolderItem.Text = folder.FolderPath + End If + FolderItem.Value = folder.FolderID.ToString() + drpDefaultImageFolder.Items.Add(FolderItem) + drpDefaultFileFolder.Items.Add(New ListItem(FolderItem.Text, FolderItem.Value)) + Next + + End Sub + + Private Sub BindTextEditorMode() + + For Each value As Integer In System.Enum.GetValues(GetType(TextEditorModeType)) + Dim li As New ListItem + li.Value = System.Enum.GetName(GetType(TextEditorModeType), value) + li.Text = Localization.GetString(System.Enum.GetName(GetType(TextEditorModeType), value), Me.LocalResourceFile) + lstTextEditorSummaryMode.Items.Add(li) + Next + + End Sub + + Private Sub BindTitleReplacement() + + For Each value As Integer In System.Enum.GetValues(GetType(TitleReplacementType)) + Dim li As New ListItem + li.Value = System.Enum.GetName(GetType(TitleReplacementType), value) + li.Text = Localization.GetString(System.Enum.GetName(GetType(TitleReplacementType), value), Me.LocalResourceFile) + lstTitleReplacement.Items.Add(li) + Next + + End Sub + + Private Sub BindUrlMode() + + For Each value As Integer In System.Enum.GetValues(GetType(UrlModeType)) + Dim li As New ListItem + li.Value = System.Enum.GetName(GetType(UrlModeType), value) + li.Text = Localization.GetString(System.Enum.GetName(GetType(UrlModeType), value), Me.LocalResourceFile) + lstUrlMode.Items.Add(li) + Next + + End Sub + + Private Sub BindPageSize() + + drpNumber.Items.Add(New ListItem(Localization.GetString("NoRestriction", Me.LocalResourceFile), "-1")) + drpNumber.Items.Add(New ListItem(Localization.GetString("1", Me.LocalResourceFile), "1")) + drpNumber.Items.Add(New ListItem(Localization.GetString("2", Me.LocalResourceFile), "2")) + drpNumber.Items.Add(New ListItem(Localization.GetString("3", Me.LocalResourceFile), "3")) + drpNumber.Items.Add(New ListItem(Localization.GetString("4", Me.LocalResourceFile), "4")) + drpNumber.Items.Add(New ListItem(Localization.GetString("5", Me.LocalResourceFile), "5")) + drpNumber.Items.Add(New ListItem(Localization.GetString("6", Me.LocalResourceFile), "6")) + drpNumber.Items.Add(New ListItem(Localization.GetString("7", Me.LocalResourceFile), "7")) + drpNumber.Items.Add(New ListItem(Localization.GetString("8", Me.LocalResourceFile), "8")) + drpNumber.Items.Add(New ListItem(Localization.GetString("9", Me.LocalResourceFile), "9")) + drpNumber.Items.Add(New ListItem(Localization.GetString("10", Me.LocalResourceFile), "10")) + drpNumber.Items.Add(New ListItem(Localization.GetString("15", Me.LocalResourceFile), "15")) + drpNumber.Items.Add(New ListItem(Localization.GetString("20", Me.LocalResourceFile), "20")) + drpNumber.Items.Add(New ListItem(Localization.GetString("50", Me.LocalResourceFile), "50")) + + End Sub + + Private Sub BindSortBy() + + drpSortBy.Items.Add(New ListItem(Localization.GetString("PublishDate.Text", Me.LocalResourceFile), "StartDate")) + drpSortBy.Items.Add(New ListItem(Localization.GetString("ExpiryDate.Text", Me.LocalResourceFile), "EndDate")) + drpSortBy.Items.Add(New ListItem(Localization.GetString("LastUpdate.Text", Me.LocalResourceFile), "LastUpdate")) + drpSortBy.Items.Add(New ListItem(Localization.GetString("HighestRated.Text", Me.LocalResourceFile), "Rating")) + drpSortBy.Items.Add(New ListItem(Localization.GetString("MostCommented.Text", Me.LocalResourceFile), "CommentCount")) + drpSortBy.Items.Add(New ListItem(Localization.GetString("MostViewed.Text", Me.LocalResourceFile), "NumberOfViews")) + drpSortBy.Items.Add(New ListItem(Localization.GetString("Random.Text", Me.LocalResourceFile), "NewID()")) + drpSortBy.Items.Add(New ListItem(Localization.GetString("SortTitle.Text", Me.LocalResourceFile), "Title")) + + End Sub + + Private Sub BindSortDirection() + + drpSortDirection.Items.Add(New ListItem(Localization.GetString("Ascending.Text", Me.LocalResourceFile), "ASC")) + drpSortDirection.Items.Add(New ListItem(Localization.GetString("Descending.Text", Me.LocalResourceFile), "DESC")) + + drpSortDirectionComments.Items.Add(New ListItem(Localization.GetString("Ascending.Text", Me.LocalResourceFile), "0")) + drpSortDirectionComments.Items.Add(New ListItem(Localization.GetString("Descending.Text", Me.LocalResourceFile), "1")) + + End Sub + + Private Sub BindSyndicationLinkMode() + + For Each value As Integer In System.Enum.GetValues(GetType(SyndicationLinkType)) + Dim li As New ListItem + li.Value = System.Enum.GetName(GetType(SyndicationLinkType), value) + li.Text = Localization.GetString(System.Enum.GetName(GetType(SyndicationLinkType), value), Me.LocalResourceFile) + lstSyndicationLinkMode.Items.Add(li) + Next + + End Sub + + Private Sub BindSyndicationEnclosureType() + + For Each value As Integer In System.Enum.GetValues(GetType(SyndicationEnclosureType)) + Dim li As New ListItem + li.Value = System.Enum.GetName(GetType(SyndicationEnclosureType), value) + li.Text = Localization.GetString(System.Enum.GetName(GetType(SyndicationEnclosureType), value) & "-Enclosure", Me.LocalResourceFile) + lstSyndicationEnclosureType.Items.Add(li) + Next + + End Sub + + Private Sub BindMenuPositionType() + + For Each value As Integer In System.Enum.GetValues(GetType(MenuPositionType)) + Dim li As New ListItem + li.Value = System.Enum.GetName(GetType(MenuPositionType), value) + li.Text = Localization.GetString(System.Enum.GetName(GetType(MenuPositionType), value), Me.LocalResourceFile) + lstMenuPosition.Items.Add(li) + Next + + End Sub + + Private Sub BindTemplates() + + Dim templateRoot As String = Me.MapPath("Templates") + If Directory.Exists(templateRoot) Then + Dim arrFolders() As String = Directory.GetDirectories(templateRoot) + For Each folder As String In arrFolders + Dim folderName As String = folder.Substring(folder.LastIndexOf("\") + 1) + Dim objListItem As ListItem = New ListItem + objListItem.Text = folderName + objListItem.Value = folderName + drpTemplates.Items.Add(objListItem) + Next + End If + + End Sub + + Private Sub BindCategories() + + Dim objCategoryController As CategoryController = New CategoryController + Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(Me.ModuleId, Null.NullInteger, ArticleSettings.CategorySortType) + + lstCategories.DataSource = objCategories + lstCategories.DataBind() + + lstDefaultCategories.DataSource = objCategories + lstDefaultCategories.DataBind() + + drpCategories.DataSource = objCategories + drpCategories.DataBind() + + End Sub + + Private Sub BindTimeZone() + + DotNetNuke.Services.Localization.Localization.LoadTimeZoneDropDownList(drpTimeZone, BasePage.PageCulture.Name, Convert.ToString(PortalSettings.TimeZoneOffset)) + + End Sub + + Private Sub BindThumbnailType() + + For Each value As Integer In System.Enum.GetValues(GetType(ThumbnailType)) + Dim li As New ListItem + li.Value = System.Enum.GetName(GetType(ThumbnailType), value) + li.Text = Localization.GetString(System.Enum.GetName(GetType(ThumbnailType), value), Me.LocalResourceFile) + rdoThumbnailType.Items.Add(li) + Next + + End Sub + + Private Sub BindWatermarkPosition() + + For Each value As Integer In System.Enum.GetValues(GetType(WatermarkPosition)) + Dim li As New ListItem + li.Value = System.Enum.GetName(GetType(WatermarkPosition), value) + li.Text = Localization.GetString(System.Enum.GetName(GetType(WatermarkPosition), value), Me.LocalResourceFile) + drpWatermarkPosition.Items.Add(li) + Next + + End Sub + +#End Region + + Private Sub BindSettings() + + BindBasicSettings() + BindArchiveSettings() + BindCategorySettings() + BindCommentSettings() + BindContentSharingSettings() + BindFilterSettings() + BindFormSettings() + BindImageSettings() + BindFileSettings() + BindNotificationSettings() + BindRelatedSettings() + BindSecuritySettings() + BindSEOSettings() + BindSyndicationSettings() + BindTwitterSettings() + BindThirdPartySettings() + + End Sub + +#Region " Private Methods - Bind/Save Basic Settings " + + Private Sub BindBasicSettings() + + chkEnableRatingsAuthenticated.Checked = ArticleSettings.EnableRatingsAuthenticated + chkEnableRatingsAnonymous.Checked = ArticleSettings.EnableRatingsAnonymous + chkEnableCoreSearch.Checked = ArticleSettings.EnableCoreSearch + + chkEnableNotificationPing.Checked = ArticleSettings.EnableNotificationPing + chkEnableAutoTrackback.Checked = ArticleSettings.EnableAutoTrackback + + chkProcessPostTokens.Checked = ArticleSettings.ProcessPostTokens + + If (Settings.Contains(ArticleConstants.ENABLE_INCOMING_TRACKBACK_SETTING)) Then + chkEnableIncomingTrackback.Checked = Convert.ToBoolean(Settings(ArticleConstants.ENABLE_INCOMING_TRACKBACK_SETTING).ToString()) + Else + chkEnableIncomingTrackback.Checked = True + End If + + If (Settings.Contains(ArticleConstants.LAUNCH_LINKS)) Then + chkLaunchLinks.Checked = Convert.ToBoolean(Settings(ArticleConstants.LAUNCH_LINKS).ToString()) + Else + chkLaunchLinks.Checked = ArticleSettings.LaunchLinks + End If + + If (Settings.Contains(ArticleConstants.BUBBLE_FEATURED_ARTICLES)) Then + chkBubbleFeaturedArticles.Checked = Convert.ToBoolean(Settings(ArticleConstants.BUBBLE_FEATURED_ARTICLES).ToString()) + Else + chkBubbleFeaturedArticles.Checked = False + End If + + If (Settings.Contains(ArticleConstants.REQUIRE_CATEGORY)) Then + chkRequireCategory.Checked = Convert.ToBoolean(Settings(ArticleConstants.REQUIRE_CATEGORY).ToString()) + Else + chkRequireCategory.Checked = False + End If + + If Not (drpDisplayType.Items.FindByValue(ArticleSettings.DisplayMode.ToString()) Is Nothing) Then + drpDisplayType.SelectedValue = ArticleSettings.DisplayMode.ToString() + End If + + If Not (drpTemplates.Items.FindByValue(ArticleSettings.Template) Is Nothing) Then + drpTemplates.SelectedValue = ArticleSettings.Template + End If + + If (drpNumber.Items.FindByValue(ArticleSettings.PageSize.ToString()) IsNot Nothing) Then + drpNumber.SelectedValue = ArticleSettings.PageSize.ToString() + End If + + If Not (drpTimeZone.Items.FindByValue(ArticleSettings.ServerTimeZone.ToString()) Is Nothing) Then + drpTimeZone.SelectedValue = ArticleSettings.ServerTimeZone.ToString() + End If + + If Not (drpSortBy.Items.FindByValue(ArticleSettings.SortBy.ToString()) Is Nothing) Then + drpSortBy.SelectedValue = ArticleSettings.SortBy.ToString() + End If + + If Not (drpSortDirection.Items.FindByValue(ArticleSettings.SortDirection.ToString()) Is Nothing) Then + drpSortDirection.SelectedValue = ArticleSettings.SortDirection.ToString() + End If + + If (lstMenuPosition.Items.FindByValue(ArticleSettings.MenuPosition.ToString()) IsNot Nothing) Then + lstMenuPosition.SelectedValue = ArticleSettings.MenuPosition.ToString() + End If + + End Sub + + Private Sub SaveBasicSettings() + + Dim objModules As New ModuleController + + ' General Configuration + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.ENABLE_RATINGS_AUTHENTICATED_SETTING, chkEnableRatingsAuthenticated.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.ENABLE_RATINGS_ANONYMOUS_SETTING, chkEnableRatingsAnonymous.Checked.ToString()) + + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.ENABLE_CORE_SEARCH_SETTING, chkEnableCoreSearch.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PROCESS_POST_TOKENS, chkProcessPostTokens.Checked.ToString()) + + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.ENABLE_NOTIFICATION_PING_SETTING, chkEnableNotificationPing.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.ENABLE_AUTO_TRACKBACK_SETTING, chkEnableAutoTrackback.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.ENABLE_INCOMING_TRACKBACK_SETTING, chkEnableIncomingTrackback.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.LAUNCH_LINKS, chkLaunchLinks.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.BUBBLE_FEATURED_ARTICLES, chkBubbleFeaturedArticles.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.REQUIRE_CATEGORY, chkRequireCategory.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.DISPLAY_MODE, CType(System.Enum.Parse(GetType(DisplayType), drpDisplayType.SelectedValue), DisplayType).ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.PAGE_SIZE_SETTING, drpNumber.SelectedValue) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.TEMPLATE_SETTING, drpTemplates.SelectedValue) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.SERVER_TIMEZONE, drpTimeZone.SelectedValue) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.SORT_BY, drpSortBy.SelectedValue) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.SORT_DIRECTION, drpSortDirection.SelectedValue) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.MENU_POSITION_TYPE, lstMenuPosition.SelectedValue) + + ' Clear Cache + DataCache.RemoveCache(TabModuleId.ToString() & TemplateConstants.LISTING_ITEM) + DataCache.RemoveCache(TabModuleId.ToString() & TemplateConstants.LISTING_FEATURED) + DataCache.RemoveCache(TabModuleId.ToString() & TemplateConstants.LISTING_HEADER) + DataCache.RemoveCache(TabModuleId.ToString() & TemplateConstants.LISTING_FOOTER) + + DataCache.RemoveCache(TabModuleId.ToString() & TemplateConstants.VIEW_ITEM) + DataCache.RemoveCache(TabModuleId.ToString() & TemplateConstants.VIEW_HEADER) + DataCache.RemoveCache(TabModuleId.ToString() & TemplateConstants.VIEW_FOOTER) + + DataCache.RemoveCache(TabModuleId.ToString() & TemplateConstants.COMMENT_ITEM) + DataCache.RemoveCache(TabModuleId.ToString() & TemplateConstants.COMMENT_HEADER) + DataCache.RemoveCache(TabModuleId.ToString() & TemplateConstants.COMMENT_FOOTER) + + DataCache.RemoveCache(TabModuleId.ToString() & TemplateConstants.MENU_ITEM) + + End Sub + +#End Region + +#Region " Private Methods - Bind/Save Archive Settings " + + Private Sub BindArchiveSettings() + + chkArchiveCurrentArticles.Checked = ArticleSettings.ArchiveCurrentArticles + chkArchiveCategories.Checked = ArticleSettings.ArchiveCategories + chkArchiveAuthor.Checked = ArticleSettings.ArchiveAuthor + chkArchiveMonth.Checked = ArticleSettings.ArchiveMonth + + End Sub + + Private Sub SaveArchiveSettings() + + Dim objModules As New ModuleController + + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.ARCHIVE_CURRENT_ARTICLES_SETTING, chkArchiveCurrentArticles.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.ARCHIVE_CATEGORIES_SETTING, chkArchiveCategories.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.ARCHIVE_AUTHOR_SETTING, chkArchiveAuthor.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.ARCHIVE_MONTH_SETTING, chkArchiveMonth.Checked.ToString()) + + End Sub + + +#End Region + +#Region " Private Methods - Bind/Save Category Settings " + + Private Sub BindCategorySettings() + + If (Settings.Contains(ArticleConstants.DEFAULT_CATEGORIES_SETTING)) Then + If Not (Settings(ArticleConstants.DEFAULT_CATEGORIES_SETTING).ToString = Null.NullString) Then + Dim categories As String() = Settings(ArticleConstants.DEFAULT_CATEGORIES_SETTING).ToString().Split(Char.Parse(",")) + + For Each category As String In categories + If Not (lstDefaultCategories.Items.FindByValue(category) Is Nothing) Then + lstDefaultCategories.Items.FindByValue(category).Selected = True + End If + Next + End If + End If + + txtCategorySelectionHeight.Text = ArticleSettings.CategorySelectionHeight.ToString() + chkCategoryBreadcrumb.Checked = ArticleSettings.CategoryBreadcrumb + chkCategoryName.Checked = ArticleSettings.IncludeInPageName + chkCategoryFilterSubmit.Checked = ArticleSettings.CategoryFilterSubmit + + If (lstCategorySortOrder.Items.FindByValue(ArticleSettings.CategorySortType.ToString()) IsNot Nothing) Then + lstCategorySortOrder.SelectedValue = ArticleSettings.CategorySortType.ToString() + End If + + End Sub + + Private Sub SaveCategorySettings() + + Dim objModules As New ModuleController + + Dim categories As String = "" + For Each item As ListItem In lstDefaultCategories.Items + If item.Selected Then + If (categories.Length > 0) Then + categories = categories & "," + End If + categories = categories & item.Value + End If + Next item + + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.DEFAULT_CATEGORIES_SETTING, categories) + + If (IsNumeric(txtCategorySelectionHeight.Text)) Then + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.CATEGORY_SELECTION_HEIGHT_SETTING, txtCategorySelectionHeight.Text) + End If + + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.CATEGORY_BREADCRUMB_SETTING, chkCategoryBreadcrumb.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.CATEGORY_NAME_SETTING, chkCategoryName.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.CATEGORY_FILTER_SUBMIT_SETTING, chkCategoryFilterSubmit.Checked.ToString()) + + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.CATEGORY_SORT_SETTING, lstCategorySortOrder.SelectedValue) + + End Sub + +#End Region + + Private Sub BindCommentSettings() + + If (Settings.Contains(ArticleConstants.ENABLE_COMMENTS_SETTING)) Then + chkEnableComments.Checked = Convert.ToBoolean(Settings(ArticleConstants.ENABLE_COMMENTS_SETTING).ToString()) + Else + chkEnableComments.Checked = True + End If + + If (Settings.Contains(ArticleConstants.ENABLE_ANONYMOUS_COMMENTS_SETTING)) Then + chkEnableAnonymousComments.Checked = Convert.ToBoolean(Settings(ArticleConstants.ENABLE_ANONYMOUS_COMMENTS_SETTING).ToString()) + Else + chkEnableAnonymousComments.Checked = True + End If + + If (Settings.Contains(ArticleConstants.ENABLE_COMMENT_MODERATION_SETTING)) Then + chkEnableCommentModeration.Checked = Convert.ToBoolean(Settings(ArticleConstants.ENABLE_COMMENT_MODERATION_SETTING).ToString()) + Else + chkEnableCommentModeration.Checked = False + End If + + If (Settings.Contains(ArticleConstants.COMMENT_HIDE_WEBSITE_SETTING)) Then + chkHideWebsite.Checked = Convert.ToBoolean(Settings(ArticleConstants.COMMENT_HIDE_WEBSITE_SETTING).ToString()) + Else + chkHideWebsite.Checked = False + End If + + If (Settings.Contains(ArticleConstants.COMMENT_REQUIRE_NAME_SETTING)) Then + chkRequireName.Checked = Convert.ToBoolean(Settings(ArticleConstants.COMMENT_REQUIRE_NAME_SETTING).ToString()) + Else + chkRequireName.Checked = True + End If + + If (Settings.Contains(ArticleConstants.COMMENT_REQUIRE_EMAIL_SETTING)) Then + chkRequireEmail.Checked = Convert.ToBoolean(Settings(ArticleConstants.COMMENT_REQUIRE_EMAIL_SETTING).ToString()) + Else + chkRequireEmail.Checked = True + End If + + If (Settings.Contains(ArticleConstants.USE_CAPTCHA_SETTING)) Then + chkUseCaptcha.Checked = Convert.ToBoolean(Settings(ArticleConstants.USE_CAPTCHA_SETTING).ToString()) + Else + chkUseCaptcha.Checked = False + End If + + If (Settings.Contains(ArticleConstants.NOTIFY_DEFAULT_SETTING)) Then + chkNotifyDefault.Checked = Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_DEFAULT_SETTING).ToString()) + Else + chkNotifyDefault.Checked = False + End If + + If Not (drpSortDirectionComments.Items.FindByValue(ArticleSettings.SortDirectionComments.ToString()) Is Nothing) Then + drpSortDirectionComments.SelectedValue = ArticleSettings.SortDirectionComments.ToString() + End If + + If (Settings.Contains(ArticleConstants.COMMENT_AKISMET_SETTING)) Then + txtAkismetKey.Text = Settings(ArticleConstants.COMMENT_AKISMET_SETTING).ToString() + End If + + End Sub + + Private Sub SaveCommentSettings() + + Dim objModules As New ModuleController + + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.ENABLE_COMMENTS_SETTING, chkEnableComments.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.ENABLE_ANONYMOUS_COMMENTS_SETTING, chkEnableAnonymousComments.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.ENABLE_COMMENT_MODERATION_SETTING, chkEnableCommentModeration.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.COMMENT_HIDE_WEBSITE_SETTING, chkHideWebsite.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.COMMENT_REQUIRE_NAME_SETTING, chkRequireName.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.COMMENT_REQUIRE_EMAIL_SETTING, chkRequireEmail.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.USE_CAPTCHA_SETTING, chkUseCaptcha.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.NOTIFY_DEFAULT_SETTING, chkNotifyDefault.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.COMMENT_SORT_DIRECTION_SETTING, drpSortDirectionComments.SelectedValue) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.COMMENT_AKISMET_SETTING, txtAkismetKey.Text) + + End Sub + + Private Sub BindContentSharingSettings() + + If (Me.UserInfo.IsSuperUser = False) Then + phContentSharing.Visible = False + Else + BindAvailableContentSharingPortals() + BindSelectedContentSharingPortals() + End If + + End Sub + + Private Sub SaveContentSharingSettings() + + End Sub + + Private Sub BindFilterSettings() + + If (ArticleSettings.MaxArticles <> Null.NullInteger) Then + txtMaxArticles.Text = ArticleSettings.MaxArticles.ToString() + End If + + If (ArticleSettings.MaxAge <> Null.NullInteger) Then + txtMaxAge.Text = ArticleSettings.MaxAge.ToString() + End If + + If (ArticleSettings.FilterSingleCategory = Null.NullInteger) Then + If (ArticleSettings.FilterCategories IsNot Nothing) Then + For Each category As String In ArticleSettings.FilterCategories + If Not (lstCategories.Items.FindByValue(category) Is Nothing) Then + lstCategories.Items.FindByValue(category).Selected = True + End If + Next + + If (ArticleSettings.MatchCategories = MatchOperatorType.MatchAny) Then + rdoMatchAny.Checked = True + End If + + If (ArticleSettings.MatchCategories = MatchOperatorType.MatchAll) Then + rdoMatchAll.Checked = True + End If + Else + rdoAllCategories.Checked = True + End If + Else + rdoSingleCategory.Checked = True + + If (drpCategories.Items.FindByValue(ArticleSettings.FilterSingleCategory.ToString()) IsNot Nothing) Then + drpCategories.SelectedValue = ArticleSettings.FilterSingleCategory.ToString() + End If + End If + + chkShowPending.Checked = ArticleSettings.ShowPending + + chkShowFeaturedOnly.Checked = ArticleSettings.FeaturedOnly + chkShowNotFeaturedOnly.Checked = ArticleSettings.NotFeaturedOnly + + chkShowSecuredOnly.Checked = ArticleSettings.SecuredOnly + chkShowNotSecuredOnly.Checked = ArticleSettings.NotSecuredOnly + + If (ArticleSettings.Author <> Null.NullInteger) Then + Dim objUserController As New DotNetNuke.Entities.Users.UserController + Dim objUser As DotNetNuke.Entities.Users.UserInfo = objUserController.GetUser(Me.PortalId, ArticleSettings.Author) + + If Not (objUser Is Nothing) Then + lblAuthorFilter.Text = objUser.Username + End If + Else + lblAuthorFilter.Text = Localization.GetString("SelectAuthor.Text", Me.LocalResourceFile) + End If + + chkQueryStringFilter.Checked = ArticleSettings.AuthorUserIDFilter + txtQueryStringParam.Text = ArticleSettings.AuthorUserIDParam + chkUsernameFilter.Checked = ArticleSettings.AuthorUsernameFilter + txtUsernameParam.Text = ArticleSettings.AuthorUsernameParam + chkLoggedInUser.Checked = ArticleSettings.AuthorLoggedInUserFilter + + End Sub + + Private Sub SaveFilterSettings() + + Dim objModules As New ModuleController + + If (txtMaxArticles.Text <> "") Then + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.MAX_ARTICLES_SETTING, txtMaxArticles.Text) + Else + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.MAX_ARTICLES_SETTING, Null.NullInteger.ToString()) + End If + + If (txtMaxAge.Text <> "") Then + If (IsNumeric(txtMaxAge.Text)) Then + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.MAX_AGE_SETTING, txtMaxAge.Text) + Else + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.MAX_AGE_SETTING, Null.NullInteger.ToString()) + End If + Else + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.MAX_AGE_SETTING, Null.NullInteger.ToString()) + End If + + If (rdoAllCategories.Checked) Then + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.CATEGORIES_SETTING & Me.TabId.ToString(), Null.NullInteger.ToString()) + End If + + If (rdoSingleCategory.Checked) Then + If (drpCategories.SelectedValue <> "") Then + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.CATEGORIES_FILTER_SINGLE_SETTING, drpCategories.SelectedValue) + Else + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.CATEGORIES_FILTER_SINGLE_SETTING, Null.NullInteger.ToString()) + End If + Else + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.CATEGORIES_FILTER_SINGLE_SETTING, Null.NullInteger.ToString()) + End If + + If (rdoMatchAny.Checked Or rdoMatchAll.Checked) Then + Dim categories As String = "" + For Each item As ListItem In lstCategories.Items + If item.Selected Then + If (categories.Length > 0) Then + categories = categories & "," + End If + categories = categories & item.Value + End If + Next item + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.CATEGORIES_SETTING & Me.TabId.ToString(), categories) + + If (rdoMatchAny.Checked) Then + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.MATCH_OPERATOR_SETTING, MatchOperatorType.MatchAny.ToString()) + End If + + If (rdoMatchAll.Checked) Then + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.MATCH_OPERATOR_SETTING, MatchOperatorType.MatchAll.ToString()) + End If + End If + + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.SHOW_PENDING_SETTING, chkShowPending.Checked.ToString()) + + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.SHOW_FEATURED_ONLY_SETTING, chkShowFeaturedOnly.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.SHOW_NOT_FEATURED_ONLY_SETTING, chkShowNotFeaturedOnly.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.SHOW_SECURED_ONLY_SETTING, chkShowSecuredOnly.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.SHOW_NOT_SECURED_ONLY_SETTING, chkShowNotSecuredOnly.Checked.ToString()) + + If (ddlAuthor.Visible) Then + If (ddlAuthor.Items.Count > 0) Then + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.AUTHOR_SETTING, ddlAuthor.SelectedValue) + End If + End If + + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.AUTHOR_USERID_FILTER_SETTING, chkQueryStringFilter.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.AUTHOR_USERID_PARAM_SETTING, txtQueryStringParam.Text) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.AUTHOR_USERNAME_FILTER_SETTING, chkUsernameFilter.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.AUTHOR_USERNAME_PARAM_SETTING, txtUsernameParam.Text) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.AUTHOR_LOGGED_IN_USER_FILTER_SETTING, chkLoggedInUser.Checked.ToString()) + + End Sub + + Private Sub BindFormSettings() + + If (lstAuthorSelection.Items.FindByValue(ArticleSettings.AuthorSelect.ToString()) IsNot Nothing) Then + lstAuthorSelection.SelectedValue = ArticleSettings.AuthorSelect.ToString() + End If + + If (ArticleSettings.AuthorDefault <> Null.NullInteger) Then + Dim objUserController As New DotNetNuke.Entities.Users.UserController + Dim objUser As DotNetNuke.Entities.Users.UserInfo = objUserController.GetUser(Me.PortalId, ArticleSettings.AuthorDefault) + + If Not (objUser Is Nothing) Then + lblAuthorDefault.Text = objUser.Username + End If + End If + + chkExpandSummary.Checked = ArticleSettings.ExpandSummary + txtTextEditorWidth.Text = ArticleSettings.TextEditorWidth + txtTextEditorHeight.Text = ArticleSettings.TextEditorHeight + If (lstTextEditorSummaryMode.Items.FindByValue(ArticleSettings.TextEditorSummaryMode.ToString()) IsNot Nothing) Then + lstTextEditorSummaryMode.SelectedValue = ArticleSettings.TextEditorSummaryMode.ToString() + End If + txtTextEditorSummaryWidth.Text = ArticleSettings.TextEditorSummaryWidth + txtTextEditorSummaryHeight.Text = ArticleSettings.TextEditorSummaryHeight + + End Sub + + Private Sub SaveFormSettings() + + Dim objModules As New ModuleController + + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.AUTHOR_SELECT_TYPE, lstAuthorSelection.SelectedValue) + If (drpAuthorDefault.Visible) Then + If (drpAuthorDefault.Items.Count > 0) Then + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.AUTHOR_DEFAULT_SETTING, drpAuthorDefault.SelectedValue) + End If + End If + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.EXPAND_SUMMARY_SETTING, chkExpandSummary.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.TEXT_EDITOR_WIDTH, txtTextEditorWidth.Text) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.TEXT_EDITOR_HEIGHT, txtTextEditorHeight.Text) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.TEXT_EDITOR_SUMMARY_MODE, lstTextEditorSummaryMode.SelectedValue) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.TEXT_EDITOR_SUMMARY_WIDTH, txtTextEditorSummaryWidth.Text) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.TEXT_EDITOR_SUMMARY_HEIGHT, txtTextEditorSummaryHeight.Text) + + End Sub + + Private Sub BindImageSettings() + + chkIncludeJQuery.Checked = ArticleSettings.IncludeJQuery + txtJQueryPath.Text = Me.ArticleSettings.ImageJQueryPath + chkEnableImagesUpload.Checked = ArticleSettings.EnableImagesUpload + chkEnablePortalImages.Checked = ArticleSettings.EnablePortalImages + chkEnableExternalImages.Checked = ArticleSettings.EnableExternalImages + If (drpDefaultImageFolder.Items.FindByValue(ArticleSettings.DefaultImagesFolder.ToString) IsNot Nothing) Then + drpDefaultImageFolder.SelectedValue = ArticleSettings.DefaultImagesFolder.ToString + End If + chkResizeImages.Checked = ArticleSettings.ResizeImages + If (rdoThumbnailType.Items.FindByValue(ArticleSettings.ImageThumbnailType.ToString) IsNot Nothing) Then + rdoThumbnailType.SelectedValue = ArticleSettings.ImageThumbnailType.ToString + Else + rdoThumbnailType.SelectedIndex = 0 + End If + txtImageMaxWidth.Text = ArticleSettings.MaxImageWidth.ToString() + txtImageMaxHeight.Text = ArticleSettings.MaxImageHeight.ToString() + + chkUseWatermark.Checked = Me.ArticleSettings.WatermarkEnabled + txtWatermarkText.Text = Me.ArticleSettings.WatermarkText + ctlWatermarkImage.Url = Me.ArticleSettings.WatermarkImage + If Not (drpWatermarkPosition.Items.FindByValue(ArticleSettings.WatermarkPosition.ToString()) Is Nothing) Then + drpWatermarkPosition.SelectedValue = ArticleSettings.WatermarkPosition.ToString() + End If + + End Sub + + Private Sub SaveImageSettings() + + Dim objModules As New ModuleController + + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.INCLUDE_JQUERY_SETTING, chkIncludeJQuery.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.IMAGE_JQUERY_PATH, txtJQueryPath.Text) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.ENABLE_UPLOAD_IMAGES_SETTING, chkEnableImagesUpload.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.ENABLE_PORTAL_IMAGES_SETTING, chkEnablePortalImages.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.ENABLE_EXTERNAL_IMAGES_SETTING, chkEnableExternalImages.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING, drpDefaultImageFolder.SelectedValue) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.IMAGE_RESIZE_SETTING, chkResizeImages.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.IMAGE_THUMBNAIL_SETTING, rdoThumbnailType.SelectedValue) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.IMAGE_MAX_WIDTH_SETTING, txtImageMaxWidth.Text) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.IMAGE_MAX_HEIGHT_SETTING, txtImageMaxHeight.Text) + + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.IMAGE_WATERMARK_ENABLED_SETTING, chkUseWatermark.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.IMAGE_WATERMARK_TEXT_SETTING, txtWatermarkText.Text) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.IMAGE_WATERMARK_IMAGE_SETTING, ctlWatermarkImage.Url) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.IMAGE_WATERMARK_IMAGE_POSITION_SETTING, drpWatermarkPosition.SelectedValue) + + End Sub + + Private Sub BindFileSettings() + + If (drpDefaultFileFolder.Items.FindByValue(ArticleSettings.DefaultFilesFolder.ToString) IsNot Nothing) Then + drpDefaultFileFolder.SelectedValue = ArticleSettings.DefaultFilesFolder.ToString + End If + + End Sub + + Private Sub SaveFileSettings() + + Dim objModules As New ModuleController + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.DEFAULT_FILES_FOLDER_SETTING, drpDefaultFileFolder.SelectedValue) + + End Sub + + Private Sub BindSecuritySettings() + + txtSecureUrl.Text = ArticleSettings.SecureUrl.ToString() + If (ArticleSettings.RoleGroupID <> Null.NullInteger) Then + If (drpSecurityRoleGroups.Items.FindByValue(ArticleSettings.RoleGroupID.ToString()) IsNot Nothing) Then + drpSecurityRoleGroups.SelectedValue = ArticleSettings.RoleGroupID.ToString() + End If + End If + + BindRoles() + + End Sub + + Private Sub SaveSecuritySettings() + + Dim objModules As New ModuleController + + Dim submitRoles As String = "" + Dim secureRoles As String = "" + Dim autoSecureRoles As String = "" + Dim approveRoles As String = "" + Dim autoApproveRoles As String = "" + Dim autoApproveCommentRoles As String = "" + Dim featureRoles As String = "" + Dim autoFeatureRoles As String = "" + For Each item As DataGridItem In grdBasicPermissions.Items + Dim role As String = grdBasicPermissions.DataKeys(item.ItemIndex).ToString() + + Dim chkSubmit As CheckBox = CType(item.FindControl("chkSubmit"), CheckBox) + If (chkSubmit.Checked) Then + If (submitRoles = "") Then + submitRoles = role + Else + submitRoles = submitRoles & ";" & role + End If + End If + + Dim chkSecure As CheckBox = CType(item.FindControl("chkSecure"), CheckBox) + If (chkSecure.Checked) Then + If (secureRoles = "") Then + secureRoles = role + Else + secureRoles = secureRoles & ";" & role + End If + End If + + Dim chkAutoSecure As CheckBox = CType(item.FindControl("chkAutoSecure"), CheckBox) + If (chkAutoSecure.Checked) Then + If (autoSecureRoles = "") Then + autoSecureRoles = role + Else + autoSecureRoles = autoSecureRoles & ";" & role + End If + End If + + Dim chkApprove As CheckBox = CType(item.FindControl("chkApprove"), CheckBox) + If (chkApprove.Checked) Then + If (approveRoles = "") Then + approveRoles = role + Else + approveRoles = approveRoles & ";" & role + End If + End If + + Dim chkAutoApproveArticle As CheckBox = CType(item.FindControl("chkAutoApproveArticle"), CheckBox) + If (chkAutoApproveArticle.Checked) Then + If (autoApproveRoles = "") Then + autoApproveRoles = role + Else + autoApproveRoles = autoApproveRoles & ";" & role + End If + End If + + Dim chkAutoApproveComment As CheckBox = CType(item.FindControl("chkAutoApproveComment"), CheckBox) + If (chkAutoApproveComment.Checked) Then + If (autoApproveCommentRoles = "") Then + autoApproveCommentRoles = role + Else + autoApproveCommentRoles = autoApproveCommentRoles & ";" & role + End If + End If + + Dim chkFeature As CheckBox = CType(item.FindControl("chkFeature"), CheckBox) + If (chkFeature.Checked) Then + If (featureRoles = "") Then + featureRoles = role + Else + featureRoles = featureRoles & ";" & role + End If + End If + + Dim chkAutoFeature As CheckBox = CType(item.FindControl("chkAutoFeature"), CheckBox) + If (chkAutoFeature.Checked) Then + If (autoFeatureRoles = "") Then + autoFeatureRoles = role + Else + autoFeatureRoles = autoFeatureRoles & ";" & role + End If + End If + Next + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_SUBMISSION_SETTING, submitRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_SECURE_SETTING, secureRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_AUTO_SECURE_SETTING, autoSecureRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_APPROVAL_SETTING, approveRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_AUTO_APPROVAL_SETTING, autoApproveRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_AUTO_APPROVAL_COMMENT_SETTING, autoApproveCommentRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_FEATURE_SETTING, featureRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_AUTO_FEATURE_SETTING, autoFeatureRoles) + + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_ROLE_GROUP_ID, drpSecurityRoleGroups.SelectedValue) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_SECURE_URL_SETTING, txtSecureUrl.Text) + + Dim categoriesRoles As String = "" + Dim excerptRoles As String = "" + Dim imageRoles As String = "" + Dim fileRoles As String = "" + Dim linkRoles As String = "" + Dim publishRoles As String = "" + Dim expiryRoles As String = "" + Dim metaRoles As String = "" + Dim customRoles As String = "" + + For Each item As DataGridItem In grdFormPermissions.Items + Dim role As String = grdFormPermissions.DataKeys(item.ItemIndex).ToString() + + Dim chkCategories As CheckBox = CType(item.FindControl("chkCategories"), CheckBox) + If (chkCategories.Checked) Then + If (categoriesRoles = "") Then + categoriesRoles = role + Else + categoriesRoles = categoriesRoles & ";" & role + End If + End If + + Dim chkExcerpt As CheckBox = CType(item.FindControl("chkExcerpt"), CheckBox) + If (chkExcerpt.Checked) Then + If (excerptRoles = "") Then + excerptRoles = role + Else + excerptRoles = excerptRoles & ";" & role + End If + End If + + Dim chkImage As CheckBox = CType(item.FindControl("chkImage"), CheckBox) + If (chkImage.Checked) Then + If (imageRoles = "") Then + imageRoles = role + Else + imageRoles = imageRoles & ";" & role + End If + End If + + Dim chkFile As CheckBox = CType(item.FindControl("chkFile"), CheckBox) + If (chkFile.Checked) Then + If (fileRoles = "") Then + fileRoles = role + Else + fileRoles = fileRoles & ";" & role + End If + End If + + Dim chkLink As CheckBox = CType(item.FindControl("chkLink"), CheckBox) + If (chkLink.Checked) Then + If (linkRoles = "") Then + linkRoles = role + Else + linkRoles = linkRoles & ";" & role + End If + End If + + Dim chkPublishDate As CheckBox = CType(item.FindControl("chkPublishDate"), CheckBox) + If (chkPublishDate.Checked) Then + If (publishRoles = "") Then + publishRoles = role + Else + publishRoles = publishRoles & ";" & role + End If + End If + + Dim chkExpiryDate As CheckBox = CType(item.FindControl("chkExpiryDate"), CheckBox) + If (chkExpiryDate.Checked) Then + If (expiryRoles = "") Then + expiryRoles = role + Else + expiryRoles = expiryRoles & ";" & role + End If + End If + + Dim chkMeta As CheckBox = CType(item.FindControl("chkMeta"), CheckBox) + If (chkMeta.Checked) Then + If (metaRoles = "") Then + metaRoles = role + Else + metaRoles = metaRoles & ";" & role + End If + End If + + Dim chkCustom As CheckBox = CType(item.FindControl("chkCustom"), CheckBox) + If (chkCustom.Checked) Then + If (customRoles = "") Then + customRoles = role + Else + customRoles = customRoles & ";" & role + End If + End If + Next + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_CATEGORIES_SETTING, categoriesRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_EXCERPT_SETTING, excerptRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_IMAGE_SETTING, imageRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_FILE_SETTING, fileRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_LINK_SETTING, linkRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_PUBLISH_SETTING, publishRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_EXPIRY_SETTING, expiryRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_META_SETTING, metaRoles) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_CUSTOM_SETTING, customRoles) + + Dim siteTemplatesRoles As String = "" + For Each item As DataGridItem In grdAdminPermissions.Items + Dim role As String = grdAdminPermissions.DataKeys(item.ItemIndex).ToString() + + Dim chkSiteTemplates As CheckBox = CType(item.FindControl("chkSiteTemplates"), CheckBox) + If (chkSiteTemplates.Checked) Then + If (siteTemplatesRoles = "") Then + siteTemplatesRoles = role + Else + siteTemplatesRoles = siteTemplatesRoles & ";" & role + End If + End If + Next + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.PERMISSION_SITE_TEMPLATES_SETTING, siteTemplatesRoles) + + End Sub + + Private Sub BindNotificationSettings() + + If (Settings.Contains(ArticleConstants.NOTIFY_SUBMISSION_SETTING)) Then + chkNotifySubmission.Checked = Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_SUBMISSION_SETTING).ToString()) + Else + chkNotifySubmission.Checked = True + End If + + If (Settings.Contains(ArticleConstants.NOTIFY_SUBMISSION_SETTING_EMAIL)) Then + txtSubmissionEmail.Text = Settings(ArticleConstants.NOTIFY_SUBMISSION_SETTING_EMAIL).ToString() + End If + + If (Settings.Contains(ArticleConstants.NOTIFY_APPROVAL_SETTING)) Then + chkNotifyApproval.Checked = Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_APPROVAL_SETTING).ToString()) + Else + chkNotifyApproval.Checked = True + End If + + If (Settings.Contains(ArticleConstants.NOTIFY_COMMENT_SETTING)) Then + chkNotifyComment.Checked = Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_COMMENT_SETTING).ToString()) + Else + chkNotifyComment.Checked = True + End If + + If (Settings.Contains(ArticleConstants.NOTIFY_COMMENT_SETTING_EMAIL)) Then + txtNotifyCommentEmail.Text = Settings(ArticleConstants.NOTIFY_COMMENT_SETTING_EMAIL).ToString() + End If + + If (Settings.Contains(ArticleConstants.NOTIFY_COMMENT_APPROVAL_SETTING)) Then + chkNotifyCommentApproval.Checked = Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_COMMENT_APPROVAL_SETTING).ToString()) + Else + chkNotifyCommentApproval.Checked = True + End If + + If (Settings.Contains(ArticleConstants.NOTIFY_COMMENT_APPROVAL_EMAIL_SETTING)) Then + txtNotifyCommentApprovalEmail.Text = Settings(ArticleConstants.NOTIFY_COMMENT_APPROVAL_EMAIL_SETTING).ToString() + End If + + End Sub + + Private Sub SaveNotificationSettings() + + Dim objModules As New ModuleController + + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.NOTIFY_SUBMISSION_SETTING, chkNotifySubmission.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.NOTIFY_SUBMISSION_SETTING_EMAIL, txtSubmissionEmail.Text.Trim().ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.NOTIFY_APPROVAL_SETTING, chkNotifyApproval.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.NOTIFY_COMMENT_SETTING, chkNotifyComment.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.NOTIFY_COMMENT_SETTING_EMAIL, txtNotifyCommentEmail.Text.Trim().ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.NOTIFY_COMMENT_APPROVAL_SETTING, chkNotifyCommentApproval.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.NOTIFY_COMMENT_APPROVAL_EMAIL_SETTING, txtNotifyCommentApprovalEmail.Text.Trim().ToString()) + + End Sub + + Private Sub BindRelatedSettings() + + If (lstRelatedMode.Items.FindByValue(RelatedType.MatchCategoriesAnyTagsAny.ToString()) IsNot Nothing) Then + lstRelatedMode.SelectedValue = RelatedType.MatchCategoriesAnyTagsAny.ToString() + End If + + If (Settings.Contains(ArticleConstants.RELATED_MODE)) Then + If (lstRelatedMode.Items.FindByValue(Settings(ArticleConstants.RELATED_MODE).ToString()) IsNot Nothing) Then + lstRelatedMode.SelectedValue = Settings(ArticleConstants.RELATED_MODE).ToString() + End If + End If + + End Sub + + Private Sub SaveRelatedSettings() + + Dim objModules As New ModuleController + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.RELATED_MODE, lstRelatedMode.SelectedValue.ToString()) + + End Sub + + Private Sub BindSEOSettings() + + If lstTitleReplacement.Items.FindByValue(ArticleSettings.TitleReplacement.ToString()) IsNot Nothing Then + lstTitleReplacement.SelectedValue = ArticleSettings.TitleReplacement.ToString() + End If + + chkAlwaysShowPageID.Checked = ArticleSettings.AlwaysShowPageID + + If lstUrlMode.Items.FindByValue(ArticleSettings.UrlModeType.ToString()) IsNot Nothing Then + lstUrlMode.SelectedValue = ArticleSettings.UrlModeType.ToString() + End If + + txtShorternID.Text = ArticleSettings.ShortenedID + + chkUseCanonicalLink.Checked = ArticleSettings.UseCanonicalLink + chkExpandMetaInformation.Checked = ArticleSettings.ExpandMetaInformation + chkUniquePageTitles.Checked = ArticleSettings.UniquePageTitles + + End Sub + + Private Sub SaveSEOSettings() + + Dim objModules As New ModuleController + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.TITLE_REPLACEMENT_TYPE, lstTitleReplacement.SelectedValue) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.SEO_ALWAYS_SHOW_PAGEID_SETTING, chkAlwaysShowPageID.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.SEO_URL_MODE_SETTING, lstUrlMode.SelectedValue) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.SEO_SHORTEN_ID_SETTING, txtShorternID.Text) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.SEO_USE_CANONICAL_LINK_SETTING, chkUseCanonicalLink.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.SEO_EXPAND_META_INFORMATION_SETTING, chkExpandMetaInformation.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.SEO_UNIQUE_PAGE_TITLES_SETTING, chkUniquePageTitles.Checked.ToString()) + + End Sub + + Private Sub BindSyndicationSettings() + + chkEnableSyndication.Checked = ArticleSettings.EnableSyndication + chkEnableSyndicationEnclosures.Checked = ArticleSettings.EnableSyndicationEnclosures + chkEnableSyndicationHtml.Checked = ArticleSettings.EnableSyndicationHtml + + If (lstSyndicationLinkMode.Items.FindByValue(ArticleSettings.SyndicationLinkType.ToString()) IsNot Nothing) Then + lstSyndicationLinkMode.SelectedValue = ArticleSettings.SyndicationLinkType.ToString() + End If + + If (lstSyndicationEnclosureType.Items.FindByValue(ArticleSettings.SyndicationEnclosureType.ToString()) IsNot Nothing) Then + lstSyndicationEnclosureType.SelectedValue = ArticleSettings.SyndicationEnclosureType.ToString() + End If + + If (ArticleSettings.SyndicationSummaryLength <> Null.NullInteger) Then + txtSyndicationSummaryLength.Text = ArticleSettings.SyndicationSummaryLength.ToString() + End If + + txtSyndicationMaxCount.Text = ArticleSettings.SyndicationMaxCount.ToString() + txtSyndicationImagePath.Text = ArticleSettings.SyndicationImagePath + + End Sub + + Private Sub SaveSyndicationSettings() + + Dim objModules As New ModuleController + + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.ENABLE_SYNDICATION_SETTING, chkEnableSyndication.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.ENABLE_SYNDICATION_ENCLOSURES_SETTING, chkEnableSyndicationEnclosures.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.ENABLE_SYNDICATION_HTML_SETTING, chkEnableSyndicationHtml.Checked.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.SYNDICATION_LINK_TYPE, lstSyndicationLinkMode.SelectedValue.ToString()) + objModules.UpdateTabModuleSetting(TabModuleId, ArticleConstants.SYNDICATION_ENCLOSURE_TYPE, lstSyndicationEnclosureType.SelectedValue.ToString()) + + objModules.DeleteModuleSetting(ModuleId, ArticleConstants.SYNDICATION_SUMMARY_LENGTH) + If (txtSyndicationSummaryLength.Text <> "") Then + If (Convert.ToInt32(txtSyndicationSummaryLength.Text) > 0) Then + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.SYNDICATION_SUMMARY_LENGTH, txtSyndicationSummaryLength.Text) + End If + End If + + Try + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.SYNDICATION_MAX_COUNT, txtSyndicationMaxCount.Text) + Catch + End Try + + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.SYNDICATION_IMAGE_PATH, txtSyndicationImagePath.Text) + + End Sub + + Private Sub BindTwitterSettings() + + If (Settings.Contains(ArticleConstants.TWITTER_USERNAME)) Then + txtTwitterName.Text = Settings(ArticleConstants.TWITTER_USERNAME).ToString() + End If + + If (Settings.Contains(ArticleConstants.TWITTER_BITLY_LOGIN)) Then + txtBitLyLogin.Text = Settings(ArticleConstants.TWITTER_BITLY_LOGIN).ToString() + End If + + If (Settings.Contains(ArticleConstants.TWITTER_BITLY_API_KEY)) Then + txtBitLyAPIKey.Text = Settings(ArticleConstants.TWITTER_BITLY_API_KEY).ToString() + End If + + End Sub + + Private Sub SaveTwitterSettings() + + Dim objModules As New ModuleController + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.TWITTER_USERNAME, txtTwitterName.Text) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.TWITTER_BITLY_LOGIN, txtBitLyLogin.Text) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.TWITTER_BITLY_API_KEY, txtBitLyAPIKey.Text) + + End Sub + + Private Sub BindThirdPartySettings() + + chkJournalIntegration.Checked = ArticleSettings.JournalIntegration + chkJournalIntegrationGroups.Checked = ArticleSettings.JournalIntegrationGroups + + If (Settings.Contains(ArticleConstants.ACTIVE_SOCIAL_SETTING)) Then + chkActiveSocial.Checked = Convert.ToBoolean(Settings(ArticleConstants.ACTIVE_SOCIAL_SETTING).ToString()) + Else + chkActiveSocial.Checked = False + End If + + txtActiveSocialSubmissionKey.Text = ArticleSettings.ActiveSocialSubmitKey + txtActiveSocialCommentKey.Text = ArticleSettings.ActiveSocialCommentKey + txtActiveSocialRateKey.Text = ArticleSettings.ActiveSocialRateKey + + If (Settings.Contains(ArticleConstants.SMART_THINKER_STORY_FEED_SETTING)) Then + chkSmartThinkerStoryFeed.Checked = Convert.ToBoolean(Settings(ArticleConstants.SMART_THINKER_STORY_FEED_SETTING).ToString()) + Else + chkSmartThinkerStoryFeed.Checked = False + End If + + End Sub + + Private Sub SaveThirdPartySettings() + + Dim objModules As New ModuleController + + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.JOURNAL_INTEGRATION_SETTING, chkJournalIntegration.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.JOURNAL_INTEGRATION_GROUPS_SETTING, chkJournalIntegrationGroups.Checked.ToString()) + + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.ACTIVE_SOCIAL_SETTING, chkActiveSocial.Checked.ToString()) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.ACTIVE_SOCIAL_SUBMIT_SETTING, txtActiveSocialSubmissionKey.Text) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.ACTIVE_SOCIAL_COMMENT_SETTING, txtActiveSocialCommentKey.Text) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.ACTIVE_SOCIAL_RATE_SETTING, txtActiveSocialRateKey.Text) + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.SMART_THINKER_STORY_FEED_SETTING, chkSmartThinkerStoryFeed.Checked.ToString()) + + End Sub + + Private Function IsInRole(ByVal roleName As String, ByVal roles As String()) As Boolean + + For Each role As String In roles + If (roleName = role) Then + Return True + End If + Next + + Return False + + End Function + + Private Sub PopulateAuthorList() + + ddlAuthor.DataSource = GetAuthorList(Me.ModuleId) + ddlAuthor.DataBind() + SortDropDown(ddlAuthor) + ddlAuthor.Items.Insert(0, New ListItem(Localization.GetString("SelectAuthor.Text", Me.LocalResourceFile), "-1")) + + If Not (ddlAuthor.Items.FindByValue(Me.ArticleSettings.Author.ToString()) Is Nothing) Then + ddlAuthor.SelectedValue = Me.ArticleSettings.Author.ToString() + End If + + End Sub + + Private Sub PopulateAuthorListDefault() + + drpAuthorDefault.DataSource = GetAuthorList(Me.ModuleId) + drpAuthorDefault.DataBind() + SortDropDown(drpAuthorDefault) + drpAuthorDefault.Items.Insert(0, New ListItem(Localization.GetString("NoDefault.Text", Me.LocalResourceFile), "-1")) + + If Not (drpAuthorDefault.Items.FindByValue(Me.ArticleSettings.AuthorDefault.ToString()) Is Nothing) Then + drpAuthorDefault.SelectedValue = Me.ArticleSettings.AuthorDefault.ToString() + End If + + End Sub + + Public Function GetAuthorList(ByVal moduleID As Integer) As ArrayList + + Dim moduleSettings As Hashtable = DotNetNuke.Entities.Portals.PortalSettings.GetModuleSettings(moduleID) + Dim distributionList As String = "" + Dim userList As New ArrayList + + If (moduleSettings.Contains(ArticleConstants.PERMISSION_SUBMISSION_SETTING)) Then + + Dim roles As String = moduleSettings(ArticleConstants.PERMISSION_SUBMISSION_SETTING).ToString() + Dim rolesArray() As String = roles.Split(Convert.ToChar(";")) + Dim userIDs As New Hashtable + + For Each role As String In rolesArray + If (role.Length > 0) Then + + Dim objRoleController As New DotNetNuke.Security.Roles.RoleController + Dim objRole As DotNetNuke.Security.Roles.RoleInfo = objRoleController.GetRoleByName(PortalSettings.PortalId, role) + + If Not (objRole Is Nothing) Then + Dim objUsers As ArrayList = objRoleController.GetUserRolesByRoleName(PortalSettings.PortalId, objRole.RoleName) + For Each objUser As DotNetNuke.Entities.Users.UserRoleInfo In objUsers + If (userIDs.Contains(objUser.UserID) = False) Then + Dim objUserController As DotNetNuke.Entities.Users.UserController = New DotNetNuke.Entities.Users.UserController + Dim objSelectedUser As DotNetNuke.Entities.Users.UserInfo = objUserController.GetUser(PortalSettings.PortalId, objUser.UserID) + If Not (objSelectedUser Is Nothing) Then + If (objSelectedUser.Email.Length > 0) Then + userIDs.Add(objUser.UserID, objUser.UserID) + userList.Add(objSelectedUser) + End If + End If + End If + Next + End If + End If + Next + + End If + + Return userList + + End Function + + Private Sub BindAvailableContentSharingPortals() + + drpContentSharingPortals.Items.Clear() + + Dim objContentSharingPortals As List(Of ContentSharingInfo) = GetContentSharingPortals(ArticleSettings.ContentSharingPortals) + + Dim objPortalController As New PortalController() + Dim objPortals As ArrayList = objPortalController.GetPortals() + + For Each objPortal As PortalInfo In objPortals + + If (objPortal.PortalID <> Me.PortalId) Then + + Dim objDesktopModuleController As New DesktopModuleController + Dim objDesktopModuleInfo As DesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByModuleName("DnnForge - NewsArticles") + + If Not (objDesktopModuleInfo Is Nothing) Then + + Dim objTabController As New DotNetNuke.Entities.Tabs.TabController() + Dim objTabs As ArrayList = objTabController.GetTabs(objPortal.PortalID) + For Each objTab As DotNetNuke.Entities.Tabs.TabInfo In objTabs + If Not (objTab Is Nothing) Then + If (objTab.IsDeleted = False) Then + Dim objModules As New ModuleController + For Each pair As KeyValuePair(Of Integer, ModuleInfo) In objModules.GetTabModules(objTab.TabID) + Dim objModule As ModuleInfo = pair.Value + If (objModule.IsDeleted = False) Then + If (objModule.DesktopModuleID = objDesktopModuleInfo.DesktopModuleID) Then + If objModule.IsDeleted = False Then + Dim strPath As String = objTab.TabName + Dim objTabSelected As DotNetNuke.Entities.Tabs.TabInfo = objTab + While objTabSelected.ParentId <> Null.NullInteger + objTabSelected = objTabController.GetTab(objTabSelected.ParentId, objTab.PortalID, False) + If (objTabSelected Is Nothing) Then + Exit While + End If + strPath = objTabSelected.TabName & " -> " & strPath + End While + + Dim add As Boolean = True + + For Each objContentSharingPortal As ContentSharingInfo In objContentSharingPortals + If (objContentSharingPortal.LinkedModuleID = objModule.ModuleID And objContentSharingPortal.LinkedPortalID = objPortal.PortalID) Then + add = False + Exit For + End If + Next + + If (add) Then + Dim objListItem As New ListItem + objListItem.Value = objPortal.PortalID.ToString() & "-" & objTab.TabID.ToString() & "-" & objModule.ModuleID.ToString() + Dim o As New PortalAliasController + Dim aliases As ArrayList = o.GetPortalAliasArrayByPortalID(objPortal.PortalID) + If (aliases.Count > 0) Then + objListItem.Text = DotNetNuke.Common.AddHTTP(CType(aliases(0), PortalAliasInfo).HTTPAlias) & " -> " & strPath & " -> " & objModule.ModuleTitle + Else + objListItem.Text = objPortal.PortalName & " -> " & strPath & " -> " & objModule.ModuleTitle + End If + drpContentSharingPortals.Items.Add(objListItem) + End If + End If + End If + End If + Next + End If + End If + Next + + End If + + End If + + Next + + If (drpContentSharingPortals.Items.Count = 0) Then + lblContentSharingNoneAvailable.Visible = True + drpContentSharingPortals.Visible = False + cmdContentSharingAdd.Visible = False + Else + lblContentSharingNoneAvailable.Visible = False + drpContentSharingPortals.Visible = True + cmdContentSharingAdd.Visible = True + End If + + End Sub + + Private Sub BindSelectedContentSharingPortals() + + If (Page.IsPostBack = False) Then + Localization.LocalizeDataGrid(grdContentSharing, Me.LocalResourceFile) + End If + + Dim objContentSharingPortals As List(Of ContentSharingInfo) = GetContentSharingPortals(ArticleSettings.ContentSharingPortals) + + If (objContentSharingPortals.Count > 0) Then + grdContentSharing.DataSource = objContentSharingPortals + grdContentSharing.DataBind() + lblNoContentSharing.Visible = False + grdContentSharing.Visible = True + Else + lblNoContentSharing.Visible = True + grdContentSharing.Visible = False + End If + + End Sub + + Private Function GetContentSharingPortals(ByVal linkedPortals As String) As List(Of ContentSharingInfo) + + Dim objPortalController As New PortalController() + Dim objContentSharingPortals As New List(Of ContentSharingInfo) + + For Each element As String In linkedPortals.Split(","c) + + If (element.Split("-"c).Length = 3) Then + + Dim objContentSharing As New ContentSharingInfo + + objContentSharing.LinkedPortalID = Convert.ToInt32(element.Split("-")(0)) + objContentSharing.LinkedTabID = Convert.ToInt32(element.Split("-")(1)) + objContentSharing.LinkedModuleID = Convert.ToInt32(element.Split("-")(2)) + + Dim objModuleController As New ModuleController + Dim objModule As ModuleInfo = objModuleController.GetModule(objContentSharing.LinkedModuleID, objContentSharing.LinkedTabID) + + If (objModule IsNot Nothing) Then + objContentSharing.ModuleTitle = objModule.ModuleTitle + objContentSharingPortals.Add(objContentSharing) + End If + + End If + + Next + + Return objContentSharingPortals + + End Function + +#End Region + +#Region " Event Handlers " + + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + + If (Page.IsPostBack = False) Then + + BindCategorySortOrder() + BindDisplayTypes() + BindAuthorSelection() + BindTextEditorMode() + BindPageSize() + BindTemplates() + BindTitleReplacement() + BindTimeZone() + BindRoleGroups() + BindFolders() + BindCategories() + BindSortBy() + BindSortDirection() + BindSyndicationLinkMode() + BindSyndicationEnclosureType() + BindUrlMode() + BindMenuPositionType() + BindRelatedTypes() + BindThumbnailType() + BindWatermarkPosition() + BindSettings() + + lstDefaultCategories.Height = Unit.Parse(ArticleSettings.CategorySelectionHeight.ToString()) + lstCategories.Height = Unit.Parse(ArticleSettings.CategorySelectionHeight.ToString()) + + trAdminSettings1.Visible = Me.UserInfo.IsSuperUser + trAdminSettings2.Visible = Me.UserInfo.IsSuperUser + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click + + Try + + If (Page.IsValid) Then + + SaveBasicSettings() + SaveArchiveSettings() + SaveCategorySettings() + SaveCommentSettings() + SaveFilterSettings() + SaveFormSettings() + SaveImageSettings() + SaveFileSettings() + SaveNotificationSettings() + SaveRelatedSettings() + SaveSecuritySettings() + SaveSEOSettings() + SaveSyndicationSettings() + SaveTwitterSettings() + SaveThirdPartySettings() + + CategoryController.ClearCache(ModuleId) + LayoutController.ClearCache(Me) + + Response.Redirect(EditArticleUrl("AdminOptions"), True) + + End If + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click + + Try + + Response.Redirect(EditArticleUrl("AdminOptions"), True) + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub valEditorWidthIsValid_ServerValidate(ByVal source As System.Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles valEditorWidthIsValid.ServerValidate + + Try + + Try + Unit.Parse(txtTextEditorWidth.Text) + args.IsValid = True + Catch ex As Exception + args.IsValid = False + End Try + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub valEditorHeightIsvalid_ServerValidate(ByVal source As System.Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles valEditorHeightIsvalid.ServerValidate + + Try + + Try + Unit.Parse(txtTextEditorHeight.Text) + args.IsValid = True + Catch ex As Exception + args.IsValid = False + End Try + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdSelectAuthor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSelectAuthor.Click + + Try + + PopulateAuthorList() + ddlAuthor.Visible = True + cmdSelectAuthor.Visible = False + lblAuthorFilter.Visible = False + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub cmdSelectAuthorDefault_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSelectAuthorDefault.Click + + Try + + PopulateAuthorListDefault() + drpAuthorDefault.Visible = True + cmdSelectAuthorDefault.Visible = False + lblAuthorDefault.Visible = False + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + + Private Sub grdBasicPermissions_ItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdBasicPermissions.ItemDataBound + + If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then + Dim objListItem As ListItem = CType(e.Item.DataItem, ListItem) + + If Not (objListItem Is Nothing) Then + + Dim role As String = CType(e.Item.DataItem, ListItem).Value + + Dim chkSubmit As CheckBox = CType(e.Item.FindControl("chkSubmit"), CheckBox) + Dim chkSecure As CheckBox = CType(e.Item.FindControl("chkSecure"), CheckBox) + Dim chkAutoSecure As CheckBox = CType(e.Item.FindControl("chkAutoSecure"), CheckBox) + Dim chkApprove As CheckBox = CType(e.Item.FindControl("chkApprove"), CheckBox) + Dim chkAutoApproveArticle As CheckBox = CType(e.Item.FindControl("chkAutoApproveArticle"), CheckBox) + Dim chkAutoApproveComment As CheckBox = CType(e.Item.FindControl("chkAutoApproveComment"), CheckBox) + Dim chkFeature As CheckBox = CType(e.Item.FindControl("chkFeature"), CheckBox) + Dim chkAutoFeature As CheckBox = CType(e.Item.FindControl("chkAutoFeature"), CheckBox) + + If (objListItem.Value = PortalSettings.AdministratorRoleName.ToString()) Then + chkSubmit.Enabled = False + chkSubmit.Checked = True + chkSecure.Enabled = True + If (Settings.Contains(ArticleConstants.PERMISSION_SECURE_SETTING)) Then + chkSecure.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_SECURE_SETTING).ToString().Split(";"c)) + End If + chkAutoSecure.Enabled = True + If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_SECURE_SETTING)) Then + chkAutoSecure.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_AUTO_SECURE_SETTING).ToString().Split(";"c)) + End If + chkApprove.Enabled = False + chkApprove.Checked = True + chkAutoApproveArticle.Enabled = True + If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_APPROVAL_SETTING)) Then + chkAutoApproveArticle.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_AUTO_APPROVAL_SETTING).ToString().Split(";"c)) + End If + chkAutoApproveComment.Enabled = True + If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_APPROVAL_COMMENT_SETTING)) Then + chkAutoApproveComment.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_AUTO_APPROVAL_COMMENT_SETTING).ToString().Split(";"c)) + End If + chkFeature.Enabled = False + chkFeature.Checked = True + chkAutoFeature.Enabled = True + If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_FEATURE_SETTING)) Then + chkAutoFeature.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_AUTO_FEATURE_SETTING).ToString().Split(";"c)) + End If + Else + If (Settings.Contains(ArticleConstants.PERMISSION_SUBMISSION_SETTING)) Then + chkSubmit.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_SUBMISSION_SETTING).ToString().Split(";"c)) + End If + If (Settings.Contains(ArticleConstants.PERMISSION_SECURE_SETTING)) Then + chkSecure.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_SECURE_SETTING).ToString().Split(";"c)) + End If + If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_SECURE_SETTING)) Then + chkAutoSecure.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_AUTO_SECURE_SETTING).ToString().Split(";"c)) + End If + If (Settings.Contains(ArticleConstants.PERMISSION_APPROVAL_SETTING)) Then + chkApprove.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_APPROVAL_SETTING).ToString().Split(";"c)) + End If + If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_APPROVAL_SETTING)) Then + chkAutoApproveArticle.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_AUTO_APPROVAL_SETTING).ToString().Split(";"c)) + End If + If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_APPROVAL_COMMENT_SETTING)) Then + chkAutoApproveComment.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_AUTO_APPROVAL_COMMENT_SETTING).ToString().Split(";"c)) + End If + If (Settings.Contains(ArticleConstants.PERMISSION_FEATURE_SETTING)) Then + chkFeature.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_FEATURE_SETTING).ToString().Split(";"c)) + End If + If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_FEATURE_SETTING)) Then + chkAutoFeature.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_AUTO_FEATURE_SETTING).ToString().Split(";"c)) + End If + End If + + End If + + End If + + End Sub + + Private Sub grdFormPermissions_ItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdFormPermissions.ItemDataBound + + If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then + Dim objListItem As ListItem = CType(e.Item.DataItem, ListItem) + + If Not (objListItem Is Nothing) Then + + Dim role As String = CType(e.Item.DataItem, ListItem).Value + + Dim chkCategories As CheckBox = CType(e.Item.FindControl("chkCategories"), CheckBox) + Dim chkExcerpt As CheckBox = CType(e.Item.FindControl("chkExcerpt"), CheckBox) + Dim chkImage As CheckBox = CType(e.Item.FindControl("chkImage"), CheckBox) + Dim chkFile As CheckBox = CType(e.Item.FindControl("chkFile"), CheckBox) + Dim chkLink As CheckBox = CType(e.Item.FindControl("chkLink"), CheckBox) + Dim chkPublishDate As CheckBox = CType(e.Item.FindControl("chkPublishDate"), CheckBox) + Dim chkExpiryDate As CheckBox = CType(e.Item.FindControl("chkExpiryDate"), CheckBox) + Dim chkMeta As CheckBox = CType(e.Item.FindControl("chkMeta"), CheckBox) + Dim chkCustom As CheckBox = CType(e.Item.FindControl("chkCustom"), CheckBox) + + If (Settings.Contains(ArticleConstants.PERMISSION_CATEGORIES_SETTING)) Then + chkCategories.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_CATEGORIES_SETTING).ToString().Split(";"c)) + Else + chkCategories.Checked = True + End If + If (Settings.Contains(ArticleConstants.PERMISSION_EXCERPT_SETTING)) Then + chkExcerpt.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_EXCERPT_SETTING).ToString().Split(";"c)) + Else + chkExcerpt.Checked = True + End If + If (Settings.Contains(ArticleConstants.PERMISSION_IMAGE_SETTING)) Then + chkImage.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_IMAGE_SETTING).ToString().Split(";"c)) + Else + chkImage.Checked = True + End If + If (Settings.Contains(ArticleConstants.PERMISSION_FILE_SETTING)) Then + chkFile.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_FILE_SETTING).ToString().Split(";"c)) + Else + chkFile.Checked = True + End If + If (Settings.Contains(ArticleConstants.PERMISSION_LINK_SETTING)) Then + chkLink.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_LINK_SETTING).ToString().Split(";"c)) + Else + chkLink.Checked = True + End If + If (Settings.Contains(ArticleConstants.PERMISSION_PUBLISH_SETTING)) Then + chkPublishDate.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_PUBLISH_SETTING).ToString().Split(";"c)) + Else + chkPublishDate.Checked = True + End If + If (Settings.Contains(ArticleConstants.PERMISSION_EXPIRY_SETTING)) Then + chkExpiryDate.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_EXPIRY_SETTING).ToString().Split(";"c)) + Else + chkExpiryDate.Checked = True + End If + If (Settings.Contains(ArticleConstants.PERMISSION_META_SETTING)) Then + chkMeta.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_META_SETTING).ToString().Split(";"c)) + Else + chkMeta.Checked = True + End If + If (Settings.Contains(ArticleConstants.PERMISSION_CUSTOM_SETTING)) Then + chkCustom.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_CUSTOM_SETTING).ToString().Split(";"c)) + Else + chkCustom.Checked = True + End If + + End If + + End If + + End Sub + + Private Sub grdAdminPermissions_ItemDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdAdminPermissions.ItemDataBound + + If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then + Dim objListItem As ListItem = CType(e.Item.DataItem, ListItem) + + If Not (objListItem Is Nothing) Then + + Dim role As String = CType(e.Item.DataItem, ListItem).Value + + Dim chkSiteTemplates As CheckBox = CType(e.Item.FindControl("chkSiteTemplates"), CheckBox) + + If (Settings.Contains(ArticleConstants.PERMISSION_SITE_TEMPLATES_SETTING)) Then + chkSiteTemplates.Checked = IsInRole(role, Settings(ArticleConstants.PERMISSION_SITE_TEMPLATES_SETTING).ToString().Split(";"c)) + Else + chkSiteTemplates.Checked = False + End If + + End If + + End If + + End Sub + + Private Sub cmdContentSharingAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdContentSharingAdd.Click + + Dim currentPortals As String = Null.NullString() + If (ArticleSettings.ContentSharingPortals = Null.NullString) Then + currentPortals = drpContentSharingPortals.SelectedValue + Else + currentPortals = ArticleSettings.ContentSharingPortals & "," & drpContentSharingPortals.SelectedValue + End If + + Dim objModules As New ModuleController + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.CONTENT_SHARING_SETTING, currentPortals) + + Settings(ArticleConstants.CONTENT_SHARING_SETTING) = currentPortals + + BindSelectedContentSharingPortals() + BindAvailableContentSharingPortals() + + End Sub + + Private Sub grdContentSharing_ItemCommand(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdContentSharing.ItemCommand + + If (e.CommandName = "Delete") Then + + Dim linkedModuleID As Integer = Convert.ToInt32(e.CommandArgument) + + Dim updateSetting As String = Null.NullString() + Dim objContentSharingPortals As List(Of ContentSharingInfo) = GetContentSharingPortals(ArticleSettings.ContentSharingPortals) + + For Each objContentSharingPortal As ContentSharingInfo In objContentSharingPortals + If (objContentSharingPortal.LinkedModuleID <> linkedModuleID) Then + + If (updateSetting = "") Then + updateSetting = objContentSharingPortal.LinkedPortalID.ToString() & "-" & objContentSharingPortal.LinkedTabID.ToString() & "-" & objContentSharingPortal.LinkedModuleID.ToString() + Else + updateSetting = updateSetting & "," & objContentSharingPortal.LinkedPortalID.ToString() & "-" & objContentSharingPortal.LinkedTabID.ToString() & "-" & objContentSharingPortal.LinkedModuleID.ToString() + End If + + End If + Next + + Dim objModules As New ModuleController + objModules.UpdateModuleSetting(ModuleId, ArticleConstants.CONTENT_SHARING_SETTING, updateSetting) + + Settings(ArticleConstants.CONTENT_SHARING_SETTING) = updateSetting + + BindSelectedContentSharingPortals() + BindAvailableContentSharingPortals() + + End If + + End Sub + + Private Sub drpSecurityRoleGroups_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drpSecurityRoleGroups.SelectedIndexChanged + + Try + + BindRoles() + + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + + End Sub + +#End Region + + End Class + +End Namespace diff --git a/web.config b/web.config new file mode 100755 index 0000000..1c703c7 --- /dev/null +++ b/web.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + +