|
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"> <?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; |
8 | 21 | }
|
9 | 22 | }
|
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]; |
17 | 29 | }
|
18 | 30 | }
|
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 += ' <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; |
62 | 35 | }
|
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> |
0 commit comments