Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsAnnouncementsAnnouncementsAnnouncements Default Sort OrderAnnouncements Default Sort Order
Previous
 
Next
New Post
12/12/2006 3:29 PM
 
When adding new announcements, the latest entry gets added to the bottom. i want it to be added to the top. How do I do so? And how do I change the default sort order from ascending/descending vice versa?

I tried entering a value for the View Order but it seems to have no effect.

I'm running DNN 4.3.7 and Announcements 03.03.05
 
New Post
10/29/2008 11:21 PM
 

This is a very old post but just in case anyone runs into this issue and wants the sort order to be changed, run the following SQL script via the host menu:

 

/************************************************************/
/*****              SqlDataProvider                     *****/
/*****                                                  *****/
/*****                                                  *****/
/***** Note: To manually execute this script you must   *****/
/*****       perform a search and replace operation     *****/
/*****       for {databaseOwner} and {objectQualifier}  *****/
/*****                                                  *****/
/************************************************************/

/** Alter Table, change description to NTEXT **/

if not exists (select * from dbo.syscolumns where id = object_id(N'{databaseOwner}{objectQualifier}Announcements') and xtype=99)
begin
  ALTER TABLE {databaseOwner}{objectQualifier}Announcements ALTER COLUMN [Description] [NTEXT] NULL
end

/** Add ImageSource field  **/
IF (SELECT COLUMNPROPERTY( OBJECT_ID('{databaseOwner}{objectQualifier}Announcements'),'ImageSource','AllowsNull')) IS NULL
ALTER TABLE {databaseOwner}{objectQualifier}Announcements ADD
    ImageSource [nvarchar] (250) NULL
GO


/** Drop old Stored Procedures **/

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}AddAnnouncement]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}AddAnnouncement
GO

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}GetAnnouncement]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}GetAnnouncement
GO

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}GetAnnouncements]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}GetAnnouncements
GO

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}GetCurrentAnnouncements]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}GetCurrentAnnouncements
GO

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}GetExpiredAnnouncements]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}GetExpiredAnnouncements
GO

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}UpdateAnnouncement]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}UpdateAnnouncement
GO

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}DeleteAnnouncement]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}DeleteAnnouncement
GO


/** To make sure, also drop new sprocs **/

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}dnnAnnouncements_Add]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}dnnAnnouncements_Add
GO

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}dnnAnnouncements_Get]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}dnnAnnouncements_Get
GO

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}dnnAnnouncements_GetAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}dnnAnnouncements_GetAll
GO

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}dnnAnnouncements_GetCurrent]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}dnnAnnouncements_GetCurrent
GO

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}dnnAnnouncements_GetExpired]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}dnnAnnouncements_GetExpired
GO

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}dnnAnnouncements_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}dnnAnnouncements_Update
GO

if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}dnnAnnouncements_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}dnnAnnouncements_Delete
GO



/** Create Stored Procedures **/

create procedure {databaseOwner}{objectQualifier}dnnAnnouncements_Add

    @ModuleId      int,
    @CreatedByUser int,
    @CreatedDate   datetime,
    @Title         nvarchar(150),
    @ImageSource   nvarchar(150),
    @Url           nvarchar(150),
    @Description   ntext,
    @ViewOrder     int,
    @PublishDate   datetime,
    @ExpireDate    datetime

as

insert into {objectQualifier}Announcements (
    ModuleId,
    CreatedByUser,
    CreatedDate,
    Title,
    ImageSource,
    Url,
    Description,
    ViewOrder,
    PublishDate,
    ExpireDate
)
values (
    @ModuleId,
    @CreatedByUser,
    @CreatedDate,
    @Title,
    @ImageSource,
    @Url,
    @Description,
    @ViewOrder,
    @PublishDate,
    @ExpireDate
)

select SCOPE_IDENTITY()

GO

CREATE procedure {databaseOwner}{objectQualifier}dnnAnnouncements_Get

@ItemId   int,
@ModuleId int

as

select  {objectQualifier}Announcements.ItemId,
        {objectQualifier}Announcements.ModuleId,
        {objectQualifier}Announcements.CreatedByUser,
        {objectQualifier}Announcements.CreatedDate,
        {objectQualifier}Announcements.Title,
        {objectQualifier}Announcements.ImageSource,
        {objectQualifier}Announcements.URL,
        {objectQualifier}Announcements.Description,
        {objectQualifier}Announcements.ViewOrder,
        {objectQualifier}Announcements.PublishDate,
        {objectQualifier}Announcements.ExpireDate,
        {objectQualifier}UrlTracking.TrackClicks,
        {objectQualifier}UrlTracking.NewWindow
from    {objectQualifier}Announcements
left outer join {objectQualifier}UrlTracking on {objectQualifier}Announcements.URL = {objectQualifier}UrlTracking.Url and {objectQualifier}UrlTracking.ModuleId = @ModuleID
where  {objectQualifier}Announcements.ItemId = @ItemId
and    {objectQualifier}Announcements.ModuleId = @ModuleId
order by {objectQualifier}Announcements.ItemId desc, {objectQualifier}Announcements.ViewOrder desc

GO

CREATE procedure {databaseOwner}{objectQualifier}dnnAnnouncements_GetCurrent

@ModuleId int,
@StartDate datetime

as

