diff --git a/html/logo.html b/html/logo.html deleted file mode 100644 index 22c2622a..00000000 --- a/html/logo.html +++ /dev/null @@ -1 +0,0 @@ -<%define "logo"%><%end%> diff --git a/html/main.html b/html/main.html index f485bc1d..c61eee94 100644 --- a/html/main.html +++ b/html/main.html @@ -6,57 +6,8 @@
- - -
- -
-
-
-
-
- -
-
- -
-
- -
-
- -
-
-
-
-
-
-
-
+ <%template "extra-body" .%> -<%end%> +<%end%> \ No newline at end of file diff --git a/static/js/app.js b/static/js/app.js index 2368ba11..2317b38f 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -190,7 +190,17 @@ define([ app.directive("spreedWebrtc", [function() { return { restrict: "A", - controller: "MediastreamController" + scope: false, + controller: "AppController" + } + }]); + + app.directive("uiLogo", ["globalContext", function(globalContext) { + return { + restrict: "A", + link: function($scope, $element, $attrs) { + $attrs.$set("title", globalContext.Cfg.Title || ""); + } } }]); diff --git a/static/js/controllers/appcontroller.js b/static/js/controllers/appcontroller.js new file mode 100644 index 00000000..6561a82d --- /dev/null +++ b/static/js/controllers/appcontroller.js @@ -0,0 +1,117 @@ +/* + * Spreed WebRTC. + * Copyright (C) 2013-2014 struktur AG + * + * This file is part of Spreed WebRTC. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +"use strict"; +define(["jquery", "angular", "underscore"], function($, angular, _) { + + // AppController + return ["$scope", "$window", "appData", "userSettingsData", "$timeout", function($scope, $window, appData, userSettingsData, $timeout) { + + // Disable drag and drop. + $($window).on("dragover dragenter drop", function(event) { + event.preventDefault(); + }); + + appData.set($scope); + + // User related scope data. + $scope.roomsHistory = []; + $scope.defaults = { + displayName: null, + buddyPicture: null, + message: null, + settings: { + videoQuality: "high", + sendStereo: false, + maxFrameRate: 20, + defaultRoom: "", + language: "", + audioRenderToAssociatedSkin: true, + videoCpuOveruseDetection: true, + experimental: { + enabled: false, + audioEchoCancellation2: true, + audioAutoGainControl2: true, + audioNoiseSuppression2: true, + audioTypingNoiseDetection: true, + videoLeakyBucket: true, + videoNoiseReduction: false + } + } + }; + $scope.master = angular.copy($scope.defaults); + + $scope.update = function(user) { + $scope.master = angular.copy(user); + if (appData.flags.connected) { + $scope.updateStatus(); + } + $scope.refreshWebrtcSettings(); + }; + + $scope.reset = function() { + $scope.user = angular.copy($scope.master); + }; + + $scope.loadUserSettings = function() { + $scope.master = angular.copy($scope.defaults); + var storedUser = userSettingsData.load(); + if (storedUser) { + $scope.user = $.extend(true, {}, $scope.master, storedUser); + $scope.user.settings = $.extend(true, {}, $scope.user.settings, $scope.master.settings, $scope.user.settings); + $scope.update($scope.user); + $scope.loadedUser = storedUser.displayName && true; + } else { + $scope.loadedUser = false; + } + $scope.roomsHistory = []; + appData.e.triggerHandler("userSettingsLoaded", [$scope.loadedUser, $scope.user]); + $scope.reset(); + }; + + $scope.manualReloadApp = function(url) { + appData.flags.manualUnload = true; + if (url) { + $window.location.href = url; + $timeout(function() { + appData.flags.manualUnload = false; + }, 0); + } else { + $window.location.reload(true); + } + }; + + $scope.$on("room.joined", function(event, roomName) { + if (roomName) { + _.pull($scope.roomsHistory, roomName); + $scope.roomsHistory.unshift(roomName); + if ($scope.roomsHistory.length > 15) { + // Limit the history. + $scope.roomsHistory = $scope.roomsHistory.splice(0, 15); + } + } + }); + + $scope.reset(); // Call once for bootstrap. + + }]; + +}); \ No newline at end of file diff --git a/static/js/controllers/controllers.js b/static/js/controllers/controllers.js index 10d51949..57c25a0c 100644 --- a/static/js/controllers/controllers.js +++ b/static/js/controllers/controllers.js @@ -28,7 +28,8 @@ define([ 'controllers/chatroomcontroller', 'controllers/usersettingscontroller', 'controllers/contactsmanagercontroller', - 'controllers/contactsmanagereditcontroller'], function(_, MediastreamController, StatusmessageController, ChatroomController, UsersettingsController, ContactsmanagerController, ContactsmanagereditController) { + 'controllers/contactsmanagereditcontroller', + 'controllers/appcontroller'], function(_, MediastreamController, StatusmessageController, ChatroomController, UsersettingsController, ContactsmanagerController, ContactsmanagereditController, AppController) { var controllers = { MediastreamController: MediastreamController, @@ -36,7 +37,8 @@ define([ ChatroomController: ChatroomController, UsersettingsController: UsersettingsController, ContactsmanagerController: ContactsmanagerController, - ContactsmanagereditController: ContactsmanagereditController + ContactsmanagereditController: ContactsmanagereditController, + AppController: AppController }; var initialize = function(angModule) { diff --git a/static/js/controllers/mediastreamcontroller.js b/static/js/controllers/mediastreamcontroller.js index c8e931ee..65622969 100644 --- a/static/js/controllers/mediastreamcontroller.js +++ b/static/js/controllers/mediastreamcontroller.js @@ -20,21 +20,13 @@ */ "use strict"; -define(['jquery', 'underscore', 'angular', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'webrtc.adapter'], function($, _, angular, BigScreen, moment, sjcl, Modernizr) { +define(['jquery', 'underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'webrtc.adapter'], function($, _, BigScreen, moment, sjcl, Modernizr) { - return ["$scope", "$rootScope", "$element", "$window", "$timeout", "safeDisplayName", "safeApply", "mediaStream", "appData", "playSound", "desktopNotify", "alertify", "toastr", "translation", "fileDownload", "localStorage", "screensharing", "userSettingsData", "localStatus", "dialogs", "rooms", "constraints", function($scope, $rootScope, $element, $window, $timeout, safeDisplayName, safeApply, mediaStream, appData, playSound, desktopNotify, alertify, toastr, translation, fileDownload, localStorage, screensharing, userSettingsData, localStatus, dialogs, rooms, constraints) { - - /*console.log("route", $route, $routeParams, $location);*/ - - // Disable drag and drop. - $($window).on("dragover dragenter drop", function(event) { - event.preventDefault(); - }); + return ["$scope", "$rootScope", "$element", "$window", "$timeout", "safeDisplayName", "safeApply", "mediaStream", "appData", "playSound", "desktopNotify", "alertify", "toastr", "translation", "fileDownload", "localStorage", "screensharing", "localStatus", "dialogs", "rooms", "constraints", function($scope, $rootScope, $element, $window, $timeout, safeDisplayName, safeApply, mediaStream, appData, playSound, desktopNotify, alertify, toastr, translation, fileDownload, localStorage, screensharing, localStatus, dialogs, rooms, constraints) { // Avoid accidential reloads or exits when in a call. - var manualUnload = false; $($window).on("beforeunload", function(event) { - if (manualUnload || !$scope.peer) { + if (appData.flags.manualUnload || !$scope.peer) { return; } return translation._("Close this window and disconnect?"); @@ -93,8 +85,6 @@ define(['jquery', 'underscore', 'angular', 'bigscreen', 'moment', 'sjcl', 'moder "prompt": "question1" }); - appData.set($scope); - var displayName = safeDisplayName; // Init STUN from server config. @@ -112,7 +102,7 @@ define(['jquery', 'underscore', 'angular', 'bigscreen', 'moment', 'sjcl', 'moder $scope.supported = { screensharing: screensharing.supported, constraints: constraints.supported - } + }; // Default scope data. $scope.status = "initializing"; @@ -132,50 +122,6 @@ define(['jquery', 'underscore', 'angular', 'bigscreen', 'moment', 'sjcl', 'moder $scope.chatMessagesUnseen = 0; $scope.autoAccept = null; $scope.isCollapsed = true; - $scope.roomsHistory = []; - $scope.defaults = { - displayName: null, - buddyPicture: null, - message: null, - settings: { - videoQuality: "high", - sendStereo: false, - maxFrameRate: 20, - defaultRoom: "", - language: "", - audioRenderToAssociatedSkin: true, - videoCpuOveruseDetection: true, - experimental: { - enabled: false, - audioEchoCancellation2: true, - audioAutoGainControl2: true, - audioNoiseSuppression2: true, - audioTypingNoiseDetection: true, - videoLeakyBucket: true, - videoNoiseReduction: false - } - } - }; - $scope.master = angular.copy($scope.defaults); - - // Data voids. - var resurrect = null; - var reconnecting = false; - var connected = false; - var autoreconnect = true; - - $scope.update = function(user) { - $scope.master = angular.copy(user); - if (connected) { - $scope.updateStatus(); - } - $scope.refreshWebrtcSettings(); - }; - - $scope.reset = function() { - $scope.user = angular.copy($scope.master); - }; - $scope.reset(); // Call once for bootstrap. $scope.setStatus = function(status) { // This is the connection status to signaling server. @@ -230,34 +176,6 @@ define(['jquery', 'underscore', 'angular', 'bigscreen', 'moment', 'sjcl', 'moder }; - $scope.manualReloadApp = function(url) { - manualUnload = true; - if (url) { - $window.location.href = url; - $timeout(function() { - manualUnload = false; - }, 0); - } else { - $window.location.reload(true); - } - }; - - $scope.loadUserSettings = function() { - $scope.master = angular.copy($scope.defaults); - var storedUser = userSettingsData.load(); - if (storedUser) { - $scope.user = $.extend(true, {}, $scope.master, storedUser); - $scope.user.settings = $.extend(true, {}, $scope.user.settings, $scope.master.settings, $scope.user.settings); - $scope.update($scope.user); - $scope.loadedUser = storedUser.displayName && true; - } else { - $scope.loadedUser = false; - } - $scope.roomsHistory = []; - appData.e.triggerHandler("userSettingsLoaded", [$scope.loadedUser, $scope.user]); - $scope.reset(); - }; - $scope.toggleBuddylist = (function() { var oldState = null; return function(status, force) { @@ -364,9 +282,9 @@ define(['jquery', 'underscore', 'angular', 'bigscreen', 'moment', 'sjcl', 'moder } // Support resurrection shrine. - if (resurrect) { - var resurrection = resurrect; - resurrect = null; + if (appData.flags.resurrect) { + var resurrection = appData.flags.resurrect; + appData.flags.resurrect = null; $timeout(function() { if (resurrection.id === $scope.id) { console.log("Using resurrection shrine", resurrection); @@ -489,25 +407,32 @@ define(['jquery', 'underscore', 'angular', 'bigscreen', 'moment', 'sjcl', 'moder alertify.dialog.alert(translation._("Oops") + "
" + message); }); + appData.flags.autoreconnect = true; + appData.flags.autoreconnectDelay = 0; + var reconnect = function() { - if (connected && autoreconnect) { - if (resurrect === null) { + if (appData.flags.connected && appData.flags.autoreconnect) { + if (appData.flags.resurrect === null) { // Storage data at the resurrection shrine. - resurrect = { + appData.flags.resurrect = { status: $scope.getStatus(), id: $scope.id } - console.log("Stored data at the resurrection shrine", resurrect); + console.log("Stored data at the resurrection shrine", appData.flags.resurrect); } - if (!reconnecting) { - reconnecting = true; + if (!appData.flags.reconnecting) { + var delay = appData.flags.autoreconnectDelay; + if (delay < 10000) { + appData.flags.autoreconnectDelay += 500; + } + appData.flags.reconnecting = true; _.delay(function() { - if (autoreconnect) { + if (appData.flags.autoreconnect) { console.log("Requesting to reconnect ..."); mediaStream.reconnect(); } - reconnecting = false; - }, 500); + appData.flags.reconnecting = false; + }, delay); $scope.setStatus("reconnecting"); } else { console.warn("Already reconnecting ..."); @@ -526,12 +451,13 @@ define(['jquery', 'underscore', 'angular', 'bigscreen', 'moment', 'sjcl', 'moder $scope.userid = $scope.suserid = null; switch (event.type) { case "open": - connected = true; + appData.flags.connected = true; + appData.flags.autoreconnectDelay = 0; $scope.updateStatus(true); $scope.setStatus("waiting"); break; case "error": - if (connected) { + if (appData.flags.connected) { reconnect(); } else { $scope.setStatus(event.type); @@ -768,17 +694,6 @@ define(['jquery', 'underscore', 'angular', 'bigscreen', 'moment', 'sjcl', 'moder $scope.chatMessagesUnseen = $scope.chatMessagesUnseen - count; }); - $scope.$on("room.joined", function(event, roomName) { - if (roomName) { - _.pull($scope.roomsHistory, roomName); - $scope.roomsHistory.unshift(roomName); - if ($scope.roomsHistory.length > 15) { - // Limit the history. - $scope.roomsHistory = $scope.roomsHistory.splice(0, 15); - } - } - }); - _.defer(function() { if (!Modernizr.websockets) { alertify.dialog.alert(translation._("Your browser is not supported. Please upgrade to a current version.")); diff --git a/static/js/directives/directives.js b/static/js/directives/directives.js index b0a110ec..ad556a4e 100644 --- a/static/js/directives/directives.js +++ b/static/js/directives/directives.js @@ -48,7 +48,8 @@ define([ 'directives/bfi', 'directives/title', 'directives/welcome', - 'directives/menu'], function(_, onEnter, onEscape, statusMessage, buddyList, buddyPictureCapture, buddyPictureUpload, settings, chat, audioVideo, usability, audioLevel, fileInfo, screenshare, roomBar, socialShare, page, contactRequest, defaultDialog, pdfcanvas, odfcanvas, presentation, youtubevideo, bfi, title, welcome, menu) { + 'directives/menu', + 'directives/ui'], function(_, onEnter, onEscape, statusMessage, buddyList, buddyPictureCapture, buddyPictureUpload, settings, chat, audioVideo, usability, audioLevel, fileInfo, screenshare, roomBar, socialShare, page, contactRequest, defaultDialog, pdfcanvas, odfcanvas, presentation, youtubevideo, bfi, title, welcome, menu, ui) { var directives = { onEnter: onEnter, @@ -76,7 +77,8 @@ define([ bfi: bfi, title: title, welcome: welcome, - menu: menu + menu: menu, + ui: ui }; var initialize = function(angModule) { diff --git a/static/js/directives/ui.js b/static/js/directives/ui.js new file mode 100644 index 00000000..2d7d81fe --- /dev/null +++ b/static/js/directives/ui.js @@ -0,0 +1,38 @@ +/* + * Spreed WebRTC. + * Copyright (C) 2013-2014 struktur AG + * + * This file is part of Spreed WebRTC. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +"use strict"; +define(['text!partials/ui.html'], function(template) { + + // ui + return [function() { + + return { + restrict: 'E', + replace: true, + scope: false, + controller: 'MediastreamController', + template: template + } + + }]; + +}); diff --git a/static/partials/ui.html b/static/partials/ui.html new file mode 100644 index 00000000..648c20ba --- /dev/null +++ b/static/partials/ui.html @@ -0,0 +1,52 @@ +
+ + +
+ +
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+ \ No newline at end of file