From 3eba59117bff919a3abc56e3aaa478f8fb7db762 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Tue, 20 Jan 2015 11:06:17 +0200 Subject: [PATCH] Fixed Calender & login issues --- www/js/ApiService.js | 16 ++++++- www/js/app.js | 8 ++-- www/js/controllers.js | 23 +++++++++- www/templates/calendar.html | 84 +++++++++++++++++++++++++++++++++++++ www/templates/menu.html | 4 +- www/templates/playlist.html | 5 --- www/templates/settings.html | 2 +- 7 files changed, 126 insertions(+), 16 deletions(-) create mode 100644 www/templates/calendar.html delete mode 100644 www/templates/playlist.html diff --git a/www/js/ApiService.js b/www/js/ApiService.js index c9a3a4d..b134c41 100644 --- a/www/js/ApiService.js +++ b/www/js/ApiService.js @@ -38,6 +38,7 @@ starter.factory('ApiService', ['$http', '$ionicPopup', '$ionicModal', function ( var password = window.localStorage['password']; var notes = window.localStorage['notes'] || null; var grades = window.localStorage['grades'] || null; + var request = "https://mipo.jce.ac.il/index.php/site/login?_dc=1419773997764&formValues=%7B%22form_fields%22%3A%7B%22name%22%3A%22"+username+"%22%2C%22pwd%22%3A%22"+password+"%22%7D%7D"; return $http.get(request).then(function(resp) { @@ -78,9 +79,20 @@ starter.factory('ApiService', ['$http', '$ionicPopup', '$ionicModal', function ( } }, function(err) { - console.error('[JCE] [INFO] : in update - can\'t get Notes', err); + console.error('[JCE] [INFO] : in update - can\'t get Grades', err); + }); + + //Get Calendar + //https://mipo.jce.ac.il/index.php/site/timetable + $http.get("https://mipo.jce.ac.il/index.php/site/timetable").then(function(resp) { + console.log('Success', resp); + console.log("[JCE] [INFO] : in update - Got Calendar!"); + window.localStorage['calendar'] = JSON.stringify(resp.data); + + + }, function(err) { + console.error('[JCE] [INFO] : in update - can\'t get Calendar', err); }); - }else{ window.localStorage['loggedIn'] = false; diff --git a/www/js/app.js b/www/js/app.js index bbbaa28..699ec1f 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -40,12 +40,12 @@ app.run(function($ionicPlatform) { } }) - .state('app.playlists', { - url: "/playlists", + .state('app.calendar', { + url: "/calendar", views: { 'menuContent': { - templateUrl: "templates/playlists.html", - controller: 'PlaylistsCtrl' + templateUrl: "templates/calendar.html", + controller: 'CalendarCtrl' } } }) diff --git a/www/js/controllers.js b/www/js/controllers.js index 17eb6f6..dd2ba3b 100644 --- a/www/js/controllers.js +++ b/www/js/controllers.js @@ -209,8 +209,8 @@ angular.module('starter.controllers', []) var localSettingsStr = window.localStorage['Settings'] || null; if (localSettingsStr === null){ - var settings_list = [ {text:"נעל גיליון ציונים", val: false}, //[0] - {text:"הצג מזג אויר", val: false} ]; //[1] + var settings_list = [ {text:"נעל גיליון ציונים", val: false}];//, //[0] + //{text:"הצג מזג אויר", val: false} ]; //[1] console.log("[JCE] [info]: No settings found!"); } else{ @@ -246,6 +246,8 @@ angular.module('starter.controllers', []) }) + + /*============================================= = JCE News - controller = =============================================*/ @@ -261,6 +263,23 @@ angular.module('starter.controllers', []) +}) + +/*============================================= += Calendar - controller = +=============================================*/ + + + + +.controller('CalendarCtrl', function($scope, $stateParams, $http) { + var calendarStr = window.localStorage['calendar'] || null; + console.log(calendarStr); + if(calendarStr != null) + $scope.calendar = JSON.parse(calendarStr); + + + }) diff --git a/www/templates/calendar.html b/www/templates/calendar.html new file mode 100644 index 0000000..fa8992c --- /dev/null +++ b/www/templates/calendar.html @@ -0,0 +1,84 @@ + + +
+ + +

מערכת שעות

+ +
+ +
+ יום ראשון +
+
+

{{class.time}}

+

{{class.subject}}

+

{{class.Lecturer_Title}} {{class.Lecturer_FirstName}} {{class.Lecturer_Surname}} ב{{class.className}}

+
+ +
+ יום שני +
+
+

{{class.time}}

+

{{class.subject}}

+

{{class.Lecturer_Title}} {{class.Lecturer_FirstName}} {{class.Lecturer_Surname}} ב{{class.className}}

+
+ +
+ יום שלישי +
+
+

{{class.time}}

+

{{class.subject}}

+

{{class.Lecturer_Title}} {{class.Lecturer_FirstName}} {{class.Lecturer_Surname}} ב{{class.className}}

+
+ +
+ יום רביעי +
+
+

{{class.time}}

+

{{class.subject}}

+

{{class.Lecturer_Title}} {{class.Lecturer_FirstName}} {{class.Lecturer_Surname}} ב{{class.className}}

+
+ +
+ יום חמישי +
+
+

{{class.time}}

+

{{class.subject}}

+

{{class.Lecturer_Title}} {{class.Lecturer_FirstName}} {{class.Lecturer_Surname}} ב{{class.className}}

+
+ +
+ יום שישי +
+
+

{{class.time}}

+

{{class.subject}}

+

{{class.Lecturer_Title}} {{class.Lecturer_FirstName}} {{class.Lecturer_Surname}} ב{{class.className}}

+
+ +
+ + +
+
+ +
diff --git a/www/templates/menu.html b/www/templates/menu.html index 7788455..156ad71 100644 --- a/www/templates/menu.html +++ b/www/templates/menu.html @@ -1,6 +1,6 @@ - + @@ -36,7 +36,7 @@ גיליון ציונים - + מערכת שעות diff --git a/www/templates/playlist.html b/www/templates/playlist.html deleted file mode 100644 index 17228cd..0000000 --- a/www/templates/playlist.html +++ /dev/null @@ -1,5 +0,0 @@ - - -

BETA

-
-
diff --git a/www/templates/settings.html b/www/templates/settings.html index 0288476..e0cf860 100644 --- a/www/templates/settings.html +++ b/www/templates/settings.html @@ -33,7 +33,7 @@

כל הקוד זמין בgithub - וכך גם הוראות הבניה והקימפול. -
הרישיון של תוכנה זו היא כדלקמן: "עשה מה שבא לך - לא מעניין אותי" +
הרישיון של תוכנה זו היא כדלקמן: "עשה מה שבא לך - לא מעניין אותי" - בקיצור תורידו ותשנו כמה שבא לכם. כל עזרה תתקבל בברכה