Skip to content

Commit 1c9202e

Browse files
jfinstromtm1000
authored andcommitted
Update did, routing, trunk grids. clean up some of the php strict errors. Fix actions on did
1 parent 7ac00ad commit 1c9202e

15 files changed

+125
-231
lines changed

Core.class.php

+13-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function ajaxRequest($req, &$setting) {
2525
switch($req) {
2626
case "quickcreate":
2727
case "delete":
28+
case "getJSON":
2829
return true;
2930
break;
3031
}
@@ -62,6 +63,14 @@ public function ajaxHandler() {
6263
$status = $this->processQuickCreate($_POST['tech'], $_POST['extension'], $_POST);
6364
return $status;
6465
break;
66+
case "getJSON":
67+
switch ($_REQUEST['jdata']) {
68+
case 'allDID':
69+
$dids = $this->getAllDIDs();
70+
return array_values($dids);
71+
break;
72+
}
73+
break;
6574
}
6675
}
6776

@@ -894,9 +903,9 @@ public function doConfigPageInit($page) {
894903
}// $page == "did"
895904

896905
if ($page == "astmodules") {
897-
$action = $request['action'];
898-
$section = $request['section'];
899-
$module = $request['module'];
906+
$action = isset($request['action'])?$request['action']:'';
907+
$section = isset($request['section'])?$request['section']:'';
908+
$module = isset($request['module'])?$request['module']:'';
900909
switch($action){
901910
case 'add':
902911
switch($section){
@@ -1425,6 +1434,7 @@ public function getAllDIDs($order='extension') {
14251434
return $results;
14261435
}
14271436

1437+
14281438
public function addDID($settings) {
14291439
//Strip <> just to be on the safe side otherwise this is not deleteable from the GUI
14301440
$invalidDIDChars = array('<', '>');

functions.inc.php

+1
Original file line numberDiff line numberDiff line change
@@ -5856,6 +5856,7 @@ function core_getAmpUser($username) {
58565856
$user["sections"] = explode(";",$results[0][5]);
58575857
return $user;
58585858
} else {
5859+
58595860
return false;
58605861
}
58615862
}

page.ampusers.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,13 @@
119119

120120
} else {
121121
// set defaults
122+
$user = array(
123+
'sections' => '',
124+
);
122125
$title = '<h2>' . _("Add Administrator") . '</h2>';
123126
$username = "";
124127
$password = "";
125-
128+
$password_sha1 ="";
126129
$extension_low = "";
127130
$extension_high = "";
128131

@@ -186,7 +189,7 @@
186189
<div class="container-fluid">
187190
<div class="row">
188191
<div class="col-sm-9">
189-
<?php if($authtypewarn){ echo $authtypewarn; } ?>
192+
<?php if(isset($authtypewarn)){ echo $authtypewarn; } ?>
190193
<div class="fpbx-container">
191194
<?php echo $title ?>
192195
<form role="form" autocomplete="off" class="fpbx-submit" name="ampuser" id="ampuser" action="config.php?display=ampusers" method="post" data-fpbx-delete="config.php?display=<?php echo urlencode($display) ?>&amp;userdisplay=<?php echo urlencode($userdisplay) ?>&amp;action=delampuser">

page.dahdichandids.php

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
$action = 'edit';
1414
}else{
1515
$action = 'add';
16+
$description = '';
17+
$channel = '';
18+
$did = '';
1619
}
1720
echo load_view(__DIR__."/views/dahdichandids/view.php", array('description' => $description, 'channel' => $channel, 'did' => $did, 'action' => $action));
1821
break;

page.did.php

+13-6
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,20 @@
9595
switch($view){
9696
case "form":
9797
$content = load_view(__DIR__.'/views/did/routeform.php', $formdata);
98+
$mwidth = '9';
99+
$bootnav = '
100+
<div class="col-sm-3 hidden-xs bootnav">
101+
<div class="list-group">';
102+
$bootnav .= load_view(__DIR__.'/views/did/rnav.php');
103+
$bootnav .= '
104+
</div>
105+
</div>
106+
';
98107
break;
99108
default:
100109
$content = load_view(__DIR__.'/views/did/didgrid.php');
110+
$bootnav = '';
111+
$mwidth = '12';
101112
break;
102113
}
103114

@@ -106,18 +117,14 @@
106117
<h1><?php echo _('Inbound Routes')?></h1>
107118
<div class = "display no-border">
108119
<div class="row">
109-
<div class="col-sm-9">
120+
<div class="col-sm-<?php echo $mwidth?>">
110121
<div class="fpbx-container">
111122
<div class="display no-border">
112123
<?php echo $content ?>
113124
</div>
114125
</div>
115126
</div>
116-
<div class="col-sm-3 hidden-xs bootnav">
117-
<div class="list-group">
118-
<?php show_view(__DIR__.'/views/did/rnav.php');?>
119-
</div>
120-
</div>
127+
<?php echo $bootnav?>
121128
</div>
122129
</div>
123130
</div>

page.routing.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
</div>
100100
</div>
101101
</div>
102-
<div class="col-sm-3 hidden-xs bootnav">
102+
<div class="col-sm-3 hidden-xs bootnav <?php echo !isset($_REQUEST['view'])?'hidden':''?>">
103103
<div class="list-group">
104104
<?php echo load_view(__DIR__.'/views/routing/bootnav.php');?>
105105
</div>

views/dahdichandids/didForm.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
?>
3-
<form name="editDAHDIchandid" autocomplete = "off" class="fpbx-submit" action="" method="post" data-fpbx-delete="config.php?display=dahdichandids&action=delete&channel=<?php echo $row['channel']; ?>">
3+
<form name="editDAHDIchandid" autocomplete = "off" class="fpbx-submit" action="" method="post" data-fpbx-delete="config.php?display=dahdichandids&action=delete&channel=<?php echo $channel ?>">
44
<input type = "hidden" name = "action" value="<?php echo $action?>">
55
<!--Channel-->
66
<div class="element-container">
@@ -13,7 +13,7 @@
1313
<i class="fa fa-question-circle fpbx-help-icon" data-for="channel"></i>
1414
</div>
1515
<div class="col-md-9">
16-
<input type="text" class="form-control" id="channel" name="channel" value="<?php echo $channel; ?>" tabindex="<?php echo ++$tabindex;?>">
16+
<input type="text" class="form-control" id="channel" name="channel" value="<?php echo $channel; ?>">
1717
</div>
1818
</div>
1919
</div>
@@ -37,7 +37,7 @@
3737
<i class="fa fa-question-circle fpbx-help-icon" data-for="description"></i>
3838
</div>
3939
<div class="col-md-9">
40-
<input type="text" class="form-control" id="description" name="description" value="<?php echo $description; ?>" tabindex="<?php echo ++$tabindex;?>">
40+
<input type="text" class="form-control" id="description" name="description" value="<?php echo $description; ?>">
4141
</div>
4242
</div>
4343
</div>
@@ -61,7 +61,7 @@
6161
<i class="fa fa-question-circle fpbx-help-icon" data-for="did"></i>
6262
</div>
6363
<div class="col-md-9">
64-
<input type="text" class="form-control" id="did" name="did" value="<?php echo $did; ?>" tabindex="<?php echo ++$tabindex;?>">
64+
<input type="text" class="form-control" id="did" name="did" value="<?php echo $did; ?>">
6565
</div>
6666
</div>
6767
</div>

views/did/didgrid.php

+32-158
Original file line numberDiff line numberDiff line change
@@ -1,163 +1,37 @@
1-
<?php
2-
//directdid
3-
$inroutes = core_did_list('directdid');
4-
foreach ($inroutes as $key => $did_items) {
5-
$did_dest = explode(',',$did_items['destination']);
6-
if (!isset($did_dest[0]) || $did_dest[0] != 'from-did-direct') {
7-
unset($inroutes[$key]);
1+
2+
<a href="config.php?display=did&view=form" class="btn btn-default"><i class="fa fa-plus">&nbsp;<?php echo _("Add Inbound Route")?></i></a>
3+
<table id="didtable" data-url="ajax.php?module=core&command=getJSON&jdata=allDID" data-cache="false" data-pagination="true" data-search="true" data-toggle="table" class="table table-striped">
4+
<thead>
5+
<tr>
6+
<th data-field="description" data-sortable="true"><?php echo _("Description")?></th>
7+
<th data-field="cidnum" data-searchable="true" data-sortable="true" data-formatter="DIDnumberFormatter"><?php echo _("CID")?></th>
8+
<th data-field="extension" data-sortable="true" data-searchable="true" data-formatter="DIDnumberFormatter"><?php echo _("DID")?></th>
9+
<th data-field="destination" data-formatter="DIDdestFormatter"><?php echo _("Destination")?></th>
10+
<th data-field="extension" data-formatter="DIDlinkFormatter"><?php echo _("Actions")?></th>
11+
</tr>
12+
</thead>
13+
</table>
14+
15+
<script type="text/javascript">
16+
function DIDnumberFormatter(value){
17+
if(value.length == 0){
18+
return _("Any");
19+
}else{
20+
return value;
821
}
922
}
10-
$directdidroutes = $inroutes;
11-
//incoming
12-
$inroutes = core_did_list('incoming');
13-
foreach ($inroutes as $key => $did_items) {
14-
$did_dest = explode(',',$did_items['destination']);
15-
if (!isset($did_dest[0]) || $did_dest[0] == 'from-did-direct') {
16-
unset($inroutes[$key]);
23+
function DIDdestFormatter(value){
24+
if(value.length == 0){
25+
return _("No Destination");
26+
}else{
27+
var dest = value.split(',');
28+
return dest[0];
1729
}
1830
}
19-
$incomingroutes = $inroutes;
20-
//unassigned
21-
$inroutes = core_did_list('unassigned');
22-
foreach ($inroutes as $key => $did_items) {
23-
if (isset($did_items['destination']) && $did_items['destination'] != '') {
24-
unset($inroutes[$key]);
25-
}
26-
}
27-
$unassignedroutes = $inroutes;
28-
//All
29-
$allroutes = core_did_list('');
30-
$allrrows = $didrrows = $uarrows = $incrrows = '';
31-
foreach($allroutes as $route){
32-
$dest = explode(',',$route['destination']);
33-
$edis = urlencode($route['extension'].'/'.$route['cidnum']);
34-
$displaydesc = ( (trim($route['description']) == "") ? _("None") : $route['description'] );
35-
$displaydid = ( (trim($route['extension']) == "") ? _("any DID") : $route['extension'] );
36-
$displaycid = ( (trim($route['cidnum']) == "") ? _("any CID") : $route['cidnum'] );
37-
$allrrows .= '<tr><td>'.$displaydesc.'</td><td>'.$displaydid.'</td><td>'.$displaycid.'</td><td>'.$dest[1].'</td><td class="actions"><a href="config.php?display=did&view=form&extdisplay='.$edis.'"><i class="fa fa-pencil-square-o"></i></a><i class="fa fa-times"></i></td></tr>';
38-
}
39-
foreach($incomingroutes as $route){
40-
$dest = explode(',',$route['destination']);
41-
$edis = urlencode($route['extension'].'/'.$route['cidnum']);
42-
$displaydesc = ( (trim($route['description']) == "") ? _("None") : $route['description'] );
43-
$displaydid = ( (trim($route['extension']) == "") ? _("any DID") : $route['extension'] );
44-
$displaycid = ( (trim($route['cidnum']) == "") ? _("any CID") : $route['cidnum'] );
45-
$incrrows .= '<tr><td>'.$displaydesc.'</td><td>'.$displaydid.'</td><td>'.$displaycid.'</td><td>'.$dest[1].'</td><td class="actions"><a href="config.php?display=did&view=form&extdisplay='.$edis.'"><i class="fa fa-pencil-square-o"></i></a><i class="fa fa-times"></i></td></tr>';
46-
}
47-
foreach($unassignedroutes as $route){
48-
$dest = explode(',',$route['destination']);
49-
$edis = urlencode($route['extension'].'/'.$route['cidnum']);
50-
$displaydesc = ( (trim($route['description']) == "") ? _("None") : $route['description'] );
51-
$displaydid = ( (trim($route['extension']) == "") ? _("any DID") : $route['extension'] );
52-
$displaycid = ( (trim($route['cidnum']) == "") ? _("any CID") : $route['cidnum'] );
53-
$uarrows .= '<tr><td>'.$displaydesc.'</td><td>'.$displaydid.'</td><td>'.$displaycid.'</td><td>'.$dest[1].'</td><td class="actions"><a href="config.php?display=did&view=form&extdisplay='.$edis.'"><i class="fa fa-pencil-square-o"></i></a><i class="fa fa-times"></i></td></tr>';
54-
}
55-
foreach($directdidroutes as $route){
56-
$dest = explode(',',$route['destination']);
57-
$edis = urlencode($route['extension'].'/'.$route['cidnum']);
58-
$displaydesc = ( (trim($route['description']) == "") ? _("None") : $route['description'] );
59-
$displaydid = ( (trim($route['extension']) == "") ? _("any DID") : $route['extension'] );
60-
$displaycid = ( (trim($route['cidnum']) == "") ? _("any CID") : $route['cidnum'] );
61-
$didrrows .= '<tr><td>'.$displaydesc.'</td><td>'.$displaydid.'</td><td>'.$displaycid.'</td><td>'.$dest[1].'</td><td class="actions"><a href="config.php?display=did&view=form&extdisplay='.$edis.'"><i class="fa fa-pencil-square-o"></i></a><i class="fa fa-times"></i></td></tr>';
31+
function DIDlinkFormatter(value, row){
32+
var html = '<a href="?display=did&view=form&extdisplay='+row['extension']+'%2F'+row['cidnum']+'"><i class="fa fa-pencil"></i></a>';
33+
html += '&nbsp;<a href="?display=did&action=delIncoming&didfilter=&rnavsort=&extdisplay='+row['extension']+'%2F'+row['cidnum']+'" class="delAction"><i class="fa fa-trash"></i></a>';
34+
return html;
6235
}
63-
?>
64-
<ul class="nav nav-tabs" role="tablist">
65-
<li role="presentation" data-name="alldids" class="active">
66-
<a href="#alldids" aria-controls="alldids" role="tab" data-toggle="tab">
67-
<?php echo _("All DIDs")?>
68-
</a>
69-
</li>
70-
<li role="presentation" data-name="userdids" class="change-tab">
71-
<a href="#userdids" aria-controls="userdids" role="tab" data-toggle="tab">
72-
<?php echo _("User DIDs")?>
73-
</a>
74-
</li> <li role="presentation" data-name="generaldids" class="change-tab">
75-
<a href="#generaldids" aria-controls="generaldids" role="tab" data-toggle="tab">
76-
<?php echo _("General DIDs")?>
77-
</a>
78-
</li> <li role="presentation" data-name="unuseddids" class="change-tab">
79-
<a href="#unuseddids" aria-controls="unuseddids" role="tab" data-toggle="tab">
80-
<?php echo _("Unused DIDs")?>
81-
</a>
82-
</li>
83-
</ul>
84-
<div class="tab-content display">
85-
<div role="tabpanel" id="alldids" class="tab-pane active">
86-
<div id="toolbar-all">
87-
<button id="remove-all" class="btn btn-danger btn-remove" data-type="all" disabled data-section="all">
88-
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete')?></span>
89-
</button>
90-
</div>
91-
<table data-toolbar="#toolbar-all" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped" id="table-all">
92-
<thead>
93-
<tr>
94-
<th data-sortable="true"><?php echo _('Description')?></th>
95-
<th data-sortable="true"><?php echo _('DID')?></th>
96-
<th data-sortable="true"><?php echo _('CID')?></th>
97-
<th data-sortable="true"><?php echo _('Destination')?></th>
98-
<th><?php echo _('Actions')?></th>
99-
</tr>
100-
</thead>
101-
<tbody>
102-
<?php echo $allrrows ?>
103-
</tbody>
104-
</table>
105-
</div>
106-
<div role="tabpanel" id="userdids" class="tab-pane">
107-
<div id="toolbar-user">
108-
<button id="remove-user" class="btn btn-danger btn-remove" data-type="user" disabled data-section="user">
109-
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete')?></span>
110-
</button>
111-
</div>
112-
<table data-toolbar="#toolbar-user" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped" id="table-all">
113-
<thead>
114-
<tr>
115-
<th data-sortable="true"><?php echo _('Description')?></th>
116-
<th data-sortable="true"><?php echo _('DID')?></th>
117-
<th data-sortable="true"><?php echo _('CID')?></th>
118-
<th data-sortable="true"><?php echo _('Destination')?></th>
119-
<th><?php echo _('Actions')?></th>
120-
</tr>
121-
</thead>
122-
<?php echo $didrrows ?>
123-
</table>
124-
</div>
125-
<div role="tabpanel" id="generaldids" class="tab-pane">
126-
<div id="toolbar-general">
127-
<button id="remove-general" class="btn btn-danger btn-remove" data-type="general" disabled data-section="general">
128-
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete')?></span>
129-
</button>
130-
</div>
131-
<table data-toolbar="#toolbar-general" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped" id="table-all">
132-
<thead>
133-
<tr>
134-
<th data-sortable="true"><?php echo _('Description')?></th>
135-
<th data-sortable="true"><?php echo _('DID')?></th>
136-
<th data-sortable="true"><?php echo _('CID')?></th>
137-
<th data-sortable="true"><?php echo _('Destination')?></th>
138-
<th><?php echo _('Actions')?></th>
139-
</tr>
140-
</thead>
141-
<?php echo $incrrows ?>
142-
</table>
143-
</div>
144-
<div role="tabpanel" id="unuseddids" class="tab-pane">
145-
<div id="toolbar-unused">
146-
<button id="remove-unused" class="btn btn-danger btn-remove" data-type="unused" disabled data-section="unused">
147-
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete')?></span>
148-
</button>
149-
</div>
150-
<table data-toolbar="#toolbar-unused" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped" id="table-all">
151-
<thead>
152-
<tr>
153-
<th data-sortable="true"><?php echo _('Description')?></th>
154-
<th data-sortable="true"><?php echo _('DID')?></th>
155-
<th data-sortable="true"><?php echo _('CID')?></th>
156-
<th data-sortable="true"><?php echo _('Destination')?></th>
157-
<th><?php echo _('Actions')?></th>
158-
</tr>
159-
</thead>
160-
<?php echo $uarrows ?>
161-
</table>
162-
</div>
163-
</div>
36+
37+
</script>

views/did/rnav.php

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
<a href="config.php?display=did" class="list-group-item"><i class="fa fa-list">&nbsp;<?php echo _("Inbound Routes List")?></i></a>
2-
<a href="config.php?display=did&view=form" class="list-group-item"><i class="fa fa-plus">&nbsp;<?php echo _("Add Inbound Route")?></i></a>

views/did/routeform.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
HERE;
4343
}
4444
echo $heading;
45-
echo $userlink
45+
echo isset($userlink)?$userlink:'';
4646
?>
4747

4848
<form name="editGRP" class="fpbx-submit" action="config.php?display=did&amp;view=form" method="post" data-fpbx-delete="?display=did&amp;extdisplay=<?php echo $extdisplay; ?>&amp;action=delIncoming&amp;didfilter=<?php echo $didfilter; ?>&amp;rnavsort=<?php echo $rnavsort; ?>">
@@ -110,7 +110,7 @@
110110
<i class="fa fa-question-circle fpbx-help-icon" data-for="extension"></i>
111111
</div>
112112
<div class="col-md-9">
113-
<input type="text" class="form-control" id="extension" name="extension" value="<?php echo isset($extension)?$extension:''; ?>" ">
113+
<input type="text" class="form-control" id="extension" name="extension" value="<?php echo isset($extension)?$extension:''; ?>" placeholder="<?php echo _("ANY")?>">
114114
</div>
115115
</div>
116116
</div>
@@ -134,7 +134,7 @@
134134
<i class="fa fa-question-circle fpbx-help-icon" data-for="cidnum"></i>
135135
</div>
136136
<div class="col-md-9">
137-
<input type="text" class="form-control" id="cidnum" name="cidnum" value="<?php echo isset($cidnum)?$cidnum:'' ?>" ">
137+
<input type="text" class="form-control" id="cidnum" name="cidnum" value="<?php echo isset($cidnum)?$cidnum:'' ?>" placeholder="<?php echo _("ANY")?>">
138138
</div>
139139
</div>
140140
</div>

0 commit comments

Comments
 (0)