Skip to content

Commit

Permalink
Initial Comit
Browse files Browse the repository at this point in the history
  • Loading branch information
nhandyal committed Jul 20, 2012
0 parents commit 30773b4
Show file tree
Hide file tree
Showing 170 changed files with 7,796 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Options -Indexes
ErrorDocument 403 http://hummingbirdapplication.com/
ErrorDocument 404 http://hummingbirdapplication.com/error.html

Binary file added extension.zip
Binary file not shown.
Binary file added extension/.DS_Store
Binary file not shown.
Binary file added extension/images/.DS_Store
Binary file not shown.
Binary file added extension/images/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extension/images/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extension/images/icon19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extension/images/icon19_green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extension/images/icon19_yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extension/images/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extension/js/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions extension/js/background-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

149 changes: 149 additions & 0 deletions extension/js/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
chrome.contextMenus.create({
"title" : "Monitor with Hummingbird",
"type" : "normal",
"contexts" : ["selection"],
"documentUrlPatterns" : ["http://web-app.usc.edu/soc/*"],
"onclick" : clickCallBack
});

function clickCallBack(info){
chrome.browserAction.setIcon({path: "../images/icon19_yellow.png"});
if(checkLogIn() != "1"){
chrome.browserAction.setIcon({path: "../images/icon19.png"});
chrome.tabs.create({url : "http://www.hummingbirdapplication.com/login.php?err=3"});
}
else{
// user is logged in
var selectionText = info.selectionText;
if(validSelection(selectionText)){
selectionText = selectionText.replace("D",""); //Remove the D from the section number
selectionText = selectionText.replace("R",""); //Remove the R from the section number
var courseInfo = (info.pageUrl).replace("http://web-app.usc.edu/soc/","");
var termNumber = courseInfo.substring(0,courseInfo.indexOf("/"));
var deptName = courseInfo.substring(courseInfo.indexOf("/"));
var courseURL = "http://web-app.usc.edu/ws/soc/api/classes"+deptName+"/"+termNumber;
validateSectionNumber(courseURL, selectionText, termNumber);
}
}
};

function checkLogIn(){
var loggedIn;
$.ajax({
type: "GET",
async: false,
url: "http://www.hummingbirdapplication.com/application/extension/ex-loggedIn.php",
success: function(response){
loggedIn = response;
}
}
);
return loggedIn;
}

function validSelection(selectionText){
if(selectionText.length == 5 || selectionText.length == 6){
return true;
}
else{
alert("You made an invalid selection. Pleae select the section you want from the sections collumn.");
return false;
}
}

function validateSectionNumber(courseURL, selectionText, termNumber){
var jsonResponse;
$.ajax({
type: "GET",
async: false,
url: courseURL,
success: function(response){
jsonResponse = JSON.parse(response);
}
}
);

// Loop through all courses
for(var i = 0; i < jsonResponse.OfferedCourses.course.length; i++){
var sectionDataLength = jsonResponse.OfferedCourses.course[i].CourseData.SectionData.length;
if(sectionDataLength == undefined){
// Perform check on single section id
if( jsonResponse.OfferedCourses.course[i].CourseData.SectionData.id == selectionText){
// match on selection text
gatherData(courseURL, termNumber, jsonResponse, i, -1, selectionText);
return;
}
}
else{
// Loop through all sections
for(var j = 0; j < sectionDataLength; j++){
if(jsonResponse.OfferedCourses.course[i].CourseData.SectionData[j].id == selectionText){
// match on selection text
gatherData(courseURL, termNumber, jsonResponse, i, j, selectionText);
return;
}
}
}
}
alert("You made an invalid selection. Pleae select the section you want from the sections collumn.");
}

