Customising a DNN Module - dotnetnuke

I am trying to modify a standard dnn module (Links) that comes with dnn. Essentially what i want is the make a copy of the current links module and change the look of it. I had a look inside the links module, and each link is placed in a table cell. I want to set the background of table cell to be an image and have a mouseover effect.
How can I do this? Is it possible with containers? I do not want to recode the links module functionality.
Also I want to create another type of a links module. I require this module to have a title, a sub-title (which is optional), then followed by the links. Since the tables in the original links module does not allow for a sub-title, i am thinking i have to create a new table and manage it separately. Is this the correct path to go down?

You should be able to make the changes to the table cell by editing the file /DesktopModules/Links/Links.ascx
In order to add the Sub-Title field, you would need to make a log of changes. To completely clone the module, you would need to make database changes, rename all (or most) classes used in the Link module, and make a copy of the Links folder to hold your new files. It sounds like you're going down the right path for this change. This will require a different level of effort than simply adding a background image and an onmouseover affect on the existing links module.

Related

Creating dynamic content on Project page with Jenkins Plugin

I'm just getting started writing plugins for Jenkins, and I'm having trouble making much headway in the exceptionally terse documentation I've been able to find for it. The main thing I'm trying to do is generate dynamic content to place on the top-level page for a particular Project. Specifically, I want to show some content that is derived from the most recent build of the Project.
Based on the skeleton project and the HTMLPublisher plugin, I've been able to create a Publisher plugin that creates an Action with getProjectActions, and that Action has a floatingBox.jelly view, whose contents are rendered at the top of the Project page. So far, so good.
Now I want to make that content dynamic. For instance, my Publisher plugin might generate some HTML content as a post-build step, and I want to display this HTML (from the latest build) at the top of the Project page. Or (more likely), I'll want to generate some HTML based on all builds, and display that (e.g., a plot showing some some kind of "quality mesaurement" for each of the last N builds).
I'm brand new to maven and jelly, and quite new to Jenkins for that matter, so any help would be useful.
Update
I've found that I can use ${it} inside my jelly scripts to access the Project object, but can I then access my Publisher instance from there, in order to invoke some methods on it to generate the content?
The only thing I've come up with so far is to iterate over the list of publishers provided by getPublishersList() on the Project object, and look for one whose class name matches my class. I can't find a way to do instanceof in jelly script.
<j:forEach items="${it.publishersList}" var="pub">
<j:if test='${pub.class.name == "com.example.myPluginName.myPublisherClassName"}'>
<!-- ${pub} is my Publisher instance, I can now invoke methods on it. -->
</j:if>
</j:forEach>
Alternatively, if you use jobMain.jelly instead of floatingBox.jelly, in that case ${it} is the Action itself.

How would I repeat content on pages (and modify some) in DNN

I am trying to figure out how to place content across pages as well as modify only some of the "same" things.
For example, I have two services. Let's say I want to add a small box on the right panel. On the pages directly under the root of my site (Home, About Us, Contact Us), I want this box to contain generic information (We provide services for . . . ). On the pages related to service one (the service one page and sub-pages), I want that same box to contain pretty much the same text except changing it specific to service one (Our service one solution...). The same for service two and it's sub-pages (Our service two solution...).
To change content I think I'd be right to leave "Make a Copy" checked. However, I don't want this box to appear on every page, just one's that I choose (whether grouped or not; i.e. root pages, service one pages, service two pages).
How can I accomplish this? I'm working directly using the DNN 7.01 admin/host interface - I'm imagining I can accomplish this by creating separate .ascx files, but for this I think it defeats the purpose.
Thanks.
What you will want to do is use the "Add Existing Module" function to handle this.
For example for the content that you want to be the same, add it to the "main" page and setup the content. Then on the pages that need to have THAT version use "Add Existing Module" and add the module from the "main" page.
Then, when you have a variation that is to be shared across other pages, repeat this process.
DO NOT use the "Display On All Pages" option though as more than likely that will trash things!
I've not a lot of experience as Mitchel, and his answer seems the way to go. But as an alternative (when dealing with LOTS of modules with static content), I found using a template page with all the modules (and content within) helps to group things so that you can use that template for sub pages that have the same content. In other words, only the actual content pane for a sub page needs to be created because you are copying all the other "widgets" you have on your page.

trigger.io remove all files stored with forge.file.SaveURL?

