Pages

Showing posts with label Online Community Portal and Discussion Forum in Asp.net and C#. Show all posts
Showing posts with label Online Community Portal and Discussion Forum in Asp.net and C#. Show all posts

Friday, September 24, 2010

Introduction of Online Community Portal

The Online Community Portal which has been running as a discussion forum based on phpBB (1) open source(15) discussion forum software. And their back end database is served by MySQL (2) Database management system (DBMS).

The site provides a basic discussion thread based forum interface with various categories and forums in different sections of IT and its subsections. The discussions of the site a visible for any users who visit the site and only registered members are allowed to discuss and reply threads in the forum. Some of the forums in the site are moderated forum and restricted to a particular group of members in the site. Moderators are assigned for each forum and moderators and administrators can do the site maintenance as well as the user maintenance.

Once a guest is registered with the site they become General Members of the site, and they can post new Article/question threads or reply to existing threads in the forum, they can participate in the option polls in the forums, and if the forum permissions allow they can create polls. And they can subscribe to any discussion so that they get alerts, when someone replies to that thread. And users can post threads and lock them so that others can only view them but cannot reply. Apart from discussions members are allowed to send and receive
private messages with other members in the site. The more posts the user make their ranking the site goes higher.

Administrators who have the full control of the website, has all the features of a moderator. Moderators in the site will be moderating and maintain posts in their relevant forums. If there are any forums that allow only posts after approval from moderator, then they have to read and decide whether to approve that post or reject them. And also moderators can Ban any abusive users from the website or warn them. And also they can lift off the bans or the warnings from the members after some period of good behavior in the site and the general user and they can create delete forums and sections. They can give ranks to users and promote them as moderators or administrators. Administrators can send mass emails and newsletters to all the members of the website. They can physically access the script files of the forum software and modify them to tweak and update the forum software.

Even though the forum software is free open source software and has a lot of advanced and good features to run a website, the forum only interface is not familiar to all the users who use internet, and it is very hard for beginners to find what they want exactly. And the less attractive interface of the website drives away the new users who visit the website.

And the sites forum software requires a high maintenance, because of very frequent patch releases and mainly because of SPAM. And customization of the software requires extensive knowledge on PHP scripting, and even a small mistake while the upgrade process might result in loss of entire site, and most of all once the software is customized the official providers of the software will not provide support in any cases which again leads to high risk.

These problems with the issues listed below, made the administration team of the website to go on with developing their own web portal with complete content management system to administrate the website.

Critical Issues in the Current Forum

1. Integrating the forum with a graphical front end is very difficult and needs special skills and understanding of the PHP scripting as well as phpBB software.

2. Frequent failure of the forum software, which causes loss of members and valuable information.

3. Difficult to use for the beginners, which drives traffic out of the websites.

4. Since the software is a very common open source product, there are too many threats are available for the site and the risk of hacking is very high.

5. Customizing the site and upgrading the site software to a newer version is never possible to do both at same time because the customized phpBB products are not officially supported.

6. The poor Graphical interface of discussion forums. Drive members away from the website.

7. The ease of use is very low. Because the Articles, teaching lessons, and discussions are all mixed up with each other in the forums. Where it is hard to find the relevant one we need soon.

8. The control over the users and the contents of the site are limited. The site has to stick to a particular user interface constantly with very rare changes.

9. Requirement for special sections in the website such as events calendar, one complete control panel for entire site content.

Website Reuirements

A website should be developed with online secured user management system, Article management system, discussion forum, and Content management system and with various other web technologies such as RSS (Really Simple Syndication) Feeds and Search engines, which Enables publishing articles and discussing various topics on IT, where it provides users a one stop learning website for all their IT needs, and for administrators and owners to manage the entire website with centralized administration, serve for users who are willing to learn online and earn revenue through the advertisements displayed in the site.