select {objectQualifier}Announcements.ItemId,
       {objectQualifier}Announcements.ModuleId,
       {objectQualifier}Announcements.CreatedByUser,
       {objectQualifier}Announcements.CreatedDate,
       {objectQualifier}Announcements.Title,
       {objectQualifier}Announcements.ImageSource,
       {objectQualifier}Announcements.URL,
       {objectQualifier}Announcements.Description,
       {objectQualifier}Announcements.ViewOrder,
       {objectQualifier}Announcements.PublishDate,
       {objectQualifier}Announcements.ExpireDate,
       {objectQualifier}UrlTracking.TrackClicks,
       {objectQualifier}UrlTracking.NewWindow
from   {objectQualifier}Announcements
       left outer join {objectQualifier}UrlTracking on {objectQualifier}Announcements.URL = {objectQualifier}UrlTracking.Url and {objectQualifier}UrlTracking.ModuleId = @ModuleID
where  {objectQualifier}Announcements.ModuleId = @ModuleId
       and ( (({objectQualifier}Announcements.PublishDate >= @StartDate) or @StartDate is null) and ({objectQualifier}Announcements.PublishDate <= GETDATE()) )
       and ( ({objectQualifier}Announcements.ExpireDate > getDate()) or ({objectQualifier}Announcements.ExpireDate is null) )
order by {objectQualifier}Announcements.ItemId desc, {objectQualifier}Announcements.ViewOrder desc

GO

CREATE procedure {databaseOwner}{objectQualifier}dnnAnnouncements_GetExpired

@ModuleId int

as

select {objectQualifier}Announcements.ItemId,
       {objectQualifier}Announcements.ModuleId,
       {objectQualifier}Announcements.CreatedByUser,
       {objectQualifier}Announcements.CreatedDate,
       {objectQualifier}Announcements.Title,
       {objectQualifier}Announcements.ImageSource,
       {objectQualifier}Announcements.URL,
       {objectQualifier}Announcements.Description,
       {objectQualifier}Announcements.ViewOrder,
       {objectQualifier}Announcements.PublishDate,
       {objectQualifier}Announcements.ExpireDate,
       {objectQualifier}UrlTracking.TrackClicks,
       {objectQualifier}UrlTracking.NewWindow
from   {objectQualifier}Announcements
       left outer join {objectQualifier}UrlTracking on {objectQualifier}Announcements.URL = {objectQualifier}UrlTracking.Url and {objectQualifier}UrlTracking.ModuleId = @ModuleID
where  {objectQualifier}Announcements.ModuleId = @ModuleId
       and {objectQualifier}Announcements.ExpireDate <=  getDate()
order by {objectQualifier}Announcements.ItemId desc, {objectQualifier}Announcements.ViewOrder desc

GO


CREATE procedure {databaseOwner}{objectQualifier}dnnAnnouncements_GetAll

@ModuleId int,
@StartDate datetime,
@EndDate datetime

as

select {objectQualifier}Announcements.ItemId,
       {objectQualifier}Announcements.ModuleId,
       {objectQualifier}Announcements.CreatedByUser,
       {objectQualifier}Announcements.CreatedDate,
       {objectQualifier}Announcements.Title,
       {objectQualifier}Announcements.ImageSource,
       {objectQualifier}Announcements.URL,
       {objectQualifier}Announcements.Description,
       {objectQualifier}Announcements.ViewOrder,
       {objectQualifier}Announcements.PublishDate,
       {objectQualifier}Announcements.ExpireDate,
       {objectQualifier}UrlTracking.TrackClicks,
       {objectQualifier}UrlTracking.NewWindow
from   {objectQualifier}Announcements
left outer join {objectQualifier}UrlTracking on {objectQualifier}Announcements.URL = {objectQualifier}UrlTracking.Url and {objectQualifier}UrlTracking.ModuleId = @ModuleID
where  {objectQualifier}Announcements.ModuleId = @ModuleId
and    ( (({objectQualifier}Announcements.PublishDate >= @StartDate) or @StartDate is null) and (({objectQualifier}Announcements.PublishDate <= @EndDate) or @EndDate is null) )
order by {objectQualifier}Announcements.ItemId desc, {objectQualifier}Announcements.ViewOrder desc

GO

create procedure {databaseOwner}{objectQualifier}dnnAnnouncements_Update

    @ItemId        int,
    @ModuleId      int,
    @CreatedByUser int,
    @CreatedDate   datetime,
    @Title         nvarchar(100),
    @ImageSource   nvarchar(150),
    @Url           nvarchar(250),
    @Description   ntext,
    @ViewOrder     int,
    @PublishDate   datetime,
    @ExpireDate    datetime

as

update {objectQualifier}Announcements
set    CreatedByUser = @CreatedByUser,
       CreatedDate   = @CreatedDate,
       Title         = @Title,
       ImageSource   = @ImageSource,
       Url           = @Url,
       Description   = @Description,
       ViewOrder     = @ViewOrder,
       PublishDate     = @PublishDate,
       ExpireDate     = @ExpireDate
where  ItemId = @ItemId
  and ModuleID = @ModuleID

GO

create procedure {databaseOwner}{objectQualifier}dnnAnnouncements_Delete
    @ModuleId int,
    @ItemId int

as

delete
from {objectQualifier}Announcements
where  ItemId = @ItemId
    and ModuleId = @ModuleID

GO
/************************************************************/
/*****              SqlDataProvider                     *****/
/************************************************************/

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsAnnouncementsAnnouncementsAnnouncements Default Sort OrderAnnouncements Default Sort Order


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out