February 2007 - Posts

Beautiful DNN

Judulnya provokatif banget ya. :) 

Tadi malam jam 2 pagi sempat chat sama beberapa core team DNN. Memang diakui bahwa DNN masih kekurangan resource mengenai module development. Ada banyak di luar sana modul yang bagus-bagus (http://www.snowcovered.com) tetapi informasi bagaimana membuat modul seperti itu jarang sekali. Resource yang mungkin agak lengkap bisa dilihat di http://dotnetuke.adefwebserver.com juga di blogs-nya Synapsis atau Scott McCulloch, atau Nina Meiyer, atau John Mitchell, dan tentu saja ... forum diskusi baik di www.asp.net maupun yang di www.dotnetnuke.com

Masalahnya adalah, hampir tidak ada informasi yang membahas bagaimana module development menggunakan javascript library. Memang ada satu dua yang membahas MS Ajax seperti di http://vladan.strigo.net tapi itu porsinya dikit banget.

Terpikir ide bagaimana mempercantik module development menggunakan Ajax ataupun javascript library seperti MS AJAX v1.0, AjaxPro, JQuery, yui-ext, Yahoo UI Library dan popular javascript library lainnya seperti motools, mochikit, moofx, scriptacoulous, prototype. Memang tidak semua bisa di bahas dengan cepat, tapi setidaknya itu akan membawa nuansa baru bagi dunia pengembangan modul di DNN.

Ide ini saya sampaikan ke core team, dan mereka sangat senang jika ada sukarelawan yang mau melakukan itu. So next, i'm gonna do that. Saya harap apa yang saya tulis bisa menjadi bahan referensi berharga bagi para DNN lover untuk mempercantik modulnya. Just for fun. Playing with those libraries is funny. Ada banyak hal yang bisa dipelajari seperti :

  • Bagaimana kita bisa menggunakan DomQuery untuk mengakses elemen pada DNN. Sederhana sih, tapi karena DNN merender dan membuat unique ID terlebih dahulu pada setiap kontrolnya, dan javascript library itu tergenerate setelahnya, maka perlu ada trik agar bisa mengakses DOM element di dalam DNN page, misal dengan mencegat proses render module agar bisa masuk di proses render page DNN. Jadi, page ID bisa mengikuti bagaimana DNN merender unique ID pada setiap elemen yang menggunakan tag runat=server atau mengganti pemanggilan javascript biasa agar bisa melalui HttpHandler (.asmx).
  • Bagaimana menggunakan javascript via ASP .NET AJAX untuk mengakses .NET class dan mengembalikan nilainya dalam bentuk JSON dan kemudian di parse oleh javascript library yang digunakan.
  • Jika informasinya tidak critical, bisa put SQL query pada level client untuk boost performance menggunakan tools Trimpath. Nice tool ! Dikombinasikan dengan MS AJAX.
  • dan banyak lagi

Saya harap bisa membuatnya disela-sela waktu senggang ngurusin project client.

 

Share this post: | | | |
Posted by agung | with no comments
Filed under:

Using yui-ext with DNN module

Today, i have doing something with yui-ext and trying to put into my DNN module.

yui-ext is an extended javascript library from cool Yahoo UI Library. After doing some testing, trial and error, now i can integrate yui-ext library into my DNN modules ! Nice !

I think, if i combine it with ASP .NET AJAX, my ASP .NET apps will bring a very great rich internet application (RIA) based on javascript technology. yui-ext is different beast compared to WPF/E. Why ? Because WPF/E need a plug-in to install to your operating system (which not all of you want it). For user experience, WPF/E is better.

There are many choice out there about javascript library. Since today, i have using :

  1. Ajax Control Toolkit (often use it in my DNN project)
  2. Yahoo UI Library (not yet researched, but after seeing yui-ext is more simpler and fast, so i choose to learn yui-ext first. yui-ext is derived from yui from Yahoo)
  3. yui-ext (still researching, nice and cool javascript library. Will be used in my next DNN project)
  4. jQuery (next, i will doing some research about this beast. Cool enough)

yui-ext into DNN modules

You can check online version here. Thanks to http://www.erudeye.net/ for DNN hosting.

That site is only for my DNN online research. Nothing special, and please do not register on that site. :)

Next, i will post how to integrate great yui-ext into DNN module. Stay tune !

Share this post: | | | |
Posted by agung | with no comments
Filed under:

On Startups

Nice site : http://onstartups.com/Home/tabid/3339/Default.aspx
Share this post: | | | |
Posted by agung | with no comments

WPF/E and ASP .NET AJAX = WOW !

Sudah seminggu ini riset makhluk bernama "WPF/E". Cool !

Kombinasi antara WPF/E dan ASP .NET AJAX akan benar-benar memberikan efek WOW ! That's why DNN Indonesia will use AJAX and WPF/E. Selain itu, WPF/E sudah cross browser. Sample yang dibuat bisa running di FF dan Mac ***. Keren !

