Engelsystem GSoC 2016 Summary

This blog post I would like to share my work done during the GSoC period (May - August). Doing GSoC has been one of the most wonderful experience in my life. Introduction ENGELSYSTEM - Engelsystem is a volunteer management application for events written in PHP. It is used for coordination among different angels who want to volunteer. END USERS FOR ENGELSYSTEM SYSTEM ADMINS It will make it easy for them to coordinate with the volunteers by the product we developed. VOLUNTEERS /USERS Those who want to volunteer finds it difficult to coordinate, contact admins. This platform helps all those who want to help. Volunteers can register and can allot their shifts. A better User Interface, Integration with different Asian languages will allow the system to be used globally and in their local languages and ease for the volunteers to use. As a part of the project I developed many new features for engelsystem. Implemented a workflow similar to wordpress, Implemented MVC model, Importing user data to database directly through script, Implemented a copy function for shifts, sending messages to entire group/ AngelType, Implemented a search for all Angels View, Date Picker for shifts, New Settings Page for admin where we can write event related information, Deployed the system on different platforms, Added Documentation, Re-factor the code, Improved the code standards, Blog Post tutorials on various technologies. I am really happy with the outcome of the project. I learnt lot of new technologies and was improving day by day. My initial proposal, time line of the project My GSOC 2016 Proposal. I have proposed a many UI changes for the system, Improving Documentation, Refactoring. All of these are done during the period. And I have implemented extra features and surpassed the proposal. I have finished most of the proposed features before the Mid Evaluation. There was a shift in the timeline but I am very happy that the outcome was excellent. I was able to finish all the issues assigned to me on time. What I have done to make Engelsystem better? Overview of my contributions Commits: 172 Additions: 87,528 Deletions: 80,555 Issue Completed: 60 Pull Requests Merged: 36 Scrum Reports: 99 Blog Posts: 15 Daily Timeline during GSOC. Everyday we need to write a scrum report about our progress and submit it before 10 AM local time. Scrum consists of the following information. 1.What did you do yesterday? (which areas, issues you worked on, links) 2.What do you plan to do today? (which areas, issues you want to work on, links) 3.What is currently preventing you from achieving your goals? What blockers do you encounter? I have written total of 99 scrum reports from May 10 - August 23. I have never missed a scrum report. My Activity on Engelsystem Google Group : https://groups.google.com/forum/#!forum/engelsystem Working Environment All the issues for engelsystem are available on github. Whenever we need to implement a new feature or resolve a bug we need to make a issue and start working on it. There are…

Continue ReadingEngelsystem GSoC 2016 Summary

Final submission post: Engelsystem

