Added lots of new stuff

This commit is contained in:
Martin Schröder 2015-04-21 17:59:26 +02:00 committed by Martin Schröder
parent 2f04d960c3
commit ae3cb213b5
29 changed files with 256 additions and 90 deletions

View file

@ -33,18 +33,7 @@
</div>
</div>
<div ui-view="content" style="min-height: 1000px;"></div>
<div class="container" >
<div class="row" style="color: #777">
<div class="col-md-1">
</div>
<div class="col-md-6">
Turkish German English
</div>
<div class="col-md-5">
WAN IP Address: 217.34.98.17 | Firmware version: AT904X-03.01
</div>
</div>
</div>
<div style="margin-bottom: 40px"></div>
<script src="/bower_components/async/lib/async.js"></script>
<script src="/bower_components/requirejs/require.js"></script>
@ -58,7 +47,7 @@
<script src="/lib/angular-ui-bootstrap-luci.min.js"></script>
<script src="/lib/jquery-jsonrpc.js"></script>
<script src="/lib/translations.js"></script>
<script src="/lib/luci-autogen.js"></script>
<!--<script src="/lib/luci-autogen.js"></script>-->
<!--<script src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>-->
<script src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="/bower_components/angular-ui-switch/angular-ui-switch.min.js"></script>
@ -73,6 +62,8 @@
<script src="js/navigation.js"></script>
<script src="js/rpc.js"></script>
<script src="js/session.js"></script>
<script src="js/tr.js"></script>
<script src="js/localStorage.js"></script>
<script src="pages/login.js"></script>
<script src="pages/overview.js"></script>
<script src="pages/internet.dns.js"></script>
@ -110,6 +101,7 @@
<script src="widgets/luci.nav.js"></script>
<script src="widgets/luci.progress.js"></script>
<script src="widgets/luci.table.js"></script>
<script src="widgets/luci.footer.js"></script>
<script src="widgets/luci.layout.single_column.js"></script>
<script src="widgets/luci.layout.with_sidebar.js"></script>
<script src="widgets/luci.layout.naked.js"></script>

View file

@ -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";
}

View file

@ -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"
]
}

View file

@ -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);
}
};
});

View file

@ -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;
};

View file

@ -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);
}
}
});

View file

@ -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 */
}]);

View file

@ -0,0 +1 @@
<p>default.html</p>

View file

@ -1,19 +1,17 @@
<luci-layout-single-column>
<div ng-controller="OverviewPageCtrl">
<div class="row">
<div class="col-md-5">
<img src="{{themeUrl}}/img/overview-background-top-left-vdsl.jpg" id="Image-Maps-Com-image-maps-2015-04-08-033120" usemap="#image-maps-2015-04-08-033120" alt="topBackground">
<img src="/img/overview-background-top-left-vdsl.jpg" id="Image-Maps-Com-image-maps-2015-04-08-033120" usemap="#image-maps-2015-04-08-033120" alt="topBackground">
</div>
<div class="col-md-6">
<center><img src="{{themeUrl}}/img/vox-2.5-804.jpg" usemap="#routerBot" alt="Router"></center>
<center><img src="/img/vox-2.5-804.jpg" usemap="#routerBot" alt="Router"></center>
</div>
</div>
<div class="row">
<div class="col-md-12">
<center>
<img src="{{themeUrl}}/img/overview-background-bot.jpg" id="Image-Maps-Com-image-maps-2015-04-08-032815" usemap="#image-maps-2015-04-08-032815" alt="Router">
<img src="/img/overview-background-bot.jpg" id="Image-Maps-Com-image-maps-2015-04-08-032815" usemap="#image-maps-2015-04-08-032815" alt="Router">
</center>
</div>
</div>

View file

@ -1,3 +1,4 @@
angular.module("luci").controller("OverviewPageCtrl", function($scope){
angular.module("luci")
.controller("OverviewPageCtrl", function($scope){
$scope.themeUrl = "";
});

View file

@ -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],

View file

@ -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;
}

