<br/>
<div class="container">
+ <div class="row">
+ <div class="col-md-6">
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" ng-class="{disabled : !userHasAdminPerm}"
+ ng-model="hatchRequired" ng-change="updateHatchRequired()">
+[% l('This workstation uses a remote print / storage service ("Hatch")?') %]
+ </label>
+ </div>
+ </div><!-- row -->
+ </div>
+ <div class="row">
+ <div class="col-md-6">
+ <input type='text' class='form-control'
+ ng-disabled="!hatchRequired || !userHasAdminPerm"
+ title="[% l('Hatch URL') %]"
+ placeholder="[% l('Hatch URL') %]"
+ ng-change='updateHatchURL()' ng-model='hatchURL'/>
+ </div>
+ </div>
+
+ <br/><br/>
<div class="row" id="splash-nav">
<div class="col-md-4">
// default page
$routeProvider.otherwise({
templateUrl : './admin/workstation/t_splash',
- controller : function() {},
+ controller : 'SplashCtrl',
resolve : resolver
});
}])
+.controller('SplashCtrl',
+ ['$scope','egPrintStore','egUser',
+function($scope , egPrintStore , egUser) {
+
+ $scope.userHasAdminPerm = false;
+ egUser.hasPermHere('ADMIN_WORKSTATION')
+ .then(function(bool) { $scope.userHasAdminPerm = bool });
+
+ $scope.hatchURL = egPrintStore.hatchURL();
+ $scope.hatchRequired =
+ egPrintStore.getLocalItem('eg.conf.hatch.required');
+
+ $scope.updateHatchRequired = function() {
+ egPrintStore.setLocalItem(
+ 'eg.conf.hatch.required', $scope.hatchRequired);
+ }
+
+ $scope.updateHatchURL = function() {
+ egPrintStore.setLocalItem(
+ 'eg.conf.hatch.url', $scope.hatchURL);
+ }
+}])
+
.controller('PrintingCtrl',
['$scope','egPrintStore',
function($scope , egPrintStore) {
// grab the edit perm
$scope.userHasDeletePerm = false;
- egUser.hasPermHere('DELETE_WORKSTATION_PREFS')
+ egUser.hasPermHere('ADMIN_WORKSTATION')
.then(function(bool) { $scope.userHasDeletePerm = bool });
// fetch the keys
service.onHatchClose();
}
+ service.hatchURL = function() {
+ return service.getLocalItem('eg.conf.hatch.url')
+ || service.defaultHatchURL;
+ }
+
service.hatchConnect = function() {
if (service.socket &&
console.debug("connecting to Hatch...");
try {
- var url = service.getLocalItem('eg.hatch.url')
- || service.defaultHatchURL;
- service.socket = new WebSocket(url);
+ service.socket = new WebSocket(service.hatchURL());
} catch(e) {
service.hatchAvailable = false;
service.hatchClosed();
if (service.hatchAvailable === false) return; // already registered
service.hatchAvailable = false;
console.debug(
- "unable to connect to Hatch server at " + service.hatchURL);
+ "unable to connect to Hatch server at " + service.hatchURL());
service.hatchClosed();
}