</a>
</li>
<li class="divider"></li>
- <li>
+ <li ng-class="{disabled : offlineDisabled()}">
<a href="./offline-interface" target="_self">
<span class="glyphicon glyphicon-alert"></span>
<span>[% l('Offline Circulation') %]</span>
* even if the code has been minified */
['$scope','$location','$window','egCore','egLovefield',
function($scope , $location , $window , egCore , egLovefield) {
- egLovefield.havePendingOfflineXacts() .then(function(eh){
- $scope.pendingXacts = eh;
- });
+ egLovefield.havePendingOfflineXacts() .then(
+ function(eh){ $scope.pendingXacts = eh; },
+ function() {} // SharedWorker not supported
+ );
$scope.focusMe = true;
$scope.args = {};
egLovefield = $injector.get('egLovefield');
}
//console.debug('About to cache a list of ' + class_ + ' objects...');
- egLovefield.isCacheGood(class_).then(function(good) {
- if (!good) egLovefield.setListInOfflineCache(class_, blob.list);
- });
+ egLovefield.isCacheGood(class_).then(
+ function(good) {
+ if (!good) {
+ egLovefield.setListInOfflineCache(class_, blob.list);
+ }
+ },
+ function() {} // Not Supported
+ );
}
angular.forEach(list, function(item) {blob.map[item[pkey]()] = item});
return $q.when();
}
);
- });
+ },
+ function() {return $q.when()} // Not Supported, exit gracefully
+ );
},
};
// relative path would be better...
service.worker = new SharedWorker(service.workerUrl);
} catch (E) {
- console.error('SharedWorker() not supported', E);
+ console.warn('SharedWorker() not supported', E);
service.cannotConnect = true;
return;
}
service.connectToSchemas = function() {
+ service.connectToWorker(); // no-op if already connected
+
if (service.cannotConnect) {
// This can happen in certain environments
return $q.reject();
}
-
- service.connectToWorker(); // no-op if already connected
var promises = [];
transclude : true,
templateUrl : 'eg-navbar-template',
controller:['$scope','$window','$location','$timeout','hotkeys','$rootScope',
- 'egCore','$uibModal','ngToast','egOpChange','$element',
+ 'egCore','$uibModal','ngToast','egOpChange','$element','egLovefield',
function($scope , $window , $location , $timeout , hotkeys , $rootScope ,
- egCore , $uibModal , ngToast , egOpChange , $element) {
+ egCore , $uibModal , ngToast , egOpChange , $element , egLovefield) {
$scope.rs = $rootScope;
return true;
};
+ $scope.offlineDisabled = function() {
+ return egLovefield.cannotConnect;
+ }
+
egCore.startup.go().then(
function() {
if (egCore.auth.user()) {
if (!angular.isArray(names)) names = [names];
if (lf.isOffline) {
- return egLovefield.getSettingsCache(names)
- .then(function(settings) {
+ return egLovefield.getSettingsCache(names).then(
+ function(settings) {
var hash = {};
angular.forEach(settings, function (s) {
hash[s.name] = s.value;
});
return $q.when(hash);
- });
+ },
+ function() {return $q.when({})} // Not Supported
+ );
}
if (here) service.cachedSettings[key] = settings[key];
});
- return egLovefield.setSettingsCache(settings).then(function() {
- // resolve with cached settings if 'here', since 'settings'
- // will only contain settings we had to retrieve
- deferred.resolve(here ? service.cachedSettings : settings);
- });
+ return egLovefield.setSettingsCache(settings).then(
+ function() {
+ // resolve with cached settings if 'here', since 'settings'
+ // will only contain settings we had to retrieve
+ deferred.resolve(here ? service.cachedSettings : settings);
+ },
+ function() {
+ deferred.resolve(here ? service.cachedSettings : settings);
+ }
+ );
});
return deferred.promise;
}
templateUrl : './share/t_org_select',
- controller : ['$scope','$timeout','egCore','egStartup','egLovefield','$q',
- function($scope , $timeout , egCore , egStartup , egLovefield , $q) {
+ controller : ['$scope','$timeout','egCore','egStartup','$q',
+ function($scope , $timeout , egCore , egStartup , $q) {
// See emptyTypeahead directive below.
var secretEmptyKey = '_INTERNAL_';