MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Blog Container settings  (Mono Support )

Viewed 76061 time(s), 23 post(s) 3/8/2011 12:22:00 PMby peterg
denis

denis

3/9/2011 5:59:23 PM
That was helpful. I was able to isolate a problem in your scenario that was cuased by the category editor part, and the fix has been implemented already - it will be available in the next minor upgrade.

Note that you will have to  set a few other properties of this part in addition to setting blog slug. Blog parts heavily rely on URL rewriting for SEO purposes, and you may have difficulties placing any of them to the page with an arbitrary URL that may not contain required information. It can be done - but it requires a good understanding of what's going on behind the scene. For example, you will have to change the format of most of the URL properties to tell the part where to go when a blog post link is clicked, etc.

In any case, it would be best if you could provide me with a working online example once the fix is published, so we can see it in action and provide some interactive help.
This content has not been rated yet. 
7207 Reputation 956 Total posts
peterg

peterg

3/10/2011 4:43:09 AM
Oh dear it sounds harder that I thought, but its importent that I get it working I think it will be a great feature for people with multi topic sites like ourselfs to be able to split the blogs to feed content to other pages within the site.

Ok so I played around and found a result i am looking for we can use the rss reader to display the data we want. im not sure what this implicates with SEO but now our users can atleast view blogs based on the page that they are on.

http://www.***************/blog/posts/Photography/?MonoXRssFeed=Photography+Photography we will feed that into the page with the rss reader so we reading a rss feed from our own rss.

this now also alows for people to subscribe to a rss feed only based on their interest.

Peter
This content has not been rated yet. 
246 Reputation 35 Total posts
denis

denis

3/10/2011 9:55:24 AM
Peter,
I didn't want to scare you off :) The scenario I described involves changing two Web part properties and that's about it. I just wanted to emphasize the fact that you should be aware of the effects of these changes.
There are a couple of ways to achieve this. Some of them require programming, others are purely drag-and-drop-and-set-properties type of tasks. In any case, I still think that a natural match for a multi-topic site is a multi-blog system - people often disregard this very powerful and simple option. Again, you could filter the posts by author or category in a single blog site, but with multiple blogs you have a total control. See http://www.jobsmarket.ie which takes this idea to extreme - each of their users can get his own blog with complete moderation, categories, tags, etc.
This content has not been rated yet. 
7207 Reputation 956 Total posts
peterg

peterg

3/11/2011 4:03:25 AM
Hi Denis,

No you didnt scare me off, I think we all learning how in depth MonoX really is and it isn't just another CMS for dummies :). I think MonoX is far more powerful than the manual describes.

I had a look at the jobsmarket site and I like the fact that normal people can blog we would like that as a community based site, I just havent had the time to really sit and figure out how its done, im still pretty much a noob developer with ideas that far outreach my development capabilities. I think our requirement is a bit more basic from that point of view where we just want some one to register and then be able to blog. Without having powerful editorial permissions.

Thanks

Peter

This content has not been rated yet. 
246 Reputation 35 Total posts
denis

denis

3/11/2011 11:23:27 AM
OK. When in doubt about which feature to use to achieve something, do not hesitate to ask here. Quite often there are several ways to implement it.
This content has not been rated yet. 
7207 Reputation 956 Total posts
peterg

peterg

3/13/2011 4:16:01 AM
Hi Denis and all,

Right ill be sitting trying to figure out how registered users can blog withour having too much editorial permissions, ie being asble to edit other peoples blog posts etc.

Is there any pointers for me to check or start at?

Peter
This content has not been rated yet. 
246 Reputation 35 Total posts
denis

denis

3/13/2011 9:32:48 AM
I will be repeating myself, but this requirement again leads to multiple blog system... You are able to define the blog editors for each blog, and users cannot touch each other's blogs if not specifically permitted to do it.
Jobsmarket and similar sites ask users if they want to open their own blog when they register... I can send you the code needed to do this. You can choose any other strategy for opening blogs (per user, per groups, whatever), but at the end of the day this will give you the flexibility you need. All other approaches look like hacks compared to that.
This content has not been rated yet. 
7207 Reputation 956 Total posts
peterg

peterg

3/14/2011 6:19:48 AM
Hi Denis, sorry you ae repeating yourself, if you can send me the code it will be of much help. Our requirements are as follow and Im sure there ae some people out there that would like the same.

