Create a custom module in mojoportal

Source: Internet
Author: User

Create a custom module in mojoportal

 

Original article: http://techblog.strongeye.com/archive/2009/12/16/creating-a-mojoportal-module.aspx

 

Mojoportal is an open-source content management system, which we use in the strongeye website. It has extensive encapsulation of Asp.net network applications and is very friendly to developers.

Update: For many common website development tasks, you may not need to write additional code. Readers of this compass are intended to learn how to create new functional modules in mojoportal.

 

Developers need to create a new module in mojoportal, which is a 100% custom application and can be seamlessly embedded into mojoportal system.

First, you need to download the mojoportal source code and then build your own VS solution.

 

How to Create a mojoportal Module

 

 

Category Type

Steps Procedure

NotesNote:

Create UI Project 

 

CreateUIEngineering

 

 

Create a new project [your project name]. UI

Delete or rename the default. aspx file automatically generated by the project to ensure that the file is not copied to the website.

Create a subfolder

/[Your project name]

/[Your project name]/controls

Create a subfolder

/Setup/

.

Note: A web application is created instead of a web site.

The content in the setup folder is beyond the scope of this article. For details, seeSee the developer documentation here for details

 

CreateBussinessEngineering

Create a class library project

[Your project name]. Business

 

 

CreateDataLayer Engineering

Create a class library project

[Your project name]. Data

 

 

Rename your data layer project

[Your project name]. Data. MSSQL (or other databases you use)

 

 

 

For youWeb UIAdd reference to project

· Log4net

· Mojoportal. Business

· Mojoportal. Business. webhelpers

· Mojoportal. features. UI

· Mojoportal. net

· Mojoportal. Web

· Mojoportal. Web. Controls

· Mojoportal. Web. Editor

· Mojoportal. Web. Framework

· [Yourproject]. Business

 

Is[Your project name]. BusinessAdd reference to project

· [Yourproject]. Data. MSSQL

 

 

Add. ResxFile for localization

Create a standard Asp.net folder app_globalresources.

In this folder, add a new. resc file by selecting add-new item-Resources file.

This file is named by the program name, which ensures the uniqueness of the name ..

 

 

Step 2:

Make your project mimicMojoportal. WebIn this way, you can compile

 

Category Category

Steps Procedure

NotesNote:

Update

Web. config

 

Open the Web. config file in mojoportal. Web,

Copy the entire <pages> part to the Web. config file of your project. UI.

<Pages> in <system. Web>, you can replace <pages> automatically generated in your project.

.

CopyMaster pages

 

 

 

In the [your project name]. UI project, create the app_masterpages folder and copy the layout. Master File in WebStore. UI. (This is more suitable, because it is a subset of the entire master page and we need to develop it)

 

Note that it is not in mojoportal. Web.

 

 

This is the correct content placeholder for your ASPX page. When you develop your feature module

 

Step 3:Create your own modules

This module is.Ascx control, which inherits from sitemodulecontrol and creates a special instance entry point to your custom code. From this entry point, you may have many other pages, such as the custom ASPX page, which uses the master page.

 

These steps can be generated using codesmith.

 

Category

Procedure

Note:

Create a moduleAscx

Create a folder as follows: [your project name]. UI

/[Project name]/

Right-click and create a new user control (. ascx), as shown below:

[Project name] module. ascx

 

 

UseCodesmithTemplate, generateAscxFile

 

 

Open the codesmith manager. In Template explorer, open the codesmith4x folder, which is in mojoportal \ codesmith templates.

 

Find the template:

Mp_UI-starter_ModuleControlGenerator.cst

Right-click and select start generation"

In the displayed window, enter:

Author: [Your name]

Businesslayernamespace: [yourproject]. Business

Controlname: [yourmodulecontrolname]

Featurename: [yourproject]

Uinamespace: [yourproject]. UI

Click Generate"

 

The generated results contain HTML and CS code. You need to separate them before performing related operations.

Paste to your module

Select

// Author: code starting with [yourname] until the end

. Paste this code into [yourmodule] module. ascx. CS

Medium

 

Copy the remaining code to the module. ascx file.

 

 

 

Step 3:Add the compiled logic code to yourWebEngineering

 

This step will enable you to integrate your code with mojoportal when compiling correctly.

 

 

Category

Procedure

Description

 

Open your. UIProject Properties

 

Open your. UIProject Properties, openBuild EventsTab

 

 

Add the command line at compile time

 

Copy the following code to your post-build event command line and replace xxx with your project name and path name,

Replace YYY with your project name

 

Xcopy/S/y "$ (projectdir) bin \ yyy. UI. dll" $ (solutiondir) web \ bin \"

Xcopy/S/y "$ (projectdir) bin \ yyy. Business. dll" $ (solutiondir) web \ bin \"

Xcopy/S/y "$ (projectdir) bin \ yyy. Data. dll" $ (solutiondir) web \ bin \"

Xcopy/S/y "$ (projectdir) XXX \ *. ashx" $ (solutiondir) web \ XXX \"

Xcopy/S/y "$ (projectdir) XXX \ *. ascx" $ (solutiondir) web \ XXX \"

Xcopy/S/y "$ (projectdir) XXX \ *. aspx" $ (solutiondir) web \ XXX \"

Xcopy/S/y "$ (projectdir) XXX \ controls \ *. ascx" $ (solutiondir) web \ XXX \ controls \"

Xcopy/S/y "$ (projectdir) app_globalresources \ *. resx" "$ (solutiondir) web \ app_globalresources \"

Xcopy/S/y "$ (projectdir) Setup \ *" $ (solutiondir) web \ setup"

 

Save and click "Edit post-build"

 

I

 

Installation Module

Add a special module to the background management.

 

For example:

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.