This summer has been really amazing, I learnt a lot and worked crazy hours it has been a crazy yet amazing ride. I am not going to stop working on open source projects and posting the blog post. In this post, I would like to summarize all the work that I did during this summer. Working with FOSSASIA was an amazing experience for me. I got to learn a lot during this summer. Thanks to such amazing mentors. My project Engelsystem is an online tool for helper and shift planning on major events. It lets the user organize their helper in teams, they share in layers or let them decide when and where they want to help themselves.   The Project was provided an A-Grade certificate from CODACY. Here the link to view all my GitHub contributions to the project during this summer, https://github.com/fossasia/engelsystem/commits/master?author=dishantk1807 The list of issues solved and features implemented by me is provided below.    Themes Issue: https://github.com/fossasia/engelsystem/issues/4 Creating new themes for Engelsystem. Two themes have been added to the system, Engelsystem color scheme-1 and Engelsystem color scheme-2.      Languages for Localisation Issue: https://github.com/fossasia/engelsystem/issues/5 Sub-issue:   https://github.com/fossasia/engelsystem/issues/52 [Language support-I] Implement localization in different languages as it will make this system reach many people across the world. There 10+ International languages added to the system. The list of languages can be checked in the issue tracker      Added Travis-CI Issue: https://github.com/fossasia/engelsystem/issues/31 Setup the Travis-CI for Engelsystem. Added a stable .travis.yml file to the system      Feature Request: User: Registration form Issue: https://github.com/fossasia/engelsystem/issues/10 Sub-issues:   https://github.com/fossasia/engelsystem/issues/33 [Marking First Name and Last Name as required]   https://github.com/fossasia/engelsystem/issues/35 [Adding more item to the Registration form] Adding more fields to the registration form(First name, Last Name, GitHub, Facbook, Twitter, Organization)      Feature Request: Admin: Export database of all Angels Issue: https://github.com/fossasia/engelsystem/issues/12 Sub-issues:   https://github.com/fossasia/engelsystem/issues/114 [Use temporary files for exporting the database]   https://github.com/fossasia/engelsystem/issues/144 [Improve User export]   https://github.com/fossasia/engelsystem/issues/155 [remove password hashes from the export]   https://github.com/fossasia/engelsystem/issues/154 [Restore Frab import] Exporting the database of the angels in the .csv format.      Feature Request: Admin: Shifts: Batch Deleting of Shifts Issue: https://github.com/fossasia/engelsystem/issues/14 Sub-issues:   https://github.com/fossasia/engelsystem/issues/113 [Adding checkboxes and delete button] Implementing batch deleting of Shifts in the shifts page allowing the admin to delete multiple shifts at once. Created checkbox for selecting the shifts to be deleted and a delete button in the Shifts page to delete the selected shifts.      Feature Request: User: Registration Form and Shifts [Captcha] Issue: https://github.com/fossasia/engelsystem/issues/18 Sub-issues:    https://github.com/fossasia/engelsystem/issues/124 [Captcha in the Registration form]   https://github.com/fossasia/engelsystem/issues/128 [Captcha in Shifts       page]    https://github.com/fossasia/engelsystem/issues/132 [Documentation for captcha]   https://github.com/fossasia/engelsystem/issues/142 [Refining captcha code]   https://github.com/fossasia/engelsystem/issues/148 [Removing keys and added it via config.php]   https://github.com/fossasia/engelsystem/issues/148 [enable and disable re-Captcha] Implementing Google re-Captcha in the Registration form and Shifts pages for enhancing the security    DB: Convert char(1) to Booleans Issue: https://github.com/fossasia/engelsystem/issues/21 This issue was listed in the engelsystem/engelsystem issue tracker.      Bug: Disallow self-signup of shifts Issue: https://github.com/fossasia/engelsystem/issues/22 Sub-issues:   https://github.com/fossasia/engelsystem/issues/199 [Create new Groups Page]   https://github.com/fossasia/engelsystem/issues/201 [Providing Privileges to the new Groups Created] Disallowing self-signup of restricted shifts when an Engel is approved for certain groups. Created a page to create new…

Continue ReadingFinal submission post: Engelsystem

Software Testing

In this post I would like to explain what is software testing and different methods, levels of software testing. What is software testing? Software Testing is the process of evaluating a system or its components with the intent to find whether it satisfies the specified requirements or not. Testing is executing a system in order to identify any gaps, errors, or missing requirements in contrary to the actual requirements. What are the Levels of software testing? Software products are tested at four levels: Unit testing Integration testing System testing Acceptance testing Unit testing During unit testing, modules are tested in isolation. If all modules were to be tested together, it may not be easy to determine which module has the error. Unit testing reduces debugging effort several folds. Programmers carry out unit testing immediately after they complete the coding of a module. Role of Unit Testing Assure minimum quality of units before integration into system Focus attention on relatively small units Testing forces us to read our own code – spend more time reading than writing Automated tests support maintainability and extendibility Integration testing After different modules of a system have been coded and unit tested: modules are integrated in steps according to an integration plan partially integrated system is tested at each integration step. Role of Integration Testing Gain confidence in the integrity of overall system design Ensure proper interaction of components Integration Testing Strategies Big-bang Top-down Bottom-up Critical-first Function-at-a-time As-delivered Sandwich System Testing Gain confidence in the integrity of the system as a whole Ensure compliance with functional requirements Ensure compliance with performance requirements Acceptance Testing Testing performed by the customer or end-user himself to determine whether the system should be accepted or reject Testing is very important step of software development. We have used unit testing for our project Engelsystem. We are developing new features. Interested Developers can work with us. Development: https://github.com/fossasia/engelsystem Issues/Bugs:https://github.com/fossasia/engelsystem/issues

Continue ReadingSoftware Testing

Working with Apache Web Server

