Join our DNN Community    (Newsletter, Tips, Tricks and Forums for DNN Skins & Modules)

 


 
Microsoft Gold Certified Partner - DNN Benefactor

DotNetNuke Powered! 


Friday, December 05, 2008 Register · Login · Contact · Search:  
Company Solutions Portfolio Contact
Forums
Tips and Tricks
Discussion of the popular 'Tips and Tricks' from the Newsletter. Questions or comments regarding the provided tips, or other general tricks of the trade.
Subject: Orders Up
You are not authorized to post a reply.
 
Author Messages
kevinmschreiner
Please Wait...
Posts:749

09/19/2005 2:04 PM Alert 

If you are having problems with the Order of you tabs within your menu system not matching the order of the tabs as they are represented within the Tab Pages Admin menu it is probably due to an errant update or insert into the Tabs table within DotNetNuke. If this is the case, or if something else has caused this odd behavior there is a simple SQL script you can execute to correct the table.

A client posed this problem with their database upon completion of a number of automated insert processes migrating Tabs and Modules from one DNN instance into another. The following script identifies all the Tabs, the order they currently are marked to appear, and their heirarchy and successfully renumbers them in an appropriate fashion. The ordering will not override the pages that have been identified as Administrative tabs based on their tab order (larger than 10000). Execute this script within your Host SQL tab, or an external connection to your database.

You will probably need to restart the site either manually or force an automatic restart by changing a runtime component (we prefer to simply rename the web.config file, and immediatly set the name back to web.config which issues a restart of the site and clears its runtime cache).

Use the following code to correct your tab/page ordering:

declare @CurrentID int
declare @ParentID int

create table #NewTabs(TabID int, ParentID int, OldTabOrder int, NewTabOrder int, [Auto] int identity(1,1), Done bit)
create table #Tabs2(TabID int)

select @CurrentID = (Select top 1 TabID from Tabs where isDeleted = 0 AND ParentID is null and TabID not in (Select TabID from #NewTabs) order by TabOrder)
WHILE not @CurrentID is null
BEGIN
   
INSERT INTO #NewTabs(TabID,ParentID, OldTabOrder, Done)
  
SELECT TabID, ParentID, TabOrder, 0   
   
FROM Tabs where TabId = @CurrentID

   
WHILE not @CurrentID is null
   
BEGIN
       
INSERT INTO #Tabs2(TabID)
       
Select TabID from Tabs WHERE isDeleted = 0 AND ParentID = @CurrentID

       
Update #NewTabs set Done = 1 where TabID = @CurrentID

       
Select @CurrentID = (Select top 1 TabID from #NewTabs where Done = 0 ORDER BY OldTabOrder)
       
IF @CurrentID is null
       
BEGIN
           
INSERT INTO #NewTabs(TabID,ParentID, OldTabOrder, Done)
           
SELECT t2.TabID,t.ParentID, t.TabOrder,0 FROM
            #Tabs2 t2
JOIN Tabs t on t.TabID = t2.TabID AND t.isDeleted = 0   ORDER BY t.TabOrder

           
TRUNCATE TABLE #Tabs2

           
Select @CurrentID = (Select top 1 TabID from #NewTabs where Done = 0 ORDER BY OldTabOrder)
           
print @CurrentID
       
END
   
END   
   
select @CurrentID = (Select top 1 TabID from Tabs where isDeleted = 0 AND  ParentID is null and TabID not in (Select TabID from #NewTabs) order by TabOrder)
END
UPDATE #newTabs set NewTabOrder = [Auto] where OldTaborder < 10000
UPDATE #newTabs set NewTabOrder = OldTabOrder where OldTabOrder >= 10000

UPDATE t set t.TabOrder = n.NewTabOrder from Tabs t JOIN #NewTabsn on t.TabId = n.TabID


drop table #newtabs
drop table #tabs2


Kevin M Schreiner

Business Intelligence Force, Inc. (bi4ce)
You are not authorized to post a reply.



ActiveForums 3.6
Latest Post
 
At R2integrated (formerly Bi4ce), we take support seriously.  That's why we support our customers and DNN community with daily monitoring from our experienced engineering team.  We ask that the first step taken is to read the relevant documentation and support forums prior to submitting any questions that may already be available or have been answered.  We ask that you review the documentation that we provide for our products before posting a question.

The Forums are for our customers to chat, exchange ideas and strategies, and submit feedback.  Please be sure to perform keyword searches for previous related forum responses.

To be helpful when submitting a new item, please include the following: 
  1. DNN Version
  2. Module Version
  3. Admin Log Viewer Information
  4. Environment detail: Operating system, .NET framework version, database and version, IIS version, Browser version (if appropriate)
We always try to respond quickly and monitor the forums daily during business hours (EST).  Occasionally, requests for a specific project requirement may not apply for the free support offered. For project specific support please submit via our Information Request form.

Thank you for using our Forums.

Click here to register for the Forums
 
© 2008 by R2integrated (formerly Bi4ce) | DNN® is a registered trademark of DotNetNuke Corporation