View file

@ -0,0 +1,11 @@
<div class="row" style="color: #777">
<div class="col-md-4">
<span ng-repeat="lang in languages">
<a style="text-decoration: {{isActiveLanguage(lang)?'underline':'none'}}; color: inherit;" href="" ng-click="setLanguage(lang)">{{lang.title}}</a>
{{$last ? '' : ' | '}}
</span>
</div>
<div class="col-md-8" style="text-align: right;">
WAN IP Address: {{wanip}} | Firmware version: {{firmwareVersion}}
</div>
</div>

View file

@ -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();
});
});
});

View file

@ -8,4 +8,9 @@
<ng-transclude></ng-transclude>
</div>
</div>
<div class="row">
<div class="col-md-12">
<luci-footer></luci-footer>
</div>
</div>
</div>

View file

@ -1,11 +1,21 @@
<div class="container" role="main">
<div class="row">
<luci-navbar></luci-navbar>
</div>
<div>
<div class="container" role="main" style="min-height: 1000px;">
<div class="row">
<luci-navbar></luci-navbar>
</div>
<div class="row">
<div class="col-md-12">
<ng-transclude></ng-transclude>
<div class="row">
<div class="col-md-12">
<ng-transclude></ng-transclude>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<luci-footer></luci-footer>
</div>
</div>
</div>
</div>

View file

@ -1,14 +1,24 @@
<div class="container" role="main">
<div class="row">
<luci-navbar></luci-navbar>
</div>
<div class="row">
<div class="col-md-3">
<luci-nav></luci-nav>
<div>
<div class="container" role="main" style="min-height: 1000px;">
<div class="row">
<luci-navbar></luci-navbar>
</div>
<div class="col-md-9">
<ng-transclude></ng-transclude>
<div class="row">
<div class="col-md-3">
<luci-nav></luci-nav>
</div>
<div class="col-md-9">
<ng-transclude></ng-transclude>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<luci-footer></luci-footer>
</div>
</div>
</div>
</div>

View file

@ -1,4 +1,4 @@
<nav>
<nav class="luci-nav" >
<ul class="nav nav-pills nav-stacked span2">
<li class="dropdown" ng-repeat="item in tree.children_list" ng-show="itemVisible(item)">
<a href="#!{{item.path}}" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">{{item.text | translate}}</a>

View file

@ -15,22 +15,14 @@ angular.module("luci")
var subtree = path.split(".")[0];
$scope.tree = $navigation.tree(subtree);
$scope.hasChildren = function(menu){
return Object.keys(menu.children) > 0;
}
$scope.isActive = function (viewLocation) {
return viewLocation === $location.path();
};
$scope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams){
var path = $location.path().replace(/^\/+|\/+$/g, '');
var subtree = path.split(".")[0];
$scope.tree = $navigation.tree(subtree);
// todo: this does not seem right
setTimeout(function(){
$("nav ul a").removeClass("open");
$("nav ul a[href='#!"+path+"']").parent().addClass("open");
}, 0);
});
$scope.itemVisible = function(item){
if(!item.modes.length) return true;
else if(item.modes && item.modes.indexOf($config.mode) == -1) {
@ -38,6 +30,22 @@ angular.module("luci")
}
else return true;
}
function activate(){
var path = $location.path().replace(/^\/+|\/+$/g, '');
var subtree = path.split(".")[0];
$scope.tree = $navigation.tree(subtree);
setTimeout(function(){
$("nav ul a").removeClass("open");
$("nav ul a[href='#!"+path+"']").parent().addClass("open");
}, 0);
};
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams){
activate();
});
activate();
/*$scope.$on('$locationChangeSuccess', function () {
var path = $location.path().replace(/^\/+|\/+$/g, '');
var subtree = path.split(".")[0];

View file

@ -11,7 +11,7 @@ angular.module("luci")
controllerAs: "ctrl"
};
})
.controller("NavigationCtrl", function($scope, $navigation, $config, $rpc){
.controller("NavigationCtrl", function($scope, $location, $navigation, $rootScope, $config, $rpc){
$scope.tree = $navigation.tree();
$scope.hasChildren = function(menu){
@ -36,8 +36,25 @@ angular.module("luci")
theme.attr('href',themeurl+"/css/theme.css");
});
});
function activate(){
var path = $location.path().replace(/^\/+|\/+$/g, '');
var subtree = path.split(".")[0];
$scope.tree = $navigation.tree();
setTimeout(function(){
$("ul.nav li a").parent().removeClass("open");
$("ul.nav li a[href='#!"+subtree+"']").addClass("open");
$("ul.nav li a[href='#!"+subtree+"']").parent().addClass("open");
}, 0);
};
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams){
activate();
});
activate();
});
/*
angular.module('autoActive', [])
.directive('autoActive', ['$location', function ($location) {
return {
@ -63,5 +80,5 @@ angular.module('autoActive', [])
scope.$on('$locationChangeSuccess', setActive);
}
}
}]);
}]);*/

