To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Show
Ignore:
Timestamp:
09/09/10 12:28:23 (21 months ago)
Author:
wjohnald
Message:

merged aControls.js into the trunk

Location:
plugins/apostrophePlugin/trunk/web/js
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • plugins/apostrophePlugin/trunk/web/js

  • plugins/apostrophePlugin/trunk/web/js/aControls.js

    r2082 r2165  
    7171                options = {}; 
    7272        } 
    73   $(target + ' select[multiple]').each( 
     73         
     74  $(target).find('select[multiple]').each( 
    7475    function(i) { 
    7576      var name = $(this).attr('name'); 
     
    127128      if (id === '') 
    128129      { 
    129         // Hopefully unique 
    130         id = name; 
     130        // We need a unique ID for the element, give it one 
     131        id = 'a_id_' + Math.floor(Math.random() * 1000000000); 
    131132      } 
    132133      var html = "<div class='a-multiple-select' id='" + id + "'>"; 
     
    152153      { 
    153154        html += "<input type='checkbox' name='" + name + "'"; 
     155 
     156        if (options['class-name'] !== undefined) 
     157        { 
     158                html += "class='" + options['class-name'] + "'"; 
     159        } 
     160 
    154161        if (selected[j]) 
    155162        { 
     
    219226        $(items[k]).click(function() { update($(this).data("boxid"), false); return false; }); 
    220227      } 
     228       
     229       
    221230      function update(remove, initial) 
    222231      { 
     
    236245          value = select.options[index].value; 
    237246        } 
     247         
    238248        var boxes = $('#' + id + " input[type=checkbox]"); 
    239         for (k = 1; (k < length); k++) 
    240         { 
    241           if (boxes[k].value === remove) 
    242           { 
    243             boxes[k].checked = false; 
    244           } 
    245           if (boxes[k].value === value) 
    246           { 
    247             boxes[k].checked = true; 
    248           } 
    249         } 
     249         
     250        boxes.each(function() 
     251        { 
     252                if ($(this).val() === remove) 
     253                { 
     254                                $(this).attr('checked', false); 
     255                } 
     256                else if ($(this).val() === value) 
     257                { 
     258                        $(this).attr('checked', true); 
     259                } 
     260        }); 
     261         
    250262        var items = $('#' + id + ' ul li'); 
    251263        var k; 
     
    253265        for (k = 0; (k < length); k++) 
    254266        { 
    255           if (boxes[k].checked) 
     267          if ($(boxes[k]).is(':checked')) 
    256268          { 
    257269            $(items[k]).show();