diff options
| author | pliablepixels <pliablepixels@gmail.com> | 2016-05-31 14:16:07 -0400 |
|---|---|---|
| committer | pliablepixels <pliablepixels@gmail.com> | 2016-05-31 14:16:07 -0400 |
| commit | 7c2b57e3ebafe875e2672a7a04ebd189d16b1928 (patch) | |
| tree | 870e6bd415b22fa54c7ebe6f72d196c7a7f51d31 /www/js | |
| parent | 75a26e142644f1a353f7ec8216e16802da8e9421 (diff) | |
#261 - additions
Former-commit-id: 58276aaa504b3c6ecccea2548d181d97c6742420
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/DataModel.js | 14 | ||||
| -rw-r--r-- | www/js/HelpCtrl.js | 43 | ||||
| -rw-r--r-- | www/js/WizardCtrl.js | 2 | ||||
| -rw-r--r-- | www/js/app.js | 38 |
4 files changed, 84 insertions, 13 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index e45829af..14864648 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -424,11 +424,6 @@ angular.module('zmApp.controllers') loginData.montageSize = 2; } - if (typeof loginData.useNphZms == 'undefined') - { - zmDebug ("useNphZms does not exist. Setting to true"); - loginData.useNphZms = true; - } if (typeof loginData.useNphZms == 'undefined') { @@ -436,8 +431,7 @@ angular.module('zmApp.controllers') loginData.useNphZms = true; } - // and now, force enable it - loginData.useNphZms = true; + if (typeof loginData.useNphZmsForEvents == 'undefined') { @@ -445,6 +439,10 @@ angular.module('zmApp.controllers') loginData.useNphZmsForEvents = true; } + // and now, force enable it + loginData.useNphZms = true; + loginData.useNphZmsForEvents = true; + if (typeof loginData.packMontage == 'undefined') { zmDebug ("packMontage does not exist. Setting to false"); @@ -511,7 +509,7 @@ angular.module('zmApp.controllers') if (typeof timelineModalGraphType == 'undefined') { zmDebug ("timeline graph type not set. Setting to all"); - loginData.timelineModalGraphType = 'all'; + loginData.timelineModalGraphType = $translate.instant('kAll'); } if (typeof loginData.resumeDelay == 'undefined') diff --git a/www/js/HelpCtrl.js b/www/js/HelpCtrl.js index 52e7c0f0..15504f7b 100644 --- a/www/js/HelpCtrl.js +++ b/www/js/HelpCtrl.js @@ -2,7 +2,7 @@ /* jslint browser: true*/ /* global cordova,StatusBar,angular,console, Masonry */ -angular.module('zmApp.controllers').controller('zmApp.HelpCtrl', ['$scope', '$rootScope', '$ionicModal', 'ZMDataModel','$ionicSideMenuDelegate', '$ionicHistory', '$state', function ($scope, $rootScope, $ionicModal, ZMDataModel,$ionicSideMenuDelegate, $ionicHistory, $state) { +angular.module('zmApp.controllers').controller('zmApp.HelpCtrl', ['$scope', '$rootScope', '$ionicModal', 'ZMDataModel','$ionicSideMenuDelegate', '$ionicHistory', '$state', '$translate', '$q', '$templateRequest', '$sce', '$compile', function ($scope, $rootScope, $ionicModal, ZMDataModel,$ionicSideMenuDelegate, $ionicHistory, $state, $translate, $q, $templateRequest, $sce, $compile) { $scope.openMenu = function () { $ionicSideMenuDelegate.toggleLeft(); }; @@ -22,6 +22,44 @@ $scope.openMenu = function () { } }; + + function insertHelp() + { + + + + var l = ZMDataModel.getDefaultLanguage() || 'en'; + var lang = "lang/help/help-"+l+".html"; + console.log ("LANG IS " + lang); + var templateUrl = $sce.getTrustedResourceUrl(lang); + var lang_fb= "lang/help/help-"+"en"+".html"; + var templateUrlFB = $sce.getTrustedResourceUrl(lang_fb); + + $templateRequest(lang) + .then (function(template) + { + var elem = angular.element(document.getElementById('insertHelp')); + $compile(elem.html(template).contents())($scope); + }, + function (error) + { + ZMDataModel.zmLog ("Language file " + lang + " not found, falling back"); + $templateRequest(templateUrlFB) + .then (function( template) + { + var elem = angular.element(document.getElementById('insertHelp')); + $compile(elem.html(template).contents())($scope); + }, + function (error) + { + ZMDataModel.zmLog("fallback help not found"); + }); + } + ); + + + + } //------------------------------------------------------------------------- // Lets make sure we set screen dim properly as we enter @@ -34,6 +72,9 @@ $scope.openMenu = function () { //console.log("**VIEW ** Help Ctrl Entered"); ZMDataModel.setAwake(false); $scope.zmAppVersion = ZMDataModel.getAppVersion(); + insertHelp(); + + diff --git a/www/js/WizardCtrl.js b/www/js/WizardCtrl.js index b241304d..aa48e1a5 100644 --- a/www/js/WizardCtrl.js +++ b/www/js/WizardCtrl.js @@ -190,6 +190,8 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$ var a3 = baseUri+"/zm/cgi-bin"; // ubuntu/debian var a2 = baseUri+"/cgi-bin-zm"; //fedora/centos/rhel var a1 = baseUri+"/cgi-bin"; // doofus + + var urls = [a1,a2,a3]; diff --git a/www/js/app.js b/www/js/app.js index dadda298..03b01c8f 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -1,6 +1,6 @@ /* jshint -W041 */ /* jslint browser: true*/ -/* global cordova,StatusBar,angular,console,alert,PushNotification, moment ,ionic, URI, $*/ +/* global cordova,StatusBar,angular,console,alert,PushNotification, moment ,ionic, URI, ConnectSDK,$*/ var appVersion = "0.0.0"; @@ -36,6 +36,7 @@ angular.module('zmApp', [ minAppVersion: '1.28.107', // if ZM is less than this, the app won't work recommendedAppVersion: '1.29', minEventServerVersion: '0.7', + castAppId: 'BA30FB4C', alarmFlashTimer: 20000, // time to flash alarm gcmSenderId: '710936220256', httpTimeout: 15000, @@ -80,6 +81,28 @@ angular.module('zmApp', [ }) +// credit: http://stackoverflow.com/questions/25391279/angularjs-ng-include-failover +.directive("ngIncludeFailover", function() { + return { + restrict: 'CAE', + scope: { + src: '=', + myInclude: '=' + }, + transclude:true, + link: function(scope, iElement, iAttrs, controller) { + iAttrs.$observe('src', function (nv) {scope.src=nv; console.log ("CHANGED");}); + scope.$on("$includeContentError", function(event, args){ + scope.loadFailed=true; + }); + scope.$on("$includeContentLoaded", function(event, args){ + scope.loadFailed=false; + }); + }, + template: "<div ng-include='ngIncludeFailover||src'></div><div ng-show='loadFailed' ng-transclude/>" + }; + }) + // credit https://gist.github.com/Zren/beaafd64f395e23f4604 .directive('mouseWheelScroll', function($timeout) { @@ -1184,19 +1207,23 @@ angular.module('zmApp', [ $ionicPlatform.ready(function () { + + $ionicNativeTransitions.enable(true, false); var lang = ZMDataModel.getDefaultLanguage(); if (lang == undefined) { - ZMDataModel.zmLog ("No language set, detecting..."); + ZMDataModel.zmLog ("No language set, switching to en"); + ZMDataModel.setDefaultLanguage("en", false); + /* if(typeof navigator.globalization !== "undefined") { navigator.globalization.getPreferredLanguage(function(language) { // dont make this permanent ZMDataModel.setDefaultLanguage((language.value).split("-")[0], false); }, null); - } + }*/ } else { @@ -1229,6 +1256,9 @@ angular.module('zmApp', [ $rootScope.platformOS = "android"; ZMDataModel.zmLog("You are running on " + $rootScope.platformOS); + + + ZMDataModel.init(); EventServer.init(); @@ -1477,7 +1507,7 @@ angular.module('zmApp', [ - $translateProvider.determinePreferredLanguage(); + //$translateProvider.determinePreferredLanguage(); //$translateProvider.preferredLanguage("en"); $translateProvider.fallbackLanguage("en"); $translateProvider.useSanitizeValueStrategy('sanitize'); |