In this article, I will examine what apache is how to setup apache for ubuntu or debian and how to view error logs for apache and how to understand what the logs contain which will be useful for web development. What is Apache? Apache is the most popular web server on the internet. It is used to serve more than half of all active websites. It is fast, reliable, and secure. It can be highly customized to meet the needs of many different environments by using extensions and modules. Installing Apache on Ubuntu and Debian If you do not already have Apache installed, you can do so now by issuing the following commands: sudo apt-get update sudo apt-get install apache2 If you visit your VPS's IP address in a web browser, you will get the default Apache index page. We get the following output. your_domain_name_or_ip_address It works! This is the default web page for this server. The web server software is running but no content has been added, yet. Looking into apache error.log files In order to effectively manage a web server, it is necessary to get feedback about the activity and performance of the server as well as any problems that may be occuring. The Apache HTTP Server provides very comprehensive and flexible logging capabilities. Error.log file The server error log, whose name and location is set by the ErrorLog directive, is the most important log file. This is the place where Apache httpd will send diagnostic information and record any errors that it encounters in processing requests. It is the first place to look when a problem occurs with starting the server or with the operation of the server, since it will often contain details of what went wrong and how to fix it. Explanation of log message There is certain information that is contained in most error log entries. For example, here is a typical message. [Sat Aug 20 08:09:38.958885 2016] [:error] [pid 1489] [client 127.0.0.1:40810] PHP Notice: Constant MIN_PASSWORD_LENGTH already defined in /var/www/html/test/engelsystem/config/config.php on line 30, referer: http://localhost/ [Sat Aug 20 08:09:38.958885 2016] The first item in the log entry is the date and time of the message. [:error] The second entry lists the severity of the error being reported. [pid 1489] Indicates process Id [client 127.0.0.1:40810] The fourth entry gives the IP address of the client that generated the error. Fifth one is error message explaining the error. Constant MIN_PASSWORD_LENGTH already defined. File and line number /var/www/html/test/engelsystem/config/config.php on line 30 Error logs are easy to understand. Using error logs we can easily figure out the problem in your server or your code and fix it. For more information about the log files and configuration please visit Apache website Apache provides excellent documentation. Apache log files were useful for me during web development project Engelsystem. We are developing new features. Interested developers can work with us. Development: https://github.com/fossasia/engelsystem Issues/Bugs:https://github.com/fossasia/engelsystem/issues

Continue ReadingWorking with Apache Web Server

Auto Upgrade feature in Engelsystem​

In one of my previous blog posts here, I talked about the Upgrade process of Wordpress, how it works. In this blog, I am going to talk about how I implement the Auto-upgrade feature in Engelsystem. The Upgrade process implemented in Engelsystem includes both core and child upgrades. Methodology: A Verison.txt file in included in the repository. It contains the version number of the current release of the Engelsystem. Implemented a check in index.php to compare the version number in the local repository and the `fossasia/engelsystem` repository. In Engelsystem index.php is run every time when we open the System. Therefore, everytime we open Engelsystem, it automatically checks for updates. if ($check_autoupdate_enable == true) { $online_ver = file_get_contents("https://raw.githubusercontent.com/fossasia/engelsystem/master/Version.txt"); $current_ver = file_get_contents(" ./Version.txt"); if (strcmp($current_ver, $online_ver) != 0) { return info('<a href="' . page_link_to("user_settings") . '">' . _('There is an Update available on GitHub! Go to settings and update') . '</a>', true); } } The above code compares the version number in the local server and the fossasia repository. If the version number is different a notification in displayed in the alert box the Engelsystem to the Admin, to update the system. In the Settings page, Admin can update the System as shown in the screenshot below, The admin can click on the "Update System Now!", to update the system to the latest version. The is also an option provided in the UI to enable/disable the Auto-update feature. When the version in the Version.txt on local server and fossasia repository are different, the changes the pulled to the local server using the command: git pull origin master , which will pull the changes from the FOSSASIA repository to the local server, and a Message will be displayed that the "System is Updated to Latest Version!" . Also, there is an option in the UI to check to Updates manually. We are developing new Features for the Engelsystem. Developers who are interested in contributing can work with us. Development: https://github.com/fossasia/engelsystem             Issues/Bugs:https://github.com/fossasia/engelsystem/issues

Continue ReadingAuto Upgrade feature in Engelsystem​

Importing database with PHP script

