summaryrefslogtreecommitdiffstats
path: root/src/main/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/resources')
-rw-r--r--src/main/resources/bwlpModule.js5
-rw-r--r--src/main/resources/config/locationConfig.js11
-rw-r--r--src/main/resources/controllers/locationFieldController.js23
-rw-r--r--src/main/resources/guac-manifest.json14
-rw-r--r--src/main/resources/styles/locationField.css47
-rw-r--r--src/main/resources/templates/locationField.html18
-rw-r--r--src/main/resources/translations/en.json5
7 files changed, 122 insertions, 1 deletions
diff --git a/src/main/resources/bwlpModule.js b/src/main/resources/bwlpModule.js
new file mode 100644
index 0000000..c74580a
--- /dev/null
+++ b/src/main/resources/bwlpModule.js
@@ -0,0 +1,5 @@
+angular.module('location', [
+ 'form'
+]);
+
+angular.module('index').requires.push('location'); \ No newline at end of file
diff --git a/src/main/resources/config/locationConfig.js b/src/main/resources/config/locationConfig.js
new file mode 100644
index 0000000..6074752
--- /dev/null
+++ b/src/main/resources/config/locationConfig.js
@@ -0,0 +1,11 @@
+angular.module('location').config(['formServiceProvider',
+ function locationConfig(formServiceProvider) {
+
+ // Define field for the TOTP code provided by the user
+ formServiceProvider.registerFieldType('LOCATION', {
+ module : 'location',
+ controller : 'locationFieldController',
+ templateUrl : 'app/ext/bwlp/templates/locationField.html'
+ });
+
+ }]); \ No newline at end of file
diff --git a/src/main/resources/controllers/locationFieldController.js b/src/main/resources/controllers/locationFieldController.js
new file mode 100644
index 0000000..8117ed7
--- /dev/null
+++ b/src/main/resources/controllers/locationFieldController.js
@@ -0,0 +1,23 @@
+angular.module('location').controller('locationFieldController', ['$scope', '$window',
+ function locationFieldController($scope, $window) {
+
+ $scope.data = { id: 0, password: '' }
+
+ $scope.$watch('data', function(newValue) {
+ $scope.model = JSON.stringify(newValue);
+ }, true);
+
+ $scope.selectLocation = function selectLocation($event, id) {
+ if (angular.element($event.target).hasClass('bwlp-password-input')) return;
+ $scope.data.password = '';
+ if ($scope.data.id === id) {
+ $scope.data.id = 0;
+ angular.element('.selected-location').removeClass('selected-location');
+ return;
+ }
+ $scope.data.id = id;
+ angular.element('.selected-location').removeClass('selected-location');
+ angular.element($event.currentTarget).addClass('selected-location');
+ };
+
+}]); \ No newline at end of file
diff --git a/src/main/resources/guac-manifest.json b/src/main/resources/guac-manifest.json
index ef3c431..e507183 100644
--- a/src/main/resources/guac-manifest.json
+++ b/src/main/resources/guac-manifest.json
@@ -3,5 +3,17 @@
"name" : "bwLehrpool virtual pool",
"namespace" : "de.bwlehrpool",
"authProviders": ["de.bwlehrpool.bwlp_guac.BwlpAuthenticationProvider"],
- "html" : [ "disclaimer.html" ]
+ "html" : [ "disclaimer.html" ],
+ "translations" : [
+ "translations/en.json"
+ ],
+ "js" : [
+ "bwlp.min.js"
+ ],
+ "css" : [
+ "bwlp.min.css"
+ ],
+ "resources" : {
+ "templates/locationField.html" : "text/html"
+ }
}
diff --git a/src/main/resources/styles/locationField.css b/src/main/resources/styles/locationField.css
new file mode 100644
index 0000000..cec1466
--- /dev/null
+++ b/src/main/resources/styles/locationField.css
@@ -0,0 +1,47 @@
+.bwlp-location-container {
+ border: 2px solid #3d3d3d;
+ width: 100%;
+ border-spacing: 0;
+}
+
+.bwlp-location {
+ background-color: white;
+ cursor: pointer;
+}
+
+.bwlp-location > td {
+ padding: 14px;
+}
+
+.bwlp-location .bwlp-password {
+ padding: 4px 8px !important;
+ margin: -10px 0 !important;
+}
+
+.bwlp-location:hover {
+ filter: brightness(0.9);
+}
+
+.bwlp-location.selected-location {
+ background-color: #c8ffc8;
+}
+
+.bwlp-location-status {
+ font-size: 16px;
+ text-align: center;
+}
+
+.bwlp-password {
+ text-align: right;
+}
+
+.bwlp-password > span {
+ font-size: 16px;
+ opacity: 0.5;
+}
+
+.bwlp-password-input {
+ margin: 0 !important;
+ padding: 5px 8px !important;
+ background-color: white !important;
+} \ No newline at end of file
diff --git a/src/main/resources/templates/locationField.html b/src/main/resources/templates/locationField.html
new file mode 100644
index 0000000..f76259e
--- /dev/null
+++ b/src/main/resources/templates/locationField.html
@@ -0,0 +1,18 @@
+<table class="bwlp-location-container">
+ <tr ng-repeat="location in field.locations" class="bwlp-location"
+ ng-click="selectLocation($event, location.id)">
+ <td>
+ {{ location.name }}
+ </td>
+ <td class="bwlp-location-status">
+ {{ location.freeCount }} available ({{ location.offlineCount }} offline)
+ </td>
+ <td style="width: 200px">
+ <div ng-if="location.password" class="bwlp-password">
+ <span ng-if="data.id !== location.id">Password protected</span>
+ <input ng-if="data.id === location.id" ng-model="data.password"
+ type="password" placeholder="Password" class="bwlp-password-input" required>
+ </div>
+ </td>
+ </tr>
+</table>
diff --git a/src/main/resources/translations/en.json b/src/main/resources/translations/en.json
new file mode 100644
index 0000000..9ad430b
--- /dev/null
+++ b/src/main/resources/translations/en.json
@@ -0,0 +1,5 @@
+{
+ "LOGIN" : {
+ "FIELD_HEADER_LOCATION" : ""
+ }
+} \ No newline at end of file