diff --git a/assets/js/sccp_manager.js b/assets/js/sccp_manager.js index f74f278..d2d3aa1 100644 --- a/assets/js/sccp_manager.js +++ b/assets/js/sccp_manager.js @@ -212,6 +212,15 @@ $(document).ready(function () { e.preventDefault(); }); + $('#sccp_hw_mac').change(function() { + var value = $(this).val(); + const regex = new RegExp('^([0-9A-Fa-f]{2}[:.-]?){5}([0-9A-Fa-f]{2})$'); + if ( regex.test(value) === false ) { + fpbxToast(_('Invalid Mac Address'),_('Invalid Mac Address'), 'warning'); + setTimeout(function(){document.getElementById("sccp_hw_mac").focus();},2000); + }; + }); + // Form.buttons - Form.adddevice $('.futuretype').change(function (e) { var kid = $(this).data('id'); diff --git a/sccpManTraits/ajaxHelper.php b/sccpManTraits/ajaxHelper.php index fc9b004..8864f36 100644 --- a/sccpManTraits/ajaxHelper.php +++ b/sccpManTraits/ajaxHelper.php @@ -35,6 +35,9 @@ trait ajaxHelper { case 'delete_dialplan': return true; break; + case 'validateMac': + return true; + break; default: return false; } @@ -49,6 +52,8 @@ trait ajaxHelper { case 'savesettings': // Consolidate this into a separate method to improve legibility $this->handleSubmit($request); + + // TODO: Need to be more specific on reload and only reload if critical settings changed. $res = $this->aminterface->core_sccp_reload(); $msg [] = array ("Config Saved: {$res['Response']}", "Info : {$res['data']}"); @@ -376,6 +381,9 @@ trait ajaxHelper { // return array('status' => false, 'message' => $result); return $result; break; + case 'validateMac': + dbug('Request', $_REQUEST); + break; } } diff --git a/sccpManTraits/bmoFunctions.php b/sccpManTraits/bmoFunctions.php index 1bd6817..d6adee0 100644 --- a/sccpManTraits/bmoFunctions.php +++ b/sccpManTraits/bmoFunctions.php @@ -32,7 +32,7 @@ trait bmoFunctions { Below adds redirect URL, but it is not followed $cc->setRedirectURL("config.php?display=sccp_phone"); so force redirect at end of addDevice in SccpClass - */ + */ } } } @@ -115,6 +115,7 @@ trait bmoFunctions { ); break; case 'sccpsettings': + // TODO: Need to change to have save and save and continue $buttons = array( 'submit' => array( 'name' => 'ajaxsubmit',