77 lines
2.4 KiB
Plaintext
77 lines
2.4 KiB
Plaintext
// create the controller and inject Angular's $scope
|
|
scotchApp.controller('topMenuController',
|
|
// create a message to display in our view
|
|
function($scope ,$location ,$route) {
|
|
|
|
//alert("topMenuController");
|
|
init();
|
|
|
|
function init() {
|
|
|
|
// var url = window.location.href;
|
|
// var intPam = url.indexOf('?');
|
|
// var p = url.substring(url.indexOf('?') + 1, url.length);
|
|
// //alert("intPam"+intPam);
|
|
// //alert("p"+p);
|
|
//
|
|
// if (intPam > 0 && null != p && p != '') {
|
|
// //p = '';
|
|
// p = "?" + p;
|
|
// } else {
|
|
// p = '';
|
|
// }
|
|
|
|
// $scope.mainUrl = "";
|
|
// $scope.mainUrl = doGetPath('/pages/main.jsp');
|
|
// $scope.$apply();
|
|
|
|
//$location.path("/defaults");
|
|
try{
|
|
var getSession = $.ajax(doGetPath('/json/getSessionLogin.json'),
|
|
{
|
|
ajax: true,
|
|
dataType: 'json',
|
|
type: "POST"
|
|
});
|
|
getSession.success(
|
|
function (data) {
|
|
//alert(data[0]);
|
|
// alert(data[2]);
|
|
if(data[0] != 1){
|
|
$scope.logIn = data[0];
|
|
|
|
$scope.flagSql = data[2];
|
|
|
|
// alert($scope.flagSql);
|
|
$scope.$apply();
|
|
|
|
//$location.path("/ENDR001/"+new Date().getTime());
|
|
//$scope.mainUrl = doGetPath('/pages/main.jsp');
|
|
//$scope.$apply();
|
|
}else{
|
|
|
|
$scope.doLogout();
|
|
$scope.$apply();
|
|
}
|
|
}
|
|
);
|
|
} catch (e) {
|
|
$location.path("/logout");
|
|
}
|
|
}
|
|
|
|
$scope.printing = function(url){
|
|
//alert("printing");
|
|
$location.path(url+"/"+new Date().getTime());
|
|
$scope.$apply();
|
|
};
|
|
|
|
$scope.redirectMainPage = function(url){
|
|
$location.path(url+"/"+new Date().getTime());
|
|
$scope.$apply();
|
|
};
|
|
|
|
$scope.doLogout = function () {
|
|
$location.path("/logout");
|
|
};
|
|
}); |