BIN
luciexpress/po/en.mo Normal file

Binary file not shown.

24
luciexpress/po/en.po Normal file
View file

@ -0,0 +1,24 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"X-Generator: Poedit 1.5.4\n"
"Language: en\n"
#: htdocs/pages/status.dsl.html:3
msgid "DSL Status"
msgstr ""
#: htdocs/widgets/luci.navbar.html:29
msgid "Theme"
msgstr ""
#: htdocs/widgets/luci.login.html:3
msgid "You are logged in!"
msgstr ""

View file

@ -4,14 +4,14 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Project-Id-Version: \n"
#: htdocs/views/about.html:2
msgid "About"
#: htdocs/pages/status.dsl.html:3
msgid "DSL Status"
msgstr ""
#: htdocs/views/status.overview.html:42
msgid "Free"
#: htdocs/widgets/luci.navbar.html:29
msgid "Theme"
msgstr ""
#: htdocs/views/about.html:3
msgid "Test"
#: htdocs/widgets/luci.login.html:3
msgid "You are logged in!"
msgstr ""

View file

@ -40,7 +40,8 @@
],
"router": [
"dslstats",
"info"
"info",
"clients"
],
"system": [
"info",

View file

@ -1,7 +1,7 @@
{
"internet": {
"title": "Internet",
"view": "internet.firewall",
"redirect": "internet.firewall",
"index": 30
},
"internet/firewall": {

View file

@ -1,7 +1,7 @@
{
"phone": {
"title": "Phone",
"view": "phone.call_log",
"redirect": "phone.call_log",
"index": 20
},
"phone/call_log": {

View file

@ -1,7 +1,7 @@
{
"settings": {
"title": "Settings",
"view": "settings.password",
"redirect": "settings.password",
"index": 50
},
"settings/password": {
@ -30,6 +30,7 @@
},
"settings/network": {
"title": "Network",
"modes": [ "expert" ],
"acls": [ ],
"view": "settings.network",
"index": 50

View file

@ -1,7 +1,7 @@
{
"status": {
"title": "Status",
"view": "status.overview",
"redirect": "status.overview",
"index": 60
},
"status/overview": {
@ -36,6 +36,7 @@
},
"status/events": {
"title": "Events",
"modes": [ "expert" ],
"acls": [ "status" ],
"view": "status.events",
"index": 50
@ -54,6 +55,7 @@
},
"status/nat": {
"title": "NAT",
"modes": [ "expert" ],
"acls": [ "status" ],
"view": "status.nat",
"index": 80

View file

@ -1,7 +1,7 @@
{
"wifi": {
"title": "WiFi",
"view": "wifi.general",
"redirect": "wifi.general",
"index": 40
},
"wifi/general": {