I make extensive use of the file.saveURL feature of trigger.io but I would like to know if its possible or maybe possible to add this functionality but to run a command to remove all stored items?
The app I am creating is customizable by the user and because of that they have the ability to "leave" the app in a since.
Doing so will clear out all localstorage and any downloaded items.
Currently I have a method that stores each reference in a localstorage and when I "leave" I loop over the items in the LC and remove each item. While this seems to work ok it does have querks at times. I'm just curious if it may be possible to add a simple remove all type function to the file save?
Seeing as we are responsible to the cleanup of these items it would be nice to simply remove all stored items
Currently, no - we don't save those files in a separate folder, which could have been cleared up in one go...
It's a change we could make in the future though if it proves a popular update to the file module!

Should we create custom pages for all objects?

I noticed that salesforce doesn't allow to override control function for all objects.
Say if you want to do something whenever objects get saved there is no way to attach the action
unless you create a custom page and include either standard controller or extension. Or if you want
to add the same meta-tag on all pages I run into this limitation. Is there better way to do this?
Generally - no. Roughly speaking if Salesforce doesn't allow you to do something it usually means there's pretty good hint you're doing in it wrong. I realize it sounds like I'm a fanboy but in reality - can you expand your question with concrete example why would you want to do something like that? For example governor limits are evil, annoying etc. - but they force you to write effective code that doesn't strain the database too much.
if you want to do something whenever objects get saved
That's what triggers are for. Ask yourself a question if the "action" you need to make should happen only from web UI or also when performed from API (mass data load, a smartphone application etc).
if you want to add the same meta-tag on all pages
You could maybe pull off similar result by adding a component to the sidebar. It won't cover all cases (like accessing Reports/Dashboards) but it's hard to say more without knowing what you're really after. Then again - custom VF page overrides won't help you when it comes to Reports either.
I wanted to add this as a comment, but was unable to.
Anyways, For the example that you mentioned in the comment, You can add that jQuery plugin in the Home page side bar component and activate the plugin only on those custom objects where you wnat to run this plugin. You might already know that we can deduce which object a record belongs to by looking at the 1st 3 letter of the record Id, using this logic, check if the record belongs to the custom object you want your plugin to act on and run the plugin.
But As eyescream has pointed out adding script in side bar has its own limitations: you cannot use the global variables , side bar components are not loaded on the reports and dashboard tabs etc.
-ಸಮಿರ್

Adding DNN module error when control has key assigned

I'm creating a module and I was able to add a user control as a view type and everything worked. I want to add a second control, also as a view type, but that's where trouble begins.
If I just add the new control to the module definition, it displays only that control and not both. If I remove it, the original control displays fine. Going back into the module definitions, I went to the module controls and assigned values to the respective Key properties. When I save, my module disappears from the page it was displayed on. If I try to add it again, I get "Object reference not set to an instance of an object."
It was through trial and error I discovered if I remove the key, I can re-add the module it works again (at least as described above).
Essentially I want multiple views for my module where individual views can be displayed on different pages (much like the Blog module). I'm not creating a package for distribution so I'm almost to the point of just creating a separate module, but where's the learning experience in that?
I've searched for a tutorial on creating a module with multiple views with no luck. Can anyone provide some insight?
I got round this issue by using the modulesettings to choose which display I wanted for that instance, in my case I used the setting to determine which front end was visable and which was not aswell as the backend code.
Another option is to have one view ascx which is a placeholder and inject either ascx view you want based on a modulesetting.
I have used both these methods before and both work well
In DotNetNuke there can only be one 'View' so if you want to make something that displays different views depending on the situation you have to create a Dispatch view. So depending on your module setting like you have, or a URL parameter, cookie, session, something in the primary View gets another user control to display what is needed.
This post talks about it a bit Dispatch View
Sounds like you found a solution that works for you.
Out of the box DotNeNuke also supports using multiple views, however as soon as you switch to a different view the module enters "Isolation Mode", where it becomes the only module visible on the page.
If this behavior would work for you, then you can add multiple controls, the FIRST control you add without a key, the secondary controls you add with a specific key. You can then use NavigateUrl or EditUrl to construct the link to the specific controls.
From an "edit" perspective, the use of this pattern ensures that your users have a consistent environment with only your module. From a View perspective the usage of other patterns is more commonly a "better" choice.

Resources