I have registered to JobsMarket and something like that would be perfect, thew only thing that I would add is people can only blog within the selected categories, but it is far more important to have the public blog as this adds content to the site..

Regards,

Peter.
This content has not been rated yet. 
246 Reputation 35 Total posts
denis

denis

3/14/2011 3:12:48 PM
Hi Peter,
I am attaching the code for the MembershipEditor part for one of the JobsMarket clone sites. This part is used on the registration page. Most of the code performs various housekeeping tasks - you will be using something similar to PostAccountCreationAction methods where a blog is created if the user checks the "Give me a blog" box.

MembershipEditor.ascx:

<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="MembershipEditor.ascx.cs" Inherits="JobsMarket.WebParts.MembershipEditor" %>
<%@ Import Namespace="MonoSoftware.MonoX.Resources"%>
  
<table cellpadding="0" cellspacing="0" class="light-box register" style="padding: 2px;"
    <tr>        
        <td class="job-search-result-header register-title">
            <%= Page.User.Identity.IsAuthenticated ? DefaultResources.MembershipEditor_Title_UpdateAccount : JobsMarket.Resources.DefaultResources.Registration_JobSeeker_Title %>
        </td>        
    </tr>
    <tr>        
        <td class="register-description">
            <%= JobsMarket.Resources.DefaultResources.Registration_JobSeeker_Description %>
            <br />
            <%=  string.Format(JobsMarket.Resources.DefaultResources.Registration_JobSeeker_NotAJobSeekerFormat, Page.ResolveUrl("/Membership/RegisterEmployer.aspx")) %>
        </td>        
    </tr>
    <tr>        
        <td>
            <div class="register-form">
                <dl
                    <dd style="margin: 0px;">
                        <div id="Div1" runat="server" style="margin-left: 20%; overflow: hidden;">
                            <asp:ValidationSummary ID="validationSummary" CssClass="validation-summary" runat="server" Style="margin-bottom: 20px;" />
                        </div>
                    </dd>
                    <dd>
                        <label for="<%= txtUserName.ClientID %>"><%= DefaultResources.MembershipEditor_UserName %></label>
                        <asp:Label ID="lblUserName" runat="server" AssociatedControlID="txtUserName"></asp:Label>
                        <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="vldRequiredUserName" runat="server" ControlToValidate="txtUserName" Text="!" CssClass="validator" Display="Dynamic" />
                        <asp:CustomValidator ID="vldCustomUserName" runat="server" ControlToValidate="txtUserName" Text="!" CssClass="validator" Display="Dynamic" />
                        <asp:RegularExpressionValidator ID="vldCleanUsername" runat="server" ControlToValidate="txtUserName" Text="!" CssClass="validator" Display="Dynamic" ValidationExpression="^[0-9a-zA-Z]+$"></asp:RegularExpressionValidator>
                    </dd>
                    <dd>
                        <label for="<%= txtPassword.ClientID %>"><%= DefaultResources.MembershipEditor_Password %></label>
                        <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="vldRequiredPassword" runat="server" ControlToValidate="txtPassword" Text="!" CssClass="validator" Display="Dynamic" />
                    </dd>
                    <dd>
                        <label for="<%= txtRepeatPassword.ClientID %>"><%= DefaultResources.MembershipEditor_RepeatPassword %></label>
                        <asp:TextBox ID="txtRepeatPassword" runat="server" TextMode="Password"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="vldRequiredRepeatPassword" runat="server" ControlToValidate="txtRepeatPassword" Text="!" CssClass="validator" Display="Dynamic" />
                        <asp:CompareValidator ID="vldCompareRepeatPassword" runat="server" ControlToValidate="txtRepeatPassword" Text="!" ControlToCompare="txtPassword" Operator="Equal" CssClass="validator" Display="Dynamic"></asp:CompareValidator>
                    </dd>
                    <dd>
                        <label for="<%= txtEmail.ClientID %>"><%= DefaultResources.MembershipEditor_Email %></label>
                        <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="vldRequiredEmail" runat="server" ControlToValidate="txtEmail" Text="!" CssClass="validator" Display="Dynamic" />
                        <asp:RegularExpressionValidator ID="vldRegexEmail" runat="server" ControlToValidate="txtEmail" Text="!" CssClass="validator" Display="Dynamic" />
                    </dd>
                    <asp:PlaceHolder ID="plhBlog" runat="server">
                        <dd style="margin: 0px; padding: 0px;">
                            <label> </label>
                            <asp:CheckBox ID="chBlog" runat="server" Checked="true" />
                            <label style="width: 70%; margin: 0px; padding: 0px; display: inline; text-align: left;" for="<%= chBlog.ClientID %>"><%= JobsMarket.Resources.DefaultResources.Label_GiveMeBlog %></label>                
                        </dd>
                    </asp:PlaceHolder>
                    <asp:PlaceHolder ID="plhNewsletter" runat="server">
                        <dd style="margin: 0px; padding: 0px;">
                            <label> </label>
                            <asp:CheckBox ID="chNewsletter" runat="server" Checked="true" />
                            <label style="width: 70%; margin: 0px; padding: 0px; display: inline; text-align: left;" for="<%= chBlog.ClientID %>"><%= JobsMarket.Resources.DefaultResources.Label_NewsletterSubscription %></label>                
                        </dd>
                    </asp:PlaceHolder>
                    <asp:PlaceHolder ID="plhRememberMe" runat="server">
                        <dd style="margin: 0px; padding: 0px;">
                            <label> </label>
                            <asp:CheckBox ID="chkRememberMe" runat="server" />
                            <label style="width: 70%; margin: 0px; padding: 0px; display: inline; text-align: left;" for="<%= chkRememberMe.ClientID %>"><%= DefaultResources.MembershipEditor_RememberMe %></label>                
                        </dd>
                    </asp:PlaceHolder>                                
                </dl>
            </div>                
        </td>        
    </tr>
    <tr>        
        <td class="job-search-result-header" style="border-top: solid 1px #DBDBDB;">
            <span style="float: left; font-size: 11px; margin: 7px 0px 0px 10px;">If you already have an account click <a runat="server" href="/Login.aspx">here</a>.</span>
            <MonoX:StyledButton ID="btnCreateAccount" runat="server" CssClass="float-right"></MonoX:StyledButton>
            <MonoX:StyledButton ID="btnUpdateAccount" runat="server" CssClass="float-right"></MonoX:StyledButton>
        </td>
    </tr>