1. FUNCTIONAL REQUIREMENT
Functional requirements define the specific functions that the system performs, along with the data operated on by the functions. The functional requirements are presented in scenarios that depict an operational system from the perspective of its end users. Included are one or more examples of all system features and an enumeration of all the specific requirements associated with these features.

The system should provide the following functions for the general user.
1. General information:
• Provide recent discussions and articles on the home page so that members can see the recent updates in the site.
• Customize the homepage with user relevant contents.
• Show General User related information.
• Contact site administration for queries and reports.
2. User Registration and set up user profile.
• Users can register with the site with a user name and password
• And complete/update their profile details.
• And subscribe for newsletters.
• Reset and Retrieve password.
3. Discuss in forums
• Registered users can create new posts in forums.
• Registered users can reply to posts in forum
• Subscribe for a thread so that members get mail alerts on each reply for the
thread.
• Create threads with no reply option
4. Write Articles
• Users can write articles on the available categories of the site.
• Rate articles.
• Read and subscribe for a particular category of articles.
• Add comments on articles.
5. Option polls
• Vote in option polls
• View results of the polls.
6. News letters
• Subscribe for HTML newsletters.
• Subscribe for Plain Newsletters.
• Unsubscribe from Newsletters.

For Administration editors and moderation the system is expected to fulfill following requirements.
1. User Administration (Administrator)
• Enable/ Disable/ Delete users in the site.
• Reset user’s password.
• Promote/ Demote user roles.
• Create new user roles.
• Find user by name/ email.
2. Forum Management
• Create/ Edit new forums.
• Create moderated forums.
• Approve/ Disapprove posts.
3. Article Management.
• Approve/Disapprove Articles
• Create/Edit Sections.
• Edit Articles.
• Remove published Articles.
• Manage and approve comments on articles.
4. Poll Management
• Create and update polls.
• Set the current polls
• Archive polls.
5. Newsletter Management
• Prepare and send newsletters.
• Manage archived newsletters.
6. Advertisements Management
• Add new Advertisements in Ad zones.
• Create Ad zones.
• Update Ad zones and ad codes.
7. System Exception logs.

2 SUPPLEMENTARY REQUIREMENTS

Supplementary requirements address aspects of the system other than the specific functions it performs. These aspects include system performance, costs, and such general system characteristics as reliability, security, and portability. The non-functional requirements also address aspects of the system development process and operational personnel.
• USABILITY- Target audience of the system is the general public accessing the Internet. So, the system should be able to be accessed by people with sufficient amount of knowledge to use a basic web-site and a standard windows-based application. User-interface of the web-component should adhere to standard web designing principles.
• ACCURACY AND RELIABILITY- The system should be accurate to the maximum extent (99.9%). Major bugs affecting accuracy will not be tolerated. It should not cease operation due to any invalid activity by the user or any other internal function, otherwise explicitly closed by the user.
• PERFORMANCE –This should not exhaustively use system resources while its normal operation, otherwise a major processing is done within the system as requested by the user. Website should be able to serve thousands of users concurrently without overloading the system, or the database server, or without showing radical decrease in performance.
• SECURITY- All personal information should be saved on the web server and the credential related details must be encrypted using some hashing algorithm. Frequent back up of database should be done. Administrative task on the server-side should only be allowed to whom having a high-level access.

Wednesday, September 15, 2010

Class Diagrams of Online Forum

The purpose of a class diagram is to depict the classes within a model. In an object oriented application, classes have attributes (member variables), operations (member functions) and relationships with other classes. The UML class diagram can depict all these things quite easily.

Below are the main classes, used in each sub systems of the system:

Class Involved in Password Recovery
2. Search:
Since search uses the full text indexing to index the articles and the forum post it doesn’t have to use other classes to search only the search is enough.



Class Diagram for Search

Example of Sequence Diagrams

Sequence diagrams contain the same information as Collaboration diagrams, but emphasize the sequence of the messages instead of the relationships between the objects. The arrows between the lifelines represent messages being sent between the objects. Sequence Diagrams clearly depict the sequence of events, show when objects are created and destroyed, are excellent at depicting concurrent operations, and are invaluable for hunting down race conditions.

