DnnGallery.net – a place to showcase your DNN sites

One of the questions I have always found hard to answer is “ok, but show me some ‘wow’ sites made with DotNetNuke”. I always had a hard time finding some sites till I read a post about www.dnngallery.net at the DotNetNuke forums.I think it’s pretty interesting, provided that the “Showcase” section at the official DotNetNuke site is dead and that there is no other place (none that I know of, at least) where one can see and rate some worthy DNN sites.


DnnGallery allows you to submit your DNN site and lets other users rate it. You will find some interesting implementations there, let’s hope that more DNN publishers participate in the future.



UDT 03.05.01 and incorrect filtering of script in text/html fields

Those of you using the latest version of the old User Defined Table module (which is to be replaced by the Form and List module in DNN 5.x) may have noticed an annoying bug that makes the UDT module insist on filtering out script, object and embed tags even when you have specifically specified that you don’t want it to.


What does this mean? It means that you can’t embed YouTube videos, for example, because UDT will filter out the embed code’s tags.


When does it happen? Well, fortunately it doesn’t happen when you’re admin or host. But it does happen if you’ve given other users edit rights on UDT data. Any user that is not Admin or Host cannot write these tags in the HTML view of a Text/HTML field inside a User Defined Table. They are just filtered out, even when the relevant setting is unchecked.


To fix that, you’ll need to download the code for UDT 03.05.01. The problem lies in file EditControls.vb, line 52:


If ParentModule.Settings.ContainsKey(SettingName.ForceInputFiltering) Then
inputFilterScript = Not isAdmin
inputFilterTags = isAnonymous
End If


The “if” clause in line 52 just checks whether the setting exists, not its value. To fix that you need to make the code in line 52 as follows:


If ParentModule.Settings.ContainsKey(SettingName.ForceInputFiltering) AndAlso ParentModule.Settings(SettingName.ForceInputFiltering).Equals("True") Then
inputFilterScript = Not isAdmin
inputFilterTags = isAnonymous
End If


(I apologise for the line breaks, please consider that the IF clause should be in a single line)


What I’ve done is that I have added a second condition that actually checks the VALUE of the setting and applies the rule only if it’s true.


You can compile the code with that change and just replace the old dll file with the newly-compiled one in dotnetnuke’s Bin folder.


Please let me know if you’ve been having trouble with this, I’ve already got a compiled dll so I could send it to anyone who’s not into code much – although, as always, I must insist that you always try those things at your own risk!




Replacing default module titles in search results with the corresponding tab’s title

How many times has it happened to you? You put some Text/HTML module here, a Links module there, maybe a third-party module and you forget to change its title, mostly because you’re using a container that doesn’t utilize it, or for any other reason.


This can lead to ugly search results, since DNN’s indexer stores the module’s title in the SearchItem table and uses it as the title for each one of your search results.


On the other hand, you’ve got some module titles you’ve explicitly set and you need to preserve for your search results. So, you’ve only got to replace the DEFAULT titles with something – in my script, I chose to replace them with the corresponding tab’s title, but you could alter it and make it display anything – or even delete the record if you like.


So here’s a trigger that checks whether the row being written in the SearchItem table is for a module having the default title, and if so, changes the title to the corresponding tab’s title.


CREATE TRIGGER tr_FixSearchItemTitle 
ON  dbo.SearchItem
-- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
--These three variables will come from the
--searchitem table.
declare @searchitemid int
declare @moduleid int
declare @title nvarchar(200)

--These two will come from the 
--modules table.
declare @moduletitle nvarchar(200)
declare @moduledefid int

--This will come from the 
--moduledefinitions table
declare @friendlyname nvarchar(200)

--This will come from the
--tabs table
declare @tabtitle nvarchar(200)

--Get inserted values
@searchitemid = searchitemid
, @title = title
, @moduleid = moduleid 

--Find moduletitle and definition id of the 
--module being inserted in searchitems table.
@moduletitle = moduletitle
, @moduledefid=moduledefid 
moduleid = @moduleid

--Find the friendly name from the
--moduledefinitions table
@friendlyname = friendlyname 
moduledefid = @moduledefid

--If the title of the module in the searchitem table
--is equal to the module definition's friendly name
--then we can safely suppose that the module has 
--the default title.
if @friendlyname = @title 
--Get the tab's title
@tabtitle = title 
where tabid in 
--If we have multiple instances
        --of modules in several pages,
        --just get the first page. I know,
        --this might be ugly but I've not found
        --any other way.
top 1 (tabid) 
moduleid = @moduleid

--Replace the default title with the page's title.
title = @tabtitle 
searchitemid = @searchitemid




This trigger checks each entry in the SearchItem table at the time it’s inserted or updated and determines whether the module title being inserted is a default title. It achieves that by comparing the module’s title with the FriendlyName field of the ModuleDefinitions table – all core modules and all third-party modules I know use this value as the default title. This means the trigger will probably work with any combination of modules you’ve installed in your site.


There’s a catch, though: If you have the same module instance (not the same module, the exact same instance – that means you’ve used the “add existing module” option) in more than one page, it’ll get only one title for it – that is, if you’ve “added an existing module” to several pages, each search result that corresponds to such a module may have the wrong title – no problem if you’re not using multiple instances of modules.


Another catch is that you have to have recursive triggers disabled for your database, or this will execute forever – it will run itself again and again since it alters a newly inserted or updated record.


In order to see how this trigger handle things, you should delete everything from your SearchItem table and then do a reindex via the Host->Search Admin page, or else the trigger will run only for new or updated entries.


As always, use at your own risk!

Related Posts with Thumbnails

Recent Comments

Free DotNetNuke Stuff

Free DotNet Videos

  © Blogger template The Professional Template by Ourblogtemplates.com 2008

Back to TOP