Archive

Archive for the ‘DotNetNuke’ Category

Create DNN Schedule in Code

August 28, 2010 Leave a comment

In one of my previous posts, i described the mechanism to schedule a tasks in DotNetNuke.

DNN provides a user interface to create and manage scheduled tasks (a.k.a Schedule Items), you can access the schedule items by logging in as Host and navigating to Host -> Schedule. You can manage already created schedule items here and you can create new schedule items as well.

But, if you want to create a schedule item in code, following piece of code will help you.

Code: Create Schedule Item


private DotNetNuke.Services.Scheduling.ScheduleItem CreateScheduleItem(
    String friendlyName,
    String typeFullName,
    String objectDependencies,
    int timeLapse,
    String timeLapseMeasurement)
{
    DotNetNuke.Services.Scheduling.ScheduleItem objScheduleItem =
        new DotNetNuke.Services.Scheduling.ScheduleItem();
    objScheduleItem.FriendlyName = friendlyName;
    //ONLY Supported in 05.02.xx and above versions

    objScheduleItem.TypeFullName = typeFullName;
    objScheduleItem.TimeLapse = timeLapse;
    objScheduleItem.TimeLapseMeasurement = timeLapseMeasurement;
    objScheduleItem.RetryTimeLapse = 1;
    objScheduleItem.RetryTimeLapseMeasurement = "m";
    objScheduleItem.RetainHistoryNum = 100;
    objScheduleItem.AttachToEvent = "";
    objScheduleItem.CatchUpEnabled = false;
    objScheduleItem.Enabled = false;
    objScheduleItem.ObjectDependencies = objectDependencies;
    objScheduleItem.Servers = Null.NullString;
    return objScheduleItem;
}

Code: Add the Schedule Item to DotNetNuke


DotNetNuke.Services.Scheduling.ScheduleItem item =
CreateScheduleItem("Test Item", "TypeFullName", "", 10, "m");

int scheduleID = 
DotNetNuke.Services.Scheduling.SchedulingProvider.Instance().AddSchedule(item);
Advertisements

Schedule a Task in DNN

August 23, 2010 1 comment

DotNetNuke provides a robust framework for scheduled tasks. Some tasks are already scheduled by DotNetNuke installation and you can also add your own custom tasks to the DotNetNuke schedule.

DotNetNuke schedule is accessible from the Host -> Schedule screen. This screen lists all of the scheduled tasks also called schedule item. You can see status, history and properties of each schedule item.

You can find more details about DotNetNuke Scheduler in this PDF document.

You can find more details about creating a DotNetNuke schedule item in following posts:

The first step in creating a Schedule Item is to create a DotNet Assembly that will contain the logic to execute the scheduled task. Your class for task execution should inherit from DotNetNuke.Services.Scheduling.SchedulerClient. Once the Assembly is ready, you can create a new Schedule Item by going to Host -> Schedule -> Add Item to Schedule.

Using jQuery with DotNetNuke 04.xx.xx

jQuery support is available in 5.0 and later versions of DotNetNuke (read more) . If you are working in older versions of DotNetNuke you can include jQuery yourself to your DNN Skin and get all jQuery benefits.

Recently I tried jQuery 1.4.x with DotNetNuke 04.09.xx in a DNN Skin. jQuery was installed successfully and it was working fine. But i noticed that some of the DNN core functionality was broken. Major issue was that once i logged in as admin action menu of modules were no more visible and there were some java-script errors.

I found out that java-script based menus were having conflict with jQuery. These issues were resolved by following two steps:

  1. Call jQuery.noConflict(); before calling jQuery methods
  2. Use fully qualified jQuery instead of $ sign e.g. jQuery(document).ready(function(){…});

Now jQuery is fully compatible and functional with older versions of DotNetNuke and all of the existing functionality is intact.

You can find more about jQuery.noConflict() at http://api.jquery.com/jQuery.noConflict/

Categories: DotNetNuke, JQuery

CATALooK Product Thumbnails

July 21, 2010 2 comments

While designing a skin for CATALook (eCommerce Module for DotNetNuke), there was a scenario where product additional images were shown in the product details page. CATALook displays some default images as thumbnails, clicking the default image opens actual image in light box.

Default Product Thumbnails

Default Product Thumbnails

Now if we want to replace the default thumbnail with actual thumbnail, CATALooK does not provide support for this. To achieve this, i edited the CATALooK skin to add ID to parent TD where the product image thumbnails control was added. You can search for the text <cat:MEDIAMENU id=”MEDIAMENU2″ Runat=”server”> in /DesktopModules/CATALooKStore/Skins/SKIN_FOLDER/ItemPane.ascx. Now we can use this ID in Java-script to replace the default image with actual product image. Following is the screenshot after adding the ID and Java-script.

Actual Product Thumbnails

Actual Product Thumbnails

Sample Java-script method can be downloaded here.
jQuery version can be downloaded here.

Categories: DotNetNuke, Javascript, JQuery Tags: ,

Dev Watch – DotNetNuke Skinning

Categories: DotNetNuke Tags:

Google Analytics Support in DNN

Google Analytics is the enterprise-class web analytics solution that gives you rich insights into your website traffic and marketing effectiveness. Powerful, flexible and easy-to-use features now let you see and analyze your traffic data in an entirely new way. With Google Analytics, you’re more prepared to write better-targeted ads, strengthen your marketing initiatives and create higher converting websites. – http://www.google.com/analytics/
Stop messing around inserting bits of script into your skin files, and fiddling about with making small changes. Get this totally free module and do it once, and do it properly!It installs as a standard DotNetNuke module, then by updating the settings with your Google Account Id, the site will immediately start reporting back to Google.
This simple, lightweight module does away with the messy business of inserting the Google Analytics (GA) script in the right place on the page and allows quick integration of a DotNetNuke portal website with Google Analytics.
This great free module can be downloaded from: http://www.ifinity.com.au/Products/Google_Analytics_Script_Module
You will have to login using Host account on your DNN installation to install this new module. Once the module is installed, it will be available to be added to DNN pages.
First of all include the module on one page and provide the Google Analytics settings. Setting screen would be simmilar to following:
GoogleAnalytics Settings

Google Analytics Settings

Once the settings are saved, Google Analytics will start working on the page. If you want to include this on all pages of your site, you can select the following settings of the iFinity Google Analytics Module:
Google Analytics Add to Pages Setting

Google Analytics Add to Pages Setting

Categories: DotNetNuke Tags: ,