Skip to content

Commit

Permalink
Merge pull request #300 from ucfopen/dev/v2.2.0
Browse files Browse the repository at this point in the history
Dev/v2.2.0
  • Loading branch information
bagofarms authored Jun 23, 2017
2 parents 001c15a + b5af342 commit a2b49ea
Show file tree
Hide file tree
Showing 45 changed files with 1,377 additions and 498 deletions.
3 changes: 0 additions & 3 deletions .bowerrc

This file was deleted.

1 change: 0 additions & 1 deletion .buildpacks
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
https://github.com/heroku/heroku-buildpack-nodejs
https://github.com/heroku/heroku-buildpack-php
88 changes: 88 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Contributing to UDOIT

Thank you for your interest in contributing to UDOIT. Even though it was originally created by the University of Central Florida, UDOIT relies on the contributions of people like you in order to be the best accessibility scanning and remediation tool possible. This document outlines the standards we use for various aspects of the project, and should be followed whenever possible. If you have ideas for additions or changes to this document, please follow the guidelines below to submit them.

## Reporting Bugs and Requesting Features

### Before Submitting

Before you reporting a bug or requesting a feature, take a few moments to look through the [existing issues](https://github.com/ucfopen/UDOIT/issues). Someone else may have already had the same issue or idea. Also, check the [pull requests](https://github.com/ucfopen/UDOIT/pulls) that have been closed since you last updated UDOIT. Your issue or feature may have already been dealt with.

### Submitting a Bug Report

Once you've determined that your bug hasn't been reported or fixed already, you can submit an issue. It's important to include as much detail as possible so that your issue can be resolved faster. Here's a quick list of information to include:

* Version number, date of your last pull from Github, or Git commit ID
* Detailed step-by-step to reproduce the issue
* Screenshots or screen captures showing the issue
* Example HTML content that causes or relates to the issue
* Severity of the issue. Is UDOIT completely broken, or can you work around the issue in the meantime?

Before submitting, use the labels to mark the issue as a Bug.

### Requesting Features

Once you've determined that your feature hasn't been requested or implemented already, you can submit an issue. Please take some time to flesh out the feature as much as possible. The more work you put into the feature now, the sooner it will be implemented. Here are some things to include:

* Why do you want this feature? What are the use cases?
* Will this feature be useful to other institutions? If so, describe how.
* How should the feature work, and what should it look like? Include wireframes and workflow.
* Are you able to implement this feature yourself? If not, are you available for consultation during the implementation process?
* How desperately do you need this feature?

Keep in mind that the individuals and institutions that contribute to UDOIT have their own list of priorities, so there is no guarantee that your feature will be implemented as soon as you would like. The more universal the feature is, the more likely other institutions will help with the implementation.

## Branching and Merging

If you are contributing code to UDOIT, please follow the guidelines below. Please keep in mind that we haven't always used this structure, so there are likely old issues and branches that do not conform.

### Forking

If you are outside of UCF, you will need to fork the UDOIT project in order to work on it. Please follow the branching guidelines below. If you are familiar with Git, but are unsure of the forking process, read the [Forking Projects](https://guides.github.com/activities/forking/) guide.

### Master Branch

* This is the default branch.
* It always points at the latest release (thus always production ready)

### Dev Branches

* Naming Convention: `dev/v1.2.10` - a new one for every upcoming release version
* Issue branches merge into this branch (never master)
* When this dev branch is ready for release, it is merged into master and deleted

### Issue Branches

* Naming Convention: `issue/3432-add-package-json-dependency`
* The number is an issue number, and the text is a very short description of the issue.
* All issue branches must be tied to an issue, even in your forked version of UDOIT.
* Make sure you update your forked version first, then create your issue branch from the current dev branch.
* After work is completed, create a pull request into the target dev branch (never master).
* Once the pull request is merged, the issue branch should be deleted.

### Releases

This section is mainly for the project managers, but is here for documentation purposes.

* Naming convention: `v1.2.10` using [SEMVER](http://semver.org/)
* Each release gets a tag after it's merged into master
* Write a [release doc for Github](https://help.github.com/articles/creating-releases/)
* It is suggested that you sign release tags for extra trust ([git tag](https://git-scm.com/book/tr/v2/Git-Tools-Signing-Your-Work)) and ([using keybase gpg keys](https://clu.cdl.ucf.edu/snippets/103))


### Pictures to really drive it home
```
┌───────────┐ ┌───────────┐ ┌───────────┐
| | | | | |
| Master | | Develop | | Issue |
| | | | | |
└───────────┘ └───────────┘ └───────────┘
release ◄── merge ◄── merge
tags: branches: branches:
v0.0.3 ◄── dev/v0.0.3 ◄── issue/123-fix-broken-links + issue/211
v0.0.2 ◄── dev/v0.0.2 ◄── issue/251-rename-all-the-files + issue/222 + issue/12221
v0.0.1 ◄── dev/v0.0.1 ◄── issue/121-get-logins-working-again
```
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Get php 5.6
FROM php:5.6-alpine

RUN apk update && apk add git
RUN apk upgrade --update && apk add --no-cache \
git \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd

WORKDIR /var/www
5 changes: 3 additions & 2 deletions HEROKU.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ After clicking the Heroku button above:
2. Give the app a name.
3. Fill out the `OAUTH2_ID` and `OAUTH2_KEY` fields with dummy data. (We'll fix it later.)
4. Fill out the `OAUTH2_URI` field with `https://yourapp.herokuapp.com/oauth2response.php`. (Replace 'yourapp' with the name you gave in step 2.)
5. Fill out the `CANVAS_NAV_ITEM_NAME` field with the name you would like the app to appear as in the course navigation menu. This is useful if your instance will be use for a pilot. The normal value to use here is ***UDOIT***.
5. Copy and paste your Google/YouTube API key.
5. Click the Deploy button and wait for the process to complete.

Expand Down Expand Up @@ -118,7 +119,7 @@ If you need to check that the tables exist, you can connect to Postgres using so
* `Select * from users;` or `Select * from reports;` will show you their contents
* `\q` quits the psql terminal

If needed, you can manually run the table creation script: `Heroku run php lib/db_create_tables.php`
If needed, you can manually run the table creation script: `heroku run composer dbsetup`

## Table Schema
The table schema can be found in [lib/db_create_tables.php](lib/db_create_tables.php)
The table schema can be found in [bin/db_create_tables.php](bin/db_create_tables.php)
40 changes: 30 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ UDOIT enables faculty to identify accessibility issues in Canvas by Instructure.

UDOIT has been recognized by the industry, heres a quick list of the awards it's won.

* 2017 - [Prudential Productivity Award](http://www.floridataxwatch.org/Events/PrudentialProductivityAwards/2017Winners.aspx)
* 2017 - [Platinum IMS Global Learning Impact Award - Established Projects Category](https://www.imsglobal.org/article/ims-global-learning-consortium-announces-2017-award-winners)
* 2016 - [Campus Technology Innovators - Administration Category](https://campustechnology.com/innovators)
* 2015 - [Online Learning Consortium Effective Practice Award](https://onlinelearningconsortium.org/about/2015-olc-effective-practice-award-winners/)
Expand Down Expand Up @@ -47,18 +48,34 @@ To start the Heroku deployment process, you can click the button below, please n
## System Requirements
* Apache or Nginx webserver
* PHP 5.4, 5.5, or 5.6 (some users have modified the code to work on 5.3)
* Bower
* [GD Graphics Library](http://php.net/manual/en/book.image.php)
* MySQL or PostgreSQL

If you're using PHP 5.3:

* Convert all empty array initializations from using the newer `[]` syntax to use the older `array()` syntax.
* If you have `short_open_tag` disabled, you'll need to change all `<?=` to `<?php echo`

## Installing Bower Dependencies
[Bower](http://bower.io/) is used to install JavaScript dependencies. Composer automatically runs Bower during install in the next step, so install Bower before continuing.
## Downloading the Source Code
There are two methods of obtaining the source code and maintaining your installation of UDOIT: Git Clone or Download ZIP.

> Currently there is only one bower library installed. You can also install manually by cloning [JSColor](https://github.com/callumacrae/JSColor) library into `assets/js/vendor/JSColor/`.
### The Git Method
The benefit of this method is that you can update an existing installation of UDOIT by simply using `git pull`. It also lets you roll back to previous versions if needed. Follow these steps:
1. [Install Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) on your server
2. Navigate to the directory on your server where UDOIT will live
3. Run `git clone [email protected]:ucfopen/UDOIT.git .` (The ` .` is important. It tells Git to download the files to the current directory.)

### The ZIP Method
This method is useful if you don't want to install Git on your server, but if you want to update UDOIT later, you will have to manually overwrite files with the new versions. Follow these steps:
1. Go to the [releases page](https://github.com/ucfopen/UDOIT/releases).
2. The latest release is displayed first. Scroll down to the Downloads area of that release.
3. Download either the .zip or .tar.gz, depending on which one you prefer.
4. Navigate to the directory on your server where UDOIT will live.
5. Unzip the archive.

## Configuring your Web Server
The details of configuring a web server with PHP are out of the scope of this README. However, there is an optional configuration step you can take to increase the security of your UDOIT installation. Without any special web server configuration, UDOIT will work if you place it in the web root of your server. You can even place it in a subfolder inside your web root with no issues. If someone tries to access any of your configuration files via a URL, they will only see a blank page.

If you'd like to add a little extra security to your installation, you can configure your web server to point to UDOIT's "public" folder. Doing this will hide the configuration files so that they are not web accessible. It will also clean up your URL structure so that you don't need to include the "public" folder in any of the URLs to UDOIT. See the [LTI Config URL Notes](#lti-config-url-notes) section of this README for examples.

## Installing Composer Dependencies
UDOIT uses [Composer](https://getcomposer.org/) to install PHP dependencies. So `cd` into your UDOIT directory and run this command before anything else:
Expand All @@ -67,7 +84,7 @@ UDOIT uses [Composer](https://getcomposer.org/) to install PHP dependencies. So
$ php composer.phar install
```

The libraries (other then Quail) that we rely on can be found in `bower.json` and `composer.json`.
The libraries (other then Quail) that we rely on can be found in `composer.json`.

Please refer to the documentation for these three libraries for additional information.

Expand All @@ -77,7 +94,7 @@ Make sure the `reports` directory in the root of UDOIT is *writable by your webs
## Database Setup
UDOIT works with MySQL, MariaDB, or PostgreSQL

1. Create a database for UDOIT.
1. Create a database for UDOIT.
2. Create a user with access to your database

### Database Config
Expand All @@ -100,13 +117,13 @@ Edit `config/localConfig.php`:

### Installing Database Tables

There are only two tables required. To create them, run the creation script below. You'll need to complete the db steps above first.
To create the required tables, run the creation script below. You'll need to complete the db steps above first.

```
$ php lib/db_create_tables.php
$ php composer.phar dbsetup
```

The table schema can be found in [lib/db_create_tables.php](lib/db_create_tables.php)
The table schema can be found in [bin/db_create_tables.php](bin/db_create_tables.php)

## Configuration and Setup
If you didn't already make `config/localConfig.php` when you set up the database, do it now.
Expand Down Expand Up @@ -167,6 +184,9 @@ The URL of your UDOIT LTI config depends on your webserver install. The file is
* `http://<DOMAIN>/udoit/udoit.xml.php`
* `http://<DOMAIN>/udoit/public/udoit.xml.php`

## Using UDOIT
For more information about how to use UDOIT you can read the [UDOIT User Guide](https://lor.instructure.com/resources/6bf40e8d2254428cbbfd213586c84406) created by Clemson University. It can be accessed by importing the pages as modules into an existing course. The guide covers the reasoning behind the accessibility issues that UDOIT addresses as well as detailed descriptions of how to interpret and interact with the results of a scan.

## General Troubleshooting
Navigate to your LTI install page at `https://<domain>/udoit.xml.php` where `domain` is the location of your install. This URL may also look like the list from the section above.

Expand Down
5 changes: 1 addition & 4 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,11 @@
"heroku-postgresql:hobby-dev"
],
"buildpacks": [
{
"url": "https://github.com/heroku/heroku-buildpack-nodejs"
},
{
"url": "https://github.com/heroku/heroku-buildpack-php"
}
],
"scripts": {
"postdeploy": "php lib/db_create_tables.php"
"postdeploy": "composer dbsetup"
}
}
6 changes: 3 additions & 3 deletions lib/db_create_tables.php → bin/db_create_tables.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

require_once(__DIR__.'/../config/settings.php');
$dbh = include(__DIR__.'/db.php');
$dbh = include(__DIR__.'/../lib/db.php');

if ($db_type == 'pgsql'){
// POSTGRESQL
Expand All @@ -10,7 +10,7 @@
id SERIAL PRIMARY KEY,
user_id integer,
course_id integer,
file_path text,
report_json text,
date_run timestamp with time zone,
errors integer,
suggestions integer
Expand All @@ -30,7 +30,7 @@
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`course_id` int(10) unsigned NOT NULL,
`file_path` text NOT NULL,
`report_json` MEDIUMTEXT NOT NULL,
`date_run` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`errors` int(10) unsigned NOT NULL,
`suggestions` int(10) unsigned NOT NULL,
Expand Down
68 changes: 68 additions & 0 deletions bin/move_reports_to_db.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
/**
* Copyright (C) 2014 University of Central Florida, created by Jacob Bates, Eric Colon, Fenel Joseph, and Emily Sachs.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Primary Author Contact: Jacob Bates <[email protected]>
*/

require_once(__DIR__.'/../config/settings.php');
$dbh = include(__DIR__.'/../lib/db.php');

$rows = $dbh->query("SELECT * FROM {$db_reports_table}")->fetchAll();

if( ! isset($rows[0]['file_path']))
{
exit("It looks like this script doesnt need to be run");
}

if( ! isset($rows[0]['report_json']))
{
// Quick hack to add report column since we dont have migrations yet
$column_type = $db_type == 'mysql' ? 'MEDIUMTEXT' : 'TEXT';
$dbh->query("ALTER TABLE {$db_reports_table} ADD report_json {$column_type}");
}

$sth = $dbh->prepare("UPDATE {$db_reports_table} set report_json = :report_json WHERE id = :id");
$count_moved = 0;

foreach ($rows as $row)
{
if(empty($row['file_path'])) continue;

$file = __DIR__. '/'. $row['file_path'];
if( ! file_exists($file)){
echo("Json file not found {$file} for report id: {$row['id']}\n");
continue;
}

$json = file_get_contents($file);

if(empty($json)) continue;

$sth->bindValue(':report_json', $json, PDO::PARAM_STR);
$sth->bindValue(':id', $row['id'], PDO::PARAM_INT);
$res = $sth->execute();

if(!$res){
echo("Failed inserting report for {$row['id']}");
continue;
}

$count_moved++;
}

$dbh->query("ALTER TABLE {$db_reports_table} DROP COLUMN file_path");
echo("Moved {$count_moved} reports from disk to the database. Feel free to delete the reports directory");
20 changes: 0 additions & 20 deletions bower.json

This file was deleted.

Loading

0 comments on commit a2b49ea

Please sign in to comment.