Tomorrow, i'm gonna speak about WPF/E and ASP .NET AJAX at ITB Academic Day in Bandung.

Share this post: | | | |
Posted by agung | 2 comment(s)
Filed under:

How-To-Select Guides for .NET developers

If you confuse about many comparison between .NET stuffs, like :

Object-relational mappings tools for .NET, or
Charting componenst for .NET, or
Visual Studio 2005 licensing options, or
Deployment tools for .NET, or
PDF components for .NET, or many things...

You should go to this site : http://www.howtoselectguides.com/

Share this post: | | | |
Posted by agung | 1 comment(s)

DNN Indonesia new site, soon !

Maaf jika situs www.dnnindonesia.net belum up hingga hari ini.

Sejak banjir besar beberapa minggu lalu, praktis server DNN Indonesia di kantor mati total. Setelah koneksi pulih, eh Telkom ADSL-nya yang gantian error. Huh, belum lagi permohonan pindah nameserver gak ditanggapi. Ternyata (katanya) server Centrin sedang mengalami gangguan. Akhirnya mati deh situs selama beberapa minggu. Sedih juga. Akhirnya diputuskan untuk pindah. Pilihan jatuh pada www.wirowaas.net dan www.erudeye.net Tapi karena di Wiro Waas hostingan untuk Windows platform sudah full, akhirnya pilihan jatuh ke www.erudeye.net.

Permohonan untuk update nameserver ke ISP Centrin baru dikerjakan (kemungkinan) hari ini. Padahal sudah sejak lama sekali. :(

Sambil nunggu terupdate dan server up lagi, saya ubah wajah DNN Indonesia di tahun 2007 ini dengan memasukkan teknologi AJAX dan WPF/E dengan Vista-style. Thanks for www.erudeye.net untuk support hostingnya dan fast technical support-nya. Karena di www.erudeye.net sudah support DotNetNuke dan juga AJAX, maka proses migrasi tidak memerlukan effort besar.

DNN Indonesia

Sample screenshot v1.0. 

Stay tune for the public release of DotNetNuke Indonesia Community new site.

Share this post: | | | |
Posted by agung | 1 comment(s)
Filed under:

List of AJAX Automated Testing and Debugging Tools

I think this information is useful for INDC community. So i wanna share you about a lot of stuff about Ajax that you can learn.

  • ASP.NET AJAX Enhancements Library - The ASP.NET Ajax Enhancements Library is designed to provide an automated Unit Testing framework that integrates with VS.NET.  It also includes a client-side library that adds additional features to the Microsoft supported ASP.NET 2.0 Ajax Extensions Core library that do not currently exist in the Futures CTP.  The client-side library adds some nice short-cuts (haven't tried them yet...but they look interesting) such as $foreach and $break, as well as List and Dictionary classes.  It also includes a LINQ to JavaScript implementation.  Cost: Free
  • Custom AJAX Testing - Article by James McCaffrey that discusses creating custom AJAX test automation scripts. Cost: Free
  • jsMock - JSMock is a fully featured Mock Object library for JavaScript that provides the necessary tools to do effective interactive based testing. JSMock provides expectation recording and matching, and has the ability to return, throw, and stub on object method calls. The interface is simple and easy to use, which makes testing easy. Cost: Free
  • jsUnit - JsUnit is a Unit Testing framework for client-side (in-browser) JavaScript. It is essentially a port of JUnit to JavaScript. Also included is a platform for automating the execution of tests on multiple browsers and mutiple machines running different OSs.  An article on using jsUnit can be found here.
  • Selenium - A test tool for web applications. Selenium tests run directly in a browser, just as real users do. And they run in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh. Cost: Free
  • Sprajax - Although not a test automation tool, Sprajax allows AJAX applications to be scanned for potential security threats. Cost: Free
  • Squish - froglogic Squish is a professional cross platform automated GUI and Web testing framework.  Squish allows to create tests for GUI and Web applications by recording or manually writing test scripts. Squish supports popular scripting languages for the test scripts and gives access to additional APIs. This way QA engineers can easily create powerful and robust tests to enhance and keep up the quality of the tested application. Cost: Unknown
  • WaitiN - WatiN is developed in C# and aims to bring you an easy way to automate tests with Internet Explorer. An article discussing WaitN can be found here.  Cost: Free
  • WebAii - Caters specifically to automated testing of the "Web 2.0" generation of internet applications. WebAii is one the most advanced and rich .NET automation infrastructures available in today's market and is provided FREE of charge to the developer and quality assurance community. Cost: Free

Several AJAX debugging tools are listed below:

  • 1st JavaScript Editor Pro - 1st JavaScript Editor is used for professionally editing JavaScript code and creating animations and other special effects for Web pages using DOM, DHTML, CSS, Ajax (Asynchronous JavaScript and XML) and JavaScript. Cost: $49.90
  • FireBug - Firebug integrates with Firefox to put a wealth of development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page. Cost: Free
  • Fiddler - Fiddler is a HTTP Debugging Proxy which logs all HTTP traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP Traffic, set breakpoints, and "fiddle" with incoming or outgoing data. Cost: Free
  • JavaScript HTML Debugger - SplineTech JavaScript HTML Debugger is an award-winning JavaScript Debugger that enables you to easily edit and debug JavaScript and VBScript inside HTML pages. Client-Side JavaScript, JScript and VBScript debugging languages are fully supported for simple and complex HTML and DHTML debugging scenarios. Cost: $89.00
  • MyEclipse AJAX Tools - The MyEclipse AJAX / Web 2.0 toolkit features an enhanced JavaScript Editor and JavaScript Debugger (Professional Edition feature). Cost: Annual subscription
  • Script Debugger - The Microsoft Script Debugger is a debugging environment that extends any Microsoft ActiveX® Scripting host application—for example, Microsoft Internet Explorer (IE) or Microsoft Internet Information Server (IIS). Cost: Free
  • Venkman - Venkman is the code name for Mozilla's JavaScript Debugger. Venkman aims to provide a powerful JavaScript debugging environment for Mozilla based browsers. Cost: Free
  • Visual Studio .NET (and Web Developer Express) - Development IDE that provides integrated JavaScript debugging capabilities. Cost: Free and pay versions
  • Web Developer Helper - Web Development Helper is an Internet Explorer plugin written by Microsoft's Nikhil Kothari that provides a set of useful tools to both Ajax/JavaScript developers as well as ASP.NET page and control developers. Cost: Free

This post originally by Dan Wahlin, copied from him. Thanks Dan.

Share this post: | | | |
Posted by agung | with no comments
Filed under:

24 Februari - ITB Academic Day, Bandung

I will be in Bandung at Februari 24. Together with .NET cheerleaders :)

0900-0930

Opening Speech

0930-1030

Risman Adnan/Zeddy Iskandar
Phoenix Framework/Windows Research Kernel

1030-1130

Norman Sasono
Multiparadigm Programming

1130-1200

Huibert Andi Wenas

How ERP support DSS of National Company in Indonesia

1200-1300

Lunch

1300-1400

Kiki Rizki Noviandi
Spreadsheet Mining

1400-1500

Basiruddin
Portal Workflow

1500-1600

Dondy Bappedyanto
Software Factories

1600-1700

Agung Riyadi
Presentation Technologies

I will speak about Presentation Technologies. From Winform, ASP .NET, Smart Client, AJAX, and next ... WPF.

I hope one hour is enough (usually one and a half or maybe more. ;) )

