function import_js in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6
Same name and namespace in other branches
- 6.2 import/merci_import.php \import_js()
Custom import JS function.
2 calls to import_js()
- import_progress_page in import/
merci_import.php - import_selection_page in import/
merci_import.php
File
- import/
merci_import.php, line 330 - Administrative page for adding MERCI bucket/resource content types and items.
Code
function import_js() {
return "\n if (Drupal.jsEnabled) {\n \$(document).ready(function() {\n \$('#edit-has-js').each(function() { this.value = 1; });\n \$('#progress').each(function () {\n var holder = this;\n\n // Success: redirect to the summary.\n var importCallback = function (progress, status, pb) {\n if (progress == 100) {\n pb.stopMonitoring();\n window.location = window.location.href.split('op=')[0] +'op=finished';\n }\n }\n\n // Failure: point out error message and provide link to the summary.\n var errorCallback = function (pb) {\n var div = document.createElement('p');\n div.className = 'error';\n \$(div).html('An unrecoverable error has occured. You can find the error message below. It is advised to copy it to the clipboard for reference. Please continue to the <a href=\"merci_import.php?op=error\">import summary</a>');\n \$(holder).prepend(div);\n \$('#wait').hide();\n }\n\n var progress = new Drupal.progressBar('importprogress', importCallback, \"POST\", errorCallback);\n progress.setProgress(-1, 'Starting import');\n \$(holder).append(progress.element);\n progress.startMonitoring('merci_import.php?op=do_import', 0);\n });\n });\n }\n ";
}