Friday, June 27, 2014

Ticket Handling System in Freemedia

         Ticket handling system is also plays a major role in Freemedia service. Because it is the method volunteer can get to know about media requests.
Basically ticket is created after user(requester) fill the requesting form. Then it will be added to the ticket list where volunteers can see them. Below it show the how it looks like.

Here ticket ID is generated according to the time it creates. Then the volunteer can decide what ticket he/she could choose in order to fulfill. when click on the ticket ID volunteer will be directed to the page where entire ticket will be shown.

In ticket view we can see there are few information attributes .

  • Summary - A brief description summarizing the request. It has the format below.                                               <first name> from <country> need <requested media>
  • Description - This contains the residential address of the requester.
  • Reporter - Requester's email ID.
  • Status -  What is the current status? One of new, assigned, closed, reopened.
  • Keywords - Keywords that a ticket is marked with. Useful for searching and report generation.
  • Media Version - Version of the media that this ticket pertains to.
  • Cc - A comma-separated list of other users or E-Mail addresses to notify.
  • Assigned  - Principal person (volunteer) responsible for handling the ticket. 
  • Resolution- Reason for why a ticket was closed. One of fixed, invalid, wontfix, duplicate,                                     worksforme.

Below illustrate the ticket life cycle.

Integrating bootstrap

To create ticket view I uses bootstrap which is nice framework for UI design.
We can easily  integrate  bootstrap into cakephp.
After download and extract  bootstrap from this link . We can simply add files to the app/webroot folder.
bootstrap.min.css -   app/webroot/css
bootstrap.min.js -     app/webroot/js

To work with bootstrap we need jquery. So simply add jquery-x.x.x.min.js to app/webroot/js.

Then we have to import bootstrap before use. Instead of importing in each view file we can add them in
app\View\Layouts\default.ctp   which is the layout shared in every view in cakephp.
we can import like below.

<?php echo  $this->Html->script('jquery-1.9.1.min');?>
<?php echo  $this->Html->script('bootstrap.min');?>

<?php echo $this->Html->css('bootstrap.min'); ?>

So we can simply update class attribute like below so that all CSS stuffs will added like a magic :)

<?php echo $this->Form->input('Reporter',
         'value'=>  $Email_ID)); ?>

So here class attribute is defined as form-control , then css will be applied to the input.

More details about bootstrap CSS

Wednesday, June 18, 2014

User Form Handling in Freemedia Tool

Very first thing in the  Freemedia process is user filling the form in order to create a ticket(making a request). This form should handle correctly , otherwise whole process will become a mess. That because if user enter invalid details, then volunteers will not be able to fulfill the requests. So form handling mechanism should have;
  • Proper validation for each field.
  • Preventing duplicates.
  • User friendly.  
For achieve these things first we need to have a proper database structure.So following  illustrate the ER diagram. 

After the database design I created models for each entity in cakePHP. For that I use CLI tool provided in cakePHP. It makes life easy :) . By just typing "cake bake model" we can create a new model. CLI tool suggest appropriate models from the database. So that we can select what we want. Then tool suggest what are the things that can included in a model.Such as validations,associations(linking models) and etc.

Then I created controller for handle model data. Up to now controller has add() function which insert user data into the database.

Then we need a view to view the user form.

In next form, there is a field for select country. In order to add country list I used formHelp in view.So I created file in view/Helper and use it in the controller(new helper function name should be added to $helper array). ex- if file is LangHelper.php  in controller $helpers = array('Html', 'Form','Lang', 'Session')  should be added.
Here is the code for helper I added to create country drop down list

Then in view file which controller has added the helper can use helper we can create country list like this

Monday, June 16, 2014

Adding OpenID Auth system to cakePHP

Fedora infrastructure currently support openID and Persona (FedAuth). So I have to add openID Auth system in login system.

What is openID?
    OpenID allows to use an existing account to sign in to multiple websites,without needing to create new passwords. With that, password is only given to identity provider, and that provider then confirms the identity of the person to the website he/she visit. So no need to worry about unscrupulous or insecure website compromising visitors identity.

How to handle OpenID in cakephp?

   In this process we need openID library. So here I found openID library for php by janrain and it is licensed under MIT license.
First of all openID library(Auth folder) should be added to app\vendor folder. Then openID component  (OpenidComponent.php) to app\Controller\Component. Then we need a login form.

Next we have to write controller to handle this form. This controller handle following tasks

  • Show the login form.
  • Redirect user to openId provider (when hit submit)
  • Handle the response from OpenID provider.

    Below code is just checks whether openID is successfully authenticated or not.
Above code is modified version of previous userController.php. Here I added Simple Registration Extension(SReg) which retrieve nine commonly requested information
nickname, email, fullname, dob (date of birth), gender, postcode, country, language, and timezone

So that we can retrieve at least few of them and use to identify the user.All request info arrives as an array by post method.
Check the implementation of this in OpenShift.

Friday, June 13, 2014

Overall Design of the Freemedia Tool

Freemedia Tool consist of five main features. 
  • User profiles and user forms.
  • Ticket System.
  • Report generating System.
  • Email System
All these features along with the system database connect to the back end.

Let's get a simple idea about above features.

User profiles and user forms.

This is the most important feature.Because all interaction with user are done here. For this project I am using cakePHP which uses MVC(Modal View Control) software architecture. So this feature directly connect user , view component and controller component.In future blog posts I'll explain them briefly. 
In this system there are three different types of users.
ex- admin,volunteer,requester.
Each type has a different role in the system. So that each user type has different user interface to interact with. 
ex-Only admins and volunteers have access to user profile page and every other users(requesters) only see request form.

Some expected access details of users.

Ticket system.

Ticket system is fully automated system. Because ticket is generated using the data which are given through the freemedia request page. Not all the data collected by the request page is use in ticket generating. So it need separate database table to store ticket details.
Ticket will rejected in case of ;
  • Duplicates
  • Invalid data 
  • Expire due to no volunteer involve .
Following illustrate the ticket handling done in the system.

Report generating system.

This feature is represent the statistical data of the data in the  freemedia database.
ex-  How many request from each country.
       Number of volunteers in each region.
       How many tickets are fulfilled.

 It will uses charts , graphs and other way of the representing statistical data. This also contain leader board of volunteers(top list of volunteers who fulfilled many requests). 

Email System

Mailing system is used to send notification about each important action done in this system.Following figure describes when mails will be send to the each type of user.

In the ticket handling process, mails are auto generated and send to users.In other situations like asking further clarifications about ticket from the request, volunteers can use the template provided and send them.
Also volunteer can change the notification mail settings. So that he/she will received relevant mails.