See you in Bandung !

Share this post: | | | |
Posted by agung | 7 comment(s)

Microsoft Shared Source Indonesia Success Story !

Hey, this morning i've got an email from Harian Seputar Indonesia like this :

Dear Mas Agung,

 

Perkenalkan saya A**** F****, wartawan Harian Seputar Indonesia (SINDO).

Tempo hari saya berbincang dengan Microsoft Indonesia.

Saya dengar dari Microsoft, Mas Agung adalah salah seorang yang sukses mengeksplorasi potensi Microsoft Shared Source.

 

Karena saya akan menulis Microsoft Shared Source, saya ingin melakukan wawancara dengan Mas Agung mengenai topik tersebut. Saya ingin mendengar cerita Mas Agung dalam memanfaatkan Microsoft Shared Source.

 

Jika memungkinkan, saya ingin melakukan wawancara tatap muka dengan Mas Agung segera. Namun jika tidak memungkinkan untuk bertemu, kita bisa wawancara melalui telepon atau e-mail. Bolehkah saya meminta nomor ponsel Mas Agung agar kita bisa lebih mudah berkomunikasi?

 

 

Regards,

 

A**** F****

Asisten Redaktur

HARIAN SEPUTAR INDONESIA

www.seputar-indonesia.com

 

Menara Kebon Sirih Lantai 22

Jl. Kebon Sirih Raya No.17-19

Jakarta Pusat 10340

P: 021 392 6955 Ext. 2431

M: 0888 1772 184

F: 021 392 9758, 021 392 7721

 

