mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-11 19:48:45 +01:00
Added phone schedule
This commit is contained in:
parent
818988b375
commit
8ea842caa5
7 changed files with 149 additions and 32 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<luci-layout-with-sidebar>
|
||||
<div ng-controller="InternetFirewallPageCtrl">
|
||||
<h2 translate>Firewall settings</h3>
|
||||
<h2 translate>Firewall settings</h2>
|
||||
<p translate>Your EasyBox provides extensive firewall functionality which protects against common attacks. Vodafone recommends not to turn off firewall.</p>
|
||||
<table class="table">
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -2,8 +2,45 @@
|
|||
<div ng-controller="PhoneNumbersPageCtrl">
|
||||
<luci-config-section>
|
||||
<luci-config-heading>{{ 'Phone Numbers' | translate }}</luci-config-heading>
|
||||
<luci-config-info>{{ 'phone.speed_dialing.info' | translate }}</luci-config-info>
|
||||
|
||||
<luci-config-info>{{ 'phone.numbers.info' | translate }}</luci-config-info>
|
||||
<luci-expandable title="{{num.name.value}}" ng-repeat="num in phone_numbers track by $index">
|
||||
<luci-config-lines>
|
||||
<luci-config-line title="Name">
|
||||
<input type="text" class="form-control" ng-model="num.name.value"/>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="Phone Number">
|
||||
{{num.username.value}}
|
||||
</luci-config-line>
|
||||
<luci-config-line title="Incoming Phone Lines">
|
||||
<div class="form-group col-md-6" ng-repeat="line in phone_lines">
|
||||
<label>{{line.name.value}}</label>
|
||||
<input type="checkbox"/>
|
||||
</div>
|
||||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
</luci-expandable>
|
||||
<luci-config-heading>{{ 'Phone Lines' | translate }}</luci-config-heading>
|
||||
<luci-config-info>{{ 'phone.lines.info' | translate }}</luci-config-info>
|
||||
<luci-expandable title="{{line.name.value}}" ng-repeat="line in phone_lines track by $index">
|
||||
<luci-config-lines>
|
||||
<luci-config-line title="Name">
|
||||
<input type="text" class="form-control" ng-model="line.name.value"/>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="Internal Number">
|
||||
{{line.extension.value}}
|
||||
</luci-config-line>
|
||||
<luci-config-line title="Outgoing Calls Number">
|
||||
<luci-select ng-model="line.sip_account.value" ng-items="allSipAccounts"/>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="Call Waiting">
|
||||
<switch ng-model="line.callwaiting.value" class="green"/>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="Call ID Restriction">
|
||||
<switch ng-model="line.clir.value" class="green"/>
|
||||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
</luci-expandable>
|
||||
</luci-config-section>
|
||||
<luci-config-apply/>
|
||||
</div>
|
||||
</luci-layout-with-sidebar>
|
||||
|
|
|
|||
|
|
@ -1,26 +1,16 @@
|
|||
/*
|
||||
* juci - javascript universal client interface
|
||||
*
|
||||
* Project Author: Martin K. Schröder <mkschreder.uk@gmail.com>
|
||||
*
|
||||
* 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 <mkschreder.uk@gmail.com>
|
||||
|
||||
$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();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,10 +9,41 @@
|
|||
<switch id="enabled" name="enabled" ng-model="settings.scheduling.value" class="green"></switch>
|
||||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
<luci-config-lines ng-show="settings.scheduling.value">
|
||||
TODO
|
||||
</luci-config-lines>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th translate>Day</th>
|
||||
<th translate>Time</th>
|
||||
<th translate>Number</th>
|
||||
<!--<th translate>Status</th>-->
|
||||
<th></th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="item in schedules">
|
||||
<td>{{ item.days.value.join(",") }}</td>
|
||||
<td>{{ item.time.value }}</td>
|
||||
<td>{{ item.number.value }}</td>
|
||||
<!--<td>{{ item.enabled.value }}</td>-->
|
||||
<td style="width: 1%"><button class="btn btn-default" ng-click="onEditSchedule(item)"><i class="fa fa-pencil" style="{{editColor}}"></i></button></td>
|
||||
<td style="width: 1%"><button class="btn btn-default" ng-click="onDeleteSchedule(item)"><i class="fa fa-trash-o"></i></button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4"></td>
|
||||
<td style="width: 1%"><button class="btn btn-default" ng-click="onAddSchedule()"><i class="fa fa-plus"></i></button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</luci-config-section>
|
||||
<luci-config-apply></luci-config-apply>
|
||||
<modal title="Add a new Ringing Schedule" ng-show="showScheduleDialog" on-accept="onAcceptSchedule()"
|
||||
on-dismiss="onDismissSchedule()" dismiss-label="Cancel" accept-label="Save">
|
||||
<luci-config-lines>
|
||||
<luci-config-line title="Phone Number">
|
||||
<luci-select ng-model="schedule.number.value" ng-items="allSipAccounts" placeholder="Pick Phone Number"/>
|
||||
</luci-config-line>
|
||||
</luci-config-line>
|
||||
<uci-wireless-schedule-edit ng-model="schedule" schedule="schedule" valid="scheduleValid"></uci-wireless-schedule-edit>
|
||||
<div class="alert alert-danger" ng-show="errors && errors.length"><ul><li ng-repeat="e in errors">{{e|translate}}</li></ul></div>
|
||||
</modal>
|
||||
</div>
|
||||
</luci-layout-with-sidebar>
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<form name="ruleForm" class="form-horizontal" novalidate>
|
||||
<div class="modal-body">
|
||||
<!--<div class="modal-body">-->
|
||||
<luci-config-lines>
|
||||
<luci-config-line title="{{'Time Frame'|translate}}">
|
||||
<luci-select ng-model="selectedTimeFrame" on-change="onChangeDays()" ng-items="allTimeFrames"></luci-select>
|
||||
|
|
@ -17,5 +17,5 @@
|
|||
<luci-input-timespan ng-model="schedule.time" luci-timespan-validator="schedule.time.value"></luci-input-timespan>
|
||||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
</div>
|
||||
<!--</div>-->
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue