Agusto Xaverius P Sipahutar

Job:Making some bugs and patch
Moss/Wss,C#,Sql Server,WWF,K2.BlackPearl
Motto : Keep Study and study
See also: Other Geeks@INDC

News




MCP Logo
MCTS Logo

MCP ID# 3542391

My Curiculum Vitae


Agusto Xaverius P S's Facebook profile

Other Article

My Community

My Article/Share Knowledge

Others Moss/Wss Site

My Other Website/Blogs

My Share (Ebook,etc)

Membuat Custom Feature Module di MojoPortal

Hari ini kita membahas membuat Custom Feature Module di MojoPortal dari article yang lalu kita membuat custom webpart module.

 

1. Kita membuat solusi ini didalam code mojoportal yang telah kita download

image 

Pembuataan folder Modules and Controls bisa bebas.

2.  Buat File SampleExternalModule.ascx didalam folder Module

Asc nya sebagai berikut :

<%@ Control Language="C#" AutoEventWireup="false" EnableViewState="false"
    CodeBehind="SampleExternalModule.ascx.cs" Inherits="SampleExternalModule.SampleModuleControl" %>

<%@ Register TagPrefix="portal" Namespace="mojoPortal.Web" Assembly="mojoPortal.Web" %>
<%@ Register TagPrefix="portal" Namespace="mojoPortal.Web.UI" Assembly="mojoPortal.Web" %>
<%@ Register TagPrefix="mp" Namespace="mojoPortal.Web.Controls" Assembly="mojoPortal.Web.Controls" %>

<portal:ModuleTitleControl id="moduleTitle" runat="server" />
<asp:Panel ID="pnlSample" Runat="server">
    <asp:Label id="lblSample" runat="server" />
</asp:Panel>
<div class="modulefooter">&nbsp;</div>

 

Sedangkan untuk di code behind dengan code sebagai berikut :

using System;
using mojoPortal.Web;

namespace SampleExternalModule
{
    public partial class SampleModuleControl : SiteModuleControl
    {
        protected override void OnInit(EventArgs e)
        {
            this.Load += new EventHandler(this.Page_Load);
            base.OnInit(e);
        }

        private void Page_Load(object sender, EventArgs e)
        {
            this.moduleTitle.EditText = Resources.SampleExternalModule.EditLinkText;
            this.moduleTitle.EditUrl = SiteUtils.GetNavigationSiteRoot() + "/SampleModuleEdit.aspx";
            lblSample.Text = Resources.SampleExternalModule.SampleText;

            this.moduleTitle.Visible = !this.RenderInWebPartMode;
            if (this.ModuleConfiguration != null)
            {
                this.Title = this.ModuleConfiguration.ModuleTitle;
                this.Description = this.ModuleConfiguration.FeatureName;
            }
        }

    }
}

3. Buat file asp nya dimana pada aplikasi di ascx kita bila user klik edit maka akan ke aspx ini.

buat filename dengan nama : SampleModuleEdit.aspx

ASPX nya sebagai berikut :

 

<%@ Page Language="C#" AutoEventWireup="false" MasterPageFile="~/App_MasterPages/layout.Master" EnableViewState="false"
    CodeBehind="SampleModuleEdit.aspx.cs" Inherits="SampleExternalModule.SampleModuleEdit" %>

<%@ Register TagPrefix="portal" Namespace="mojoPortal.Web" Assembly="mojoPortal.Web" %>
<%@ Register TagPrefix="mp" Namespace="mojoPortal.Web.Controls" Assembly="mojoPortal.Web.Controls" %>

<asp:Content ContentPlaceHolderID="leftContent" ID="MPLeftPane" runat="server" />
<asp:Content ContentPlaceHolderID="mainContent" ID="MPContent" runat="server">
        <asp:Panel id="pnlInclude" runat="server">
            <asp:TextBox id="txtTest" runat="server" />
            <asp:Button id="btnClickMe" runat="server" />
            <mp:HelpLinkButton runat="server" id="HelpLinkButton1" HelpKey="linksedithelp" ImageUrl="~/Data/SiteImages/FeatureIcons/help.gif" />
        </asp:Panel>
</asp:Content>
<asp:Content ContentPlaceHolderID="rightContent" ID="MPRightPane" runat="server" />
<asp:Content ContentPlaceHolderID="pageEditContent" ID="MPPageEdit" runat="server" />

dengan code behindnya sebagai berikut :

using System;
using mojoPortal.Web;

namespace SampleExternalModule
{
    public partial class SampleModuleEdit : mojoBasePage
    {
        override protected void OnInit(EventArgs e)
        {
            this.Load += new EventHandler(this.Page_Load);
            this.btnClickMe.Click += new EventHandler(btnClickMe_Click);
            base.OnInit(e);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.PageTitle = siteSettings.SiteName + " - " + Resources.SampleExternalModule.EditPageTitle;
            this.btnClickMe.Text = Resources.SampleExternalModule.ClickMeButtonText;
        }

        void btnClickMe_Click(object sender, EventArgs e)
        {
            this.txtTest.Text = Resources.SampleExternalModule.YouClickedMeText;
        }

    }
}

 

Nah jadilah 1 page feature and edit datanya. Tinggal ditambahkan di feature mojoportal supaya di kenal.

 

Happy Coding in MojoPortal

Share this post: | | | |
Posted: Oct 28 2008, 01:14 PM by agusto | with no comments
Filed under: , ,

Comments

No Comments