Site extra setting

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.
9/24/2008 4:48:28 AM
Gravatar
Total Posts 20
Que???

Site extra setting

Hi all,

I am currently working in a group that is building an app on top of mojoPortal and we want to add a new setting for the website. Our new setting, which we have called loginRedirection, does a very basic thing. The setting allows the admin to decide where abouts should the user be redirected after he has logged in, that is, go to the home page, or the news page etc...

The steps we have followed are the following:

  1. Modify the SiteSettings class locate in mojoPortal.Bussiness: We have added a private variable called loginRedirection and a property to get and set it called LoginRedirection (we have tried to follow the naming style that is currently found in the code).
  2. Modify the dbSiteSetting.Create && dbSiteSettings.Update to take an extra parameter which is the loginRedirection string.
  3. Modify the SQL that creates the table "mp_Sites" located in /SetUp/mojoportal-core/SchemaInstallScripts to have an extra column called "LoginRedirection" of type TEXT (we do not limit the legnth of the url that we are redirecting to). *
  4. Modify the SiteSetting and Login pages accordingly.

Does anyone know if we have missed something to change? we would also like to know if the project would like such a setting, if so let me know, my group is more than happy to provide the changes to the comunity.

Regards,

Mandel

* We have recently updated our source code copy of mojoPortal and we have found that the /SetUp/mojoportal-core/SchemaInstallScripts/mssql/2.2.4.8.config is in the project but missing in the svn tree, we are talking about revision 4238. We have seen that there is a file named 2.2.6.7

9/24/2008 5:16:51 AM
Gravatar
Total Posts 18439

Re: Site extra setting

Hi Mandel,

In my opinion you are heading way down the wrong path by modifying components of mojoPortal. You are basically forking the code and once you do that it will be very difficult for you to keep up with upgrades and changes in mojoPortal and it will make it very difficult for me to provide support. You should keep all customizations in external projects and never change the core of mojoPortal. If you find yourself thinking you need to change the core you should let me know what you are trying to do and maybe I can tell you a way to do it without touching the core, or maybe I can think of something we can do in the core to make it easier to do what you want.

SiteSettings as of the the latest version has an ability for you to store your custom properties:
siteSettings.GetExpnadoProperty(string keyName);
siteSettings.SetExpandoProperty(string keyName, string keyValue);

The only thing is there isn't currently a UI for your setting. I've been thinking of a way to make it possible to configure expando properties in a config file and then show them in the UI based on this but its not done yet. You could make a custom module that sets this setting very easily though.

For the redirect logic you should implement a signinhandler. There is also a web.config setting already existing that you can use to specify where to redirect after signin but as its in Web.config its global in a multi site installation it won't work well.

All of your work should be in your own external projects so that you can always do svn update to get the atest version of mojoportal.

You are right, although I removed that 2.2.4.8 script file I forgot to remove it from the project. I will do that today. There should always only be one file in the /Setup/applications/mojoportal-core/SchemaInstallScripts/mssql folder. After running this script it will run scripts from /SchemaUpgradeScripts/mssql that are of a higher version number.

Hope it helps,

Joe

9/24/2008 5:24:45 AM
Gravatar
Total Posts 20
Que???

Re: Site extra setting

Hi Joe,

Thanks for the quick reply, we will be using the Web.config to store the change since I do not believe  that the admin will change the redirection that often. We of course do not want to fork(we all know the implications of that in an opesource poject  ) the code at all.

Regards,

Mandel

9/24/2008 5:33:53 AM
Gravatar
Total Posts 18439

Re: Site extra setting

Hi Mandel,

This is the setting to look for:

<add key="PageToRedirectToAfterSignIn" value="" />

if left blank then mojoportal has its own logic for redirecting, to specify a page just enter it like this:

<add key="PageToRedirectToAfterSignIn" value="/yourcustompage.aspx" />

Note that by using this setting your site will not have the same redirect logic as normal. The way we do the redirect by default is to redirect to the page you were on when you clicked the login link. This produces very natural behavior. For example if you are viewing a forum post and you need to sign in to reply then you will be redirected right back to that forum post. Once you specify a redirect page this won't happen and it may be disconcerting to the user to have to find that forum thread again after you redirected him elsewhere.

Hope it helps,

Joe

9/24/2008 5:43:04 AM
Gravatar
Total Posts 20
Que???

Re: Site extra setting

Joe,

I agree that going back to the old page you where is the correct behaviour, but sometimes developers cannot reason much with their managers

Thanks for the tip,

Mandel

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