function gatherData(courseURL, term, jsonResponse, courseIndex, sectionIndex, sectionNumber){
var department = jsonResponse.Dept_Info.department;
var deptAbbreviation = jsonResponse.Dept_Info.abbreviation;
var publishedCourseName = jsonResponse.OfferedCourses.course[courseIndex].PublishedCourseID + ": " + jsonResponse.OfferedCourses.course[courseIndex].CourseData.title;
var sectionData = "";
if(sectionIndex == -1)
sectionData = jsonResponse.OfferedCourses.course[courseIndex].CourseData.SectionData;
else
sectionData = jsonResponse.OfferedCourses.course[courseIndex].CourseData.SectionData[sectionIndex];

if(sectionData.canceled == "Y"){
alert("The section you selected has been canceled");
return;
}

var courseType = sectionData.type;
var instructor = "";
if(!$.isEmptyObject(sectionData.instructor.first_name))
instructor = sectionData.instructor.first_name+" "+sectionData.instructor.last_name;
var courseDays = sectionData.day;
var startTime = sectionData.start_time;
var endTime = sectionData.end_time;
var location = sectionData.location;
var numberRegistered = sectionData.number_registered;
var spacesAvailable = sectionData.spaces_available;
var seatOpen = (Number(spacesAvailable) > Number(numberRegistered));
if(seatOpen){
alert("This class has space in it! Go to my usc to get your spot before someone else does!")
chrome.browserAction.setIcon({path: "../images/icon19.png"});
}
else{
$.post("http://www.hummingbirdapplication.com/application/extension/ex-addClass.php",
{
"term" : term,
"deptAbbreviation" : deptAbbreviation,
"department" : department,
"courseDataURL" : courseURL,
"sectionNumber" : sectionNumber,
"publishedCourseName" : publishedCourseName,
"courseIndex" : courseIndex,
"sectionIndex" : sectionIndex,
"courseType" : courseType,
"instructor" : instructor,
"courseDays" : courseDays,
"startTime" : startTime,
"endTime" : endTime,
"location" : location,
"numberRegistered" : numberRegistered,
"spacesAvailable" : spacesAvailable,
"seatOpen" : seatOpen
},
function(response){
var jsonResponse = JSON.parse(response);
chrome.browserAction.setIcon({path: "../images/icon19.png"});
alert(jsonResponse.message);
}
);
}
}
4 changes: 4 additions & 0 deletions extension/js/jquery-1.7.1.min.js

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions extension/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "Hummingbird",
"version": "1.0.2",

"description": "A USC couse scheduling assistant",
"icons": {
"16": "images/icon16.png",
"48": "images/icon48.png",
"128": "images/icon128.png"
},

"browser_action": {
"default_icon": "images/icon19.png",
"default_title": "Hummingbird"
},

"background": {
"scripts" : [
"js/jquery-1.7.1.min.js",
"js/background-min.js"
]
},
"permissions" : [
"contextMenus",
"<all_urls>"
]
}
Binary file added website/.DS_Store
Binary file not shown.
69 changes: 69 additions & 0 deletions website/adminLogin/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>HostGator Website Startup Guide</title>
<link rel="stylesheet" href="http://www.hostgatorsupport.com/style.css" type="text/css" />
</head>

<body>
<br />
<div id="wrap">

<div id="header"><img src="http://www.hostgatorsupport.com/images/ban2.png" alt="ban" width="768" height="141" /></div>


<div id="content"><a href="/webmail" target="_blank"></a><br />

<br />
<table width="100%" border="0">
<tr>
<td align="right"><img src="http://www.hostgatorsupport.com/images/cp.png" alt="cp" width="51" height="40" /></td>
<td valign="middle" class="contentlinks"><a href="/cpanel" target="_blank">cPanel Login</a></td>
<td align="right"><img src="http://www.hostgatorsupport.com/images/mail2.png" alt="webmail" width="51" height="36" /></td>
<td class="contentlinks"><a href="/webmail" target="_blank">Webmail Login</a></td>
</tr>

<tr>
<td width="24%" align="right"><img src="http://www.hostgatorsupport.com/images/start.png" alt="start" width="45" height="35" /></td>
<td width="24%" valign="middle"><a href="http://www.hostgator.com/gettingstarted.shtml" target="_blank" class="contentlinks">Getting Started</a></td>
<td width="8%" align="right"><img src="http://www.hostgatorsupport.com/images/dollar.png" alt="dollar" width="35" height="40" /></td>
<td width="40%"><a href="https://gbclient.hostgator.com" target="_blank" class="contentlinks">Billing / Invoices </a></td>
</tr>
<tr>
<td align="right"><img src="http://www.hostgatorsupport.com/images/filmstrip2.jpg" alt="film2" width="46" height="39" />&nbsp;</td>

<td><a href="http://www.hostgator.com/tutorials.shtml" target="_blank" class="contentlinks">Video Tutorials</a></td>
<td align="right"><img src="http://www.hostgatorsupport.com/images/com.png" alt="com" width="45" height="35" /></td>
<td><a href="http://www.hostgator.com/domains" target="_blank" class="contentlinks">Purchase / Transfer Domain Name </a></td>
</tr>
<tr>
<td align="right"><img src="http://www.hostgatorsupport.com/images/book3.png" alt="book" width="42" height="42" />&nbsp;&nbsp;</td>
<td class="contentlinks"><a href="http://support.hostgator.com/index.php?_m=knowledgebase&amp;_a=view" target="_blank">Knowledgebase</a></td>

