| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 /* $Id: project_release.js,v 1.4 2010/01/17 01:03:58 dww Exp $ */ 2 3 // IE doesn't support hiding or disabling select options, so we have to rebuild the list. :( 4 Drupal.projectReleaseRebuildSelect = function() { 5 // Remove everything 6 recommended = this.value; 7 while (this.length > 1) { 8 this.remove(1); 9 } 10 11 // Now add the choices back. 12 choices = this; 13 $(this).parents('table:eq(0)').find('input.form-checkbox.supported:checked').each(function () { 14 $(this).parents('tr:eq(0)').find('td:first-child').each(function () { 15 choices.appendChild(new Option(this.innerHTML, this.innerHTML)); 16 if (this.innerHTML == recommended) { 17 choices.selectedIndex = choices.length-1; 18 } 19 }); 20 }); 21 22 // If removing a supported version changes the recommended version then highlight it. 23 if (this.selectedIndex == 0 && recommended != -1) { 24 $(this).parents('table:eq(0)').find('tr:last').css('background-color', '#FFFFAA'); 25 } 26 } 27 28 Drupal.behaviors.projectReleaseAutoAttach = function () { 29 // Set handler for clicking a radio to change the recommended version. 30 $('form#project-release-project-edit-form select.recommended').change(function () { 31 $(this).parents('table:eq(0)').find('tr:last').css('background-color', '#FFFFAA'); 32 }); 33 34 // Set handler for clicking checkbox to toggle a version supported/unsupported. 35 $('form#project-release-project-edit-form input.form-checkbox.supported').click(function() { 36 $(this).parents('table:eq(0)').find('select').each(Drupal.projectReleaseRebuildSelect); 37 38 if (this.checked) { 39 // Marking this version as supported. 40 $(this).parents('tr:eq(0)').find('.snapshot').removeAttr('disabled'); 41 } 42 else { 43 // Marking this version as unsupported, so disable row. 44 $(this).parents('tr:eq(0)').find('.snapshot').attr('disabled','true').removeAttr('checked'); 45 } 46 }).each( function() { // Disable unsupported versions on initial page load. 47 if (!this.checked) { 48 $(this).parents('tr:eq(0)').find('.snapshot').attr('disabled','true'); 49 } 50 }); 51 52 // Go ahead and remove the unavailable choices from the recommended list. 53 $('select.recommended').each(Drupal.projectReleaseRebuildSelect); 54 };
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 |