Changeset 33109 for main

Show
Ignore:
Timestamp:
24.05.2019 23:56:45 (5 months ago)
Author:
ak19
Message:

Added a toggling Select All checkbox and tested it works in conjuction with Delete All and Delete Selected (the latter after deselected some of the items after Select All).

Location:
main/trunk/greenstone3/web/interfaces/default
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/berrybasket/berrycheckout.js

    r33108 r33109  
    1919var options = ['fullview', 'textview', 'email']; 
    2020 
     21function toggleSelectAll(selAllCheckbox) { 
     22    // https://stackoverflow.com/questions/386281/how-to-implement-select-all-check-box-in-html 
     23    var allBerriesCheckboxList = document.getElementsByName('select-berry-checkbox'); 
     24    for (var i = 0; i < allBerriesCheckboxList.length; i++) { 
     25    // if the selectAllCheckbox is checked, then all the berries' checkboxes will get checked 
     26    // And vice-versa. 
     27    allBerriesCheckboxList[i].checked = selAllCheckbox.checked; 
     28    } 
     29} 
     30 
    2131function deleteSelected() { 
    2232     
    2333    if(docList.length == 0) return; // no berries on page, nothing to delete 
    2434 
    25     // https://stackoverflow.com/questions/386281/how-to-implement-select-all-check-box-in-html 
    2635    // https://stackoverflow.com/questions/590018/getting-all-selected-checkboxes-in-an-array 
    2736    // https://www.w3schools.com/jsref/met_document_queryselectorall.asp 
     
    145154    } 
    146155 
    147     // Ensure the delete-all and delete-selected checkboxes are deselected 
    148     YAHOO.util.Dom.get('delall-checkbox').checked = false;  
    149     YAHOO.util.Dom.get('delselected-checkbox').checked = false;  
     156    // Ensure the select-all, delete-all and delete-selected checkboxes are deselected 
     157    YAHOO.util.Dom.get('select-all-checkbox').checked = false;  
     158    YAHOO.util.Dom.get('delete-selected-checkbox').checked = false; 
     159    YAHOO.util.Dom.get('delete-all-checkbox').checked = false;  
    150160    } 
    151161 
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/berry.xsl

    r33106 r33109  
    5151            <div class="clear"><xsl:text> </xsl:text></div> 
    5252        </table> 
    53         <input type="checkbox" name="delsel-checkbox" id="delselected-checkbox" value="delete-all" onclick="deleteSelected()">Delete Selected</input> 
    54         <input type="checkbox" name="delall-checkbox" id="delall-checkbox" value="delete-all" onclick="deleteAll()">Delete All</input> 
     53        <input type="checkbox" name="selall-checkbox" id="select-all-checkbox" value="select-all" onclick="toggleSelectAll(this)">Select All</input> 
     54        <input type="checkbox" name="delsel-checkbox" id="delete-selected-checkbox" value="delete-all" onclick="deleteSelected()">Delete Selected</input> 
     55        <input type="checkbox" name="delall-checkbox" id="delete-all-checkbox" value="delete-all" onclick="deleteAll()">Delete All</input> 
    5556        <div id="berryBasketContent"><span><xsl:text> </xsl:text></span></div> 
    5657