Great to hear that i have choosen to interview with Harian Seputar Indonesia. Yes, BataviaSoft using this stuff from Microsoft Shared Source to help our business grow :

  • Microsoft AJAX v1.0 (a free AJAX implementation technology from Microsoft)
  • ASP .NET Ajax Control Toolkit (a free Ajax control for ASP .NET 2.0)
  • Enterprise Library (a free library of application block designed to assist developers with common enterprise development challanges)
  • Rotor (C#/JScript/CLI) Implementation (a free .NET Framework source to learn in .NET Academy)
  • Sharepoint Community Kit (a free site template that enables the creation of a functional community website on Windows SharePoint Services V3 or MOSS 2007)
  • Source Code Outliner Power Toy (a free Visual Studio extension that provides a tree view of your source code's types and members and lets you quickly navigate to them inside the editor)
  • SQL Server Hosting Toolkit (a free tools for deploy .mdf database in .sql shape. Suitable for hosting scenario)
  • SQL Server Web Tools (a free web-based solution to manage SQL Server databases)
  • Visual Studio .NET Academic Tools (a free tools to enable professor, students, academic researchers, and independent developers to access and use source code for specific tools that can be used with Microsoft's Visual Studio.

Plus DotNetNuke (a free web application framework) as our core main business.

I think we are the only company that propose solution based on free things (Microsoft said, shared ;-) ). So, next you can read my story on Harian Seputar Indonesia. :)

Share this post: | | | |
Posted by agung | with no comments

June 2007, DNN roadshow in 9 provinces !

In November 2006 we have done a DNN training for 5 cities (Yogyakarta, Semarang, Surabaya, Banten, Bandung) for IKM (Industri Kecil Menengah). Now, we have a agenda for DNN roadshow.

Yes, DNN roadshow and training for IKM will be held in 9 provinces. Stay tune !

Share this post: | | | |
Posted by agung | 2 comment(s)
Filed under:

My DNN articles on DNN Wiki

I just put my DNN articles on DNN Wiki (http://www.dnnwiki.net).

  1. Simple Module Delete Tutorial
  2. Custom technique, Action Menu, Navigation, and Module path tutorial

Why use DNN Wiki ? Because DNN Wiki only post ORIGINAL article !

This is the notification from DNN Wiki administrator page :

"Some simple rules please:

  1. Keep it legal
  2. Keep it original (no copying without the owners express permission)
  3. Use "Heading 2" for sub-headings on the page
  4. No swearing, abuse, or anything that could be used in a court of law!!

Please don't copy content from other web sites without the express permission of the copyright owner of the material - we will have to remove it. We would far rather link to that web site instead."

Check it out !

Share this post: | | | |
Posted by agung | 2 comment(s)
Filed under:

Custom technique, Action Menu, Navigation, Module path reference - Part 2

Ok. Let's continue. :)

Next, what i'm gonna show you is how to add custom drop down action menu.

Just open your Injector.ascx.cs, and watch this line :

public partial class DesktopModules_MyModule_MyModule : PortalModuleBase

Change it to :

public partial class DesktopModules_MyModule_MyModule : PortalModuleBase, IActionable

Hey ! What's the different ? Remember that every .ascx must inherit from DotNetNuke.Entities.Modules.PortalModuleBase. To add custom drop down list menu, you have to implement IActionable interface. That's why you have to implement it in your class. Create this code after you change your class declaration :

    public ModuleActionCollection ModuleActions
    {
        get
        {
            ModuleActionCollection myAction = new ModuleActionCollection();

            myAction.Add(GetNextActionID(),
                    "Goto Page2",
                    ModuleActionType.AddContent,
                    "",
                    "",
                    Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "", "ControlType=page2"),
                    false,
                    DotNetNuke.Security.SecurityAccessLevel.Edit,
                    true,
                    false);

            myAction.Add(GetNextActionID(),
                    "Goto Page3",
                    ModuleActionType.AddContent,
                    "",
                    "",
                    Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "", "ControlType=page3"),
                    false,
                    DotNetNuke.Security.SecurityAccessLevel.Edit,
                    true,
                    false);
            return myAction;
        }
    } 

This property is an implementation from IActionable interface. Create a ModuleActionCollection instance, name it with myAction. I will not cover in detail about parameters that are used in ModuleActionCollection. But only the important thing that you should understand. First parameter is a GetNextActionID() method. It is a method to create unique ID of your menu. Second parameter is a string that you want to put in your drop down action menu. You can use a resource file to separate string you want to use. In this case, i hardcode with "Goto Page2" and "Goto Page3". Sixth parameter is an action where your menu will be redirect to. In this case, every time a user click a "Goto Page2" menu link, i'm gonna redirect it to Injector.ascx again and passes a querystring with name "ControlType". This querystring then will be evaluated in ReadQueryString method. :) That's why i create a ReadQueryString method. So, based on ControlType querystring value, i pass a control into Injector.ascx. This technique is very flexible. Since i only register one control to DNN Framework. Another .ascx can be evaluated from ReadQueryString method.

Watch this code : 

Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "", "ControlType=page2")

This is a special method to redirect to another .ascx in DNN Framework. Usually you use code like this to redirect to another page :

Response.Redirect("Homepage.aspx");

But, in DNN Framework if you want to redirect to another ascx, you have to code like this :

Response.Redirect(Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "", "ControlType=page2"));

You have to pass a TabID (a menu), pass a control key (if it exists), and pass a whatever querystring parameter you want to use. If you're in the same page (the same Tab or the same menu), so you do not have to inclue PortalSettings.ActiveTab.TabID parameter. Just pass your control key or your querystring parameters.

