Commit 19636306 authored by Evren Kutar's avatar Evren Kutar

Merge branch 'feature/issue-5120' into develop

parents 6fea70a1 0e4aa8eb
...@@ -124,6 +124,7 @@ module.exports = function (grunt) { ...@@ -124,6 +124,7 @@ module.exports = function (grunt) {
"app/zetalib/interceptors.js", "app/zetalib/interceptors.js",
"app/zetalib/general.js", "app/zetalib/general.js",
"app/zetalib/form_service.js", "app/zetalib/form_service.js",
"app/zetalib/error_service.js",
"app/zetalib/action_service.js", "app/zetalib/action_service.js",
"app/zetalib/socket.js", "app/zetalib/socket.js",
"app/shared/directives.js", "app/shared/directives.js",
...@@ -150,6 +151,8 @@ module.exports = function (grunt) { ...@@ -150,6 +151,8 @@ module.exports = function (grunt) {
"app/bower_components/angular-resource/angular-resource.js", "app/bower_components/angular-resource/angular-resource.js",
"app/bower_components/angular-bootstrap/ui-bootstrap.js", "app/bower_components/angular-bootstrap/ui-bootstrap.js",
"app/bower_components/angular-bootstrap/ui-bootstrap-tpls.js", "app/bower_components/angular-bootstrap/ui-bootstrap-tpls.js",
"app/bower_components/showdown/dist/showdown.min.js",
"app/bower_components/angular-markdown-filter/markdown.js",
"app/bower_components/angular-sanitize/angular-sanitize.js", "app/bower_components/angular-sanitize/angular-sanitize.js",
"app/bower_components/tv4/tv4.js", "app/bower_components/tv4/tv4.js",
"app/bower_components/objectpath/lib/ObjectPath.js", "app/bower_components/objectpath/lib/ObjectPath.js",
......
...@@ -36,6 +36,7 @@ angular.module( ...@@ -36,6 +36,7 @@ angular.module(
'ulakbus.devSettings', 'ulakbus.devSettings',
'ulakbus.version', 'ulakbus.version',
'gettext', 'gettext',
'markdown',
]) ])
/** /**
* @memberof ulakbus * @memberof ulakbus
...@@ -55,6 +56,8 @@ angular.module( ...@@ -55,6 +56,8 @@ angular.module(
angular.forEach(cookiearray, function (item) { angular.forEach(cookiearray, function (item) {
if (item.indexOf("backendurl") > -1) { if (item.indexOf("backendurl") > -1) {
backendurl = item.split('=')[1]; backendurl = item.split('=')[1];
if (backendurl.slice(-1) !== '/') {backendurl += '/'}
if (backendurl.substring(0,4) !== 'http') {backendurl = 'http://'+backendurl}
} }
}); });
} }
...@@ -62,6 +65,8 @@ angular.module( ...@@ -62,6 +65,8 @@ angular.module(
if (location.href.indexOf("backendurl") > -1) { if (location.href.indexOf("backendurl") > -1) {
var urlfromqstr = location.href.split('?')[1].split('=')[1]; var urlfromqstr = location.href.split('?')[1].split('=')[1];
backendurl = decodeURIComponent(urlfromqstr.replace(/\+/g, " ")); backendurl = decodeURIComponent(urlfromqstr.replace(/\+/g, " "));
if (backendurl.slice(-1) !== '/') {backendurl += '/'}
if (backendurl.substring(0,4) !== 'http') {backendurl = 'http://'+backendurl}
document.cookie = "backendurl=" + backendurl; document.cookie = "backendurl=" + backendurl;
window.location.href = window.location.href.split('?')[0]; window.location.href = window.location.href.split('?')[0];
} }
...@@ -69,6 +74,12 @@ angular.module( ...@@ -69,6 +74,12 @@ angular.module(
return {url: backendurl}; return {url: backendurl};
})()) })())
.constant('toastr', window.toastr) .constant('toastr', window.toastr)
.constant('WS', window.WebSocket)
.config(function ($logProvider) { .config(function ($logProvider) {
$logProvider.debugEnabled(true); $logProvider.debugEnabled(true);
})
.config(function(markdownProvider) {
//markdownProvider.config({
// extensions: ['table']
//});
}); });
\ No newline at end of file
...@@ -53,6 +53,8 @@ angular.module('ulakbus') ...@@ -53,6 +53,8 @@ angular.module('ulakbus')
$rootScope.loggedInUser = true; $rootScope.loggedInUser = true;
$rootScope.loginAttempt = 0; $rootScope.loginAttempt = 0;
$rootScope.websocketIsOpen = false;
$rootScope.current_user = true;
$rootScope.$on("$routeChangeStart", function (event, next, current) { $rootScope.$on("$routeChangeStart", function (event, next, current) {
// will be used when needed // will be used when needed
}); });
......
...@@ -25,19 +25,17 @@ angular.module('ulakbus.auth', ['ngRoute', 'ngCookies']) ...@@ -25,19 +25,17 @@ angular.module('ulakbus.auth', ['ngRoute', 'ngCookies'])
* @description LoginCtrl responsible to handle login process.<br> * @description LoginCtrl responsible to handle login process.<br>
* Using 'ulakbus.formService.get_form' function generates the login form and post it to the API with input datas. * Using 'ulakbus.formService.get_form' function generates the login form and post it to the API with input datas.
*/ */
.controller('LoginController', function ($scope, $q, $timeout, $routeParams, $rootScope, $log, Generator, AuthService) { .controller('LoginController', function ($scope, $q, $timeout, $location, $routeParams, $rootScope, $log, Generator, AuthService) {
$scope.url = 'login'; $scope.url = 'login';
$scope.form_params = {}; $scope.form_params = {};
$scope.form_params['clear_wf'] = 1; $scope.form_params['clear_wf'] = 1;
Generator.get_form($scope).then(function (data) { AuthService.get_form($scope).then(function (data) {
if (data.login) { $location.path('/'); }
$scope.form = [ $scope.form = [
{key: "username", type: "string", title: "Kullanıcı Adı"}, {key: "username", type: "string", title: "Kullanıcı Adı"},
{key: "password", type: "password", title: "Şifre"}, {key: "password", type: "password", title: "Şifre"},
{type: 'submit', title: 'Giriş Yap'} {type: 'submit', title: 'Giriş Yap'}
]; ];
// to show page items showApp must be set to true
// it prevents to show empty nonsense page items when http401/403
//$rootScope.showApp = true;
}); });
$scope.loggingIn = false; $scope.loggingIn = false;
$scope.onSubmit = function (form) { $scope.onSubmit = function (form) {
...@@ -47,6 +45,10 @@ angular.module('ulakbus.auth', ['ngRoute', 'ngCookies']) ...@@ -47,6 +45,10 @@ angular.module('ulakbus.auth', ['ngRoute', 'ngCookies'])
$rootScope.loginAttempt = 1; $rootScope.loginAttempt = 1;
Generator.button_switch(false); Generator.button_switch(false);
AuthService.login($scope.url, $scope.model) AuthService.login($scope.url, $scope.model)
.success(function (data) {
$scope.message = data.title;
$scope.loggingIn = false;
})
.error(function (data) { .error(function (data) {
$scope.message = data.title; $scope.message = data.title;
$scope.loggingIn = false; $scope.loggingIn = false;
......
...@@ -15,9 +15,17 @@ angular.module('ulakbus.auth') ...@@ -15,9 +15,17 @@ angular.module('ulakbus.auth')
* @name AuthService * @name AuthService
* @description provides generic functions for authorization process. * @description provides generic functions for authorization process.
*/ */
.factory('AuthService', function ($http, $rootScope, $location, $log, Generator, RESTURL) { .factory('AuthService', function ($http, $rootScope, $location, $log, $route, Generator, RESTURL, WSOps) {
var authService = {}; var authService = {};
authService.get_form = function (scope) {
return $http
.post(Generator.makeUrl(scope), scope.form_params)
.then(function (res) {
return Generator.generate(scope, res.data);
});
};
/** /**
* @memberof ulakbus.auth * @memberof ulakbus.auth
* @ngdoc function * @ngdoc function
...@@ -36,11 +44,19 @@ angular.module('ulakbus.auth') ...@@ -36,11 +44,19 @@ angular.module('ulakbus.auth')
.success(function (data, status, headers, config) { .success(function (data, status, headers, config) {
//$window.sessionStorage.token = data.token; //$window.sessionStorage.token = data.token;
Generator.button_switch(true); Generator.button_switch(true);
$rootScope.loggedInUser = true; if (data.status_code !== 403) {
$rootScope.loggedInUser = true;
$rootScope.$broadcast("regenerate_menu");
$location.path('/dashboard');
}
if (data.status_code === 403) {
data.title = "İşlem başarısız oldu. Lütfen girdiğiniz bilgileri kontrol ediniz.";
return data;
}
}) })
.error(function (data, status, headers, config) { .error(function (data, status, headers, config) {
// Handle login errors here // Handle login errors here
data.title = "İşlem başarısız oldu. Lütfen girdiğiniz bilgileri kontrol ediniz." data.title = "İşlem başarısız oldu. Lütfen girdiğiniz bilgileri kontrol ediniz.";
return data; return data;
}); });
}; };
...@@ -54,8 +70,9 @@ angular.module('ulakbus.auth') ...@@ -54,8 +70,9 @@ angular.module('ulakbus.auth')
* @returns {*} * @returns {*}
*/ */
authService.logout = function () { authService.logout = function () {
$log.debug("logout");
return $http.post(RESTURL.url + 'logout', {}).success(function (data) { $rootScope.loginAttempt = 0;
WSOps.request({wf: 'logout'}).then(function (data) {
$rootScope.loggedInUser = false; $rootScope.loggedInUser = false;
$log.debug("loggedout"); $log.debug("loggedout");
$location.path("/login"); $location.path("/login");
......
<div ng-app="ulakbus.auth" class="container"> <div style="width: 100%; height: 100%; position: fixed; z-index: 1100; top:0; left:0; background: #fff;">
<div class="row"> <div ng-app="ulakbus.auth" class="container">
<div class="col-md-4 col-md-offset-4"> <div class="row">
<div class="login-panel panel panel-default"> <div class="col-md-6 col-md-offset-3">
<div class="panel-heading"> <div class="login-panel panel panel-default">
<h3 class="panel-title">Giriş Yap <span ng-if="loggingIn" class="loader pull-right"></span></h3> <div class="panel-heading">
</div> <h3 class="panel-title">Giriş Yap <span ng-if="loggingIn" class="loader pull-right"></span></h3>
<div class="panel-body"> </div>
<span class="label label-warning">{{message}}</span> <div class="panel-body">
<form name="loginForm" sf-schema="schema" sf-form="form" sf-model="model" ng-submit="onSubmit(loginForm)"></form> <form name="loginForm" sf-schema="schema" sf-form="form" sf-model="model"
ng-submit="onSubmit(loginForm)"></form>
</div>
</div> </div>
<span class="label label-inverse label-warning">{{message}}</span>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -152,8 +152,14 @@ angular.module('ulakbus.crud', ['schemaForm', 'ulakbus.formService']) ...@@ -152,8 +152,14 @@ angular.module('ulakbus.crud', ['schemaForm', 'ulakbus.formService'])
* *
* @returns {object} * @returns {object}
*/ */
.controller('CRUDListFormController', function ($scope, $rootScope, $location, $http, $log, $uibModal, $timeout, Generator, $routeParams, CrudUtility) { .controller('CRUDListFormController', function ($scope, $rootScope, $location, $sce, $http, $log, $uibModal, $timeout, Generator, $routeParams, CrudUtility) {
$scope.paginate = function (reloadData) {
$scope.form_params.cmd = $scope.reload_cmd;
$scope.form_params = angular.extend($scope.form_params, reloadData);
$log.debug('reload data', $scope);
Generator.get_wf($scope);
};
$scope.$on('reload_cmd', function(event, data){ $scope.$on('reload_cmd', function(event, data){
$scope.reload_cmd = data; $scope.reload_cmd = data;
$scope.reloadCmd(); $scope.reloadCmd();
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
<td ng-repeat="field in object.fields track by $index"> <td ng-repeat="field in object.fields track by $index">
<a role="button" ng-if="field.type==='link'" <a role="button" ng-if="field.type==='link'"
ng-click="do_action(object.key, field)">{{field.content}}</a> ng-click="do_action(object.key, field)" ng-bind-html="field.content | markdown"></a>
<span ng-if="field.type==='str'">{{field.content}}</span> <span ng-if="field.type==='str'" ng-bind-html="field.content | markdown"></span>
</td> </td>
<td> <td>
...@@ -55,16 +55,16 @@ ...@@ -55,16 +55,16 @@
<nav ng-if="pagination && pagination.total_pages > 1" class="text-center"> <nav ng-if="pagination && pagination.total_pages > 1" class="text-center">
<ul class="pagination"> <ul class="pagination">
<li ng-class="{disabled:pagination.page===1}"> <li ng-class="{disabled:pagination.page===1}">
<a aria-label="Önceki" ng-click="reload({page:pagination.page-1})"> <a role="button" aria-label="Önceki" ng-click="paginate({page:pagination.page-1})">
<span aria-hidden="true">&laquo;</span> <span aria-hidden="true">&laquo;</span>
</a> </a>
</li> </li>
<li ng-repeat="page in getNumber(pagination.total_pages) track by $index" <li ng-repeat="page in getNumber(pagination.total_pages) track by $index"
ng-class="{active:$index+1===pagination.page}"> ng-class="{active:$index+1===pagination.page}">
<a ng-click="reload({page:$index+1})">{{$index+1}}</a> <a role="button" ng-click="paginate({page:$index+1})">{{$index+1}}</a>
</li> </li>
<li ng-class="{disabled:pagination.page===pagination.total_pages}"> <li ng-class="{disabled:pagination.page===pagination.total_pages}">
<a aria-label="Sonraki" ng-click="reload({page:pagination.page+1})"> <a role="button" aria-label="Sonraki" ng-click="paginate({page:pagination.page+1})">
<span aria-hidden="true">&raquo;</span> <span aria-hidden="true">&raquo;</span>
</a> </a>
</li> </li>
......
This diff is collapsed.
...@@ -21,7 +21,8 @@ angular.module('ulakbus.dashboard', []) ...@@ -21,7 +21,8 @@ angular.module('ulakbus.dashboard', [])
$uibTooltipProvider.setTriggers({'click': 'mouseleave'}); $uibTooltipProvider.setTriggers({'click': 'mouseleave'});
}) })
.controller('DashController', function ($scope, $rootScope, $timeout, $http, $cookies, RESTURL, Generator) { .controller('DashController', function ($scope, $rootScope, $routeParams, $route, $timeout, $http, $cookies, RESTURL, Generator, WSOps) {
$scope.section = function (section_index) { $scope.section = function (section_index) {
$rootScope.section = section_index; $rootScope.section = section_index;
}; };
...@@ -37,28 +38,27 @@ angular.module('ulakbus.dashboard', []) ...@@ -37,28 +38,27 @@ angular.module('ulakbus.dashboard', [])
$scope.staffs = []; $scope.staffs = [];
$scope.search = function (where) { $scope.search = function (where) {
$timeout(function () { if ($scope.keyword.staff.length > 2 || $scope.keyword.student.length > 2) {
if (where === 'personel') { $timeout(function () {
// if input length greater than 2 search for the value if (where === 'personel') {
if ($scope.keyword.staff.length > 2) { // if input length greater than 2 search for the value
$scope.getItems(where, $scope.keyword.staff).success(function (data) {
$scope.getItems(where, $scope.keyword.staff).then(function (data) {
$scope.staffs = data.results; $scope.staffs = data.results;
}); });
} }
} if (where === 'ogrenci') {
if (where === 'ogrenci') { $scope.getItems(where, $scope.keyword.student).then(function (data) {
if ($scope.keyword.student.length > 2) {
$scope.getItems(where, $scope.keyword.student).success(function (data) {
$scope.students = data.results; $scope.students = data.results;
}) })
} }
} }, 500);
}, 500); }
}; };
$scope.getItems = function (where, what) { $scope.getItems = function (where, what) {
$scope.showResults = true; $scope.showResults = true;
return $http.get(RESTURL.url + 'ara/' + where + '/' + what); return WSOps.request({view: where + '_ara', query: what});
}; };
$scope.userPopover = {templateUrl: 'components/dashboard/user-info.html'}; $scope.userPopover = {templateUrl: 'components/dashboard/user-info.html'};
...@@ -96,7 +96,11 @@ angular.module('ulakbus.dashboard', []) ...@@ -96,7 +96,11 @@ angular.module('ulakbus.dashboard', [])
$scope.markAsRead = function (items) { $scope.markAsRead = function (items) {
$rootScope.$broadcast("markasread", items); $rootScope.$broadcast("markasread", items);
} };
//if ($routeParams.cmd = 'reload') {
// $route.reload();
//}
}) })
.directive('sidebarNotifications', function () { .directive('sidebarNotifications', function () {
......
<div class="dashboard-main-search clearfix">
<div class="row" ng-if="$root.current_user.can_search">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">Arama</div>
</div>
<div class="panel-body">
<div class="dashboard-student-search" data-step="2"
data-intro="isim veya tcno ile öğrenci araması yapabilirsiniz."
ng-show="$root.searchInputs.ogrenci">
<div class="text-center">
<h3>ÖĞRENCİ</h3>
<input type="text" placeholder="Öğrenci ara" ng-model="keyword.student"
ng-keyup="search('ogrenci')">
<span class="bordered-fa-icon fa fa-search" ng-click="search('ogrenci')"></span>
</div>
<div class="dashboard-search-results" ng-show="showResults">
<ul ng-if="students.length > 0">
<li ng-repeat="student in students">
<a role="button">
<span ng-click="select(student, 'ogrenci')">{{student[0]}}</span>
<i class="fa fa-fw fa-info-circle pull-right" popover-placement="bottom"
uib-popover-template="userPopover.templateUrl"
ng-click="get_info('Ogrenci', student[2])"></i></a>
</li>
</ul>
</div>
<!-- end of dashboard-student-search-results -->
</div>
<!-- end of dashboard-student-search -->
<div class="dashboard-personnel-search" data-step="3"
data-intro="isim veya tcno ile personel araması yapabilirsiniz."
ng-show="$root.searchInputs.personel">
<div class="text-center">
<h3>PERSONEL</h3>
<input type="text" placeholder="Personel ara" ng-model="keyword.staff"
ng-keyup="search('personel')">
<span class="bordered-fa-icon fa fa-search" ng-click="search('personel')"></span>
</div>
<div class="dashboard-search-results" ng-show="showResults">
<ul ng-if="staffs.length > 0">
<li ng-repeat="staff in staffs">
<a role="button">
<span ng-click="select(staff, 'personel')">{{staff[0]}}</span>
<i class="fa fa-fw fa-info-circle pull-right"
popover-placement="bottom"
uib-popover-template="userPopover.templateUrl"
ng-click="get_info('Personel', staff[2])"></i></a>
</li>
</ul>
</div>
<!-- end of dashboard-personnel-search-results -->
</div>
<!-- end of dashboard-personnel-search -->
</div>
</div>
</div>
</div>
</div>
<!-- end of dashboard-main-search -->
<div class="row">
<div class="col-md-12 quick-links">
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">Hızlı İşlemler</div>
<div class="panel-action pull-right"><i class="fa fa-edit fa-fw"></i> Düzenle</div>
</div>
<div class="panel-body">
<div class="col-md-6 text-center link-buttons"
ng-repeat="item in $root.quick_menu track by $index">
<a
ng-href="#/{{item.wf}}/{{item.model}}?{{item.param}}={{selectedUser.key}}">
{{item.text}}
</a>
</div>
</div>
</div>
</div>
</div>
<!-- end of row -->
<div class="dashboard-main-anouncement clearfix">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">Duyurular</div>
</div>
<div class="panel-body">
<a ng-click="markAsRead(notify)"
ng-repeat="notify in notifications[3] | limitTo:5">{{notify
.body}}</a>
</div>
</div>
</div>
</div>
</div>
<!-- end of dashboard-main-anouncement -->
\ No newline at end of file
This diff is collapsed.
...@@ -5,4 +5,4 @@ angular.module('ulakbus.version', [ ...@@ -5,4 +5,4 @@ angular.module('ulakbus.version', [
'ulakbus.version.version-directive' 'ulakbus.version.version-directive'
]) ])
.value('version', '0.6.10'); .value('version', '0.8.0');
\ No newline at end of file \ No newline at end of file
...@@ -5,7 +5,7 @@ describe('ulakbus.version module', function() { ...@@ -5,7 +5,7 @@ describe('ulakbus.version module', function() {
describe('version service', function() { describe('version service', function() {
it('should return current version', inject(function(version) { it('should return current version', inject(function(version) {
expect(version).toEqual('0.6.10'); expect(version).toEqual('0.8.0');
})); }));
}); });
}); });
\ No newline at end of file
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</head> </head>
<body ng-controller="KeyListenController" ng-keydown="down($event)"> <body ng-controller="KeyListenController" ng-keydown="down($event)">
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0" ng-if="$root.loggedInUser"> <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0" ng-if="$root.current_user">
<collapse-menu></collapse-menu> <collapse-menu></collapse-menu>
<!--<ul class="header-menu">--> <!--<ul class="header-menu">-->
<!--<li><a href="">Mesajlar</a></li>--> <!--<li><a href="">Mesajlar</a></li>-->
...@@ -53,12 +53,12 @@ ...@@ -53,12 +53,12 @@
<header-notification></header-notification> <header-notification></header-notification>
</nav> </nav>
<sidebar ng-if="$root.loggedInUser"></sidebar> <sidebar ng-if="$root.current_user"></sidebar>
<div class="manager-view"> <div class="manager-view">
<div class="manager-view-inner"> <div class="manager-view-inner">
<!-- manager-header --> <!-- manager-header -->
<header-sub-menu ng-if="$root.loggedInUser"></header-sub-menu> <header-sub-menu ng-if="$root.current_user"></header-sub-menu>
<!-- end of manager-header --> <!-- end of manager-header -->
<div class="manager-view-content"> <div class="manager-view-content">
<div class="row"> <div class="row">
...@@ -82,10 +82,12 @@ ...@@ -82,10 +82,12 @@
<!--<script src="bower_components/angular-resource/angular-resource.min.js"></script>--> <!--<script src="bower_components/angular-resource/angular-resource.min.js"></script>-->
<!--<script src="bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>--> <!--<script src="bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>-->
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script> <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
<script src="bower_components/showdown/dist/showdown.min.js"></script>
<script src="bower_components/angular-markdown-filter/markdown.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.min.js"></script> <script src="bower_components/angular-sanitize/angular-sanitize.min.js"></script>
<script src="bower_components/tv4/tv4.js"></script> <script src="bower_components/tv4/tv4.js"></script>
<script src="bower_components/objectpath/lib/ObjectPath.js"></script> <script src="bower_components/objectpath/lib/ObjectPath.js"></script>
<script src="bower_components/angular-schema-form/dist/schema-form.min.js"></script> <script src="bower_components/angular-schema-form/dist/schema-form.js"></script>
<script src="bower_components/angular-schema-form/dist/bootstrap-decorator.min.js"></script> <script src="bower_components/angular-schema-form/dist/bootstrap-decorator.min.js"></script>
<script src="bower_components/angular-gettext/dist/angular-gettext.min.js"></script> <script src="bower_components/angular-gettext/dist/angular-gettext.min.js"></script>
<script src="bower_components/moment/min/moment.min.js"></script> <script src="bower_components/moment/min/moment.min.js"></script>
...@@ -106,6 +108,7 @@ ...@@ -106,6 +108,7 @@
<script src="zetalib/interceptors.js"></script> <script src="zetalib/interceptors.js"></script>
<script src="zetalib/form_service.js"></script> <script src="zetalib/form_service.js"></script>
<script src="zetalib/action_service.js"></script> <script src="zetalib/action_service.js"></script>
<script src="zetalib/error_service.js"></script>
<script src="zetalib/socket.js"></script> <script src="zetalib/socket.js"></script>
<!-- components --> <!-- components -->
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
</head> </head>
<body ng-controller="KeyListenController" ng-keydown="down($event)"> <body ng-controller="KeyListenController" ng-keydown="down($event)">
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0" ng-if="$root.loggedInUser"> <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0" ng-if="$root.current_user">
<collapse-menu></collapse-menu> <collapse-menu></collapse-menu>
<!--<ul class="header-menu">--> <!--<ul class="header-menu">-->
<!--<li><a href="">Mesajlar</a></li>--> <!--<li><a href="">Mesajlar</a></li>-->
...@@ -60,12 +60,12 @@ ...@@ -60,12 +60,12 @@
<header-notification></header-notification> <header-notification></header-notification>
</nav> </nav>
<sidebar ng-if="$root.loggedInUser"></sidebar> <sidebar ng-if="$root.current_user"></sidebar>
<div class="manager-view"> <div class="manager-view">
<div class="manager-view-inner"> <div class="manager-view-inner">
<!-- manager-header --> <!-- manager-header -->
<header-sub-menu ng-if="$root.loggedInUser"></header-sub-menu> <header-sub-menu ng-if="$root.current_user"></header-sub-menu>
<!-- end of manager-header --> <!-- end of manager-header -->
<div class="manager-view-content"> <div class="manager-view-content">
<div class="row"> <div class="row">
...@@ -90,10 +90,12 @@ ...@@ -90,10 +90,12 @@
<!--<script src="bower_components/angular-resource/angular-resource.min.js"></script>--> <!--<script src="bower_components/angular-resource/angular-resource.min.js"></script>-->
<!--<script src="bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>--> <!--<script src="bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>-->
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script> <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
<script src="bower_components/showdown/dist/showdown.min.js"></script>
<script src="bower_components/angular-markdown-filter/markdown.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.min.js"></script> <script src="bower_components/angular-sanitize/angular-sanitize.min.js"></script>
<script src="bower_components/tv4/tv4.js"></script> <script src="bower_components/tv4/tv4.js"></script>
<script src="bower_components/objectpath/lib/ObjectPath.js"></script> <script src="bower_components/objectpath/lib/ObjectPath.js"></script>
<script src="bower_components/angular-schema-form/dist/schema-form.min.js"></script> <script src="bower_components/angular-schema-form/dist/schema-form.js"></script>
<script src="bower_components/angular-schema-form/dist/bootstrap-decorator.min.js"></script> <script src="bower_components/angular-schema-form/dist/bootstrap-decorator.min.js"></script>
<script src="bower_components/angular-gettext/dist/angular-gettext.min.js"></script> <script src="bower_components/angular-gettext/dist/angular-gettext.min.js"></script>
<script src="bower_components/moment/min/moment.min.js"></script> <script src="bower_components/moment/min/moment.min.js"></script>
...@@ -114,6 +116,7 @@ ...@@ -114,6 +116,7 @@
<script src="zetalib/interceptors.js"></script> <script src="zetalib/interceptors.js"></script>
<script src="zetalib/form_service.js"></script> <script src="zetalib/form_service.js"></script>
<script src="zetalib/action_service.js"></script> <script src="zetalib/action_service.js"></script>
<script src="zetalib/error_service.js"></script>
<script src="zetalib/socket.js"></script> <script src="zetalib/socket.js"></script>
<!-- components --> <!-- components -->
......
...@@ -36,6 +36,7 @@ angular.module( ...@@ -36,6 +36,7 @@ angular.module(
'ulakbus.devSettings', 'ulakbus.devSettings',
'ulakbus.version', 'ulakbus.version',
'gettext', 'gettext',
'markdown',
// @if NODE_ENV='PRODUCTION' // @if NODE_ENV='PRODUCTION'
'templates-prod', 'templates-prod',
// @endif // @endif
...@@ -60,6 +61,8 @@ angular.module( ...@@ -60,6 +61,8 @@ angular.module(
angular.forEach(cookiearray, function (item) { angular.forEach(cookiearray, function (item) {
if (item.indexOf("backendurl") > -1) { if (item.indexOf("backendurl") > -1) {
backendurl = item.split('=')[1]; backendurl = item.split('=')[1];
if (backendurl.slice(-1) !== '/') {backendurl += '/'}
if (backendurl.substring(0,4) !== 'http') {backendurl = 'http://'+backendurl}
} }
}); });
} }
...@@ -67,6 +70,8 @@ angular.module( ...@@ -67,6 +70,8 @@ angular.module(
if (location.href.indexOf("backendurl") > -1) { if (location.href.indexOf("backendurl") > -1) {
var urlfromqstr = location.href.split('?')[1].split('=')[1]; var urlfromqstr = location.href.split('?')[1].split('=')[1];
backendurl = decodeURIComponent(urlfromqstr.replace(/\+/g, " ")); backendurl = decodeURIComponent(urlfromqstr.replace(/\+/g, " "));
if (backendurl.slice(-1) !== '/') {backendurl += '/'}
if (backendurl.substring(0,4) !== 'http') {backendurl = 'http://'+backendurl}
document.cookie = "backendurl=" + backendurl; document.cookie = "backendurl=" + backendurl;
window.location.href = window.location.href.split('?')[0]; window.location.href = window.location.href.split('?')[0];
} }
...@@ -74,6 +79,7 @@ angular.module( ...@@ -74,6 +79,7 @@ angular.module(
return {url: backendurl}; return {url: backendurl};
})()) })())
.constant('toastr', window.toastr) .constant('toastr', window.toastr)
.constant('WS', window.WebSocket)
.config(function ($logProvider) { .config(function ($logProvider) {
// @if NODE_ENV='PRODUCTION' // @if NODE_ENV='PRODUCTION'
$logProvider.debugEnabled(false); $logProvider.debugEnabled(false);
...@@ -81,4 +87,9 @@ angular.module( ...@@ -81,4 +87,9 @@ angular.module(
// @if NODE_ENV='DEVELOPMENT' // @if NODE_ENV='DEVELOPMENT'
$logProvider.debugEnabled(true); $logProvider.debugEnabled(true);
// @endif // @endif
})
.config(function(markdownProvider) {
//markdownProvider.config({
// extensions: ['table']
//});
}); });
\ No newline at end of file
...@@ -14,14 +14,15 @@ angular.module('ulakbus') ...@@ -14,14 +14,15 @@ angular.module('ulakbus')
* @description logout directive provides a button with click event. When triggered it post to * @description logout directive provides a button with click event. When triggered it post to
* '/logout' path of the API. * '/logout' path of the API.
*/ */
.directive('logout', function ($http, $location, RESTURL) { .directive('logout', function ($http, $location, RESTURL, AuthService) {
return { return {
link: function ($scope, $element, $rootScope) { link: function ($scope, $element, $rootScope) {
$element.on('click', function () { $element.on('click', function () {
$http.post(RESTURL.url + 'logout', {}).then(function () { AuthService.logout();
$rootScope.loggedInUser = false; //$http.post(RESTURL.url + 'logout', {}).then(function () {
$location.path("/login"); // $rootScope.loggedInUser = false;
}); // $location.path("/login");
//});
}); });
} }
}; };
...@@ -61,10 +62,10 @@ angular.module('ulakbus') ...@@ -61,10 +62,10 @@ angular.module('ulakbus')
*/ */
$scope.getNotifications = function () { $scope.getNotifications = function () {
// ignore loading bar here // ignore loading bar here
$http.get(RESTURL.url + "notify", {ignoreLoadingBar: true}).success(function (data) { //$http.get(RESTURL.url + "notify", {ignoreLoadingBar: true}).success(function (data) {
$scope.groupNotifications(data.notifications); // $scope.groupNotifications(data.notifications);
$rootScope.$broadcast("notifications", $scope.notifications); // $rootScope.$broadcast("notifications", $scope.notifications);
}); //});
}; };
$scope.getNotifications(); $scope.getNotifications();
...@@ -82,11 +83,11 @@ angular.module('ulakbus') ...@@ -82,11 +83,11 @@ angular.module('ulakbus')
* @todo: do it in detail page of notification * @todo: do it in detail page of notification
*/ */
$scope.markAsRead = function (items) { $scope.markAsRead = function (items) {
$http.post(RESTURL.url + "notify", {ignoreLoadingBar: true, read: [items]}) //$http.post(RESTURL.url + "notify", {ignoreLoadingBar: true, read: [items]})
.success(function (data) { // .success(function (data) {
$scope.groupNotifications(data.notifications); // $scope.groupNotifications(data.notifications);
$rootScope.$broadcast("notifications", $scope.notifications); // $rootScope.$broadcast("notifications", $scope.notifications);
}); // });
}; };
// if markasread triggered outside the directive // if markasread triggered outside the directive
...@@ -133,10 +134,10 @@ angular.module('ulakbus') ...@@ -133,10 +134,10 @@ angular.module('ulakbus')
$scope.$broadcast('schemaFormValidate'); $scope.$broadcast('schemaFormValidate');
if (form.$valid) { if (form.$valid) {
var searchparams = { var searchparams = {
url: $scope.wf,
token: $scope.$parent.token, token: $scope.$parent.token,
object_id: $scope.$parent.object_id, object_id: $scope.$parent.object_id,
form_params: { form_params: {
wf: $scope.$parent.wf,
model: $scope.$parent.form_params.model, model: $scope.$parent.form_params.model,
cmd: $scope.$parent.reload_cmd, cmd: $scope.$parent.reload_cmd,
flow: $scope.$parent.form_params.flow, flow: $scope.$parent.form_params.flow,
...@@ -144,10 +145,7 @@ angular.module('ulakbus') ...@@ -144,10 +145,7 @@ angular.module('ulakbus')
} }
}; };
Generator.submit(searchparams).success(function (data) { Generator.submit(searchparams);
// update objects item of page scope
$rootScope.$broadcast('updateObjects', data.objects);
});
} }
}; };
} }
...@@ -310,59 +308,66 @@ angular.module('ulakbus') ...@@ -310,59 +308,66 @@ angular.module('ulakbus')
return newMenuItems; return newMenuItems;
}; };
var sidebarmenu = $('#side-menu'); var generate_menu = function () {
sidebarmenu.metisMenu(); var sidebarmenu = $('#side-menu');
$http.get(RESTURL.url + 'menu/') sidebarmenu.metisMenu();
.success(function (data) { $http.get(RESTURL.url + 'menu', {ignoreLoadingBar: true})
$scope.allMenuItems = angular.copy(data); .success(function (data) {
$scope.allMenuItems = angular.copy(data);
// regroup menu items based on their category
function reGroupMenuItems(items, baseCategory) { // regroup menu items based on their category
var newItems = {}; function reGroupMenuItems(items, baseCategory) {
angular.forEach(items, function (value, key) { var newItems = {};
newItems[value.kategori] = newItems[value.kategori] || []; angular.forEach(items, function (value, key) {
value['baseCategory'] = baseCategory; newItems[value.kategori] = newItems[value.kategori] || [];
newItems[value.kategori].push(value); value['baseCategory'] = baseCategory;
}); newItems[value.kategori].push(value);
return newItems; });
} return newItems;
angular.forEach($scope.allMenuItems, function (value, key) {
if (key !== 'current_user' && key !== 'settings') {
$scope.allMenuItems[key] = reGroupMenuItems(value, key);
} }
});
// quick menus to dashboard via rootscope angular.forEach($scope.allMenuItems, function (value, key) {
if (key !== 'current_user' && key !== 'settings') {
$scope.allMenuItems[key] = reGroupMenuItems(value, key);
}
});
$rootScope.quick_menu = reGroupMenuItems(data.quick_menu, 'quick_menus'); // quick menus to dashboard via rootscope
$rootScope.quick_menu = data.quick_menu;
delete data.quick_menu;
$log.debug('quick menu', $rootScope.quick_menu);
// broadcast for authorized menu items, consume in dashboard to show search inputs and/or $rootScope.quick_menu = reGroupMenuItems(data.quick_menu, 'quick_menus');
// related items $rootScope.quick_menu = data.quick_menu;
$rootScope.$broadcast("authz", data); delete data.quick_menu;
$rootScope.searchInputs = data; $log.debug('quick menu', $rootScope.quick_menu);
$rootScope.current_user = data.current_user; // broadcast for authorized menu items, consume in dashboard to show search inputs and/or
if (data.ogrenci || data.personel) { // related items
$rootScope.current_user.can_search = true; $rootScope.$broadcast("authz", data);
} $rootScope.$broadcast("ws_turn_on");
$rootScope.settings = data.settings; $rootScope.searchInputs = data;
$scope.menuItems = $scope.prepareMenu({other: $scope.allMenuItems.other}); $rootScope.current_user = data.current_user;
if (data.ogrenci || data.personel) {
$rootScope.current_user.can_search = true;
}
$rootScope.settings = data.settings;
$timeout(function () { $scope.menuItems = $scope.prepareMenu({other: $scope.allMenuItems.other});
sidebarmenu.metisMenu();
// to show page items showApp must be set to true $timeout(function () {
// it prevents to show empty nonsense page items when http401/403 sidebarmenu.metisMenu();
//$rootScope.showApp = true; });
})
.error(function (data, status, headers, config) {
$log.error('menu not retrieved', data);
$location.path('/login');
}); });
}); };
$scope.$on("regenerate_menu", function () {
generate_menu();
});
generate_menu();
// changing menu items by listening for broadcast // changing menu items by listening for broadcast
$scope.$on("menuitems", function (event, data) { $scope.$on("menuitems", function (event, data) {
var menu = {}; var menu = {};
menu[data] = $scope.allMenuItems[data]; menu[data] = $scope.allMenuItems[data];
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<label class="control-label {{form.labelHtmlClass}}" ng-show="showTitle()"> <label class="control-label {{form.labelHtmlClass}}" ng-show="showTitle()">
{{form.title}} {{form.title}}
</label> </label>
<a role="button"><i class="fa fa-plus-circle fa-fw" add-modal-for-linked-model="{{form.formName}}"></i></a> <!--<a role="button"><i class="fa fa-plus-circle fa-fw" add-modal-for-linked-model="{{form.formName}}"></i></a>-->
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
......
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*
* @author Evren Kutar
*/
angular.module('ulakbus')
.factory('ErrorService', function (toastr, $rootScope, $location, $log) {
var error_service = {};
error_service.handle = function (rejection, prtcl) {
var errorInModal;
if (prtcl === 'http') {
if (rejection.data) {
errorInModal = ('error' in rejection.data);
} else {
errorInModal = false;
}
}
if (prtcl === 'ws') {
rejection.status = rejection.status || rejection.code;
rejection.data = {error: rejection.error};
errorInModal = true;
}
var errorModal = function () {
if ($rootScope.loginAttempt === 0 && prtcl === 'http') {
$log.debug('not logged in, no alert message triggered');
return;
}
var codefield = "";
if (rejection.data.error) {
codefield = '<p><pre>' +
rejection.data.error +
'</pre></p>';
}
$('<div class="modal">' +
'<div class="modal-dialog" style="width:100%;" role="document">' +
'<div class="modal-content">' +
'<div class="modal-header">' +
'<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span' +
' aria-hidden="true">&times;</span></button>' +
'<h4 class="modal-title" id="exampleModalLabel">' +
"Error Status: " + rejection.status + "<br>Error Title: " + rejection.data.title +
'</h4>' +
'</div>' +
'<div class="modal-body">' +
'<div class="alert alert-danger">' +
'<strong>' +
rejection.data.description +
'</strong>' +
codefield +
'</div>' +
'</div>' +
'<div class="modal-footer">' +
'<button type="button" class="btn btn-default" data-dismiss="modal">Kapat</button>' +
'</div>' +
'</div>' +
'</div>' +
'</div>').modal();
try {
$('pre:not(.hljs)').each(function (i, block) {
hljs.highlightBlock(block);
});
}
catch (e) {
$log.debug('Exception: ', e.message);
}
};
var errorInAlertBox = function (alertContent) {
if (errorInModal) {
errorModal();
} else {
if ($rootScope.loginAttempt > 0) {
toastr.error(alertContent.msg, alertContent.title);
}
}
};
var errorForAlertBox = {
title: rejection.status,
msg: rejection.data ? rejection.data.description : 'Error',
type: 'error'
};
var errorDispatch = {
"-1": function () {
//rejection.status = 'Sunucu hatası';
//rejection.data = rejection.data || {};
//rejection.data.title = rejection.data.title || "Sunucu Hatası";
//rejection.data.description = rejection.data.description || 'Sunucu bağlantısında bir hata oluştu. Lütfen yetkili personelle iletişime geçiniz.';
$log.error('-1 returned:', rejection);
//errorInAlertBox(errorForAlertBox);
//$location.path('/login');
},
"400": function () {
$location.reload();
},
"401": function () {
$location.path('/login');
if ($location.path() === "/login") {
$log.debug("show errors on login form");
}
},
"403": function () {
if (rejection.data.is_login === true) {
$rootScope.loggedInUser = true;
if ($location.path() === "/login") {
$location.path("/dashboard");
}
}
},
"404": function () {
errorInAlertBox(errorForAlertBox);
},
"500": function () {
errorInAlertBox(errorForAlertBox);
},
"503": function () {
rejection.data = {description: "Servise erişilemiyor."};
errorInAlertBox(errorForAlertBox);
}
};
errorDispatch[rejection.status]();
};
return error_service;
});
\ No newline at end of file
This diff is collapsed.
...@@ -21,7 +21,7 @@ angular.module('ulakbus') ...@@ -21,7 +21,7 @@ angular.module('ulakbus')
* - API returns `is_login` key to check if current user is authenticated. Interceptor checks and if not logged * - API returns `is_login` key to check if current user is authenticated. Interceptor checks and if not logged
* in redirects to login page. * in redirects to login page.
*/ */
$httpProvider.interceptors.push(function ($q, $rootScope, $location, $timeout, $log, toastr) { $httpProvider.interceptors.push(function (ErrorService, $q, $rootScope, $location, $timeout, $log, toastr) {
return { return {
'request': function (config) { 'request': function (config) {
if (config.method === "POST") { if (config.method === "POST") {
...@@ -62,101 +62,7 @@ angular.module('ulakbus') ...@@ -62,101 +62,7 @@ angular.module('ulakbus')
return response; return response;
}, },
'responseError': function (rejection) { 'responseError': function (rejection) {
var errorInModal = ('error' in rejection.data); ErrorService.handle(rejection, 'http');
var errorModal = function () {
if ($rootScope.loginAttempt === 0) {
$log.debug('not logged in, no alert message triggered');
return;
}
var codefield = "";
if (rejection.data.error) {
codefield = '<p><pre>' +
rejection.data.error +
'</pre></p>';
}
$('<div class="modal">' +
'<div class="modal-dialog" style="width:100%;" role="document">' +
'<div class="modal-content">' +
'<div class="modal-header">' +
'<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span' +
' aria-hidden="true">&times;</span></button>' +
'<h4 class="modal-title" id="exampleModalLabel">' +
"Error Status: " + rejection.status + "<br>Error Title: " + rejection.data.title +
'</h4>' +
'</div>' +
'<div class="modal-body">' +
'<div class="alert alert-danger">' +
'<strong>' +
rejection.data.description +
'</strong>' +
codefield +
'</div>' +
'</div>' +
'<div class="modal-footer">' +
'<button type="button" class="btn btn-default" data-dismiss="modal">Kapat</button>' +
'</div>' +
'</div>' +
'</div>' +
'</div>').modal();
try {
$('pre:not(.hljs)').each(function (i, block) {
hljs.highlightBlock(block);
});
}
catch (e) {
$log.debug('Exception: ', e.message);
}
};
var errorInAlertBox = function (alertContent) {
if (errorInModal) {
errorModal();
} else {
//$rootScope.$broadcast('alertBox', alertContent);
toastr.error(alertContent.msg, alertContent.title);
}
};
var errorForAlertBox = {
title: rejection.status,
msg: rejection.data.description,
type: 'error'
};
var errorDispatch = {
"-1" : function () {
rejection.status = 'Sunucu hatası';
rejection.data.title = rejection.data.title || "Sunucu Hatası";
rejection.data.description = rejection.data.description || 'Sunucu bağlantısında bir hata oluştu. Lütfen yetkili personelle iletişime geçiniz.';
errorInAlertBox(errorForAlertBox);
},
"400": function () {
$location.reload();
},
"401": function () {
$location.path('/login');
if ($location.path() === "/login") {
$log.debug("show errors on login form");
}
},
"403": function () {
if (rejection.data.is_login === true) {
$rootScope.loggedInUser = true;
if ($location.path() === "/login") {
$location.path("/dashboard");
}
}
},
"404": function () {
errorInAlertBox(errorForAlertBox);
},
"500": function () {
errorInAlertBox(errorForAlertBox);
}
};
errorDispatch[rejection.status]();
return $q.reject(rejection); return $q.reject(rejection);
} }
......
...@@ -11,43 +11,116 @@ angular.module('ulakbus') ...@@ -11,43 +11,116 @@ angular.module('ulakbus')
/** /**
* WSUri returns websocket uri * WSUri returns websocket uri
*/ */
.service('WSUri', function () { .service('WSUri', function (RESTURL) {
return {url: 'ws://localhost:9001/ws'} var base = RESTURL.url.replace('http', 'ws');
return {url: base + 'ws'}
})
/**
* websocket with callbackId
* use when need to retrieve special data
*/
.service('WSWithCallback', function () {
return {"cbs": []};
}) })
/** /**
* WSOps operates all websocket interactions * WSOps operates all websocket interactions
*/ */
.service('WSOps', function (WSUri, $log) { .factory('WSOps', function (WSUri, $q, $log, $rootScope, $timeout, ErrorService, WS) {
var websocket = new WebSocket(WSUri.url); $rootScope.$on('ws_turn_on', function () {
websocket.onopen = function (evt) { generate_ws();
wsOps.onOpen(evt) });
};
websocket.onclose = function (evt) { var websocket;
wsOps.onClose(evt) var generate_ws = function () {
}; $log.info('Openning web socket...');
websocket.onmessage = function (evt) { websocket = new WS(WSUri.url);
wsOps.onMessage(evt) websocket.onopen = function (evt) {
}; wsOps.onOpen(evt)
websocket.onerror = function (evt) { };
wsOps.onError(evt) websocket.onclose = function (evt) {
wsOps.onClose(evt);
generate_ws();
};
websocket.onmessage = function (evt) {
wsOps.onMessage(evt)
};
websocket.onerror = function (evt) {
wsOps.onError(evt)
};
}; };
var wsOps = {}; var wsOps = {};
wsOps.onOpen = function(evt) { wsOps.onOpen = function (evt) {
$rootScope.websocketIsOpen = true;
$log.info("CONNECTED", evt); $log.info("CONNECTED", evt);
}; };
wsOps.onClose = function(event) { wsOps.onClose = function (event) {
$rootScope.websocketIsOpen = false;
$log.info("DISCONNEDTED", event); $log.info("DISCONNEDTED", event);
}; };
wsOps.onMessage = function(event) { // two types of data can be come from websocket: with / without callback
$log.info("MESSAGE:", event.data); //
wsOps.callbacks = {};
wsOps.onMessage = function (event) {
var data = angular.fromJson(event.data);
if (data.hasOwnProperty('error')) {
ErrorService.handle(data, 'ws');
}
if (angular.isDefined(wsOps.callbacks[data.callbackID])) {
var callback = wsOps.callbacks[data.callbackID];
delete wsOps.callbacks[data.callbackID];
callback.resolve(data);
} else {
$log.info("Data without callback: %o", data);
}
$log.info("MESSAGE:", event, "Data:", JSON.parse(event.data));
}; };
wsOps.onError = function(evt) { wsOps.onError = function (evt) {
$log.error("Error :: " + evt); $log.error("ERROR :: " + evt);
}; };
wsOps.doSend = function(data) { wsOps.doSend = function (data) {
websocket.send(data); websocket.send(data);
$log.info('SENT:', data); $log.info('SENT:', data);
}; };
wsOps.retryCount = 0;
// reactor with promise
wsOps.request = function (data) {
var request = {
callbackID: Math.random().toString(36).substring(7),
data: data
};
var deferred = $q.defer();
wsOps.callbacks[request.callbackID] = deferred;
websocket.send(angular.toJson(request));
$log.info('SENT:', data);
return deferred.promise.then(function (response) {
request.response = response;
return response;
}
);
};
wsOps.waitForSocketConnection = function (socket, callback) {
$timeout(
function () {
if (angular.isDefined(socket)) {
if (socket.readyState === 1) {
$log.info("Connection made.");
if (callback != null) {
callback();
}
} else {
$log.info("waiting for connection...");
wsOps.waitForSocketConnection(socket, callback);
}
} else {
$log.info("waiting for connection...");
wsOps.waitForSocketConnection(socket, callback);
}
}, 50); // wait 50 milisecond for the connection...
};
return wsOps; return wsOps;
}); });
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -32,6 +32,13 @@ body { ...@@ -32,6 +32,13 @@ body {
background-color:#999; background-color:#999;
} }
.tooltip {
font-family:'robotolight';
font-size:13px;
letter-spacing:0.3px;
padding:15px;
}
.badge { .badge {
border-radius: 100%; border-radius: 100%;
width: 22px; width: 22px;
...@@ -1584,6 +1591,225 @@ table.dataTable thead .sorting:after { ...@@ -1584,6 +1591,225 @@ table.dataTable thead .sorting:after {
/* END OF SIDEBAR COLLAPSE */ /* END OF SIDEBAR COLLAPSE */
/* STUDENT DASHBOARD */
.student-dashboard a:hover {
text-decoration:none;
background-color:#f9f9f9;
}
.student-dashboard .panel-body ul,
.student-dashboard .panel-body {
padding:0;
margin:0;
}
.student-dashboard .panel-body ul li {
list-style: none;
border-bottom: 1px solid #f5f5f5;
font-size:16px;
}
.student-dashboard .panel-body ul li a {
padding:25px;
display:block;
color:#333;
}
.student-dashboard .panel-body ul li:last-child {
border:none;
}
.student-course-list .panel-body,
.student-assignment-list .panel-body {
height:437px;
overflow-y:auto;
}
.student-course-list .panel-body ul li span {
margin-right:15px;
}
.student-assignment-list .assignment-status {
width:35px;
float:left;
}
.student-assignment-list .assignment-status .assignment-circle {
width:10px;
height:10px;
border-radius:100%;
margin-top: 7px;
margin-left: 3px;
}
.student-assignment-list .urgent-assignment .assignment-circle {
background-color:#D4244B;
}
.student-assignment-list .urgent-assignment .assignment-due-date {
color:#D4244B;
}
.student-assignment-list .approaching-assignment .assignment-circle {
background-color:#F7941E;
}
.student-assignment-list .approaching-assignment .assignment-due-date {
color:#F7941E;
}
.student-assignment-list .non-urgent-assignment .assignment-circle {
background-color:#01AEEE;
}
.student-assignment-list .non-urgent-assignment .assignment-due-date {
color:#01AEEE;
}
.student-assignment-list .assignment-title {
width:calc(100% - 100px);
float:left;
}
.student-assignment-list .assignment-title {
font-family:'robotomedium';
}
.student-assignment-list .assignment-title div:nth-child(1) {
font-family:'robotomedium';
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
padding-right: 15px;
}
.student-assignment-list .assignment-title div:nth-child(2) {
font-size:15px;
font-family:'robotolight';
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
padding-right: 15px;
}
.student-assignment-list .assignment-due-date {
width:65px;
float:left;
font-family:'robotolight';
position:relative;
}
.student-assignment-list .assignment-due-date div:nth-child(1) {
width:65px;
font-size:22px;
position:absolute;
text-align:center;
}
.student-assignment-list .assignment-due-date div:nth-child(2) {
width:65px;
font-size:13px;
position:absolute;
margin-top:25px;
text-align:center;
}
.student-assignment-list .last-assignment .assignment-status div {
width:3px;
height:47px;
background-color: #00A650;
margin-left: 6px;
}
.student-assignment-list .last-assignment .panel-title {
background-color: #fff;
border-color: #F2F2F2;
font-family: 'robotolight';
color: rgb(95, 95, 95);
padding: 12px 0 0;
font-size: 18px;
}
.student-assignment-list .last-assignment .assignment-due-date i {
color:#01A550;
margin-top: 16px;
}
.student-announcement-list .announcement-date {
float:left;
font-family:'robotolight';
margin-right:25px;
width:30px;
}
.student-announcement-list .announcement-text {
float:left;
width:calc(100% - 55px);
margin-top:3px;
}
.student-announcement-list .announcement-date div:first-child {
font-size: 22px;
text-align: center;
}
.student-announcement-list .announcement-date div:last-child {
font-size: 13px;
text-align: center;
}
.student-message-list .profile-pic {
width: 65px;
display: block;
margin-right: 20px;
float: left;
}
.student-message-list .profile-pic img {
width: 100%;
border-radius: 100%;
}
.student-message-list .message-content {
width: calc(100% - 200px);
float: left;
}
.student-message-list .message-content div:first-child {
margin-top:7px;
font-family:'robotomedium';
font-size:18px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.student-message-list .message-content div:last-child {
margin-top: 5px;
color: #848484;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.student-message-list .message-time {
width: 100px;
float: right;
text-align:right;
padding-top: 21px;
color: #B3B3B3;
font-size: 14px;
}
/* END OF STUDENT DASHBOARD */
/* Responsive: Portrait tablets and up */ /* Responsive: Portrait tablets and up */
@media screen and (min-width: 768px) { @media screen and (min-width: 768px) {
/* Remove the padding we set earlier */ /* Remove the padding we set earlier */
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</head> </head>
<body ng-controller="KeyListenController" ng-keydown="down($event)"> <body ng-controller="KeyListenController" ng-keydown="down($event)">
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0" ng-if="$root.loggedInUser"> <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0" ng-if="$root.current_user">
<collapse-menu></collapse-menu> <collapse-menu></collapse-menu>
<!--<ul class="header-menu">--> <!--<ul class="header-menu">-->
<!--<li><a href="">Mesajlar</a></li>--> <!--<li><a href="">Mesajlar</a></li>-->
...@@ -44,12 +44,12 @@ ...@@ -44,12 +44,12 @@
<header-notification></header-notification> <header-notification></header-notification>
</nav> </nav>
<sidebar ng-if="$root.loggedInUser"></sidebar> <sidebar ng-if="$root.current_user"></sidebar>
<div class="manager-view"> <div class="manager-view">
<div class="manager-view-inner"> <div class="manager-view-inner">
<!-- manager-header --> <!-- manager-header -->
<header-sub-menu ng-if="$root.loggedInUser"></header-sub-menu> <header-sub-menu ng-if="$root.current_user"></header-sub-menu>
<!-- end of manager-header --> <!-- end of manager-header -->
<div class="manager-view-content"> <div class="manager-view-content">
<div class="row"> <div class="row">
......
This diff is collapsed.
...@@ -20,6 +20,8 @@ module.exports = function (config) { ...@@ -20,6 +20,8 @@ module.exports = function (config) {
'app/bower_components/angular-gettext/dist/angular-gettext.min.js', 'app/bower_components/angular-gettext/dist/angular-gettext.min.js',
'app/bower_components/angular-route/angular-route.js', 'app/bower_components/angular-route/angular-route.js',
'app/bower_components/angular-resource/angular-resource.js', 'app/bower_components/angular-resource/angular-resource.js',
"app/bower_components/showdown/dist/showdown.min.js",
"app/bower_components/angular-markdown-filter/markdown.js",
'app/bower_components/angular-sanitize/angular-sanitize.min.js', 'app/bower_components/angular-sanitize/angular-sanitize.min.js',
'app/bower_components/tv4/tv4.js', 'app/bower_components/tv4/tv4.js',
'app/bower_components/objectpath/lib/ObjectPath.js', 'app/bower_components/objectpath/lib/ObjectPath.js',
...@@ -38,7 +40,7 @@ module.exports = function (config) { ...@@ -38,7 +40,7 @@ module.exports = function (config) {
frameworks: ['jasmine'], frameworks: ['jasmine'],
//browsers: ['PhantomJS', 'Chrome', 'Firefox', 'Safari'], //browsers: ['PhantomJS', 'Chrome', 'Firefox', 'Safari'],
browsers: ['PhantomJS'], browsers: ['Chrome'],
customLaunchers: { customLaunchers: {
'PhantomJS_custom': { 'PhantomJS_custom': {
...@@ -61,12 +63,12 @@ module.exports = function (config) { ...@@ -61,12 +63,12 @@ module.exports = function (config) {
plugins: [ plugins: [
'karma-phantomjs-launcher', 'karma-phantomjs-launcher',
//'karma-chrome-launcher', 'karma-chrome-launcher',
//'karma-firefox-launcher', //'karma-firefox-launcher',
//'karma-safari-launcher', //'karma-safari-launcher',
'karma-jasmine', 'karma-jasmine',
'karma-junit-reporter', //'karma-junit-reporter',
'karma-coverage' //'karma-coverage'
], ],
junitReporter: { junitReporter: {
...@@ -74,33 +76,33 @@ module.exports = function (config) { ...@@ -74,33 +76,33 @@ module.exports = function (config) {
suite: 'unit' suite: 'unit'
}, },
reporters: ['progress', 'coverage'], //reporters: ['progress', 'coverage'],
preprocessors: { //preprocessors: {
'app/app.js': ['coverage'], // 'app/app.js': ['coverage'],
'app/app_routes.js': ['coverage'], // 'app/app_routes.js': ['coverage'],
'app/components/auth/*.js': ['coverage'], // 'app/components/auth/*.js': ['coverage'],
'app/components/crud/*.js': ['coverage'], // 'app/components/crud/*.js': ['coverage'],
'app/components/dashboard/*.js': ['coverage'], // 'app/components/dashboard/*.js': ['coverage'],
'app/components/version/*.js': ['coverage'], // 'app/components/version/*.js': ['coverage'],
'app/zetalib/**/!(action_service).js': ['coverage'] // 'app/zetalib/**/!(action_service).js': ['coverage']
}, //},
coverageReporter: { //coverageReporter: {
check: { // check: {
global: { // global: {
statements: 60, // statements: 60,
branches: 10, // branches: 10,
functions: 60, // functions: 60,
lines: 60, // lines: 60,
excludes: [ // excludes: [
'app/components/uitemplates/*.js' // 'app/components/uitemplates/*.js'
] // ]
} // }
}, // },
type : 'html', // type : 'html',
dir : 'coverage/' // dir : 'coverage/'
} //}
}); });
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment