Simple mojoPortal Control

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.
1/10/2012 2:58:02 PM
Gravatar
Total Posts 148

Simple mojoPortal Control

Hi:

I am trying to install a control that will use mojoPortal to set parameters inside my control.  I watched the videos but I would rather write the code myself than use Codesmith, which I don't have.

I created a control that inherited from SiteModuleControl. I know you need to also change the feature definitions file. 

What is the simplest control I can take a look at to get started with this and where is it located in the forest of directory trees in mojoPortal.

Thanks.

 

1/10/2012 3:02:22 PM
Gravatar
Total Posts 2239

Re: Simple mojoPortal Control

Hi,

The simplest of all the features is probably one of the Twitter widgets, I-Frame or the HTML Include modules. If you want an example of a feature that uses the DB (other than for settings), take a look at the HTML Content or Contact Form modules.

HTH,
Joe D.

1/10/2012 3:38:21 PM
Gravatar
Total Posts 148

Re: Simple mojoPortal Control

Hi:

I copied the control TwitterProfileModule.ascx to my own project and changed the namespace to match my own.  After building in my project and installing into mojoPortal, the control looks ok but nothing shows up on the Settings page. I receive the message "User must be specified on the settings page." I believe I will need to use a features config file. Can I just copy the file from the Setup\Applications\Twitter folder? Where would I copy this file to? I tried putting it in the directory of my newly created Twitter control but it didn't work.

 

1/10/2012 3:55:16 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Simple mojoPortal Control

See the document Module Settings - A Developer Convenience. Also, be sure to visit /Setup so the settings get loaded.

Jamie

1/10/2012 5:29:08 PM
Gravatar
Total Posts 148

Re: Simple mojoPortal Control

Hi:

I didn't use a Features Definition File.  Instead, I went to the Feature Settings page under the Administration menu.  I set the values except the Resource File.  What is the resource File used for? I left it blank. I'm still not getting a "Settings" link next to my control.

 

1/10/2012 8:27:45 PM
Gravatar
Total Posts 2239

Re: Simple mojoPortal Control

Hi,

The best advice I can give you is to watch the Developer Video series. Those videos are a great resource whether you're going to use CodeSmith or not.

Have you looked in your log for any clue as to what might be going on?

HTH,
Joe D.

1/11/2012 9:05:27 AM
Gravatar
Total Posts 148

Re: Simple mojoPortal Control

Hi:

Yes, the video series are very good. My control is pretty simple and I'm not using a features config file. I am simply visiting the feature settings for the control.  My simple ccontrol is shown below.

 

namespace MyControls.SimpleControl {

       public partial class MySimpleControl : SiteModuleControl

              {

                        private string btnString = "MyString";

                        protected override void OnInit(EventArgs e) {

                                          base.OnInit(e);

                                         this.Load += newEventHandler(Page_Load);

                          }

 

                         protected void Page_Load(object sender, EventArgs e) {

                                      LoadSettings();

                                      PopulateControls();

                           }

                            private void PopulateControls() {

                                    if (this.ModuleConfiguration != null)

                                         {

                                                       this.Title = this.ModuleConfiguration.ModuleTitle;

                                                       this.Description = this.ModuleConfiguration.FeatureName;

                                          }

                                    

                                              Button1.Text = btnString;

                          }

                                  private void LoadSettings() {

                                                 if (Settings.Contains("BtnString"))

                                                  {

                                                               btnString = Settings["BtnString"].ToString();

                                                   }

                             }

                     }

}

 

1/11/2012 9:09:01 AM
Gravatar
Total Posts 148

Re: Simple mojoPortal Control

 

The values on the feature settings page are:

Resource File:

Group Name Key:

Setting Key: BtnString

Control Type: TextBox

Control Source: ~/MyControls/MySimpleControl.ascx

Settings Value: George

Sort Order: 500

 

1/11/2012 9:20:27 AM
Gravatar
Total Posts 18439

Re: Simple mojoPortal Control

Hi,

The Resource file is used to make it possible to localize labels and buttons for any language. You should right click your custom webui project node and choose Add > Add ASP.NET Folder and choose App_GlobalResources. Thne you can right click that folder and choose Add Item and you can add a Resource file YourFeatureResources.resx and you can use that for string used on labels and buttons in your feature. Make sure your post build event is configured to copy that file up to Web/App_GlobalResources. You'll need to add

using Resources;

in your UI classes and then you can set label and button text like 

btnSave.Text = YourFeatureResources.SaveButton where "SAveButton" would be the resource key from your resource file.

Study the code for any exisitng feature for more details.

See also Using The Installation System. The Feature Defnition file automates the instalaltion of your feature and any custom settings. Since you have already added your control from the UI, you will need to copy the feature guid it generated into your FeatureDefinition file. You'll need to specify the name of your resource file (without the .resx extension) in your feature definition file.

Hope that helps,

Joe

1/11/2012 9:27:35 AM
Gravatar
Total Posts 148

Re: Simple mojoPortal Control

Hi:

Is a Resource File required even if I don't need it?

A Feature Definition File is not required if you add the settings through the Feature Settings page, correct?

1/11/2012 9:33:19 AM
Gravatar
Total Posts 18439

Re: Simple mojoPortal Control

correct, if you don't care about automated installation or localization you can just use the UI to configure your feature and settings just put Resource for the resource file from the UI and then hard code your own labels and buttons internally to your control. Though if you have any settings the settings page will look first in our resource file for your key, and if not found it will just use the actual text of your resource key.

Hope that helps,

Joe

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