Example of a Sequence Diagram of a Online Forum:

1. Registration:



2. Write Article:



Master Template of the Online Forum

The main layout of the site uses a master template which will be used in the entire site. And all other contents are contained in the content area of the template. So the detailed designs of the contents are given below with the master template.




The master template contains login tool, Navigation (Categories, menu), Content Area and Option Poll.

Now, see the code of making this forum page. (C sharp Code)
Forum.cs

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using g2c;
namespace g2c.BLL.Forums
{
public class Forum : BaseForum
{
private string _title = "";
public string Title
{
get { return _title; }
set { _title = value; }
}
private bool _moderated = false;
public bool Moderated
{
get { return _moderated; }
set { _moderated = value; }
}
private int _importance = 0;

public int Importance
{
get { return _importance; }
private set { _importance = value; }
}
private string _description = "";
public string Description
{
get { return _description; }
set { _description = value; }
}
private string _imageUrl = "";
public string ImageUrl
{
get { return _imageUrl; }
set { _imageUrl = value; }
}
private List<Post> _allThreads = null;
public List<Post> AllThreads
{
get
{
if (_allThreads == null)
_allThreads = Post.GetThreads(this.ID, "", 0, BizObject.MAXROWS);
return _allThreads;
}
}

public Forum(int id, DateTime addedDate, string addedBy, string title, bool moderated, int
importance, string description, string imageUrl)
{
this.ID = id;
this.AddedDate = addedDate;
this.AddedBy = addedBy;
this.Title = title;
this.Moderated = moderated;
this.Importance = importance;
this.Description = description;
this.ImageUrl = imageUrl;
}
public bool Delete()
{
bool success = Forum.DeleteForum(this.ID);
if (success)
this.ID = 0;
return success;
}
public bool Update()
{
return Forum.UpdateForum(this.ID, this.Title, this.Moderated,
this.Importance, this.Description, this.ImageUrl);
}
public static List<Forum> GetForums()
{

List<Forum> forums = null;
string key = "Forums_Forums";
if (BaseForum.Settings.EnableCaching && BizObject.Cache[key] != null)
{
forums = (List<Forum>)BizObject.Cache[key];
}
else
{
List<ForumDetails> recordset = SiteProvider.Forums.GetForums();
forums = GetForumListFromForumDetailsList(recordset);
BaseForum.CacheData(key, forums);
}
return forums;
}
public static Forum GetForumByID(int forumID)
{
Forum forum = null;
string key = "Forums_Forum_" + forumID.ToString();
if (BaseForum.Settings.EnableCaching && BizObject.Cache[key] != null)
{
forum = (Forum)BizObject.Cache[key];
}
else
{
forum = GetForumFromForumDetails(SiteProvider.Forums.GetForumByID(forumID));
BaseForum.CacheData(key, forum);
}
return forum;
}

public static bool UpdateForum(int id, string title, bool moderated, int importance, string
description, string imageUrl)
{
ForumDetails record = new ForumDetails(id, DateTime.Now, "", title, moderated, importance,
description, imageUrl);
bool ret = SiteProvider.Forums.UpdateForum(record);
BizObject.PurgeCacheItems("forums_forum");
return ret;
}
public static bool DeleteForum(int id)
{
bool ret = SiteProvider.Forums.DeleteForum(id);
new RecordDeletedEvent("forum", id, null).Raise();
BizObject.PurgeCacheItems("forums_forum");
return ret;
}
public static int InsertForum(string title, bool moderated, int importance, string description, string
imageUrl)
{
ForumDetails record = new ForumDetails(0, DateTime.Now,
BizObject.CurrentUserName, title, moderated, importance, description, imageUrl);
int ret = SiteProvider.Forums.InsertForum(record);
BizObject.PurgeCacheItems("forums_forum");
return ret;
}
private static Forum GetForumFromForumDetails(ForumDetails record)
{

if (record == null)
return null;
else
{
return new Forum(record.ID, record.AddedDate, record.AddedBy,
record.Title, record.Moderated, record.Importance, record.Description, record.ImageUrl);
}
}
private static List<Forum> GetForumListFromForumDetailsList(List<ForumDetails> recordset)
{
List<Forum> forums = new List<Forum>();
foreach (ForumDetails record in recordset)
forums.Add(GetForumFromForumDetails(record));
return forums;
}
}
}

