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> <module>
<rawname>sccp_manager</rawname> <rawname>sccp_manager</rawname>
<name>SCCP Manager</name> <name>SCCP Manager</name>
<version>14.4.0.5</version> <version>14.4.0.6</version>
<type>setup</type> <type>setup</type>
<category>SCCP Connectivity</category> <category>SCCP Connectivity</category>
<publisher>Steve Lad, Alex GP</publisher> <publisher>Steve Lad, Alex GP</publisher>

View file

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

View file

@ -46,8 +46,7 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
<form autocomplete="off" name="frm_keyset" id="frm_keyset" class="fpbx-submit" action="" method="post"> <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="category" value="keysetform">
<input type="hidden" name="Submit" value="Submit"> <input type="hidden" name="Submit" value="Submit">
<div class="fpbx-container container-fluid">
<div class="fpbx-container container-fluid">
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="display no-border"> <div class="display no-border">
@ -57,12 +56,11 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
<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"> <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> <thead>
<tr> <tr>
<!-- <th data-checkbox="true"></th> -->
<th data-sortable="true" data-field="softkeys"><?php echo _('KeySetName')?></th> <th data-sortable="true" data-field="softkeys"><?php echo _('KeySetName')?></th>
<?php <?php
$i = 0; $i = 0;
foreach ($keynamearray as $key => $value) { foreach ($keynamearray as $key => $value) {
if ($i < 9) { if ($i < 12) {
echo '<th data-sortable="false" data-field="'.$key.'">'._($value['sname']).'</th>'; echo '<th data-sortable="false" data-field="'.$key.'">'._($value['sname']).'</th>';
} }
$i ++; $i ++;
@ -78,7 +76,7 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
<!-- Begin Form Input New / Edit --> <!-- 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> <h4 class="modal-title" id="gridSystemModalLabel">Add New KeySet</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<style type="text/css">
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3"> 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> <label class="control-label" for="new_keysetname">Name Keyset</label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_devmodel"></i> <i class="fa fa-question-circle fpbx-help-icon" data-for="new_devmodel"></i>
</div><div class="col-md-9"> </div>
<input type="text" maxlength="15" class="form-control" id="new_keySetname" name="new_keySetname" value="SoftKeyset"> <div class="col-md-9">
</div> </div></div> <input type="text" maxlength="15" pattern="[a-zA-Z0-9]{4,15}" class="form-control" id="new_keySetname" name="new_keySetname" value="SoftKeyset">
<div class="row"><div class="col-md-12"> </div>
<span id="new_devmodel-help" class="help-block fpbx-help-block">Help. max len = 15</span> </div>
</div></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"> <ul class="nav nav-tabs" role="tablist">
<?php <?php
@ -157,8 +164,6 @@ foreach ($keysetarray as $key => $value) {
</div> </div>
</div> </div>
<script> <script>
function DispayActionsKeyFormatter(value, row, index) { function DispayActionsKeyFormatter(value, row, index) {
var exp_model = ''; var exp_model = '';