Module example?

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
5/8/2006 9:15:01 AM
Gravatar
Total Posts 92

Module example?

I already have an existing portal system in place using Cuyahoga for our company and 4 associate companies, and I am seriously considering switching to mojoPortal because I don't like the hassle of NHibernate and Castle which is the route Cuyahoga is going.

I played with mojoPortal a long time ago and Joe was very helpful in answering my questions but we went with Cuyahoga because at the time it worked better with Mono on Linux.  I've been playing with mojoPortal for a couple of days and found it to be very much improved and the base feature set is a strong draw for me to switch.

I've already written many custom modules for Cuyahoga that I want to port to mojoPortal, but I want to avoid putting them all in mojoPortal.Web.  (Joe, have you considered grouping similar parts in directories?)   I'd like them to remain seperate.   That way I can give only the modules that the network needs and avoid creating bloatware.

Does anyone have an example of a module that uses CodeBehind (ascx and dll file) that I could start off with as a base to migrate my Cuyahoga modules to mojoPortal?  You know, the usual "Hello World" example?
5/8/2006 1:56:54 PM
Gravatar
Total Posts 18439

Re: Module example?

Hi Richard,

To make it easy for you I just created an external Hello World Module and added it to svn /trunk
If you get the latest code from svn trunk you can see how it works. You will see the new Class library project named SampleExternalModule.
The module consists of the module control and an edit page. The code behind file for both the control and the edit page are in the SampleExternalModule class library project.

These are the steps I took:
1. Create a new Class library project in the solution to contain the code for your external module.
2. Add a Reference to System.Web and also to mojoPortal.Web (I used a project reference)
3. I put the SampleExternalModule.ascx file in the Modules folder of the Web (though you could put it anywhere in the web)
4. I put the SampleModuleEdit.aspx file in the root of the web

both the ascx file and the .aspx file inherit from classes in the class library project
the .ascx file class file (in the class library project) inherits from mojoPortal.Web.SiteModuleControl

When I build the solution I want the dll from my class library project to be copied to the bin folder beneath the web so I right clicked the class library and went to properties > Build Events and added a Post Build Event Command Line like this:
xcopy $(TargetPath) $(SolutionDir)\Web\bin

Now whenever I build, the dll goes in the bin of the web and the module works as expected. To make the module available for your site go to SiteSettings > Feature Modules and click Add Module. Enter the Relative path to the .ascx and give the module a name and now you can add it to a page.

Now when packaging up the app it is optional whether to include the external module. To include it just put the dll in the bin and the .ascx and .aspx files in appropriate places.

Hope it helps,

Joe
5/9/2006 1:22:33 AM
Gravatar
Total Posts 92

Re: Module example?

Wow, that was fast...   I'm currently working off your Subversion code so you couldn't have made it any easier...
Once I figure out the differences it looks like it's going to be an easy conversion.

Thanks again.
You must sign in to post in the forums. This thread is closed to new posts.