Building a module for use on multiple pages

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.
8/15/2011 8:38:50 PM
Gravatar
Total Posts 111
Matt Millican InternetMill

Building a module for use on multiple pages

Hi all,

I'm trying to build a module that can be installed on 2 different pages.  Here's what I'm trying to do:

I have a module that essentially has 2 sections to it: a public and an admin/members side.  I would like to have the module installed on 2 different pages (and if possible show different views) but would like to avoid using supporting pages so the content around the 2 modules can still be edited?

I've seen the setting in the config files for modules, but unsure how to go from there.

Thanks,
Matt

8/16/2011 10:55:01 AM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Building a module for use on multiple pages

Hi Matt, I'm not totally clear on what you are trying to do. Assuming that you want to have the "user" view of the feature on one page, and the "admin" view on another, you can use module settings to specify a checkbox like "Use Admin View?". Based on the state of the checkbox, you can show/hide the appropriate controls. Your feature will need to inherit from SiteModuleControl, but if the module is showing the same data everywhere, you don't have to distinguish the feature instances by ModuleId in your code. There is nothing that forces you to use supporting pages.

Hope that helps. If I totally missed the point, feel free to expand a little on what your goal is.

Jamie

8/18/2011 11:09:55 PM
Gravatar
Total Posts 111
Matt Millican InternetMill

Re: Building a module for use on multiple pages

Hey Jamie,

Thanks for the response and sorry for the delay!

I think you're on track with what I'm talking about and I was kind of thinking about using the "Admin view" as you were talking about.  The part I guess I'm confused about is, if you install a module on 2 pages, it will get 2 module IDs, correct?

If so, I would need to be able to relate the data between the 2 modules.  I thought about making a setting called "Data module ID" or something like that, but I wanted to see if there was a better way.

I would also want to associate module IDs incase it was used as a completely separate module.

Does that make some sense?

Thanks!

Matt

8/19/2011 1:29:05 AM
Gravatar
Total Posts 245
mojoPortal Community Expert

Re: Building a module for use on multiple pages

Hi Matt

I know where you are going with this and have a feature using similar requirements.  In fact I take it one level deeper to the mojoPortal site level using code like this...

private void LoadSettings()
{
     siteSettings = CacheHelper.GetCurrentSiteSettings();
     currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code);

     SiteUser siteUser = SiteUtils.GetCurrentSiteUser();
     if (siteUser != null) _gUser = siteUser.UserGuid;
     Module module = new Module(ModuleId);
     _gModule = module.ModuleGuid;
     _iModuleID = module.ModuleId;
     _gSite = siteSettings.SiteGuid;
     _sUser = Context.User.Identity.Name;

}

My stored procedures in MS SQL have a Where clause something like this...

WHERE  ([BPRGuid] = @BPRGuid) AND //  BPRGuid being table specific
             ([SiteGuid] = @SiteGuid) AND
             ([ModuleGuid] = @ModuleGuid)

Hope this helps

Rick Hubka

8/22/2011 10:57:53 AM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Building a module for use on multiple pages

Hi Matt, like Rick implied, you will have two unique module IDs for the two installed instances, but you don't have to use those values as keys when reading and writing your data (effectively making the two instances behave as if they were a single one).

Jamie

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