| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 // $Id: features.js,v 1.1.2.10 2010/08/09 14:56:58 yhahn Exp $ 2 3 Drupal.behaviors.features = function() { 4 // Features management form package tabs 5 $("ul#features-form-links li a:not(.features-processed)").each(function() { 6 $(this).addClass('features.processed').click(function() { 7 $(".features-package-active").removeClass('features-package-active'); 8 var panel = $(this).attr('href').split('#')[1]; 9 $("div.package-" + panel).addClass('features-package-active'); 10 $(this).addClass('features-package-active'); 11 return false; 12 }); 13 }); 14 15 // Features management form 16 $('table.features:not(.processed)').addClass('processed').each(function() { 17 // Check the overridden status of each feature 18 Drupal.features.checkStatus(); 19 20 // Add some nicer row hilighting when checkboxes change values 21 $('input', this).bind('change', function() { 22 if (!$(this).attr('checked')) { 23 $(this).parents('tr').removeClass('enabled').addClass('disabled'); 24 } 25 else { 26 $(this).parents('tr').addClass('enabled').removeClass('disabled'); 27 } 28 }); 29 }); 30 31 // Export form component selector 32 $('form.features-export-form select.features-select-components:not(.processed)').each(function() { 33 $(this) 34 .addClass('processed') 35 .change(function() { 36 var target = $(this).val(); 37 $('div.features-select').hide(); 38 $('div.features-select-' + target).show(); 39 return false; 40 }); 41 }); 42 43 // Export form machine-readable JS 44 $('.feature-name:not(.processed)').each(function() { 45 $('.feature-name') 46 .addClass('processed') 47 .after(' <small class="feature-module-name-suffix"> </small>'); 48 if ($('.feature-module-name').val() === $('.feature-name').val().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/_+/g, '_') || $('.feature-module-name').val() === '') { 49 $('.feature-module-name').parents('.form-item').hide(); 50 $('.feature-name').keyup(function() { 51 var machine = $(this).val().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/_+/g, '_'); 52 if (machine !== '_' && machine !== '') { 53 $('.feature-module-name').val(machine); 54 $('.feature-module-name-suffix').empty().append(' Machine name: ' + machine + ' [').append($('<a href="#">'+ Drupal.t('Edit') +'</a>').click(function() { 55 $('.feature-module-name').parents('.form-item').show(); 56 $('.feature-module-name-suffix').hide(); 57 $('.feature-name').unbind('keyup'); 58 return false; 59 })).append(']'); 60 } 61 else { 62 $('.feature-module-name').val(machine); 63 $('.feature-module-name-suffix').text(''); 64 } 65 }); 66 $('.feature-name').keyup(); 67 } 68 }); 69 }; 70 71 Drupal.features = { 72 'checkStatus': function() { 73 if ($('table.features').is('.loading')) { 74 return; 75 } 76 $('table.features tbody tr:not(.processed):first').addClass('processed').each(function() { 77 var uri = $(this).find('a.admin-check').attr('href'), elem = $(this); 78 if (uri) { 79 $('table.features').addClass('loading'); 80 $.get(uri, [], function(data) { 81 $(elem).find('.admin-loading').hide(); 82 switch (data.storage) { 83 case 3: 84 $(elem).find('.admin-rebuilding').show(); 85 break; 86 case 2: 87 $(elem).find('.admin-needs-review').show(); 88 break; 89 case 1: 90 $(elem).find('.admin-overridden').show(); 91 break; 92 default: 93 $(elem).find('.admin-default').show(); 94 break; 95 } 96 $('table.features').removeClass('loading'); 97 Drupal.features.checkStatus(); 98 }, 'json'); 99 } 100 else { 101 Drupal.features.checkStatus(); 102 } 103 }); 104 } 105 };
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 |