George Mason University Antonin Scalia Law School

Sass

$ sass --watch style.scss:style.css --style compressed

// Import
@import "normalize";

// Variables
$body_font: 'Georgia', serif;

// Mixin
@mixin rounded_corners($rounding) {
-webkit-border-radius:$rounding;
-moz-border-radius: $rounding;
-o-border-radius: $rounding;
border-radius: $rounding; }

Apache Rewrites

Redirect non-www to www with .htaccess


RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Example: law.gmu.edu to www.law.gmu.edu


Add trailing slash (/) to URL:


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.sample.com/$1/ [QSA,L,R=301]

Example: law.gmu.edu to law.gmu.edu/

LRWA Online Document Submission

URL: http://www.law.gmu.edu/academics/lrwa

  1. In MODX tree menu, browse to: Academics > LRWA Online Document Submission
  2. Duplicate an existing form. Example: 2012 Fall Law 097 LRWA II and rename to the new semester.
  3. Edit instructors’ email
  4. update this chunk name: &tpl=`eForm.lrwa2012fall097.form` (Also pay attention to these chunks: &report=`eForm.lrwa.email` &thankyou=`eForm.lrwa.thankyou`
  5. Navigate to “Chunks” under “Manage Elements” and duplicate an existing chunk. Example: eForm.lrwa2012fall097.form
  6. Update faculty names in the drop down box.

Validation messages lives in english.inc.php. Update validation message via command lines:
cd /home/lawdevlaw/public_html/assets/snippets/eform/lang/
chmod 755 english.inc.php
vi english.inc.php
chmod 444 english.inc.php (read only)

Course Schedule Import Script

Make sure the csv file is properly formatted. Use the csv files from the previous semesters as example, strictly apply the same format for name, time, date, etc.

1. ssh into the masonlaw main server

2. su into root

3. cd /home/lawdevlaw/public_html/assets/snippets/

4. change permissions: chmod -R 755 csv_new/

5. cd csv_new

6. upload the csv file (make sure the uploaded csv file is readable).
cd /home/lawdevlaw/public_html/assets/snippets/csv_new
touch zz-spring-2012.csv (new csv file)
vi zz-spring-2012.csv (paste CSV file from TextEdit)
:wq (save file)

7. Copy a convert_schedule_201?_????.php to a file name appropriate for the school year and semester, e.g., convert_schedule_2012_spring.php (Make sure to do this via command line and not upload through MODX).

8. Edit convert_schedule_2012_spring.php. Make sure all the parameters shown below are correct:

$SITE = 'LIVE'; // 'LIVE' OR 'DEV'

$csv_file = ‘./zz.csv’; // CSV files
$xml_file = ‘./schedule2.xml’; // XML definition files
$data_year = 2012;
$data_semester = 1; // 1-spring 2-summer 3-fall
$data_semester_name = ‘Spring’;
$data_instructor_parent = 1812; //this value stays the same
if($SITE==’LIVE’) {
$data_course_parent = 7714; //change this value according to the parent container

Note 7714 is the object id in modx, for which all the course instances will be created. Check the other convert files for examples.

9. From your browser, visit the php file you just edited, e.g.: http://law.gmu.edu/assets/snippets/csv_new/convert_schedule_2012_spring.php

10. Note all red lines are errors or warnings. Make sure they are properly dealt with. If the script says it will create a new instructor for you, make sure the newly created instructor does not already exist in the system. Even small typo can trigger the script into thinking we need to add another instructor.

11. Submit the form, until the page shows no error and there is nothing more to do.

12. IMPORTANT! Now you must change back the script permission:
chmod -R 000 csv_new/


Update course descriptions to point to the new semester

Edit “2012_course_info.html” template in (elements/manage files/templates) change the header and the &parent code.

Update course container

1. Inside MODX: Academics -> Course Schedules and Assignments -> Pick the newest course schedules (example: 2013 Course Schedules) –> Pick the newest semester (example: 2013 Summer)

2. Edit the parent. Add URL alias.

3. Edit resource content: [!course_instances? &semester=`2` &year=`2013` &updated_threshold=`0`!] (1-spring 2-summer 3-fall)

4. In setting tab, check “published” and “container”

5. Hit “save.”

Upgrade Notes

WordPress: Just hit the upgrade button

MODX: 1.06

  • Follow Upgrading Guide (Alternate Method).
  • Back up config.inc.php and document.parser.class.inc.php
  • Once upgraded, change default sort order in resource tree:if (!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) {
    // This is the first startup, set default sort order
    $_SESSION['tree_sortby'] = 'menuindex'; // Change menuindex to a value of your choice.
    $_SESSION['tree_sortdir'] = 'ASC';
    }
  • PHx Bug & pageTOC issue: The fix is to increase the pcre.backtrack_limit setting in php.inifrom 100000 to 800000

    [Pcre]
    ;PCRE library backtracking limit.
    pcre.backtrack_limit=800000

Modifying the document.parser.class.inc.php

Add the following codes when upgrade:

// START CODE BY PAUL BOHMAN/DONNY TRUONG
// Ability to get all documents, whether deleted or unpublished, added by Paul Bohman
if ($published == '*') $sqlPublished = '';
else $sqlPublished = "AND sc.published=$published";
if ($deleted == '*') $sqlDeleted = '';
else $sqlDeleted = "AND sc.deleted=$deleted";
// END CODE BY PAUL BOHMAN/DONNY TRUONG

And here:

$result= $this->getTemplateVars($vars, "*", $docid, $published, "", "", $sep, $deleted=0);
// The deleted option above was added by Paul Bohman/Donny Truong

Remember to add the codes for CASifying MODX as well.

Frequently Used Linux Command Lines

Install WordPress
wget https://wordpress.org/latest.tar.gz
tar xfz latest.tar.gz
cp -r * ~/public_html/your/website/folder/

Change Permissions (rwx => 4 + 2 + 1 = 7)
For Directories: find /path/to/your/directory/ -type d -exec chmod 755 {} \;
For Files: find /path/to/your/file/ -type f -exec chmod 644 {} \;

Permissions
chmod -R 755 directory
chmod -R 644 files

Remove files and directory (use carefully)
rm -rf YourDirectory

Change Owner
chown -R apache new_name (change entire directory)

Remane Directory
mv {old} {new}

Database
To access database: mysql -u root -p
mysql> create database [database name];
mysql> show databases;
mysql> drop database [database name];
More

VI editor
Reference: Using the VI editor