So, everytime you want to redirect to another page, just type :

Response.Redirect(Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "", "ControlType=your_querystring_value_here"));

And everytime you want to add another control, just add some code from ReadQueryString() method based on your needs. 

And the last thing is, if you want to refer to you module path you can use this code :

this.ResolveUrl("your_image_or_css_or_js_file_here_with_extension");

ResolveUrl method is an override method that always return your relative path to your module project. It will always returns the correct path to your module project directory. You can explore more, for example, you can refer to HomeDirectory folder, or SkinPath folder, or Images folder, etc. All special folder can be accessed from DNN API.

You see that, DNN Framework provide a consistent and standar way how to develop module. It will makes your development become easier, consistent, standard, powerfull, robust, and secure (we will cover about security in my next articles).

See you next time in my DNN development module tutorial !

Share this post: | | | |
Posted by agung | with no comments
Filed under:

Custom technique, Action Menu, Navigation, Module path reference - Part 1

Yesterday, i post about DNN Quick Module Management. It's a simple module that show you about some DNN capabilities (including ClientAPI). Now, many of my friends ask me that can DNN module be built with C# language ?

The answer is YES.

There are many ways to create DNN module. You can use DNN Templates (both C# and VB are available). Or you can create DNN module just like ASP .NET Web Application Project as usual. You can seperate DNN module project from it's source and manage with your own Visual Source Safe. Ok, stop speaking, just show me what you are talking about ! :)

First, i'm gonna create my simple UI like this :

DNN simple module

You see, there are a couple things that i'm gonna cover in this tutorial :

  1. How to add custom drop down action menu (eg. "Goto Page2", "Goto Page3"). This custom dropdown action menu also will render as link button as you see above (look at below the module, you see a link "Goto Page2" and "Goto Page3")
  2. How to refer to a relative path to your module directory (like the Vista image)
  3. How to navigate between one .ascx to other .ascx in one module.

Let's DNN rock !

You know, there are many ways to create DNN module. What i'm gonna tell you is another technique that usually i use in every module development in my company. I'm gonna explain with a short way :

  • Create a new folder under DesktopModules folder. Name it with MyModule folder. 
  • Create one .ascx (eg. name it with Injector.ascx) under MyModule folder. This Injector.ascx will act as control injector for every .ascx that you want to add into your module. This is the file that will be recognized by DNN Framework as a default View for MyModule module. Injector.ascx only have one PlaceHolder control. So, you have to put your PlaceHolder control onto Injector.ascx.
  • Write code to handle control injection.

Suppose that you have opened your dotnetnuke web project. Just right click to DesktopModules folder, create a new folder and name it with MyModule folder.

Right click on MyModule folder, and click Add New Item. Choose Web User Control, name it with Injector.ascx (don't forget to choose Visual C# as a language from language drop down list)

Do the same thing, and add 3 more files. Name it each : Home.ascx, Page2.ascx, Page3.ascx (don't forget to choose Visual C# as a language)

By default your .ascx file will always be inherited from System.Web.UI.UserControl. Change it to DotNetNuke.Entities.Modules.PortalModuleBase for each file.

To save your time, just add this reference to your Injector.ascx.cs :

using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Common;

Right below your class code, add this code :

    private string m_ControlToLoad; 

Then, add this functionality (i will explain it after code) :

    private void LoadControlType()
    {
        PortalModuleBase objPMB = (PortalModuleBase) this.LoadControl(m_ControlToLoad);
        if (objPMB != null)
        {
            objPMB.ModuleConfiguration = this.ModuleConfiguration;
            objPMB.ID = System.IO.Path.GetFileNameWithoutExtension(m_ControlToLoad);
            plhControl.Controls.Add(objPMB);
        }
    }

LoadControlType method is used to inject your other .ascx. First, you have to create one PortalModuleBase instance, and load a control based on m_ControlToLoad variable and cast it to PortalModuleBase object (that's why your .ascx should inherit from PortalModuleBase class). m_ControlToLoad only a string variable that used to keep your .ascx file name. You have to declare it as private right under your class.

This method also will check if objPMB is null. If it doesn't, then it will put ModuleConfiguration information to your PortalModuleBase instance (objPMB). Then, you set the ID property based on m_ControlToLoad value. You see that System.IO.Path.GetFileNameWithoutExtension is used because the PortalModuleBase ID is based on relative path on your module including filename without extension. This is only make sure that you load the appropriate module. Last, you inject your PortalModuleBase instance (objPMB) into your plhControl object.

After you add LoadControlType method, you have to create another method :

    private void ReadQueryString()
    {
        string qs = string.Empty;

        if (Request.QueryString["ControlType"] != null)
        {
            qs = Request.QueryString["ControlType"].ToString();
        }

        if (qs != string.Empty)
        {
            switch (qs.ToLower())
            {
                case "home":
                m_ControlToLoad = "Home.ascx";
                break;

                case "page2":
                m_ControlToLoad = "Page2.ascx";
                break;

                case "page3":
                m_ControlToLoad = "Page3.ascx";
                break;

                default:
                m_ControlToLoad = "Home.ascx";
                break;
            }
        }
        else
        {
            m_ControlToLoad = "Home.ascx";
        }
       
    } 

ReadQueryString method is used to catch querystring name (in this case is ControlType) and check its value. You have to determine which page should be the default page that will load automatically if no querystring exist. In this case, i use Home.ascx as the default value.

Last, put your methods into Page_Init method like this :

    protected void Page_Init(object sender, EventArgs e)
    {
        ReadQueryString();
        LoadControlType();
    }

Next step is register your module to DNN Framework. Go to your DotNetNuke website. Login as a Host. Then, go to Host --> Module Definitions. Choose Create New Modules. On Edit Module Definitions page, fill this information :

Module Name : MyModule
Folder Name : MyModule
Friendly Name : MyModule
Description : This is mymodule description (blah..blah..blah) :)

Click Update

Then, fill this information :

New Definition : MyModule

Click Add New Definition

Click Add Control

After that, you will see a Edit Module Control page. Fill this information :

Source : DesktopModules/MyModule/Injector.ascx
Type : View

Click Update

That's all !

Is that finished ? No. Not yet folks. :) Next, we will cover how to navigate between one .ascx to another and how to refer to your module folder path in second part.

Stay tune !

Go to Part 2.

 

Share this post: | | | |
Posted by agung | 1 comment(s)
Filed under:

DotNetNuke Quick Module Management

Every time i got DNN project, this scenario always happened :

You know, every page of DNN consist one or more modules. Deleting 3 or more modules are painful. You have to click in every action menu in every module, and click Delete. After click Delete link, a confirmation window trigger and you have to click OK button again. There are many click you have to do.

It's time to develop custom module to create a short-way. This is the prototype that i have created 4 months ago (yes, it quite long, wasn't it ? :) ) But i believe it will usefull for DNN lovers. :)

