A web application for discussion and peer review
PHP JavaScript Other
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


NTG (New Training Grounds, formerly Gummii): A web application for writing and peer review

This project is undergoing a simplification of sorts. I will update this with a new mission statement when I have time. Where I started changing my approach has been put on the "overambitious" branch.


This aims to be a social writing/publishing and peer review web application. Currently, it is a robust and lightweight boilerplate for an AJAX-driven web application that minimizes page reloads and is very easy to re-theme via jQuery UI Themeroller. The schema and strategy planned for this application are mostly done.


How to build a Gummii theme:

  1. Make a folder with a URL-friendly name in 'webroot/themes'
  2. Make subfolders: css/ js/
  3. Go to http://jqueryui.com/themeroller/ and set up a color/texture scheme.
  4. Download the theme. No need for extra plugins and whatnot; you just want the images and CSS.
  5. In the zip file that you downloaded, copy the contents of the css/custom-theme/ folder to the css subfolder of your theme's folder
  6. Rename the CSS file "jquery-ui.css"
  7. Create a "main.css" file in the css folder of your theme (where you will put your custom CSS) and put your images in the css/images/ folder.
  8. Images:
    • Make a favicon. Store it in the root level of your theme folder.
    • Create a "logo", 40x40 px, name it "logo.png", and put it in the root level of your theme's folder.
    • Make a 100x100 image to serve as the rotating "loading" image. Call it 'loading.png' and put it in the root level of your theme's folder.
  9. Pick an overlay color (and transparency level) for the tint that appears over content while it's loading, with the following CSS:

    div.loading-overlay { background-color: rgba(0, 0, 0, 0.1); }

    You can also make the overlay contain a background image if you like, with the following CSS:

    div.loading-overlay { background: transparent url(images/hex-screen.png) repeat; }

  10. Make a PHP file named "img_preload.php", and put it in the root level of your theme folder. It should return an array of filenames (relative to the theme's root) of images that you want pre-loaded (to avoid having to load them right when they're needed). Example: for the loading and overlay image;

<?php return array('/loading.png','/css/images/overlay.png'); ?>

Finally, protect the theme folder by copying the .htaccess file from another theme's folder into the root level of your theme's folder. It will then be safe to override view files by putting them in (yourtheme)/views/(controller ID)/(view name) (see: Special topics: Theming

Happy theming!

Test Driven Development

The following files are necessary for testing. They are in the .gitignore to allow for local differences in configuration, i.e. database name/password. ;webroot/protected/config/custom-test-postinstall.php : This is basically the same as webroot/protected/data/pre-installation/protected/config/custom.php.txt, with all of the necessary details (in curly braces) filled in for the local testing environment. ;webroot/protected/config/isInstalled.php : Returns True or False based on whether the application is installed; fixtures should write to this file to distinguish between which configuration files to use. ;webroot/protected/tests/WebTestCaseConfig.php : Contains the following lines (which must be configured for the local test environment: :* define('TEST_BASE_URL','http://url/of/your/testing/environment/path/to/');

Recommended Netbeans Configuration

Following these guidelines should make merges easier, if you would like to help me on this project.

  • Project/Source folder: "NTG" (Same as git repository folder)
  • PHP Version: 5.3
  • Default encoding: UTF-8
  • Netbeans folder outside of source folder UNCHECKED
  • Index file: webroot/index.php
  • Disable expanding tabs to spaces;
  • In Tools->Options->Editor->Formatting, uncheck "Expand Tabs to Spaces" for ALL languages. See, for additional configuration: http://www.yiiframework.com/wiki/83/netbeans-ide-and-yii-projects/ (Don't bother with anything more than "1. Code completion"; keep it simple. That one configuration step will help you avoid mistakes and give you helpful Yii documentation / tips.)

Foreign Key Relationship Notes

Here are the rationales behind each foreign key relationship that isn't cascade-cascade, as a reminder. Unless listed here, relationships will always be cascade-cascade to streamline management). For each, the first option is update, second is delete.

posts.assetId->assets.id: cascade, set null Don't delete posts just because the image they use has been deleted.

posts.parentId->posts.id: cascade, set null Deleting a thread won't completely erase all the comments made in the thread, so if someone wrote a meaningful comment, it can be salvaged.

tags.userId-> users.id: cascade,set null A tag sort of becomes the work of the community (i.e. using it for categorization) once it has been applied widely. Thus, even if a user is deleted, the user's tags should not be.