</table>

MembershipEditor.ascx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MonoSoftware.MonoX.ModuleGallery;
using MonoSoftware.MonoX;
using MonoSoftware.MonoX.Repositories;
using MonoSoftware.MonoX.DAL;
using MonoSoftware.MonoX.DAL.DatabaseSpecific;
using MonoSoftware.MonoX.DAL.EntityClasses;
using MonoSoftware.MonoX.DAL.FactoryClasses;
using MonoSoftware.MonoX.DAL.HelperClasses;
using MonoSoftware.MonoX.DAL.RelationClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
using MonoSoftware.Core;
using MonoSoftware.MonoX.Caching;
using MonoSoftware.MonoX.Utilities;
using System.Net.Mail;
using MonoSoftware.MonoX.Mail;
using MonoSoftware.Web;
using System.Web.Security;
using JobsMarket.Repositories;
using JobsMarket.DAL;
using JobsMarket.DAL.DatabaseSpecific;
using JobsMarket.DAL.EntityClasses;
using JobsMarket.DAL.FactoryClasses;
using JobsMarket.DAL.HelperClasses;
using JobsMarket.DAL.RelationClasses;
using System.Web.UI.WebControls.WebParts;
using JobsMarket.Layers;
using JobsMarket.Resources;
using MonoSoftware.Web.Caching;
using MonoSoftware.Core.Mail;
  
namespace JobsMarket.WebParts
{
    public partial class MembershipEditor : MonoSoftware.MonoX.ModuleGallery.MembershipEditor
    {
        private string _notificationMailContent = "User {UserName} has just created his/her account on {Portalname}.";
        public string NotificationMailContent
        {
            get { return _notificationMailContent; }
            set { _notificationMailContent = value; }
        }
  
        private string _notificationMailSubject = "New user notification";
        public string NotificationMailSubject
        {
            get { return _notificationMailSubject; }
            set { _notificationMailSubject = value; }
        }
  