Quick Page Module Management

First, just create UI like screenshot above. Very simple, only have 4 controls, btnDelete, btnShowModules, listTabs, and gridModules.

What we will cover is :

  1. How to load DNN menu (or tabs) and bind it in a bindable control
  2. How to use DNN ClientAPI to inject confirmation window to a button control (or whatever web control you like)
  3. How to load DNN modules and bind it in a bindable control
  4. How to delete module
  5. How to clear DNN site cache

First, make sure you add your namespace reference :

Imports DotNetNuke
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Entities.Tabs

Let's code !

1. Suppose that i have a dropdown list control (eg. listTabs). I will bind DNN tabs into my dropdownlist control using this code :

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Dim objTabs As New TabController
            Dim arTabs As ArrayList = objTabs.GetTabs(PortalSettings.PortalId)

            listTabs.Items.Insert(0, New ListItem("--- Select Tabs ---", "0"))

            For Each tab As TabInfo In arTabs
                If Not (tab.IsAdminTab Or tab.IsSuperTab) Then
                    If tab.IsVisible Then
                        Dim item As New ListItem
                        item.Text = tab.TabName
                        item.Value = tab.TabID.ToString()

                        listTabs.Items.Add(item)
                    End If
                End If
            Next
        End If
    End Sub

    You see a method called IsAdminTab, isSuperTab, and IsVisible. We have to extract tabs first because we do not want Admin and Host module to be deleted, right ? :) So IsAdminTab and IsSuperTab will filter those things. And what is the isVisible ? You know, when you click on Admin --> Pages, you will see Search Result page which is not visible from user perspective, but shown on Pages administration menu. We have to filter it too. Since users can have more than one non-visible menu (even the name is non-visible, but it still can accessed from you DNN framework or your code).

    Then I create two methods to wrap LoadTabModules functionality. I will explain each of them.

    ' This method used to load tab modules based on TabID/menuID. It returns as ArrayList.
    Private Function LoadTabModules(ByVal TabID As Integer) As ArrayList
        Dim objModules As New ModuleController
        Dim arrModules As New ArrayList

        For Each kvp As KeyValuePair(Of Integer, ModuleInfo) In objModules.GetTabModules(TabID)
            Dim objModule As ModuleInfo = kvp.Value

            If PortalSecurity.IsInRoles(objModule.AuthorizedEditRoles) = True And objModule.IsDeleted = False And objModule.AllTabs = False Then
                arrModules.Add(objModule)
            End If
        Next

        Return arrModules
    End Function 

    You see that objModules.GetTabModules(TabID) **IS A NEW** method to replace GetModules method. It will return KeyValuePair object, then you put it's value into ModuleInfo object. You have to check it first, does it in AuthorizedEditRoles role ? This should checked because your code have to make sure that only appropriate user can delete/add/edit modules. You also have to check, doest it in IsDeleted state ? You can see the deleted module in Admin --> Recycled Bin. It's no use to show them in your custom module. :) The last it, you have to check doest it in AllTabs mode ? AllTabs means that your module will be visible in ALL PAGES in your site. AllTabs is a little bit complicated since it can has more than one behavior. For example, you can have one module that shown on all pages with the same content AND WITH THE SAME ModuleID (meaning that, your other modules is only references from the original one. Change content from original module content will automatically reflected to others). You also can have on module that shown on all pages with the same content BUT different ModuleID (meaning that you don't have a reference to original module). That's why i said that AllTabs should check first because we have to do different behavior for it.

    ' This is only private method to show grid modules
    Private Sub ShowGridModules()
        gridModules.DataSource = LoadTabModules(Integer.Parse(listTabs.SelectedItem.Value))
        gridModules.DataBind()
    End Sub

    This is simple method. Just call LoadTabModules with listTabs.SelectedItem.Value as a parameter and bind it to gridModules object. 

2. Using ClientAPI to inject delete button (the ID is btnDelete), so i'm using code like this :

    Protected Sub btnShowModules_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnShowModules.Click
        ShowGridModules()
        DotNetNuke.UI.Utilities.ClientAPI.AddButtonConfirm(btnDelete, "Do you want to delete selected item(s) ?")
    End Sub

    Please remind that i put ClientAPI.AddButtonConfirm into btnShowModules_Click event. Every time click event fired in this button, it will automatically inject confirmation window into btnDelete control. So whenever you click Delete button, it will show you confirmation button before triggered btnDelete_Click method. Nice ClientAPI ! DNN also has many useful ClientAPI that will help you to work with your project. :)

