@@ -94,47 +94,47 @@ app.filter("courseNum", function() {
9494 } ;
9595} ) ;
9696
97- app . factory ( "sessionStorage " , function ( $window ) {
97+ app . factory ( "localStorage " , function ( $window ) {
9898
99- var sessionStorage = $window . localStorage ;
99+ var localStorage = $window . localStorage ;
100100
101101 return {
102102 setItem : function ( key , value ) {
103- if ( sessionStorage ) {
103+ if ( localStorage ) {
104104 if ( value != null ) {
105- sessionStorage . setItem ( key , angular . toJson ( value ) ) ;
105+ localStorage . setItem ( key , angular . toJson ( value ) ) ;
106106 } else {
107- sessionStorage . setItem ( key , null ) ;
107+ localStorage . setItem ( key , null ) ;
108108 }
109109 } else {
110110 return false ;
111111 }
112112 } ,
113113 getItem : function ( key ) {
114- if ( sessionStorage ) {
115- return angular . fromJson ( sessionStorage . getItem ( key ) ) ;
114+ if ( localStorage ) {
115+ return angular . fromJson ( localStorage . getItem ( key ) ) ;
116116 } else {
117117 return false ;
118118 }
119119 } ,
120120 hasKey : function ( key ) {
121- if ( sessionStorage ) {
122- return sessionStorage . hasOwnProperty ( key ) ;
121+ if ( localStorage ) {
122+ return localStorage . hasOwnProperty ( key ) ;
123123 } else {
124124 return false ;
125125 }
126126 } ,
127127 clear : function ( ) {
128- if ( sessionStorage ) {
129- return sessionStorage . clear ( ) ;
128+ if ( localStorage ) {
129+ return localStorage . clear ( ) ;
130130 } else {
131131 return false ;
132132 }
133133 } ,
134134 } ;
135135} ) ;
136136
137- app . controller ( "AppCtrl" , function ( $scope , sessionStorage , $window , $filter ) {
137+ app . controller ( "AppCtrl" , function ( $scope , localStorage , $window , $filter ) {
138138
139139 $scope . initState = function ( ) {
140140 $scope . state = { } ;
@@ -179,7 +179,7 @@ app.controller("AppCtrl", function($scope, sessionStorage, $window, $filter) {
179179 } ;
180180
181181 $scope . saveState = function ( ) {
182- sessionStorage . setItem ( 'state' , $scope . state ) ;
182+ localStorage . setItem ( 'state' , $scope . state ) ;
183183 } ;
184184
185185 // Force save on close
@@ -188,11 +188,13 @@ app.controller("AppCtrl", function($scope, sessionStorage, $window, $filter) {
188188 } ;
189189
190190 $scope . noStateSaveOnUnload = function ( ) {
191- $window . onbeforeunload = null ;
191+ $window . onbeforeunload = function ( ) {
192+ //No-op
193+ } ;
192194 } ;
193195
194196 // Reload the state if it exists
195- var storedState = sessionStorage . getItem ( 'state' ) ;
197+ var storedState = localStorage . getItem ( 'state' ) ;
196198 if ( storedState != null ) {
197199
198200 // Check if state version exists or is correct
@@ -249,9 +251,9 @@ app.controller("AppCtrl", function($scope, sessionStorage, $window, $filter) {
249251
250252 // The schedule was set as a global variable
251253 $scope . reloadSchedule ( $window . reloadSchedule ) ;
252- } else if ( sessionStorage . hasKey ( 'reloadSchedule' ) ) {
254+ } else if ( localStorage . hasKey ( 'reloadSchedule' ) ) {
253255 // Get the schedule from sessions storage
254- var reloadSchedule = sessionStorage . getItem ( 'reloadSchedule' ) ;
256+ var reloadSchedule = localStorage . getItem ( 'reloadSchedule' ) ;
255257 if ( reloadSchedule != null ) {
256258 $scope . reloadSchedule ( reloadSchedule ) ;
257259 }
@@ -764,18 +766,18 @@ app.controller("AppCtrl", function($scope, sessionStorage, $window, $filter) {
764766 } ;
765767} ) ;
766768
767- app . controller ( "GenerateCtrl" , function ( $scope , globalKbdShortcuts , $http , $filter , sessionStorage , uiDayFactory ) {
769+ app . controller ( "GenerateCtrl" , function ( $scope , globalKbdShortcuts , $http , $filter , localStorage , uiDayFactory ) {
768770
769771
770772 //Check if we are forking a schedule
771- if ( sessionStorage . hasKey ( 'forkSchedule' ) ) {
773+ if ( localStorage . hasKey ( 'forkSchedule' ) ) {
772774
773775 // Get the schedule from sessions storage
774- var forkSchedule = sessionStorage . getItem ( 'forkSchedule' ) ;
776+ var forkSchedule = localStorage . getItem ( 'forkSchedule' ) ;
775777 if ( forkSchedule != null ) {
776778
777779 // Clear it so we don't fork again
778- sessionStorage . setItem ( 'forkSchedule' , null ) ;
780+ localStorage . setItem ( 'forkSchedule' , null ) ;
779781
780782 var days = uiDayFactory ( ) ;
781783
@@ -1538,7 +1540,7 @@ app.factory('shareServiceInfo', function() {
15381540/**
15391541 * Several endpoint abstractions for the schedules
15401542 */
1541- app . directive ( 'scheduleActions' , function ( $http , $q , shareServiceInfo , openPopup , sessionStorage ) {
1543+ app . directive ( 'scheduleActions' , function ( $http , $q , shareServiceInfo , openPopup , localStorage ) {
15421544
15431545 var serializer = new XMLSerializer ( ) ;
15441546
@@ -1609,7 +1611,7 @@ app.directive('scheduleActions', function($http, $q, shareServiceInfo, openPopup
16091611 } ) ;
16101612 } else {
16111613
1612- sessionStorage . setItem ( 'forkSchedule' , scope . schedule ) ;
1614+ localStorage . setItem ( 'forkSchedule' , scope . schedule ) ;
16131615
16141616 window . location = "/generate.php" ;
16151617 }
@@ -1686,7 +1688,7 @@ app.directive('scheduleActions', function($http, $q, shareServiceInfo, openPopup
16861688
16871689 var popup = openPopup ( 780 , 600 ) ;
16881690
1689- popup . sessionStorage . setItem ( 'reloadSchedule' , angular . toJson ( reloadSchedule ) ) ;
1691+ popup . localStorage . setItem ( 'reloadSchedule' , angular . toJson ( reloadSchedule ) ) ;
16901692 popup . document . title = "My Schedule" ;
16911693 popup . location = "http://" + window . location . hostname + '/schedule/render/print' ;
16921694 }
@@ -1978,7 +1980,7 @@ app.controller("scheduleCtrl", function($scope, $location) {
19781980} ) ;
19791981
19801982
1981- app . controller ( "printScheduleCtrl" , function ( $scope , $location , sessionStorage ) {
1983+ app . controller ( "printScheduleCtrl" , function ( $scope , $location , localStorage ) {
19821984
19831985 if ( $scope . schedule ) {
19841986 var pTerm = '' + $scope . state . requestOptions . term ;
@@ -2004,11 +2006,27 @@ app.controller("printScheduleCtrl", function($scope, $location, sessionStorage)
20042006 }
20052007
20062008 $scope . heading = "My " + year + "-" + ( year + 1 ) + " " + term + " Schedule" ;
2009+
2010+ $scope . printTheme = 'woc' ;
2011+
2012+ $scope . printThemeOptions = [ {
2013+ value : 'woc' ,
2014+ label : "Modern Colors"
2015+ } , {
2016+ value : 'bow' ,
2017+ label : "Classic B&W"
2018+ } , {
2019+ value : 'gow' ,
2020+ label : "Classic Greyscale"
2021+ } , {
2022+ value : 'boc' ,
2023+ label : "Black Text & Colors"
2024+ } ] ;
20072025 }
20082026
20092027 $scope . noStateSaveOnUnload ( ) ;
20102028
2011- window . print ( ) ;
2029+ $scope . print = window . print . bind ( window ) ;
20122030} ) ;
20132031
20142032
0 commit comments