From 8ea842caa5ac20ced09044607fbdd9106d5367e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schr=C3=B6der?= Date: Tue, 26 May 2015 14:44:07 +0200 Subject: [PATCH] Added phone schedule --- .../internet/pages/internet.firewall.html | 2 +- .../plugins/phone/pages/phone.numbers.html | 41 +++++++++++++- .../plugins/phone/pages/phone.numbers.js | 38 +++++-------- .../phone/pages/phone.ringing_schedule.html | 37 +++++++++++-- .../phone/pages/phone.ringing_schedule.js | 54 +++++++++++++++++++ luciexpress/htdocs/plugins/phone/phone.js | 5 ++ .../widgets/uci.wireless.schedule.edit.html | 4 +- 7 files changed, 149 insertions(+), 32 deletions(-) diff --git a/luciexpress/htdocs/plugins/internet/pages/internet.firewall.html b/luciexpress/htdocs/plugins/internet/pages/internet.firewall.html index f5030305c..420578f39 100644 --- a/luciexpress/htdocs/plugins/internet/pages/internet.firewall.html +++ b/luciexpress/htdocs/plugins/internet/pages/internet.firewall.html @@ -1,6 +1,6 @@
-

Firewall settings

+

Firewall settings

Your EasyBox provides extensive firewall functionality which protects against common attacks. Vodafone recommends not to turn off firewall.

diff --git a/luciexpress/htdocs/plugins/phone/pages/phone.numbers.html b/luciexpress/htdocs/plugins/phone/pages/phone.numbers.html index 1d8473a99..ad6f24617 100644 --- a/luciexpress/htdocs/plugins/phone/pages/phone.numbers.html +++ b/luciexpress/htdocs/plugins/phone/pages/phone.numbers.html @@ -2,8 +2,45 @@
{{ 'Phone Numbers' | translate }} - {{ 'phone.speed_dialing.info' | translate }} - + {{ 'phone.numbers.info' | translate }} + + + + + + + {{num.username.value}} + + +
+ + +
+
+
+
+ {{ 'Phone Lines' | translate }} + {{ 'phone.lines.info' | translate }} + + + + + + + {{line.extension.value}} + + + + + + + + + + + +
+
diff --git a/luciexpress/htdocs/plugins/phone/pages/phone.numbers.js b/luciexpress/htdocs/plugins/phone/pages/phone.numbers.js index c1864e4a4..52077cbd3 100644 --- a/luciexpress/htdocs/plugins/phone/pages/phone.numbers.js +++ b/luciexpress/htdocs/plugins/phone/pages/phone.numbers.js @@ -1,26 +1,16 @@ -/* - * juci - javascript universal client interface - * - * Project Author: Martin K. Schröder - * - * Copyright (C) 2012-2013 Inteno Broadband Technology AB. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation. - * - * 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ +//! Author: Martin K. Schröder -$juci.module("phone") -.controller("PhoneNumbersPageCtrl", function($scope){ - +JUCI.app +.controller("PhoneNumbersPageCtrl", function($scope, $uci){ + $uci.sync("voice_client").done(function(){ + $scope.phone_lines = $uci.voice_client["@brcm_line"]; + $scope.phone_numbers = $uci.voice_client["@sip_service_provider"]; + $scope.allSipAccounts = $scope.phone_numbers.map(function(x){ + return { + label: x.name.value, + value: x[".name"] + } + }); + $scope.$apply(); + }); }); diff --git a/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.html b/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.html index f92a68b73..0a1fe3c85 100644 --- a/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.html +++ b/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.html @@ -9,10 +9,41 @@ - - TODO - +
+ + + + + + + + + + + + + + + + + + + + + + +
DayTimeNumber
{{ item.days.value.join(",") }}{{ item.time.value }}{{ item.number.value }}
+ + + + + + + +
  • {{e|translate}}
+
diff --git a/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.js b/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.js index 87533a4e4..06b41db46 100644 --- a/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.js +++ b/luciexpress/htdocs/plugins/phone/pages/phone.ringing_schedule.js @@ -25,5 +25,59 @@ $juci.module("phone") $uci.sync(["voice_client"]).done(function(){ // TODO add config for phone //if($uci.voice_client && $uci.voice_client.settings) $scope.settings = $uci.voice_client.settings; + $scope.schedules = $uci.voice_client["@schedule"]; + $scope.allSipAccounts = $scope.phone_numbers.map(function(x){ + return { + label: x.name.value, + value: x[".name"] + } + }); }); + + $scope.onAcceptSchedule = function(){ + //$uci.save().done(function(){ + var schedule = $scope.schedule; + var errors = schedule.$getErrors(); + + if(errors && errors.length){ + $scope.errors = errors; + } else { + $scope.errors = []; + $scope.showScheduleDialog = 0; + } + } + + $scope.onDismissSchedule = function(schedule){ + if($scope.schedule[".new"]){ + $scope.schedule.$delete().done(function(){ + $scope.showScheduleDialog = 0; + $scope.$apply(); + }); + } else { + $scope.showScheduleDialog = 0; + } + } + + $scope.onAddSchedule = function(){ + $uci.voice_client.create({".type": "schedule"}).done(function(item){ + $scope.schedule = item; + $scope.schedule[".new"] = true; + $scope.showScheduleDialog = 1; + $scope.$apply(); + console.log("Added new schedule!"); + }).fail(function(err){ + console.log("Failed to create schedule!"); + }); ; + } + + $scope.onEditSchedule = function(sched){ + console.log("Editing: "+sched[".name"]); + $scope.schedule = sched; + $scope.showScheduleDialog = 1; + } + $scope.onDeleteSchedule = function(sched){ + sched.$delete().always(function(){ + $scope.$apply(); + }); + } }); diff --git a/luciexpress/htdocs/plugins/phone/phone.js b/luciexpress/htdocs/plugins/phone/phone.js index 023e1fd33..f8ece26ce 100644 --- a/luciexpress/htdocs/plugins/phone/phone.js +++ b/luciexpress/htdocs/plugins/phone/phone.js @@ -154,3 +154,8 @@ UCI.voice_client.$registerSectionType("speed_dial", { "tone": { dvalue: 1, type: Number }, "number": { dvalue: "", type: String } }); +UCI.voice_client.$registerSectionType("schedule", { + "days": { dvalue: [], type: Array, allow: ["mon", "tue", "wed", "thu", "fri", "sat", "sun"], validator: UCI.validators.WeekDayListValidator}, + "time": { dvalue: "", type: String, validator: UCI.validators.TimespanValidator}, + "number": { dvalue: "", type: String } +}); diff --git a/luciexpress/htdocs/plugins/wifi/widgets/uci.wireless.schedule.edit.html b/luciexpress/htdocs/plugins/wifi/widgets/uci.wireless.schedule.edit.html index d6be31e1c..c72dedd48 100644 --- a/luciexpress/htdocs/plugins/wifi/widgets/uci.wireless.schedule.edit.html +++ b/luciexpress/htdocs/plugins/wifi/widgets/uci.wireless.schedule.edit.html @@ -1,5 +1,5 @@
- +