Articles Management of Online Forum

Main activities is to set up an online respiratory for all those who are willing to learn the various sections in IT, and the site was used to publish latest Articles related to newest technologies as well as to discuss about IT related issues with people around the world, which in return will provide the best solutions in result of discussions between experts in all areas.



Once a guest is registered with the site they become General Members of the site, and they can post new Article/question threads or reply to existing threads in the forum, they can participate in the option polls in the forums, and if the forum permissions allow they can create polls. And they can subscribe to any discussion so that they get alerts, when someone replies to that thread. And users can post threads and lock them so that others can only view them but cannot reply. Apart from discussions members are allowed to send and receive private messages with other members in the site. The more posts the user make their ranking the site goes higher.


Admin Panel of Online Forum

Moderators are assigned for each forum and moderators and administrators can do the site maintenance as well as the user maintenance. Once a guest is registered with the site they become General Members of the site, and they can post new Article/question threads or reply to existing threads in the forum, they can participate in the option polls in the forums, and if the forum permissions allow they can create polls. And they can subscribe to any discussion so that they get alerts, when someone replies to that thread. And users can post threads and lock them so that others can only view them but cannot reply. Apart from discussions members are allowed to send and receive private messages with other members in the site. The more posts the user make their ranking the site goes higher.

Moderators
in the site will be moderating and maintain posts in their relevant forums. If there are any forums that allow only posts after approval from moderator, then they have to read and decide whether to approve that post or reject them. And also moderators can Ban any abusive users from the website or warn them. And also they can lift off the bans or the warnings from the members after some period of good behavior in the site

Administrators who have the full control of the website, has all the features of a moderator and the general user and they can create delete forums and sections. They can give ranks to users and promote them as moderators or administrators. Administrators can send mass emails and newsletters to all the members of the website. They can physically access the script files of the forum software and modify them to tweak and update the forum software.

Even though the forum software is free open source software and has a lot of advanced and good features to run a website, the forum only interface is not familiar to all the users who use internet, and it is very hard for beginners to find what they want exactly. And the less  attractive interface of the website drives away the new users who visit the website.

And the sites forum software requires a high maintenance, because of very frequent patch releases and mainly because of SPAM. And customization of the software requires extensive knowledge on PHP scripting, and even a small mistake while the upgrade process might result in loss of entire site, and most of all once the software is customized the official providers of the software will not provide support in any cases which again leads to high risk.

Contact.Aspx Code of Online Forum

Coding is done using asp.net 2.0 with c# programming language. 

<%@ Page Language="C#" MasterPageFile="~/Template.master" AutoEventWireup="true"
CodeFile="Contact.aspx.cs" Inherits="g2c.Contact" Title="Get2code.com ‐ Contact Us" %>
<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" Runat="Server">
<div class="sectiontitle">Contact Us</div>
<p>For any queries,reports, advertisments, or any partner programs please use the
contact form below to contact us.</p>
<p></p>
we will respond as soon as possible.<br />
<table cellpadding="2">
<tr> <td style="width: 80px;" class="fieldname"><asp:Label runat="server" ID="lblName"
AssociatedControlID="txtName" Text="Your name:" /></td>
<td style="width: 400px;"><asp:TextBox runat="server" ID="txtName" Width="100%" /></td>
<td>
<asp:RequiredFieldValidator runat="server" Display="dynamic" ID="valRequireName"
SetFocusOnError="true"
ControlToValidate="txtName" ErrorMessage="Your name is
required">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr> <td class="fieldname"><asp:Label runat="server" ID="lblEmail"
AssociatedControlID="txtEmail" Text="Your e‐mail:" /></td> <td><asp:TextBox runat="server"
ID="txtEmail" Width="100%" /></td>
<td>
<asp:RequiredFieldValidator runat="server" Display="dynamic" ID="valRequireEmail"
SetFocusOnError="true"

