Actualités développement .NET

Actualités DotNetNuke Pro et Communitaire et autres technologies mises en oeuvre par DevPCI.
19
If you frequently use DNN for large projects, you as much due to abandon devised used the "Show on All Pages" function and generalize the use of Add existing module (clone) from another page.

Some interesting elements here :

http://www.dnnsoftware.com/community-blog/cid/134599/Display-Module-On-almost-All-Pages

http://stackoverflow.com/questions/17696282/display-module-in-all-pages-of-site-except-admin-pages-dnn7
https://dnntracker.atlassian.net/browse/DNN-19940
http://www.dnnsoftware.com/voice/cid/419275
http://www.dnnsoftware.com/voice/cid/139030
http://mitchelsellers.com/blogs/2014/01/17/dnns-display-on-all-pages-an-alternative-to-avoid-nightmares.aspx

So, my idea was to check how Display Module on All Pages and Add Module to Page works to find the best way to get something more efficient.

After some reseach around Site Template, i've been convinced to use the way of Add Module to Page work rather than the show on all page. (If you export a site that have Module with show on All Page enable, these modules are well in the template files, but are not imported (didn't take time to debug it)

In resume, the Show on all page uses a method named CopyModule while the Add Existing Module (to a Page) use a method named AddModule.
the both method are similar, but not the sames, and they don't produce exactly the same "copied" item (line in TabModules table). With the CopyModule, there is a New LocalizedVersionGUID (in DNN Platform\Library\Entities\Modules\ModuleController.cs  line 1022 : destinationModule.LocalizedVersionGuid = Guid.NewGuid();) while it keep the same LocalizedVersionGUID with the AddModule method (that seem better in the case of duplicating a module on many pages in the same language. In an other language you 'll copy an other module in the other language, so keep the localization too).

Two things interesting too in DNN core code :
1- the Added to Page section in a module setting


2 - the Pages treeview showing all pages in Admin Pages or Export Site Template



So the objective is to Build a TreeView with the Site Pages and  enable CheckBox for each page and Check it if the module is present on the page. (It could be a great enhancement to replace the Added to page section with this pages Treeview with checkbox ;-)



By the way, as I was needing this asap, I've first build an independent  module, and it will be proposed as an enhancement to DNN by a future Pull request on GitHub.

We just need the ModuleId (select one in the list) to be able to build the tree-view,
In the list you'll see the number of clone in (), the ModuelId, it's title (on this page), the Page, the Pane, if the module is delete (in the Recycle bin), and if the Show on All page stored value (All Tabs).


I've finally put some basics (an independent) filters to quick reduce the size of the modules lists.

Take care if selecting a module then Unckeck all Pages and set Definitive Delete, this content will totally be deleted and you won't be able to restore it.


See it in action in the teaser :


Or in the longer Demo :

The Project Sources on GitHub : https://github.com/DevPCI/Clonator


Download available here :

Install : http://clonator.codeplex.com/downloads/get/781055

Source :  http://clonator.codeplex.com/downloads/get/781056

Min DNN Version 7.1.1