You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

99 lines
2.8 KiB

  1. jQuery('#plugin_move__progress').each(function () {
  2. var $this = jQuery(this);
  3. // initialize the progress bar
  4. var $progressbar = $this.find('.progress');
  5. $progressbar.html('');
  6. $progressbar.progressbar({
  7. value: $progressbar.data('progress')
  8. });
  9. /**
  10. * Set visibility of buttons according to current error state
  11. *
  12. * @param isError
  13. */
  14. var setButtons = function(isError) {
  15. $this.find('.ctlfrm-start').addClass('hide');
  16. if(isError) {
  17. $this.find('.ctlfrm-skip').removeClass('hide');
  18. $this.find('.ctlfrm-retry').removeClass('hide');
  19. $this.find('.ctlfrm-continue').addClass('hide');
  20. }else {
  21. $this.find('.ctlfrm-skip').addClass('hide');
  22. $this.find('.ctlfrm-retry').addClass('hide');
  23. $this.find('.ctlfrm-continue').addClass('hide');
  24. }
  25. };
  26. /**
  27. * Execute the next steps
  28. *
  29. * @param {bool} skip should an error be skipped?
  30. */
  31. var nextStep = function(skip) {
  32. // clear error output
  33. $this.find('.output').html('');
  34. $this.find('.controls img').removeClass('hide');
  35. setButtons(false);
  36. // execute AJAX
  37. jQuery.post(
  38. DOKU_BASE + 'lib/exe/ajax.php',
  39. {
  40. call: 'plugin_move_progress',
  41. skip: skip
  42. },
  43. function (data) {
  44. $progressbar.progressbar('option', 'value', data.progress);
  45. $this.find('.controls img').addClass('hide');
  46. if (data.error) {
  47. $this.find('.output').html('<p><div class="error">' + data.error + '</div></p>');
  48. setButtons(true);
  49. } else if (data.complete) {
  50. $progressbar.progressbar('option', 'value', 100);
  51. // redirect to start page
  52. alert(LANG.plugins.move.complete);
  53. window.location.href = DOKU_BASE;
  54. } else {
  55. // do it again
  56. nextStep(skip);
  57. }
  58. }
  59. );
  60. };
  61. // attach AJAX actions to buttons
  62. $this.find('.ctl-continue').click(function (e) {
  63. e.preventDefault();
  64. // move in progress, no more preview
  65. jQuery('#plugin_move__preview').remove();
  66. // should the next error be skipped?
  67. var skip = e.target.form.skip.value;
  68. // step on it
  69. nextStep(skip);
  70. });
  71. });
  72. // hide preview list on namespace move
  73. jQuery('#plugin_move__preview').each(function () {
  74. var $this = jQuery(this);
  75. $this.find('ul').hide();
  76. $this.find('span')
  77. .click(function () {
  78. $this.find('ul').dw_toggle();
  79. $this.find('span').toggleClass('closed');
  80. })
  81. .addClass('closed');
  82. });