A WYSIWYG Editor for Questions and Answers (Q & A). Edit them in HTML, JSON, or Markup Text. Several Question types can be created such as Tick-correct-options, Fill-in-the-blanks, True-or-False. Though primarily developed for school kids practicing their curriculum questions online, it can also be used for similar purposes, say, practicing inte…
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
common/src
editor/src
player
screenshots
sqls
LICENSE
README.md
composer.json

README.md

Question Editor and Player

A WYSIWYG Editor for Questions and Answera (Q & A). Edit them in HTML, JSON, or Markup Text. Developed in PHP/Laravel 5.1.35 (for backend) and Javascript/AngularJS 1.5 (for frontend). Though, primarily intended for school kids praciticing their curriculum questions online, it can also be used for similar such purposes, say practicing interview questions.

Features

This package includes following features:

  1. Category tree to put questions under different categories
  2. Edit questions in several formats such as html, html-source, json, markup-text
  3. Mass upload or downloads*
  4. Roles and Permissions
  5. JSON Web Tokens (JWT) for authentication
  6. Social Logins**

Note:

    • only markup-text is supported
  • ** only Google, Facebook, LinkedIn, and Github social logins are supported

Demo

Here is the demo.

Editor page needs a credentials. Enter user id as demo@eastgate.in and password as secret.

Note:

  1. The demo is provided with all permissions and with restrictions on number of records that can be added.
  2. Two more links are available, with read-only permission. They are Standard 3 Questions and Standard 7 Questions. Again, credentials mentioned above can be used to enter into Editor page.

Documentation

A Getting Started documentation is available here

License

This package is licensed under the MIT license. See the LICENSE file for more info.

Installation

  1. Go to folder where Laravel is already installed. Then run: composer require eastgate/question-editor-and-player

  2. Modify config/app.php file:

    a) In the providers array, add following five classes:

     Eastgate\Question\Common\QuestionServiceProvider::class,  
     Eastgate\Question\Editor\QuestionServiceProvider::class,  
     Eastgate\Question\Player\QuestionServiceProvider::class,  
     Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,  
     Zizaco\Entrust\EntrustServiceProvider::class,  
    

    b) In the aliases array, add following three classes:

     'JWTAuth'   => Tymon\JWTAuth\Facades\JWTAuth::class,  
     'JWTFactory'=> Tymon\JWTAuth\Facades\JWTFactory::class,  
     'Entrust'   => Zizaco\Entrust\EntrustFacade::class,  
    
  3. Modify app/Http/Kernel.php file:

    a) Comment out or Remove the line \App\Http\Middleware\VerifyCsrfToken::class in the $middlewareGroups - 'web' array

    b) Add following five lines into $routeMiddleware array

     'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,  
     'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,  
     'role' => \Zizaco\Entrust\Middleware\EntrustRole::class,  
     'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class,  
     'ability' => \Eastgate\Question\Editor\Middleware\TokenEntrustAbility::class,  
    
  4. Ensure database is already configured

  5. Run php artisan migrate --path="vendor/eastgate/question-editor-and-player/editor/src/migrations". This command adds following nine tables into the database:

    i. users
    ii. questions
    iii. question_images
    iv. categories
    v. category_question
    vi. roles
    vii. role_user
    viii. permissions
    ix. permission_role

  6. Run following six commands:

    a. php artisan vendor:publish --provider="Eastgate\Question\Common\QuestionServiceProvider" --tag=views

    b. php artisan vendor:publish --provider="Eastgate\Question\Editor\QuestionServiceProvider" --tag=views --tag=public --tag=seeds --tag=config

    c. php artisan vendor:publish --provider="Eastgate\Question\Editor\QuestionServiceProvider" --tag=user --force

    d. php artisan vendor:publish --provider="Eastgate\Question\Player\QuestionServiceProvider" --tag=views --tag=public

    e. php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\JWTAuthServiceProvider"

    f. php artisan vendor:publish --provider="Zizaco\Entrust\EntrustServiceProvider"

    • The above commands add public files such as js, css, images, partial htmls, etc. in their respective folders
      public/eastgate/question/common
      public/eastgate/question/editor
      public/eastgate/question/player

    • resources/views folder is added with index.blade.php files

    • public/bower_components folder is created and adds dependant javascript files for angular, bootstrap, jquery, jstree, font-awesome

    • database/seeds folder is added with following seeder files RoleTableSeeder.php
      PermissionTableSeeder.php
      QuestionTableSeeder.php
      UserTableSeeder.php

    • WARNING: Command 'c' above replaces existing app/User.php file.

    • config folder is added with entrust.php and constants.php files.

  7. Modify config/entrust.php file:

    a. Replace 'role' => 'App\Role' with 'role' => 'Eastgate\Question\Editor\Models\Role'

    b. Replace 'permission' => 'App\Permission' with 'permission' => 'Eastgate\Question\Editor\Models\Permission'

  8. Modify .env file in the laravel root folder:

    a) Replace CACHE_DRIVER=file with CACHE_DRIVER=array

    b) Add a key-value pair.

    URL_PATH_PREFIX=/qenp-demo/public [ if this package is installed in a subfolder say, 'qenp-demo']
    or URL_PATH_PREFIX= [ else leave it blank]

This URL_PATH_PREFIX is used to assign a javascript variable.

  1. Run composer dumpautoload to pickup seeder classes

  2. Run following four commands in the order from a to d

    a. php artisan db:seed --class="QuestionTableSeeder"  
    b. php artisan db:seed --class="PermissionTableSeeder"  
    c. php artisan db:seed --class="RoleTableSeeder"  
    d. php artisan db:seed --class="UserTableSeeder"  
    

    Check database tables to ensure data are populated into it.

  3. Now, point the browser to url: http://eastgate.in/qenp-demo-app/public/question. A Welcome message appears.