Skip to content

Commit d97f993

Browse files
committed
Merge branch 'JoelEager-master'
2 parents 74e7491 + cf8ff59 commit d97f993

File tree

10 files changed

+121
-98
lines changed

10 files changed

+121
-98
lines changed

assets/src/modules/sm/App/controllers/AppController.js

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ angular.module('sm').controller("AppController", function($scope, localStorage,
1111
$scope.state.courseMap = {};
1212
$scope.state.nonCourses = [];
1313
$scope.state.noCourses = [];
14-
$scope.state.schedules =[];
14+
$scope.state.schedules = [];
1515
$scope.state.drawOptions = {
1616
startTime: 480,
1717
endTime: 1320,
1818
startDay: 1,
1919
endDay: 6,
20-
bldgStyle: 'code'
20+
bldgStyle: 'code',
21+
theme: 'woc',
22+
classDetails: 'NPL'
2123
};
2224

2325
$scope.state.displayOptions = {
@@ -38,7 +40,7 @@ angular.module('sm').controller("AppController", function($scope, localStorage,
3840
alert_searchFeatures: true,
3941
alert_browseFeatures: true,
4042
alert_labClasses: false,
41-
action_generateSchedules: false,
43+
action_generateSchedules: false
4244
};
4345

4446
$scope.state.meta = {
@@ -68,23 +70,30 @@ angular.module('sm').controller("AppController", function($scope, localStorage,
6870

6971
// Reload the state if it exists
7072
var storedState = localStorage.getItem('state');
71-
if(storedState != null) {
72-
73+
if (storedState != null) {
7374
// Check if state version exists or is correct
74-
if(storedState.hasOwnProperty('meta') && storedState.meta.stateVersion == $scope.stateVersion) {
75+
if (storedState.hasOwnProperty('meta') && storedState.meta.stateVersion == $scope.stateVersion) {
7576
$scope.state = storedState;
76-
if(!$scope.state.displayOptions.hasOwnProperty('creditWarning') || !$scope.state.displayOptions.creditWarning) {
77+
if (!$scope.state.displayOptions.hasOwnProperty('creditWarning') || !$scope.state.displayOptions.creditWarning) {
7778
$scope.state.displayOptions.creditWarning = 18;
7879
}
79-
if($scope.state.schedules.length > 0 && $scope.state.schedules[0].length > 0 && !$scope.state.schedules[0][0].hasOwnProperty('initialIndex')){
80+
81+
// Initialize new values
82+
if ($scope.state.schedules.length > 0 && $scope.state.schedules[0].length > 0 && !$scope.state.schedules[0][0].hasOwnProperty('initialIndex')) {
8083
for (var count = 0; count < $scope.state.schedules.length; count++) {
8184
$scope.state.schedules[count][0].initialIndex = count;
8285
}
8386
}
87+
if (!$scope.state.drawOptions.classDetails) {
88+
$scope.state.drawOptions.classDetails = 'NPL';
89+
}
90+
if (!$scope.state.drawOptions.theme) {
91+
$scope.state.drawOptions.theme = 'woc';
92+
}
8493
} else {
8594

8695
// Before state meta
87-
if(confirm('We need to clear your session in order to update ScheduleMaker, is that ok? \n If you press cancel, you may run into errors.')) {
96+
if (confirm('We need to clear your session in order to update ScheduleMaker, is that ok? \n If you press cancel, you may run into errors.')) {
8897
$scope.resetState();
8998
} else {
9099
$scope.state = storedState;
@@ -100,7 +109,6 @@ angular.module('sm').controller("AppController", function($scope, localStorage,
100109
// Default, images are supported
101110
$scope.imageSupport = true;
102111

103-
104112
var courseNumFilter = $filter('courseNum');
105113

106114
// Course cart tools for non-generate pages.
@@ -591,7 +599,30 @@ angular.module('sm').controller("AppController", function($scope, localStorage,
591599
1410: '11:30pm',
592600
1440: '12:00am',
593601
}
594-
}
602+
},
603+
themeOptions: [{
604+
value: 'woc',
605+
label: "Modern Colors"
606+
}, {
607+
value: 'bow',
608+
label: "Classic B&W"
609+
}, {
610+
value: 'gow',
611+
label: "Classic Greyscale"
612+
}, {
613+
value: 'boc',
614+
label: "Black Text & Colors"
615+
}],
616+
classDetailsOptions: [{
617+
value: 'NPL',
618+
label: "Number, Professor, Location"
619+
}, {
620+
value: 'LPN',
621+
label: "Location, Professor, Number"
622+
}, {
623+
value: 'LNP',
624+
label: "Location, Number, Professor"
625+
}]
595626
},
596627
colors:
597628
["#7BA270",

assets/src/modules/sm/App/styles/global.css

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,28 @@ body.print div[schedule] > .panel {
6363
margin: 0 auto;
6464
}
6565

66-
body.print div[schedule].bow svg g[svg-schedule-item] rect,
67-
body.print div[schedule].gow svg g[svg-schedule-item] rect {
66+
body .bow svg g[svg-schedule-item] rect,
67+
body .gow svg g[svg-schedule-item] rect {
6868
fill: #FFFFFF !important;
6969
fill-opacity: 1 !important;
7070
stroke: #000;
7171
stroke-width: 1px;
7272
}
7373

74-
body.print div[schedule].gow svg g[svg-schedule-item] rect {
74+
body .gow svg g[svg-schedule-item] rect {
7575
stroke: #555;
7676
}
7777

78-
body.print div[schedule].bow text,
79-
body.print div[schedule].boc svg g[svg-schedule-item] text {
78+
body .bow text,
79+
body .boc svg g[svg-schedule-item] text {
8080
fill: #000000 !important;
8181
}
8282

83-
body.print div[schedule].bow svg line {
83+
body .bow svg line {
8484
stroke: #000000 !important;
8585
}
8686

87-
body.print div[schedule].gow svg g[svg-schedule-item] text {
87+
body .gow svg g[svg-schedule-item] text {
8888
fill: #333 !important;
8989
}
9090

@@ -113,7 +113,6 @@ body.print header.main {
113113
display: none;
114114
}
115115

116-
117116
body.print footer.main.print {
118117
display: block;
119118
}

assets/src/modules/sm/Generate/templates/generate.html

Lines changed: 60 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -262,48 +262,70 @@ <h3 class="panel-title">Mobile Display</h3>
262262
<div class="panel panel-default">
263263
<div class="panel-heading panel-heading-controls">
264264
<div class="row form-horizontal">
265-
<div class="col-md-2">
266-
<div class="form-group">
267-
<label for="options-bldgStyle" class="col-sm-6 control-label">Buildings:</label>
268-
<div class="col-sm-6">
269-
<select id="options-bldgStyle" class="form-control" ng-model="state.drawOptions.bldgStyle">
270-
<option value="code">Codes (eg. GOL)</option>
271-
<option value="number">Number (eg. 70)</option>
272-
</select>
265+
<div class="col-md-9">
266+
<div class="row">
267+
<div class="col-md-4">
268+
<div class="form-group">
269+
<label for="options-bldgStyle" class="col-sm-4 control-label">Buildings:</label>
270+
<div class="col-sm-8">
271+
<select id="options-bldgStyle" class="form-control" ng-model="state.drawOptions.bldgStyle">
272+
<option value="code">Codes (eg. GOL)</option>
273+
<option value="number">Number (eg. 70)</option>
274+
</select>
275+
</div>
276+
</div>
273277
</div>
274-
</div>
275-
</div>
276-
<div class="col-md-2">
277-
<div class="form-group hidden-xs">
278-
<label for="options-fullscreen" class="col-sm-4 control-label">Width:</label>
279-
<div class="col-sm-8">
280-
<select id="displayOptions-fullscreen" class="form-control" ng-model="state.displayOptions.fullscreen">
281-
<option value="">Default</option>
282-
<option value="true">Fullscreen</option>
283-
</select>
278+
<div class="col-md-3">
279+
<div class="form-group">
280+
<label for="displayOptions-pageSize" class="col-sm-6 control-label">Page Size:</label>
281+
<div class="col-sm-6">
282+
<select id="displayOptions-pageSize" class="form-control" ng-model="state.displayOptions.pageSize">
283+
<option value="3">3</option>
284+
<option value="5">5</option>
285+
<option value="10">10</option>
286+
<option value="15">15</option>
287+
<option value="20">20</option>
288+
<option value="50">50</option>
289+
</select>
290+
</div>
291+
</div>
284292
</div>
285-
</div>
286-
</div>
287-
<div class="col-md-3">
288-
<div class="form-group">
289-
<label for="displayOptions-pageSize" class="col-sm-6 control-label">Page Size:</label>
290-
<div class="col-sm-6">
291-
<select id="displayOptions-pageSize" class="form-control" ng-model="state.displayOptions.pageSize">
292-
<option value="3">3</option>
293-
<option value="5">5</option>
294-
<option value="10">10</option>
295-
<option value="15">15</option>
296-
<option value="20">20</option>
297-
<option value="50">50</option>
298-
</select>
293+
<div class="col-md-5">
294+
<div class="form-group">
295+
<label for="options-theme" class="col-sm-4 control-label">Theme:</label>
296+
<div class="col-sm-8">
297+
<select id="options-theme" class="form-control" ng-model="state.drawOptions.theme" ng-options="opt.value as opt.label for opt in ui.optionLists.themeOptions"></select>
298+
</div>
299+
</div>
299300
</div>
300301
</div>
301-
</div>
302-
<div class="col-md-2">
303-
<div class="form-group">
304-
<label for="displayOptions-creditWarning" class="col-sm-6 control-label">Credits:</label>
305-
<div class="col-sm-6">
306-
<input ng-pattern="/^\d{1,2}$/" type="text" id="displayOptions-creditWarning" class="form-control" ng-model="state.displayOptions.creditWarning" />
302+
<div class="row">
303+
<div class="col-md-4">
304+
<div class="form-group hidden-xs">
305+
<label for="options-fullscreen" class="col-sm-4 control-label">Width:</label>
306+
<div class="col-sm-8">
307+
<select id="displayOptions-fullscreen" class="form-control" ng-model="state.displayOptions.fullscreen">
308+
<option value="">Default</option>
309+
<option value="true">Fullscreen</option>
310+
</select>
311+
</div>
312+
</div>
313+
</div>
314+
<div class="col-md-3">
315+
<div class="form-group">
316+
<label for="displayOptions-creditWarning" class="col-sm-6 control-label">Credits:</label>
317+
<div class="col-sm-6">
318+
<input ng-pattern="/^\d{1,2}$/" type="text" id="displayOptions-creditWarning" class="form-control" ng-model="state.displayOptions.creditWarning" />
319+
</div>
320+
</div>
321+
</div>
322+
<div class="col-md-5">
323+
<div class="form-group">
324+
<label for="options-classDetails" class="col-sm-4 control-label">Class Details:</label>
325+
<div class="col-sm-8">
326+
<select id="options-classDetails" class="form-control" ng-model="state.drawOptions.classDetails" ng-options="opt.value as opt.label for opt in ui.optionLists.classDetailsOptions"></select>
327+
</div>
328+
</div>
307329
</div>
308330
</div>
309331
</div>

assets/src/modules/sm/Schedule/controllers/ScheduleController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ angular.module('sm').controller("ScheduleController", function($scope, parsedSch
2323

2424
// Set the correct draw options
2525
for(var key in $scope.state.drawOptions) {
26-
$scope.overrideDrawOptions[key] = parsedSchedule[key];
26+
$scope.overrideDrawOptions[key] = parsedSchedule[key] || $scope.state.drawOptions[key];
2727
}
2828

2929
// Set image property

assets/src/modules/sm/Schedule/controllers/SchedulePrintController.js

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,6 @@ angular.module('sm').controller("SchedulePrintController", function($scope, $loc
2424
}
2525

2626
$scope.heading = "My " + year + "-" + (year+1) + " " + term + " Schedule";
27-
28-
$scope.printTheme = 'woc';
29-
30-
$scope.printThemeOptions = [{
31-
value: 'woc',
32-
label: "Modern Colors"
33-
}, {
34-
value: 'bow',
35-
label: "Classic B&W"
36-
}, {
37-
value: 'gow',
38-
label: "Classic Greyscale"
39-
}, {
40-
value: 'boc',
41-
label: "Black Text & Colors"
42-
}];
43-
44-
$scope.printClassDetails = 'NPL';
45-
46-
$scope.printClassDetailsOptions = [{
47-
value: 'NPL',
48-
label: "Number, Professor, Location"
49-
}, {
50-
value: 'LPN',
51-
label: "Location, Professor, Number"
52-
}, {
53-
value: 'LNP',
54-
label: "Location, Number, Professor"
55-
}];
5627
}
5728

5829
localStorage.setItem("reloadSchedule", null);

assets/src/modules/sm/Schedule/directives/scheduleDirective.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ angular.module('sm').directive('schedule', function($timeout, $filter) {
227227

228228
var update = function(options) {
229229
if(scope.scheduleController.init(options)) {
230+
scope.scheduleDrawOptions = options;
230231
// Only redraw if valid options
231232
scope.scheduleController.draw();
232233

assets/src/modules/sm/Schedule/templates/schedule.print.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ <h3 class="panel-title">
2020
<div class="form-group">
2121
<label for="printOptions-theme" class="col-sm-4 control-label">Theme:</label>
2222
<div class="col-sm-8">
23-
<select id="printOptions-theme" class="form-control" ng-model="printTheme" ng-options="opt.value as opt.label for opt in printThemeOptions"></select>
23+
<select id="printOptions-theme" class="form-control" ng-model="overrideDrawOptions.theme" ng-options="opt.value as opt.label for opt in ui.optionLists.themeOptions"></select>
2424
</div>
2525
</div>
2626
</div>
2727
<div class="col-sm-9">
2828
<div class="form-group">
2929
<label for="printOptions-classDetails" class="col-sm-3 control-label">Class Details:</label>
3030
<div class="col-sm-7">
31-
<select id="printOptions-classDetails" class="form-control" ng-model="printClassDetails" ng-options="opt.value as opt.label for opt in printClassDetailsOptions"></select>
31+
<select id="printOptions-classDetails" class="form-control" ng-model="overrideDrawOptions.classDetails" ng-options="opt.value as opt.label for opt in ui.optionLists.classDetailsOptions"></select>
3232
</div>
3333
</div>
3434
</div>
@@ -42,4 +42,4 @@ <h3 class="panel-title">
4242
</div>
4343
</div>
4444
<h2 id="print_header" class="center" ng-bind="heading"></h2>
45-
<div ng-class="printTheme" schedule print="true"></div>
45+
<div schedule print="true"></div>

assets/src/modules/sm/Schedule/templates/scheduleitem.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="panel panel-default" schedule-actions>
1+
<div class="panel panel-default" ng-class="scheduleDrawOptions.theme" schedule-actions>
22
<div ng-show="!print" class="panel-heading">
33
<div class="row form-horizontal">
44
<div class="col-xs-12">
@@ -69,8 +69,8 @@ <h2 class="panel-title control-label pull-left smaller-sm">{{saveAction == "crea
6969
</div>
7070
<div class="schedule-cont">
7171
<div class="schedule-track" ng-class="mobileTrackClass">
72-
<svg version="1.1" ng-attr-height="{{grid.opts.height}}" width="100%" xmlns="http://www.w3.org/2000/svg"><defs><pattern vector-effect="non-scaling-stroke" id="day{{initialIndex}}" width="100%" x="0" height="40" patternUnits="userSpaceOnUse"><line vector-effect="non-scaling-stroke" x1="0" y1="19.5" x2="100%" y2="19.5" style="stroke:#bbb;stroke-width:1" /></pattern></defs><rect x="0" y="0" width="100%" height="100%" fill="#ffffff" /><g ng-attr-transform="{{grid.opts.pixelAlignment}}" font-family="Roboto" font-size="15"><g class="svg-schedule-hours"><text fill="#aaa" text-anchor="end" ng-repeat="hour in grid.hours track by $index" ng-attr-x="{{print?'41':'5%'}}" ng-attr-y="{{($index * 40) + 25}}">{{hour}}</text></g><g ng-repeat="day in grid.days"><text y="12" ng-attr-x="{{day.offset}}" ng-attr-width="{{grid.opts.daysWidth}}" fill="#aaa" ng-bind="day.name"></text><rect y="19" ng-attr-x="{{day.offset}}" ng-attr-width="{{grid.opts.daysWidth}}" ng-attr-height="{{grid.opts.daysHeight}}" fill="url(#day{{initialIndex}})" /></g><g svg-schedule-item class="item" ng-mouseenter="itemEnter($event)" ng-mouseleave="itemLeave($event)" ng-repeat="item in scheduleItems | orderBy:'-boundry.y'"><rect ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y}}" ng-attr-width="{{item.boundry.width}}" ng-attr-height="{{item.boundry.height}}" ng-attr-fill="{{item.color}}" fill-opacity=".8" /><rect ng-if="item.boundry.shorten != 0" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.shorten < 0 ?item.boundry.y : item.boundry.y + item.boundry.height - 2}}" ng-attr-width="{{item.boundry.width}}" height="2" fill="#ffff00" /><text svg-text-line="{{item.title}}" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y + 16}}" transform="translate(3,0)" font-weight="bold" fill="white"></text>
73-
<g ng-switch="printClassDetails">
72+
<svg version="1.1" ng-attr-height="{{grid.opts.height}}" width="100%" xmlns="http://www.w3.org/2000/svg"><defs><pattern vector-effect="non-scaling-stroke" id="day{{initialIndex}}" width="100%" x="0" height="40" patternUnits="userSpaceOnUse"><line vector-effect="non-scaling-stroke" x1="0" y1="19.5" x2="100%" y2="19.5" style="stroke:#bbb;stroke-width:1" /></pattern></defs><rect x="0" y="0" width="100%" height="100%" fill="#ffffff" /><g ng-attr-transform="{{grid.opts.pixelAlignment}}" font-family="Roboto" font-size="15"><g class="svg-schedule-hours"><text fill="#aaa" text-anchor="end" ng-repeat="hour in grid.hours track by $index" ng-attr-x="{{print?'41':'5%'}}" ng-attr-y="{{($index * 40) + 25}}">{{hour}}</text></g><g ng-repeat="day in grid.days"><text y="12" ng-attr-x="{{day.offset}}" ng-attr-width="{{grid.opts.daysWidth}}" fill="#aaa" ng-bind="day.name"></text><rect y="19" ng-attr-x="{{day.offset}}" ng-attr-width="{{grid.opts.daysWidth}}" ng-attr-height="{{grid.opts.daysHeight}}" fill="url(#day{{initialIndex}})" /></g><g svg-schedule-item class="item" ng-mouseenter="itemEnter($event)" ng-mouseleave="itemLeave($event)" ng-repeat="item in scheduleItems | orderBy:'-boundry.y'"><rect ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y}}" ng-attr-width="{{item.boundry.width}}" ng-attr-height="{{item.boundry.height}}" ng-attr-fill="{{item.color}}" fill-opacity="1" /><rect ng-if="item.boundry.shorten != 0" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.shorten < 0 ?item.boundry.y : item.boundry.y + item.boundry.height - 2}}" ng-attr-width="{{item.boundry.width}}" height="2" fill="#ffff00" /><text svg-text-line="{{item.title}}" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y + 16}}" transform="translate(3,0)" font-weight="bold" fill="white"></text>
73+
<g ng-switch="scheduleDrawOptions.classDetails">
7474
<g ng-switch-default>
7575
<text ng-if="item.boundry.height > 32 && item.content.courseNum" svg-text-line="{{item.content.courseNum}}" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y + 32}}" transform="translate(3,0)" fill="#fff"></text><text ng-if="item.boundry.height > 48 && item.content.instructor" svg-text-line="{{item.content.instructor}}" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y + 48}}" transform="translate(3,0)" fill="#fff"></text><text ng-if="item.boundry.height > 64 && item.content.location" svg-text-line="{{item.content.location}}" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y + 64}}" transform="translate(3,0)" fill="#fff"></text>
7676
</g>
@@ -80,8 +80,7 @@ <h2 class="panel-title control-label pull-left smaller-sm">{{saveAction == "crea
8080
<g ng-switch-when="LNP">
8181
<text ng-if="item.boundry.height > 32 && item.content.location" svg-text-line="{{item.content.location}}" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y + 32}}" transform="translate(3,0)" fill="#fff"></text><text ng-if="item.boundry.height > 48 && item.content.courseNum" svg-text-line="{{item.content.courseNum}}" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y + 48}}" transform="translate(3,0)" fill="#fff"></text><text ng-if="item.boundry.height > 64 && item.content.instructor" svg-text-line="{{item.content.instructor}}" ng-attr-x="{{item.boundry.x}}" ng-attr-y="{{item.boundry.y + 64}}" transform="translate(3,0)" fill="#fff"></text>
8282
</g>
83-
</g>
84-
<g svg-text-content="item.content"></g></g></g></svg>
83+
</g></g></g></svg>
8584
</div>
8685
</div>
8786
<div ng-if="!print && totalCredits > state.displayOptions.creditWarning" class="row">

assets/src/modules/sm/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ angular.module('sm', ['ngAnimate', 'ngSanitize', 'ui.router'])
6464
}).state('schedule.view', {
6565
url: '',
6666
templateUrl: tplPath('Schedule', 'schedule.view'),
67-
controller: 'ScheduleViewController',
67+
controller: 'ScheduleViewController'
6868
}).state('schedule.print', {
6969
url: '/print',
7070
templateUrl: tplPath('Schedule', 'schedule.print'),
@@ -90,4 +90,4 @@ angular.module('sm', ['ngAnimate', 'ngSanitize', 'ui.router'])
9090
)
9191
document.getElementsByTagName("head")[0].appendChild(msViewportStyle)
9292
}
93-
});
93+
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "schedulemaker",
3-
"version": "3.0.23",
3+
"version": "3.0.24",
44
"private": true,
55
"description": "A course database lookup tool and schedule building web application for use at Rochester Institute of Technology.",
66
"main": "index.php",

0 commit comments

Comments
 (0)