3, 4, 5 will become one. This code will do the rest :

    Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click
        Dim objModules As New ModuleController

        For Each item As GridViewRow In gridModules.Rows
            Dim chk As CheckBox = CType(item.FindControl("chkSelect"), CheckBox)
            If chk.Checked Then
                objModules.DeleteModule(Integer.Parse(item.Cells(1).Text))
            End If
        Next

        DataCache.ClearHostCache(True)

        ShowGridModules()

    End Sub

    If you see this line --> objModules.DeleteModule(Integer.Parse(item.Cells(1).Text))
    Cells with index number 1 is the ModuleID. Look at the screenshot above. I use custom column that bind like this :

1st column --> Template Column, fill with CheckBox web control. Assign it with chkSelect as ID.
2nd column --> Bound Field, fill your Header Text with "ModuleID" and Data Field with "ModuleID"
3rd column --> Bound Field, fill your header text with "Title" and DataField with "ModuleTitle"
4th column --> Bound Field, fill your header text with "ModuleName" and DataField with "FriendlyName"
5th column --> Bound Field, fill your header text with "Pane Name" and DataField with "PaneName"

Do not forget to uncheck the Auto Generate Columns (or change AutoGenerateColumns value to False from your Property Window).

If you see this line --> DataCache.ClearHostCache(True)
It will clear your host cache, so cache will be invalidated in order to show up the newest request. This line should be used because DNN using cache method that define in Host --> Host Settings --> Performance Settings option. Sometimes, when you delete a module from code in your custom module, it's not really reflected into your site. So you have to clearing up the cache.

You see that DNN provide many functionality that usually happened in your ASP .NET development project. DNN not only has very useful ClientAPI, but also DNN WebControls that you can start with (eg. DNNLabelEdit, DNNTextSuggest, DNNTabStrips, DNNMenu, DNNTreeview, and will grown up in the next release of DotNetNuke)

That's all folks !

See you next time in my DNN development tutorial !

Share this post: | | | |
Posted by agung | with no comments
Filed under:

Five Things You Didn't Know About Me

Norman post an interesting thing here [V], and also post in INDC GroupLeader mailing list about "five things you didn't know about me" that we should post like that too. :)

