setexport.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. $(function()
  2. {
  3. $('[name^=' + window.mode + ']').change(function()
  4. {
  5. var checked = $(this).prop('checked');
  6. $(this).parents('.settingBox').find('.fieldBox').toggle(checked);
  7. $(this).parents('.settingBox').find('[name^=checkAll], [name^=fields]').prop('checked', checked);
  8. });
  9. $('[name^=checkAll]').change(function()
  10. {
  11. var checked = $(this).prop('checked');
  12. $(this).parents('.fieldBox').find('[name^=fields]').prop('checked', checked);
  13. });
  14. $('#submit').click(function()
  15. {
  16. /* Check if checked the fields to export. */
  17. var table = '';
  18. $('[name^=' + window.mode + ']:checked').each(function()
  19. {
  20. if($(this).parents('.settingBox').find('[name^=fields]:checked').length == 0)
  21. {
  22. table = table == '' ? $(this).data('name') : table + ',' + $(this).data('name');
  23. }
  24. });
  25. if(table == '')
  26. {
  27. $('#ajaxForm').submit();
  28. return false;
  29. }
  30. var message = window.emptyExport.replace(/TABLE/, table);
  31. bootbox.confirm(message, function(result)
  32. {
  33. if(result)
  34. {
  35. $('#ajaxForm').submit();
  36. }
  37. });
  38. return false;
  39. });
  40. $('.sortable .checkbox label').append("<i class='icon-move'></i>");
  41. $('.sortable').sortable({trigger: '.icon-move'});
  42. });