        private bool _sendMailNotifications = true;
        public bool SendMailNotifications
        {
            get { return _sendMailNotifications; }
            set { _sendMailNotifications = value; }
        }
  
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (Page.User.Identity.IsAuthenticated)
            {
                string link = String.Empty;
                if (SecurityBLL.IsEmployer() || SecurityBLL.IsCompanyAdministrator())
                    link = PathsJobMarket.JobsMarket.Pages.EmployerDashboard.EmployerDashboard_aspx;
                else
                    link = PathsJobMarket.JobsMarket.Pages.UserDashboard.UserDashboard_aspx;
  
                MonoSoftware.MonoX.Message.Show(String.Format(UserProfileResources.Register_AlReadyRegistered, UrlFormatter.ResolveServerUrl(LocalizationUtility.RewriteLink(link))), PathsJobMarket.Message_aspx);
            }
            ((BasePage)this.Page).SetPageTitle(JobsMarket.Resources.DefaultResources.Registration_JobSeekerPageTitle);
  
            vldCleanUsername.ErrorMessage = DefaultResources.UsernameValidatorErrorMessage;
        }
  
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
                chBlog.Checked = true;
        }
  
        protected virtual void AddUserToRole(MembershipUser membershipUser)
        {
           //add user to the default role
           Roles.AddUserToRole(membershipUser.UserName, ApplicationSettings.JobSeekersRole);
        }
  
        public override void CreateAccount(MembershipUser membershipUser)
        {
            AddUserToRole(membershipUser);
            PostAccountCreationActions(membershipUser);
            SendNotifications(membershipUser);
        }
  
        protected virtual void PostAccountCreationActions(MembershipUser membershipUser)
        {
            JobUserRepository userRepository = JobUserRepository.GetInstance();
            JobUserDetailEntity userDetails = userRepository.EnsureUserDetails(new Guid(membershipUser.ProviderUserKey.ToString()));
            userDetails.NewsletterSubscription = chNewsletter.Checked;
            userDetails.Title = string.Empty;
            userRepository.SaveEntity(userDetails);
              
            if (chBlog.Checked)
            {
                BlogEntity blog = new BlogEntity(GuidExtension.NewSequentialGuid());
                blog.Name = membershipUser.UserName;
                blog.Slug = UrlSeoOptimizer.GetOptimizedString(blog.Name);
                blog.DateCreated = DateTime.Now;
                blog.UserId = new Guid(membershipUser.ProviderUserKey.ToString());
                blog.ApplicationId = MembershipRepository.GetInstance().GetApplicationId();
                blog.LanguageId = LocalizationUtility.GetCurrentLanguageId();
                BlogRepository.GetInstance().SaveBlog(blog, string.Empty);
                CacheManager cacheManager = CacheManager.GetInstance(); 
                cacheManager.RemoveAll("MonoXBlog");
                cacheManager.RemoveAll("MonoXBlogEditors");
            }
  
        }
  
        protected virtual void SendNotifications(MembershipUser membershipUser)
        {
            if (SendMailNotifications)
            {
                MailMessage mailMsg = new MailMessage();
                mailMsg.From = new MailAddress(ApplicationSettings.MailFromAddress, txtUserName.Text);
                mailMsg.To.Add(ApplicationSettingsJobsmarket.NotificationMailAddress);
                mailMsg.Subject = this.NotificationMailSubject;
  
                string profileLink = UrlFormatter.ResolveServerUrl(RewrittenPaths.Profile.UrlPattern.Replace("{UserNameUrlEncoded}", MonoSoftware.Web.UrlEncoder.UrlEncode(txtUserName.Text), StringComparison.CurrentCultureIgnoreCase));
                profileLink = string.Format("<a href=\"{0}\">{1}</a>", profileLink, txtUserName.Text);
                string plainTextBody = this.NotificationMailContent.Replace("{UserName}", profileLink, StringComparison.CurrentCultureIgnoreCase).Replace("{PortalName}", ApplicationSettings.ApplicationTitle, StringComparison.CurrentCultureIgnoreCase);
                mailMsg.Body = plainTextBody;
                mailMsg.IsBodyHtml = true;
                MailSender mailSender = MailSender.GetInstance();
                mailSender.SendMail(mailMsg);
            }
        }
    }
}
Rated 5.00, 1 vote(s). 
7207 Reputation 956 Total posts
peterg

peterg

3/14/2011 3:44:24 PM
Most excelent thanks Denis, I can work with that.

I have a good friend witch is a bit of a nerd programmer, there are some ideas I want to bounce with him, when we get it working ill post them here.

Thanks again for the great support
This content has not been rated yet. 
246 Reputation 35 Total posts
1 2 3