| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 Drupal.behaviors.RulesAdminSetAddArg = function (context) { 2 $('.rules-argument-data-type:not(.RulesAdminSetAddArg-processed)', context).addClass('RulesAdminSetAddArg-processed').each(function () { 3 $('select', this).bind("change", function() { 4 5 if ($(this).parents("td").nextAll(".rules-argument-name").find('input').val() == '') 6 $(this).parents("td").nextAll(".rules-argument-name").find('input').val( $(this).val() ); 7 8 if ($(this).parents("td").nextAll(".rules-argument-label").find('input').val() == '') 9 $(this).parents("td").nextAll(".rules-argument-label").find('input').val( 10 $("option:selected", this).text() 11 ); 12 13 }); 14 }); 15 }; 16 17 Drupal.behaviors.RulesAdminMachineName = function (context) { 18 // Add rule form machine-readable JS 19 $('#edit-label').addClass('processed').after(' <small class="rules-name-suffix"> </small>'); 20 $('#edit-name').parents('.form-item').hide(); 21 22 // Add a click function to our rules name suffix. 23 $('.rules-name-suffix').click(function() { 24 $('#edit-name').parents('.form-item').show(); 25 $('.rules-name-suffix').hide(); 26 $('#edit-label').unbind('keyup'); 27 return false; 28 }); 29 30 $('#edit-label').keyup(function() { 31 var machine = $(this).val().toLowerCase().replace(/[^a-z0-9]/g, '_').replace(/_+/g, '_').replace(/^[^a-z]/, 'a'); 32 if (machine !== '') { 33 $('#edit-name').val(machine); 34 $('.rules-name-suffix').html(' ' + Drupal.t('Machine name:') + ' ' + machine + ' [').append($('<a href="#">'+ Drupal.t('Edit') +'</a>')).append(']'); 35 } 36 else { 37 $('#edit-name').val(machine); 38 $('.rules-name-suffix').text(''); 39 } 40 }); 41 // If we already have a machine name filled in, then just use that. 42 if($('#edit-name').val() !== '') { 43 $('.rules-name-suffix').html(' ' + Drupal.t('Machine name:') + ' ' + $('#edit-name').val() + ' [').append($('<a href="#">'+ Drupal.t('Edit') +'</a>')).append(']'); 44 } 45 // If there's nothing in the field, then we can just trigger the event. 46 else { 47 $('#edit-label').keyup(); 48 } 49 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |