bpsreport.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*##############################################################################
  2. # Copyright (C) 2011 HPCC Systems.
  3. #
  4. # All rights reserved. This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU Affero General Public License as
  6. # published by the Free Software Foundation, either version 3 of the
  7. # License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU Affero General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Affero General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. ############################################################################## */
  17. // for bpsreport: Options
  18. function doSelectOptions(toSelect, parentId) {
  19. // alert("toSelect="+toSelect+", parentId=" + parentId);
  20. // TODO: we can do better start with children of this elements
  21. var ctrls = document.forms['esp_form'].elements;
  22. for (var idx=0; idx<ctrls.length; idx++) {
  23. var c = ctrls[idx];
  24. if (c.id!='' && c.type == 'checkbox'){
  25. if ( (c.id.substr(0,parentId.length+1)==parentId+'.') && (c.id.indexOf("Include")>0) ) {
  26. if ((c.checked && !toSelect) || (!c.checked && toSelect))
  27. c.click(); // this ensure calls the onclick()
  28. }
  29. }
  30. }
  31. }
  32. var optionsSelected = false;
  33. function selectAllBpsReportOptions(img, idCtrl)
  34. {
  35. optionsSelected = !optionsSelected;
  36. img.src = 'files_/img/' + (optionsSelected ? 'unselectall.gif':'selectall.gif' );
  37. img.title = optionsSelected ? "Unselect All" : "Select All";
  38. doSelectOptions(optionsSelected,idCtrl);
  39. }