<td align="right"><img src="http://www.hostgatorsupport.com/images/mail1.png" alt="mail" width="45" height="48" /></td>
<td><a href="https://tickets.hostgator.com" target="_blank" class="contentlinks">Ticket System </a></td>
</tr>
<tr>
<td align="right"><img src="http://www.hostgatorsupport.com/images/people.png" alt="people" width="51" height="40" /></td>
<td class="contentlinks"><a href="http://forums.hostgator.com" target="_blank">Online Forums</a></td>
<td align="right"><img src="http://www.hostgatorsupport.com/images/phone2.png" alt="phone2" width="47" height="45" /></td>
<td class="contentlinks"><a href="http://www.hostgator.com/contact.shtml" target="_blank">Contact US</a></td>

</tr>
</table>
<table width="100%" border="0">
<tr>
<td align="left">&nbsp;</td>
</tr>
</table>
</div>
<div id="footer"><a href="javascript:void(0);" onclick="window.open('http://chat.hostgator.com/liveperson/', (Math.floor(Math.random()*100000)), 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=375,left = 310,top = 275');"><img src="http://www.hostgatorsupport.com/images/banner1.jpg" alt="Live Support" border="0" /></a><br />
| <a href="http://www.hostgator.com/" target="_blank">HostGator.com</a> |<br />

<span class="style8">Copyright 2010 &copy; HostGator.com</span></div>

</div>
<script language='javascript' type="JavaScript/text" src='http://server.iad.liveperson.net/hc/33645339/x.js?cmd=file&amp;file=chatScript3&amp;site=33645339&amp;imageUrl=null'> </script>
</body>
</html>
Binary file added website/application/.DS_Store
Binary file not shown.
Binary file added website/application/cron/.DS_Store
Binary file not shown.
45 changes: 45 additions & 0 deletions website/application/cron/checkCourseAvailability-cron.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

require_once("../global/includes/db-open.php");


$query = "SELECT term, deptAbbreviation, JSONData FROM departments";
$department_result = mysqli_query($link, $query);

while($department_r = mysqli_fetch_assoc($department_result)){
$term = $department_r['term'];
$deptAbbreviation = $department_r['deptAbbreviation'];
$departmentData = json_decode($department_r['JSONData']);


$query = "SELECT sectionNumber, courseIndex, sectionIndex FROM courses WHERE term=$term AND deptAbbreviation='$deptAbbreviation'";
$course_result = mysqli_query($link,$query);
while($course_r = mysqli_fetch_assoc($course_result)){
$sectionNumber = $course_r['sectionNumber'];
$courseIndex = $course_r['courseIndex'];
$sectionIndex = $course_r['sectionIndex'];


$numberRegistered;
$spacesAvailable;
$seatOpen = 0;
if($sectionIndex == -1){
$numberRegistered = $departmentData->OfferedCourses->course[$courseIndex]->CourseData->SectionData->number_registered;
$spacesAvailable = $departmentData->OfferedCourses->course[$courseIndex]->CourseData->SectionData->spaces_available;
}
else{
$numberRegistered = $departmentData->OfferedCourses->course[$courseIndex]->CourseData->SectionData[$sectionIndex]->number_registered;
$spacesAvailable = $departmentData->OfferedCourses->course[$courseIndex]->CourseData->SectionData[$sectionIndex]->spaces_available;
}

if($numberRegistered < $spacesAvailable)
$seatOpen = 1;

$courseUpdate = "UPDATE courses SET numberRegistered=$numberRegistered, seatOpen=$seatOpen WHERE term=$term AND deptAbbreviation='$deptAbbreviation' AND sectionNumber=$sectionNumber";
mysqli_query($link,$courseUpdate) or die(mysqli_error($link)." - ".$courseUpdate);
}
}

require_once("../global/includes/db-close.php");
print_r($link);
?>
9 changes: 9 additions & 0 deletions website/application/cron/cleanUserEntries-cron.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

require_once("../global/includes/db-open.php");

$deleteQuery = "DELETE FROM users WHERE vrf_email=0";
mysqli_query($link,$deleteQuery);

require_once("../global/includes/db-close.php");
?>
Loading

0 comments on commit 30773b4

Please sign in to comment.