Fix saving of custom soft keysets

Red border if invalid set name
Clean up modal indenting
Define valid chars
Only initialise general section at each save (previously initialised all clearing soft key sets)
This commit is contained in:
stevenA 2022-01-19 13:46:47 +01:00
parent 1c5fa400ae
commit 60777bf3e3
3 changed files with 50 additions and 46 deletions

View file

@ -1,7 +1,7 @@
<module>
<rawname>sccp_manager</rawname>
<name>SCCP Manager</name>
<version>14.4.0.5</version>
<version>14.4.0.6</version>
<type>setup</type>
<category>SCCP Connectivity</category>
<publisher>Steve Lad, Alex GP</publisher>

View file

@ -280,8 +280,8 @@ trait helperfunctions {
// [general] section
// TODO: Need to review sccpsettings seq numbering, as will speed this up, and remove the need for $permittedSettings.
$cnf_wr = \FreePBX::WriteConfig();
//clear old settings, and initiate with allow/disallow and permit/deny keys in correct order
$this->sccp_conf_init = array();
//clear old general settings, and initiate with allow/disallow and permit/deny keys in correct order
$this->sccp_conf_init['general'] = array();
$this->sccp_conf_init['general']['disallow'] = 'all';
$this->sccp_conf_init['general']['allow'] = '';
$this->sccp_conf_init['general']['deny'] = '0.0.0.0/0.0.0.0';
@ -352,7 +352,6 @@ trait helperfunctions {
);
}
$cnf_wr->WriteConfig('sccp.conf', $this->sccp_conf_init);
//$this->$cnf_wr->writeConfig('sccp.conf', $this->sccp_conf_init);
}
public function initVarfromXml() {

View file

@ -46,39 +46,37 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
<form autocomplete="off" name="frm_keyset" id="frm_keyset" class="fpbx-submit" action="" method="post">
<input type="hidden" name="category" value="keysetform">
<input type="hidden" name="Submit" value="Submit">
<div class="fpbx-container container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="display no-border">
<div id="toolbar-all">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" onclick="load_oncliсk(this,'*new*')" data-target=".edit_new_keyset"><i class="fa fa-bolt"></i> <?php echo _("Add Keyset"); ?></button>
</div>
<table data-cookie="true" data-cookie-id-table="sccp_keyset-all" data-url="ajax.php?module=sccp_manager&command=getSoftKey&type=active" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-all" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="softkey-all" data-unique-id="softkeys">
<thead>
<tr>
<!-- <th data-checkbox="true"></th> -->
<th data-sortable="true" data-field="softkeys"><?php echo _('KeySetName')?></th>
<?php
$i = 0;
foreach ($keynamearray as $key => $value) {
if ($i < 9) {
echo '<th data-sortable="false" data-field="'.$key.'">'._($value['sname']).'</th>';
}
$i ++;
<div class="fpbx-container container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="display no-border">
<div id="toolbar-all">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" onclick="load_oncliсk(this,'*new*')" data-target=".edit_new_keyset"><i class="fa fa-bolt"></i> <?php echo _("Add Keyset"); ?></button>
</div>
<table data-cookie="true" data-cookie-id-table="sccp_keyset-all" data-url="ajax.php?module=sccp_manager&command=getSoftKey&type=active" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-all" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="softkey-all" data-unique-id="softkeys">
<thead>
<tr>
<th data-sortable="true" data-field="softkeys"><?php echo _('KeySetName')?></th>
<?php
$i = 0;
foreach ($keynamearray as $key => $value) {
if ($i < 12) {
echo '<th data-sortable="false" data-field="'.$key.'">'._($value['sname']).'</th>';
}
?>
<th data-field="actions" data-formatter="DispayActionsKeyFormatter"><?php echo _('Actions')?></th>
</tr>
</thead>
<tbody>
$i ++;
}
?>
<th data-field="actions" data-formatter="DispayActionsKeyFormatter"><?php echo _('Actions')?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</form>
<!-- Begin Form Input New / Edit -->
@ -90,18 +88,27 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
<h4 class="modal-title" id="gridSystemModalLabel">Add New KeySet</h4>
</div>
<div class="modal-body">
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
<label class="control-label" for="new_keysetname">Name Keyset</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_devmodel"></i>
</div><div class="col-md-9">
<input type="text" maxlength="15" class="form-control" id="new_keySetname" name="new_keySetname" value="SoftKeyset">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="new_devmodel-help" class="help-block fpbx-help-block">Help. max len = 15</span>
</div></div></div>
<style type="text/css">
input:invalid {border: red solid 3px;}
</style>
<div class="element-container">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="new_keysetname">Name Keyset</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_devmodel"></i>
</div>
<div class="col-md-9">
<input type="text" maxlength="15" pattern="[a-zA-Z0-9]{4,15}" class="form-control" id="new_keySetname" name="new_keySetname" value="SoftKeyset">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="new_devmodel-help" class="help-block fpbx-help-block">Max length 15 letters or numbers without spaces</span>
</div>
</div>
</div>
<ul class="nav nav-tabs" role="tablist">
<?php
@ -157,8 +164,6 @@ foreach ($keysetarray as $key => $value) {
</div>
</div>
<script>
function DispayActionsKeyFormatter(value, row, index) {
var exp_model = '';