Changeset 11000
- Timestamp:
- 01/17/11 15:53:57 (2 years ago)
- Files:
-
- modules/branches/2.9/core/advancedsettings.js (modified) (6 diffs)
- modules/branches/2.9/core/page.advancedsettings.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.9/core/advancedsettings.js
r10997 r11000 1 1 $(document).ready(function() { 2 //hope this isnt to much to ask for... Not sure why this doent happen automaticaly, but this kludge works!3 //if(url_pram('display') == 'advancedsettings'){$('#footer').remove().appendTo($('#wrapper'));}4 2 //save settings 5 3 function savebinder(e) { … … 8 6 return false; 9 7 } 10 mythis = $(this); 11 mykey = $(this).attr('data-key'); 8 var mythis = $(this); 9 var mykey = $(this).attr('data-key'); 10 switch ($(this).attr('data-type')) { 11 case 'BOOL': 12 var myval = $('input[name="' + mykey + '"]:checked').val(); 13 break; 14 default: 15 var myval = $('#' + mykey).val(); 16 break; 17 } 18 //console.log('saving ',mykey,'as',myval,'which is a',$(this).attr('type')) 12 19 $.ajax({ 13 20 type: 'POST', … … 19 26 action: 'setkey', 20 27 keyword: mykey, 21 value: $('#' + mykey).val()28 value: myval 22 29 }, 23 beforeSend: function(XMLHttpRequest) { 30 beforeSend: function(XMLHttpRequest, set) { 31 //console.log('set',set) 24 32 mythis.attr({src: 'images/spinner.gif'}) 25 33 }, … … 30 38 } else { 31 39 mythis.parent().delay(500).fadeOut(); 40 } 41 42 //reset data-valueinput-orig to new value 43 switch (mythis.attr('data-type')) { 44 case 'BOOL': 45 $('input[name="' + mykey + '"]').attr('data-valueinput-orig', mykey); 46 break; 47 default: 48 var myval = $('#' + mykey).attr('data-valueinput-orig', mykey); 49 break; 32 50 } 33 51 }, … … 45 63 $('.valueinput').bind('keyup keypress keydown paste change', function(){ 46 64 var myel = $(this).parent().next().next(); 65 //console.log(myel) 47 66 if($(this).val() != $(this).attr('data-valueinput-orig')){ 48 67 49 myel.stop(true, true).delay( 1000).fadeIn();68 myel.stop(true, true).delay(500).fadeIn(); 50 69 //only bind if not already bound 51 70 if (myel.children(".save").data("events") == undefined … … 54 73 } 55 74 } else { 56 myel.stop(true, true).delay( 1000).fadeOut();75 myel.stop(true, true).delay(500).fadeOut(); 57 76 myel.children('.save').unbind('click', savebinder); 58 77 } modules/branches/2.9/core/page.advancedsettings.php
r10994 r11000 1 1 <?php /* $Id */ 2 2 $tabindex = isset($tabindex) ? $tabindex : 0; 3 3 // TODO: localize if needed 4 4 // TODO: Get rid of undefined in http log. Sigh … … 9 9 } 10 10 11 //dbug('$var',$var); 11 12 if($var['action'] === 'setkey') { 12 //set value, then return a value13 13 if ($freepbx_conf->conf_setting_exists($var['keyword'])) { 14 $freepbx_conf->set_conf_values(array($keyword => $value),true); 14 if ($freepbx_conf->set_conf_values(array($var['keyword'] => $var['value']),true)) { 15 echo 'ok'; 16 } 15 17 } 16 18 exit; … … 64 66 case CONF_TYPE_BOOL: 65 67 ?> 66 <input class="valueinput" data-valueinput-orig="<?php echo $amp_conf[$c['keyword']] ?1:0 ?>" id="<?php echo $c['keyword'] ?>-true" type="radio" name="<?php echo $c['keyword'] ?>" value="1" tabindex="<?php echo ++$tabindex;?>"<?php echo $amp_conf[$c['keyword']]?"checked=\"yes\"":""?>/>68 <input class="valueinput" data-valueinput-orig="<?php echo $amp_conf[$c['keyword']] ? 1 : 0 ?>" id="<?php echo $c['keyword'] ?>-true" type="radio" name="<?php echo $c['keyword'] ?>" value="1" tabindex="<?php echo ++$tabindex;?>"<?php echo $amp_conf[$c['keyword']]?"checked=\"yes\"":""?>/> 67 69 <label for="<?php echo $c['keyword'] ?>-true"><?php echo _("True") ?></label> 68 <input class="valueinput" data-valueinput-orig="<?php echo $amp_conf[$c['keyword']] ?1:0 ?>" id="<?php echo $c['keyword'] ?>-false" type="radio" name="<?php echo $c['keyword'] ?>" value="0" tabindex="<?php echo ++$tabindex;?>"<?php echo !$amp_conf[$c['keyword']]?"checked=\"yes\"":""?>/>70 <input class="valueinput" data-valueinput-orig="<?php echo $amp_conf[$c['keyword']] ? 1 : 0 ?>" id="<?php echo $c['keyword'] ?>-false" type="radio" name="<?php echo $c['keyword'] ?>" value="0" tabindex="<?php echo ++$tabindex;?>"<?php echo !$amp_conf[$c['keyword']]?"checked=\"yes\"":""?>/> 69 71 <label for="<?php echo $c['keyword'] ?>-false"><?php echo _("False") ?></label> 70 72 <?php … … 77 79 if(!$c['readonly']){ 78 80 echo '<td><input type="image" class="adv_set_default" src="images/default-option.png" data-key="'.$c['keyword'].'" data-default="'.$c['defaultval'].'" name="default" title="'._('Revert to Default').'"></td>'; 79 echo '<td class="savetd"><input type="image" class="save" src="images/accept.png" name="save" data-key="'.$c['keyword'].'" title="'._('Save').'"></td>'; 80 //echo '<td><input type="image" class="delete" src="images/trash.png" name="delete" data-key="'.$c['keyword'].'" title="'._('Delete').'"></td>'; 81 echo '<td class="savetd"><input type="image" class="save" src="images/accept.png" name="save" data-key="' 82 . $c['keyword'] 83 . '" title="' . _('Save') . '"' 84 . 'data-type="' . (($c['type'] == CONF_TYPE_BOOL) ? 'BOOL' : '') . '" ' 85 . '></td>'; 81 86 } 82 87 echo '</tr>';
