This is an old revision of the document!
var cmbReSupplyP = Ext.create('Ext.form.ComboBox', { fieldLabel : 'Re-Supply Phone Interval', store : reSupply, queryMode : 'local', displayField : 'name', valueField : 'id', name : 'ctc_resupply_phone_interval', itemId : 'cmbReSupplyPhone', labelCls : 'lblRd', allowBlank : false, forceSelection : true, value : 0 }); var cmbReSupplyDn = Ext.create('Ext.form.ComboBox', { fieldLabel : 'Re-Supply DN Interval', store : reSupply, queryMode : 'local', displayField : 'name', valueField : 'id', name : 'ctc_resupply_dn_interval', itemId : 'cmbReSupplyDn', labelCls : 'lblRd', allowBlank : false, forceSelection : true, value : 0 });
{ xtype : 'checkbox', fieldLabel : 'Require Phone To Connect', itemId : 'chkCtcRequirePhone', name : 'ctc_require_phone', inputValue : 'ctc_require_phone', checked : false, disabled : true }, cmbReSupplyP, { xtype : 'checkbox', fieldLabel : 'Require DN To Connect', itemId : 'chkCtcRequireDn', name : 'ctc_require_dn', inputValue : 'ctc_require_dn', checked : false, disabled : true }, cmbReSupplyDn
Ext.define('Rd.view.dynamicDetails.vcDynamicDetailClickToConnect', { extend : 'Ext.app.ViewController', alias : 'controller.vcDynamicDetailClickToConnect', control: { '#chkClickToConnect' : { change: 'chkClickToConnectChange' }, '#chkCtcRequireEmail' : { change: 'chkCtcRequireEmailChange' }, '#chkCtcRequirePhone' : { change: 'chkCtcRequirePhoneChange' }, '#chkCtcRequireDn' : { change: 'chkCtcRequireDnChange' } }, chkClickToConnectChange: function(chk){ var me = this; var form = chk.up('form'); var un = form.down('#txtConnectUsername'); var sx = form.down('#txtConnectSuffix'); var cd = form.down('#nrConnectDelay'); var co = form.down('#chkConnectOnly'); var re = form.down('#chkCtcRequireEmail'); var rs = form.down('#cmbReSupply'); var rp = form.down('#chkCtcRequirePhone'); var rsp = form.down('#cmbReSupplyPhone'); var rdn = form.down('#chkCtcRequireDn'); var rsdn = form.down('#cmbReSupplyDn'); var value = chk.getValue(); if(value){ un.setDisabled(false); sx.setDisabled(false); cd.setDisabled(false); co.setDisabled(false); re.setDisabled(false); rs.setDisabled(false); rp.setDisabled(false); rsp.setDisabled(false); rdn.setDisabled(false); rsdn.setDisabled(false); }else{ un.setDisabled(true); sx.setDisabled(true); cd.setDisabled(true); co.setDisabled(true); re.setDisabled(true); rs.setDisabled(true); rp.setDisabled(true); rsp.setDisabled(true); rdn.setDisabled(true); rsdn.setDisabled(true); } }, chkCtcRequireEmailChange: function(chk){ var me = this; var form = chk.up('form'); var value = chk.getValue(); var rs = form.down('#cmbReSupply'); if(value){ rs.setDisabled(false); }else{ rs.setDisabled(true); } }, chkCtcRequirePhoneChange: function(chk){ var me = this; var form = chk.up('form'); var value = chk.getValue(); var rs = form.down('#cmbReSupplyPhone'); if(value){ rs.setDisabled(false); }else{ rs.setDisabled(true); } }, chkCtcRequireDnChange: function(chk){ var me = this; var form = chk.up('form'); var value = chk.getValue(); var rs = form.down('#cmbReSupplyDn'); if(value){ rs.setDisabled(false); }else{ rs.setDisabled(true); } } });
{ text: 'E-Mail', dataIndex: 'email', tdCls: 'gridTree', flex: 1,stateId: 'StateGridDynamicDetailEmails2'}, { text: 'Phone', dataIndex: 'phone', tdCls: 'gridTree', flex: 1,stateId: 'StateGridDynamicDetailEmails2a'}, { text: 'DN', dataIndex: 'dn', tdCls: 'gridTree', flex: 1,stateId: 'StateGridDynamicDetailEmails2b'}, { text : 'Captive MAC', dataIndex : 'cp_mac', tdCls : 'gridTree', hidden : true, flex : 1, stateId : 'DD_Email_B' },
IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE column_name = 'ctc_require_phone' AND TABLE_NAME = 'dynamic_details' AND table_schema = 'rd') THEN ALTER TABLE dynamic_details ADD COLUMN `ctc_require_phone` tinyint(1) NOT NULL DEFAULT '0'; END IF; IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE column_name = 'ctc_resupply_phone_interval' AND TABLE_NAME = 'dynamic_details' AND table_schema = 'rd') THEN ALTER TABLE dynamic_details ADD COLUMN `ctc_resupply_phone_interval` INT(4) NOT NULL DEFAULT '0'; END IF; IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE column_name = 'ctc_require_dn' AND TABLE_NAME = 'dynamic_details' AND table_schema = 'rd') THEN ALTER TABLE dynamic_details ADD COLUMN `ctc_require_dn` tinyint(1) NOT NULL DEFAULT '0'; END IF; IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE column_name = 'ctc_resupply_dn_interval' AND TABLE_NAME = 'dynamic_details' AND table_schema = 'rd') THEN ALTER TABLE dynamic_details ADD COLUMN `ctc_resupply_dn_interval` INT(4) NOT NULL DEFAULT '0'; END IF;
IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE column_name = 'phone' AND TABLE_NAME = 'data_collectors' AND table_schema = 'rd') THEN ALTER TABLE data_collectors ADD COLUMN `phone` VARCHAR(36) NOT NULL DEFAULT ''; END IF; IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE column_name = 'dn' AND TABLE_NAME = 'data_collectors' AND table_schema = 'rd') THEN ALTER TABLE data_collectors ADD COLUMN `dn` VARCHAR(36) NOT NULL DEFAULT ''; END IF;
$check_items = [ 'connect_check', 'connect_only', 'ctc_require_email', 'ctc_require_phone', 'ctc_require_dn', ];
public function addMac(){ if ($this->request->is('post')) { if($this->request->getData('email')){ if(!$this->_test_email($this->request->data['email'])){ return; } } $dd = $this->_find_dynamic_detail_id();
private function _addOrEdit($user,$type= 'add') { //__ Authentication + Authorization __ $user_id = $user['id']; if($this->request->getData('email')){ if(!$this->_test_email($this->request->data['email'])){ return; } } $this->request->data['public_ip'] = $this->request->clientIp();
public function macCheck(){ $data = $this->request->data; $q_r = $this->_find_dynamic_detail_id(); $data['ctc_require_email'] = false; // By defaul don't ask for email; if($q_r){ //Once we found the Dynamic Login Page; We need to figure out if we need to ask for an email for this person //For that we need to look for a combo **dynamic_detail_id** and **mac** //IF found look at the modify timestamp and if it 'expired' ask for it again //If not found ask for it (ctc_require_email == true) //Else we set ctc_require_email == false since we found the combo and it has not expired yet $dd_id = $q_r->dynamic_detail_id; $dd_resuply_int = $q_r->dynamic_detail->ctc_resupply_email_interval; $dd_resuply_intP = $q_r->dynamic_detail->ctc_resupply_phone_interval; $data['dd_id'] = $dd_id; if($q_r->dynamic_detail->ctc_require_email == true){ $q_dd = $this->{$this->main_model}->find() ->where([$this->main_model.'.dynamic_detail_id' => $dd_id,$this->main_model.'.mac' => $this->request->data['mac']]) ->first(); if($q_dd){ if($dd_resuply_int > 0){ //This has an expiry date lets compare $expiry_time = $q_dd->modified->toUnixString()+($dd_resuply_int * 24 * 60 *60); $now = new FrozenTime(); if($expiry_time < $now->toUnixString()){ //It already expired ask for a new one $data['ctc_require_email'] = true; } } }else{ $data['ctc_require_email'] = true; //We did not found it so have to supply email } } if($q_r->dynamic_detail->ctc_require_phone == true){ $q_dd = $this->{$this->main_model}->find() ->where([$this->main_model.'.dynamic_detail_id' => $dd_id,$this->main_model.'.mac' => $this->request->data['mac']]) ->first(); if($q_dd){ if($dd_resuply_intP > 0){ //This has an expiry date lets compare $expiry_time = $q_dd->modified->toUnixString()+($dd_resuply_intP * 24 * 60 *60); $now = new FrozenTime(); if($expiry_time < $now->toUnixString()){ //It already expired ask for a new one $data['ctc_require_email'] = true; } } }else{ $data['ctc_require_phone'] = true; //We did not found it so have to supply email } } if($q_r->dynamic_detail->ctc_require_dn == true){ $q_dd = $this->{$this->main_model}->find() ->where([$this->main_model.'.dynamic_detail_id' => $dd_id,$this->main_model.'.mac' => $this->request->data['mac']]) ->first(); if($q_dd){ if($dd_resuply_intP > 0){ //This has an expiry date lets compare $expiry_time = $q_dd->modified->toUnixString()+($dd_resuply_intP * 24 * 60 *60); $now = new FrozenTime(); if($expiry_time < $now->toUnixString()){ //It already expired ask for a new one $data['ctc_require_dn'] = true; } } }else{ $data['ctc_require_dn'] = true; //We did not found it so have to supply dn } } } $this->set(array( 'data' => $data, 'success' => true, '_serialize' => array('data','success') )); }