In this post I would like to discuss how to import tables to database directly through PHP script. For our Project Engelsystem we need to import the tables manually by the command line or PHPMYADMIN. Now the user need not worry about the importing table. They are directly imported through the script. Initially we used to import the tables in a sql file by source command or mysql command. $ mysql -u root -p CREATE DATABASE engelsystem; use engelsystem; source db/install.sql; source db/update.sql; Script to import tables directly through PHP. function import_tables() { // get the database variables. global $DB_HOST, $DB_PASSWORD, $DB_NAME, $DB_USER; // file names to import $import_install = '../db/install.sql'; $import_update = '../db/update.sql'; // command to import both the files. $command_install = 'mysql -h' .$DB_HOST .' -u' .$DB_USER .' -p' .$DB_PASSWORD .' ' .$DB_NAME .' < ' .$import_install; $command_update = 'mysql -h' .$DB_HOST .' -u' .$DB_USER .' -p' .$DB_PASSWORD .' ' .$DB_NAME .' < ' .$import_update; $output = array(); // execute the command exec($command_install, $output, $worked_install); exec($command_update, $output, $worked_update); // test whether they are imported successfully or not switch ($worked_install && $worked_update) { case 0: return true; case 1: return false; } } Once we execute the above script the tables will be imported automatically. User need not import the tables manually. In this way we can import tables using script. For more information visit about project please visit here. Development: https://github.com/fossasia/engelsystem Issues/Bugs:https://github.com/fossasia/engelsystem/issues

Continue ReadingImporting database with PHP script

Unit Testing and Travis

Tests are an important part of any software development process. We need to write test codes for any feature that we develop to check if that feature is working properly. In this post, I am gonna talk about writing Unit tests and running those test codes. If you are a developer, I assume you have heard about unit tests. Most of you probably even wrote one in your life. Unit testing is becoming more and more popular in software development. Let's first talk about what Unit testing is: What is unit testing? Unit testing is the process through which units of source code are tested to verify if they work properly. Performing unit tests is a way to ensure that all functionalities of an application are working as they should. Unit tests inform the developer when a change in one unit interferes with the functionality of another. Modern unit testing frameworks are typically implemented using the same code used by the system under test. This enables a developer who is writing application code in a particular language to write their unit tests in that language as well. What is a unit testing framework? Unit testing frameworks are developed for the purpose of simplifying the process of unit-testing. Those frameworks enable the creation of Test Fixtures, which are classes that have specific attributes enabling them to be picked up by a Test Runner. Although it is possible to perform unit tests without such a framework, the process can be difficult, complicated and very manual. There are a lot of unit testing frameworks available. Each of the frameworks has its own merits and selecting one depends on what features are needed and the level of expertise of the development team. For my project, Engelsystem I choose PHPUnit as the testing framework. PHPUnit With PHPUnit, the most basic thing you’ll write is a test case. A test case is just a term for a class with several different tests all related to the same functionality. There are a few rules you’ll need to worry about when writing your cases so that they’ll work with PHPUnit: The test class would extend the PHPUnit_Framework_TestCase class. The test parameters will never receive any parameters. Below is an example of a test code from my project, Engelsystem <?php class ShiftTypes_Model_test extends PHPUnit_Framework_TestCase { private $shift_id = null; public function create_ShiftType(){ $this->shift_id = ShiftType_create('test', '1', 'test_description'); } public function test_ShiftType_create() { $count = count(ShiftTypes()); $this->assertNotFalse(create_ShiftType($shift_id)); // There should be one more ShiftTypes now $this->assertEquals(count(ShiftTypes()), $count + 1); } public function test_ShiftType(){ $this->create_ShiftType(); $shift_type = ShiftType($this->shift_id); $this->assertNotFalse($shift_type); $this->assertTrue(count(ShiftTypes()) > 0); $this->assertNotNull($shift_type); $this->assertEquals($shift_type['name'], 'test'); $this->assertEquals(count(ShiftTypes()), 0); $this->assertNull(ShiftTypes(-1)); } public function teardown() { if ($this->shift_id != null) ShiftType_delete($this->shift_id); } } ?> We can use different Assertions to test the functionality. We are running these tests on Travis-CI What is Travis-CI? Travis CI is a hosted, distributed continuous integration service used to build and test software projects hosted on GitHub. Open source projects may be tested at no charge via travis-ci.org. Private projects may be tested at…

Continue ReadingUnit Testing and Travis

Configuring Document Root Apache2 Ubuntu

In this post I will explain how to setup document root for apache server. Initially the document root is set to /var/www/html by default. We need to change it when we have web applications in /var/www/html/folder. I will show an example how to configure document root for our project engelsystem. Engelsystem is downloaded to /var/www/html/ . We must make sure to point our apache2 document root to the Engelsystem directory to prevent any user from accessing anything other than the public/ directory for security reasons. Changing apache2 document root The default document root is set in the 000-default.conf file that is under /etc/apache2/sites-available folder. $ cd /etc/apache2/sites-available $ sudo nano 000-default.conf While the file is opened change DocumentRoot /var/www/ with your new folder e.g DocumentRoot /var/www/html/engelsystem/public where your index.php file resides Set the right Apache configuration The configuration of the /var/www folder is under /etc/apache2/apache2.conf. Edit this file to add the configuration of your new document root. $ sudo nano/etc/apache2/apache2.conf Copy the following: <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> and change the directory path: <Directory /var/www/html/engelsystem/public> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> Restart Apache Now we can view the engelsystem at localhost/ or http://[i.p.address]/ $ sudoservice apache2 restart

Continue ReadingConfiguring Document Root Apache2 Ubuntu

Installing Engelsystem in Five Minutes

Here are the instructions to install engelsystem on your local server in just five minutes. Prerequisites 1.1 PHP 5.4.x (cgi-fcgi) 1.2 MySQL-Server 5.5+ or MariaDB 1.3 Webserver ( Apache/Nginx/lighttpd) Step 1: Download or Clone the repository git clone --recursive https://github.com/fossasia/engelsystem.git Download and unzip the engelsystem from here Step 2: Create a Database and a User Using the MySQL Client You can create MySQL/MariaDB user and database quickly and easily by running mysql from the shell. The syntax is shown below and the dollar sign is the command prompt: $ mysql -u adminusername -p Enter password: mysql> CREATE DATABASE databasename; Query OK, 1 row affected (0.00 sec) Step 3: Set up config.php Renname config/config-sample.php to config/config.php, and add your database information. // MySQL-Connection Settings $DB_HOST = "localhost"; $DB_USER = "username_here"; $DB_PASSWORD = "password_here"; $DB_NAME = "database_name_here"; Step 4: Upload the files and configure Document Root Now you will need to decide where on your domain you'd like your engelsystem to appear: Upload the engelsystem files to the desired location on your web server. For Apache server we need to upload to /var/www/html/ Now we need to configure document root. Change the document root in /etc/apache2/sites-available/000-default.conf from /var/www to /var/www/html/engelsystem/public. Now we can view engelsystem at localhost or http://[i.p.address]. Following command will change the document root from /var/www/ to /var/www/html/engelsystem/public. $ sudo sed -i -e 's/DocumentRoot \/var\/www\/html/DocumentRoot \/var\/www\/html\/engelsystem\/public/g' /etc/apache2/sites-available/000-default.conf Step 5: Run the Install Script Point a web browser to start the installation script. We will be redirected to install page where we need to fill in the information for installation. Once we fill the information and press install engelsystem. All the tables will be imported and we are redirected to login page. In this way we can install engelsystem using installation script in just five minutes. For more information visit here Development: https://github.com/fossasia/engelsystem Issues/Bugs:https://github.com/fossasia/engelsystem/issues        

Continue ReadingInstalling Engelsystem in Five Minutes

Creating New Groups in Engelsystem

User roles determine the access level or permissions of a person authorized (by an Administrator) to use the Engelsystem. If a user (other than admin) have access to only a specific set of pages and features that are assigned to the Group to which the user belongs. Summary In Engelsystem, the Privileges to specific pages and features can be set through GroupRights. There are initially 7 groups present in the Engelsystem namely: Guest Engel Shift Coordinator Team Co-ordinator Burokrat Developer Shirt Manager Each user role is capable of everything that a less powerful role is capable of. All of these 7 groups have different Privileges assigned to them. When a user registers on Engelsystem, it is initially assigned to Group-2 i.e Engel by default, then admin can add a user to different groups according to the requirements. Problem There was a problem with this feature. Bug: https://github.com/fossasia/engelsystem/issues/22 If the user was added to the group with some Admin Privileges, he/she was able to sign up for restricted shifts as well. Solution Added a new page to Engelsystem for creating new Groups with specific privileges which can be that can be provided by the Admin to that group.   New groups can be created by Admin, with default Privileges set to privileges as provided to the Engel group.These Privileges can be set while creating a group or can be edited in the GroupRights shown as follow: The group is successfully created and can be viewed in GroupRights page, where the Admin can edit the Privileges of this and the other groups. Providing Privileges to user other than Admin is important as it ease the workload of admin, plus there'll be other users who'll be handling different tasks in an Event which is important in managing an Event. We are developing new feature for Engelsystem and we will be applying this WordPress like update system toEngelsystem in the upcoming weeks. Developers who are interested in contributing can work with us. Development: https://github.com/fossasia/engelsystem             Issues/Bugs:https://github.com/fossasia/engelsystem/issues

Continue ReadingCreating New Groups in Engelsystem