diff --git a/luciexpress/htdocs/index.html b/luciexpress/htdocs/index.html index 07590dbed..dcbca5df3 100644 --- a/luciexpress/htdocs/index.html +++ b/luciexpress/htdocs/index.html @@ -33,18 +33,7 @@
-
-
-
-
-
- Turkish German English -
-
- WAN IP Address: 217.34.98.17 | Firmware version: AT904X-03.01 -
-
-
+
@@ -58,7 +47,7 @@ - + @@ -73,6 +62,8 @@ + + @@ -110,6 +101,7 @@ + diff --git a/luciexpress/htdocs/js/app.js b/luciexpress/htdocs/js/app.js index 7073900f2..838f62c08 100644 --- a/luciexpress/htdocs/js/app.js +++ b/luciexpress/htdocs/js/app.js @@ -66,21 +66,25 @@ angular.module("luci", [ }) .run(function($rootScope, $state, $session, gettextCatalog, $rpc, $navigation){ // set current language - gettextCatalog.currentLanguage = "se"; + //gettextCatalog.currentLanguage = "se"; //gettextCatalog.debug = true; // get the menu navigation $rpc.luci2.ui.menu().done(function(data){ //console.log(JSON.stringify(data)); Object.keys(data.menu).map(function(key){ - var view = data.menu[key].view; + var menu = data.menu[key]; + var view = menu.view; var path = key.replace("/", "."); var obj = { path: path, modes: data.menu[key].modes || [ ], text: data.menu[key].title, - index: data.menu[key].index || 0 + index: data.menu[key].index || 0, }; + if(menu.redirect){ + obj.redirect = menu.redirect; + } if(view){ obj.page = "/pages/"+view.replace("/", ".")+".html"; } diff --git a/luciexpress/htdocs/js/config.js b/luciexpress/htdocs/js/config.js index 5b0a6caec..58e37ffc4 100644 --- a/luciexpress/htdocs/js/config.js +++ b/luciexpress/htdocs/js/config.js @@ -2,6 +2,21 @@ angular.module("luci") .factory('$config', function($rootScope){ return { mode: "basic", // basic or expert supported + model: "Inteno DG301", + languages: { + "tr": { + title: "Turkish" + }, + "en": { + title: "English" + }, + "de": { + title: "German" + }, + "se": { + title: "Swedish" + } + }, themes: { "default": "/themes/default/", "red" : "/themes/inteno-red/", @@ -20,6 +35,7 @@ angular.module("luci") "router.dslstats", "router.info", "router.clients", + "network.interface.status", "system.info" ] } diff --git a/luciexpress/htdocs/js/localStorage.js b/luciexpress/htdocs/js/localStorage.js new file mode 100644 index 000000000..317e58d87 --- /dev/null +++ b/luciexpress/htdocs/js/localStorage.js @@ -0,0 +1,12 @@ +// service for managing session data +angular.module("luci") +.factory('$localStorage', function() { + return { + getItem: function(item){ + return localStorage.getItem(item); + }, + setItem: function(item, value){ + return localStorage.setItem(item, value); + } + }; +}); diff --git a/luciexpress/htdocs/js/navigation.js b/luciexpress/htdocs/js/navigation.js index 5772a99e7..8db9e3f12 100644 --- a/luciexpress/htdocs/js/navigation.js +++ b/luciexpress/htdocs/js/navigation.js @@ -64,42 +64,26 @@ angular.module("luci") this.register = function(item){ if(!item.path) return; item = this.insertLeaf(item.path, item); - + // now also register with the routing service - if(item.page){ + //if(item.page){ (function(item){ var lazyPromise = null; $stateProvider.state(item.path.replace(".", "_"), { url: "/"+item.path, views: { "content": { - templateUrl: item.page, - //template: 'template', - /*templateProvider: function($q, $state, $templateFactory, $templateCache, $http) { - //alert(lazyPromise); - return lazyPromise; - }, - resolve: { - load: function($q, $http, $state, $templateCache, $rootScope){ - var deferred = $q.defer(); - lazyPromise = deferred.promise; - require([ - 'pages/overview', - ], function () { - $http.get("pages/"+item.path+".html", {cache: $templateCache}).then(function(html){ - deferred.resolve(html.data); - }); - }); - return deferred.promise; - } - }*/ + templateUrl: item.page || "/pages/default.html" } }, - + onEnter: function($window){ + // TODO: all these redirects seem to load page multiple times. + if(item.redirect) $window.location.href = "#!"+item.redirect; + }, luci_config: item }); })(item); - } + //} //alert(JSON.stringify(data)); return data; }; diff --git a/luciexpress/htdocs/js/tr.js b/luciexpress/htdocs/js/tr.js new file mode 100644 index 000000000..48260eae0 --- /dev/null +++ b/luciexpress/htdocs/js/tr.js @@ -0,0 +1,28 @@ +// service for managing session data +angular.module("luci") +.factory('$tr', function(gettextCatalog, $localStorage) { + return function(str){ + return gettextCatalog.getString(str); + } +}); + +angular.module("luci") +.factory('$languages', function($config, gettextCatalog, $localStorage, $window) { + gettextCatalog.currentLanguage = $localStorage.getItem("language") || "se"; + return { + getLanguages: function(){ + return Object.keys($config.languages).filter(function(lang){ + return lang in gettextCatalog.strings; + }).map(function(lang){ + return { + title: $config.languages[lang].title, + short_code: lang + } + }); + }, + setLanguage: function(short_code){ + gettextCatalog.currentLanguage = short_code; + $localStorage.setItem("language", short_code); + } + } +}); diff --git a/luciexpress/htdocs/lib/translations.js b/luciexpress/htdocs/lib/translations.js index 6d7b83d42..dd5cbe4e6 100644 --- a/luciexpress/htdocs/lib/translations.js +++ b/luciexpress/htdocs/lib/translations.js @@ -1,5 +1,6 @@ angular.module('gettext').run(['gettextCatalog', function (gettextCatalog) { /* jshint -W100 */ + gettextCatalog.setStrings('en', {}); gettextCatalog.setStrings('se', {"About":"Om","Actual Data Rate":"Nuvarande hastighet","Bit Rate":"Bithastighet","CRC Errors":"CRC fel","Cell Counter":"Cell räknare","Configured":"Konfigurerad","Current":"Nuvarande","DSL Connection":"DSL uppkoppling","DSL Mode":"DSL Mode","DSL Status Information":"DSL Status","Downstream":"Ner","Error Counter":"Fel","FEC Corrections":"FEC rättelser","Free":"Tillgänglig","Indicator Name":"Indikatornamn","Line Status":"Uppkopplingsstatus","Link Type":"Uppkopplingstyp","Loop Attenuation":"Loop attenuation","Operating Data":"Operationsdata","Received Cells":"Mottagna cells","SNR Margin":"SNR tolerans","Statistics":"Statistik","Test":"Jag testar","Transmitted Cells":"Celler sänt","Upstream":"Upp"}); /* jshint +W100 */ }]); \ No newline at end of file diff --git a/luciexpress/htdocs/pages/default.html b/luciexpress/htdocs/pages/default.html new file mode 100644 index 000000000..ce7327f29 --- /dev/null +++ b/luciexpress/htdocs/pages/default.html @@ -0,0 +1 @@ +

default.html

diff --git a/luciexpress/htdocs/pages/overview.html b/luciexpress/htdocs/pages/overview.html index 2a22834ba..f9631d9a9 100644 --- a/luciexpress/htdocs/pages/overview.html +++ b/luciexpress/htdocs/pages/overview.html @@ -1,19 +1,17 @@
- -
- topBackground + topBackground
-
Router
+
Router
- Router + Router
diff --git a/luciexpress/htdocs/pages/overview.js b/luciexpress/htdocs/pages/overview.js index c113840b3..d1f5400f6 100644 --- a/luciexpress/htdocs/pages/overview.js +++ b/luciexpress/htdocs/pages/overview.js @@ -1,3 +1,4 @@ -angular.module("luci").controller("OverviewPageCtrl", function($scope){ +angular.module("luci") +.controller("OverviewPageCtrl", function($scope){ $scope.themeUrl = ""; }); diff --git a/luciexpress/htdocs/pages/status.overview.js b/luciexpress/htdocs/pages/status.overview.js index 0dc191fda..a38c80f1a 100644 --- a/luciexpress/htdocs/pages/status.overview.js +++ b/luciexpress/htdocs/pages/status.overview.js @@ -47,7 +47,7 @@ angular.module("luci").controller("StatsOverviewCtrl", function ($scope, $sessio function (cb){$rpc.luci2.network.dhcp_leases().done(function(res){leases = res.leases || []; cb();}).fail(function(res){cb();});} ], function(err, next){ $scope.systemStatusTbl.rows = [ - [tr("Hostname"), "N/A"], + [tr("Hostname"), info.system.name], [tr("Model"), info.system.nvramver], [tr("Firmware Version"), info.system.firmware], [tr("Kernel Version"), info.system.kernel], diff --git a/luciexpress/htdocs/themes/vodaphone/css/theme.css b/luciexpress/htdocs/themes/vodaphone/css/theme.css index 184b04435..e57403dcc 100644 --- a/luciexpress/htdocs/themes/vodaphone/css/theme.css +++ b/luciexpress/htdocs/themes/vodaphone/css/theme.css @@ -18,3 +18,13 @@ div.logo { .navbar-default { box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6); } + +.luci-nav a { + color: #444; +} +.nav > li.open > a { + color: #ee0000 !important; +} +.navbar .nav > li.open > a { + color: #fff !important; +} diff --git a/luciexpress/htdocs/widgets/luci.footer.html b/luciexpress/htdocs/widgets/luci.footer.html new file mode 100644 index 000000000..ed8815d27 --- /dev/null +++ b/luciexpress/htdocs/widgets/luci.footer.html @@ -0,0 +1,11 @@ +
+
+ + {{lang.title}} + {{$last ? '' : ' | '}} + +
+
+ WAN IP Address: {{wanip}} | Firmware version: {{firmwareVersion}} +
+
diff --git a/luciexpress/htdocs/widgets/luci.footer.js b/luciexpress/htdocs/widgets/luci.footer.js new file mode 100644 index 000000000..f7286a291 --- /dev/null +++ b/luciexpress/htdocs/widgets/luci.footer.js @@ -0,0 +1,30 @@ +angular.module("luci") +.directive("luciFooter", function(){ + return { + // accepted parameters for this tag + scope: { + }, + templateUrl: "widgets/luci.footer.html", + controller: "LuciFooterControl", + controllerAs: "ctrl" + }; +}) +.controller("LuciFooterControl", function($scope, $rpc, $languages, gettextCatalog){ + // TODO: move this into a higher level controller maybe? + $scope.languages = $languages.getLanguages(); + $scope.isActiveLanguage = function(lang){ + return gettextCatalog.currentLanguage == lang.short_code; + } + $scope.setLanguage = function(lang){ + $languages.setLanguage(lang.short_code); + }; + $rpc.network.interface.status({ + "interface": "wan" + }).done(function(wan){ + $rpc.router.info().done(function(info){ + $scope.firmwareVersion = info.system.firmware; + $scope.wanip = wan["ipv4-address"][0].address; + $scope.$apply(); + }); + }); +}); diff --git a/luciexpress/htdocs/widgets/luci.layout.naked.html b/luciexpress/htdocs/widgets/luci.layout.naked.html index d165baa87..fb2e171d8 100644 --- a/luciexpress/htdocs/widgets/luci.layout.naked.html +++ b/luciexpress/htdocs/widgets/luci.layout.naked.html @@ -8,4 +8,9 @@
+
+
+ +
+
diff --git a/luciexpress/htdocs/widgets/luci.layout.single_column.html b/luciexpress/htdocs/widgets/luci.layout.single_column.html index d165baa87..6db7f599f 100644 --- a/luciexpress/htdocs/widgets/luci.layout.single_column.html +++ b/luciexpress/htdocs/widgets/luci.layout.single_column.html @@ -1,11 +1,21 @@ -
-
- -
+
+
+
+ +
-
-
- +
+
+ +
+
+ +
+
+
+
+ +
diff --git a/luciexpress/htdocs/widgets/luci.layout.with_sidebar.html b/luciexpress/htdocs/widgets/luci.layout.with_sidebar.html index f647522a2..a272b6c0e 100644 --- a/luciexpress/htdocs/widgets/luci.layout.with_sidebar.html +++ b/luciexpress/htdocs/widgets/luci.layout.with_sidebar.html @@ -1,14 +1,24 @@ -
-
- -
- -
-
- +
+
+
+
-
- + +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
diff --git a/luciexpress/htdocs/widgets/luci.nav.html b/luciexpress/htdocs/widgets/luci.nav.html index 0a0c52355..103e1d004 100644 --- a/luciexpress/htdocs/widgets/luci.nav.html +++ b/luciexpress/htdocs/widgets/luci.nav.html @@ -1,4 +1,4 @@ -