I try to be the second.

  1. I'm a guitarist. Yeah baby ! I play guitar since when i was in high school. My favorite song is "Sweet Child Of Mine" from GnR. I can play that song with my close eye, and also with guitar melody too. :) I also can play keyboard a little. My favorite song is "Cinta Kan Membawamu Kembali" from Dewa 19. When i teach in university, i usually join with students music band at Saturday. We rent a music studio, and play whatever song there until we tired. :) Song for fun ! Not to being a music band. :)
  2. I'm a 'Pesilat'. My first martial art organization when i was in Junior High School (or SMP) was "Tapak Suci". But only 3 years. Then, i joined Merpati Putih since 1994 when i was in High School (or SMU) until today. I really like Merpati Putih materials. It's very logic (no mantra or doa-doa) and very accelerate our body and mind. Now i'm in "Kombinasi 2" level. I will tell you in short about Merpati Putih. Merpati Putih has 12 level : Dasar 1, Dasar 2, Balik 1, Balik 2, Kombinasi 1, Kombinasi 2, Khusus 1, Khusus 2, Khusus 3, Kesegaran,Inti 1, Inti 2. Each level learned in different time and with different technique. Merpati Putih has special technique which called IGMP (not like SNMP, SMTP, FTP, or HTTP, hehehe) but "ILMU GETARAN MERPATI PUTIH". This technique only learned since Balik 2 level and become higher and pure in the next level. Merpati Putih has recently publicly released a special training program called Vibration Energy that enables human being to feel the surrounding without literary use the eyes. Today in Indonesia there are more than 5000 legally blind persons already trained with this vibration techniques. Now they can walk or head direction without any assistant, they can also physically see objects without touching almost as good as the non-visually impaired. A senior instructor of Merpati Putih, can recognize things surround him and can even read while his eyes are completely blindfolded. Objects around us generate vibrations and ILMU GETARAN MERPATI PUTIH relies on our innate ability to detect the vibrations of objects nearby. This ability or sense can be improved by practice. Visually handicapped people who have mastered the art of ILMU GETARAN MERPATI PUTIH can avoid obstacles in their path, distinguish stationary objects from moving ones, detect speed and distance, and perceive the volume of objects. Ultimately they can read and draw without using Braille. They can even read the text on a computer monitor, read the newspaper and other printed materials. All of this is done without touching the objects. Thanks to IGMP, the visually handicapped can carry out the same activities as those that normal people do and even have the ability to detect vibrations of objects nearby. Thus, ILMU GETARAN MERPATI PUTIH can improve human resources and reduce the visually handicap dependence on others. The training center, INTERNATIONAL VIBRA-VISION FOR THE NON-SEEING, has beenl opened  in early 1998 and offers an opportunity for everyone, especially the visually handicapped to join in IGMP training, which is found only in Indonesia. Not so long after CNN's exclusive report on Merpati Putih program, Oman country has expressed their enthusiasm and strong interest to send their people, particularly The Blinds, to join Merpati Putih Energy Vibration program. His excellency Dr. Omar Zawawi of Oman was very impressed to witness how Merpati Putih training can change the life of the blinds. Information about development can be found here : http://www.geocities.com/HotSprings/4829/develop.html. Scientific information can be found here: http://www.geocities.com/HotSprings/4829/scientific.html. Programs can be found here : http://www.geocities.com/HotSprings/4829/programs.html. This is a few of my experience. In 1996, i'm only a participant in "Kejuaraan Pencak Silat Antar Pelajar se-Wilayah III Cirebon". In 1997 i got my first champion in "Kejuaraan Pencak Silat Antar Pelajar se-Wilayah III Cirebon Dalam Rangka Seleksi Porda". And i'm passed. In 1998 i'm the second champion of "Kejuaraan Pencak Silat Antar Pelajar di Bogor". In 2000 i'm the first champion of "Kejuaraan Merpati Putih se-wilayah III Cirebon". Then in 2002 i also got first champion of "Kejuaraan Daerah Perkelahian Bebas Antar Kelompok Cabang Merpati Putih se-Jawa Barat di STIE YPKP Bandung". In 2003 i got third champion of "Kejuaraan Nasional Perkelahian Bebas Merpati Putih se-Indonesia di Taman Mini Indonesia Indah". In 2005 i got third champion in "Kejuaraan Getaran Merpati Putih se-Wilayah III Cirebon". I also teach my father and my families Merpati Putih technique. Yes, my father got a diabetes (540 ! very high !). But since he learned Merpati Putih, there is no complain about his sickness again. Merpati Putih can save his life (exactly, Allah SWT save his life with Merpati Putih way) ! And now, i teach my son about Merpati Putih since he was 4 years old. My son really like to see me when i'm doing Merpati Putih style. He's trying to follow what i have done. And sometimes when he sicks (usually fever), IGMP can help me to cure him. I want him to know about theirself better (emotion, power, mind, heart, skill, endurance, knowledge, vision, etc). You can read more details here : http://id.wikipedia.org/wiki/Merpati_putih
  3. I love reading books. Yes, i have more than 1000 books from whatever sources. From novel, comics, economy, biography, technology, religy, enterpreneur, biology, and many more. I also have more than 300 CD/DVD from whatever sources. I have full collections of National Geography, BBC, NASA, Martial Arts Magazine, and many more. My dream is own more than 5000 books ! :)
  4. I learned computer since in college (1997). First time i met with ... Foxpro, Clipper, then Visual Basic. And now i fully specialized only in .NET.  technology. I just want to focus in one or two technology area only. The other things should 'known only' (or do you want to learn Delphi also, Power Builder also, Java also ? Don't !!! It's stupid !). Be a specialize !
  5. I have two wife. Sst.. don't follow me yah. :) hehehe
Share this post: | | | |
Posted by agung | 2 comment(s)
More Posts Next page »