ControlToValidate="txtEmail" ErrorMessage="Your e‐mail address is
required">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator runat="server" Display="dynamic" ID="valEmailPattern"
SetFocusOnError="true"
ControlToValidate="txtEmail" ValidationExpression="\w+([‐+.']\w+)*@\w+([‐
.]\w+)*\.\w+([‐.]\w+)*" ErrorMessage="The e‐mail address you specified is not well‐
formed">*</asp:RegularExpressionValidator>
</td> </tr> <tr>
<td class="fieldname"><asp:Label runat="server" ID="lblSubject"
AssociatedControlID="txtSubject" Text="Subject:" /></td>
<td><asp:TextBox runat="server" ID="txtSubject" Width="100%" /></td>
<td>
<asp:RequiredFieldValidator runat="server" Display="dynamic" ID="valRequireSubject"
SetFocusOnError="true"
ControlToValidate="txtSubject" ErrorMessage="The subject is
required">*</asp:RequiredFieldValidator> </td> </tr>
<tr>
<td class="fieldname"><asp:Label runat="server" ID="lblBody" AssociatedControlID="txtBody"
Text="Body:" /></td>
<td><asp:TextBox runat="server" ID="txtBody" Width="100%" TextMode="MultiLine"
Rows="8" /></td>
<td>
<asp:RequiredFieldValidator runat="server" Display="dynamic" ID="valRequireBody"
SetFocusOnError="true"
ControlToValidate="txtBody" ErrorMessage="The body is
required">*</asp:RequiredFieldValidator>
</td>
</tr> <tr>
<td colspan="3" style="text‐align: right;"> <asp:Label runat="server"
ID="lblFeedbackOK" Text="Your message has been successfully sent." SkinID="FeedbackOK"
Visible="false" />
<asp:Label runat="server" ID="lblFeedbackKO" Text="Sorry, there was a problem sending
your message." SkinID="FeedbackKO" Visible="false" />
<asp:Button runat="server" ID="txtSubmit" Text="Send" OnClick="txtSubmit_Click" />
<asp:ValidationSummary runat="server" ID="valSummary" ShowSummary="false"
ShowMessageBox="true" />

</td>
</tr>
</table>
</asp:Content>

Contact. cs (C#) for Online Forum

The Members can contact the Administrator for queries or questions:





Contact.cs Code:


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
using g2c;
namespace g2c.UI
public partial class Contact : BasePage
protected void Page_Load(object sender, EventArgs e)
}
protected void txtSubmit_Click(object sender, EventArgs e)
{
try
{
// send the mail
MailMessage msg = new MailMessage();
msg.IsBodyHtml = false;
msg.From = new MailAddress(txtEmail.Text, txtName.Text);
msg.To.Add(new MailAddress(Globals.Settings.ContactForm.MailTo));
if (!string.IsNullOrEmpty(Globals.Settings.ContactForm.MailCC))
msg.CC.Add(new MailAddress(Globals.Settings.ContactForm.MailCC));
msg.Subject = string.Format(Globals.Settings.ContactForm.MailSubject, txtSubject.Text);
msg.Body = txtBody.Text;
new SmtpClient().Send(msg);
// show a confirmation message, and reset the fields
lblFeedbackOK.Visible = true;
lblFeedbackKO.Visible = false;
txtName.Text = "";
txtEmail.Text = "";
txtSubject.Text = "";
txtBody.Text = "";
}
catch (Exception)
{
lblFeedbackOK.Visible = false;
lblFeedbackKO.Visible = true;
}
}
}
}