diff --git a/includes/ingest.form.inc b/includes/ingest.form.inc index 7edd0f60..f9ed2b21 100644 --- a/includes/ingest.form.inc +++ b/includes/ingest.form.inc @@ -697,11 +697,48 @@ function islandora_ingest_form_ingest_button(array &$form_state) { '#type' => 'submit', '#name' => 'ingest', '#value' => t('Ingest'), + '#process' => array('islandora_ingest_form_ingest_button_process'), '#validate' => $validate, '#submit' => $submit, ); } +/** + * Process hook for the ingest button, adds the please wait spinning icon. + */ +function islandora_ingest_form_ingest_button_process(array $element) { + $settings['spinner'][$element['#id']] = array( + 'message' => t('Please be patient while the the page loads.'), + 'options' => array( + 'lines' => 10, + 'length' => 20, + 'width' => 10, + 'radius' => 30, + 'corners' => 1, + 'rotate' => 0, + 'direction' => 1, + 'color' => '#000', + 'speed' => 1, + 'trail' => 60, + 'shadow' => FALSE, + 'hwaccel' => FALSE, + 'className' => 'spinner', + 'zIndex' => 2000000000, + 'top' => 'auto', + 'left' => 'auto', + ), + ); + drupal_add_js($settings, 'setting'); + $islandora_path = drupal_get_path('module', 'islandora'); + $element['#attached'] = array( + 'js' => array( + "$islandora_path/js/spin/spin.min.js", + "$islandora_path/js/spinner.js", + ), + ); + return $element; +} + /** * The submit handler for the ingest form. * diff --git a/js/spin/LICENSE.txt b/js/spin/LICENSE.txt new file mode 100644 index 00000000..b0a7912e --- /dev/null +++ b/js/spin/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2011 Felix Gnass [fgnass at neteye dot de] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/js/spin/README.md b/js/spin/README.md new file mode 100755 index 00000000..f88c257b --- /dev/null +++ b/js/spin/README.md @@ -0,0 +1,11 @@ +CONTENTS OF THIS FILE +--------------------- + + * summary + +SUMMARY +------- + +This directory contains the spin.js library: http://fgnass.github.io/spin.js/ +downloaded from http://fgnass.github.io/spin.js/dist/spin.min.js on Sept 27th +2013. This project is under version control: https://github.com/fgnass/spin.js. diff --git a/js/spin/spin.min.js b/js/spin/spin.min.js new file mode 100644 index 00000000..d4283919 --- /dev/null +++ b/js/spin/spin.min.js @@ -0,0 +1 @@ +(function(t,e){if(typeof exports=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else t.Spinner=e()})(this,function(){"use strict";var t=["webkit","Moz","ms","O"],e={},i;function o(t,e){var i=document.createElement(t||"div"),o;for(o in e)i[o]=e[o];return i}function n(t){for(var e=1,i=arguments.length;e>1):parseInt(n.left,10)+s)+"px",top:(n.top=="auto"?l.y-a.y+(t.offsetHeight>>1):parseInt(n.top,10)+s)+"px"})}r.setAttribute("role","progressbar");e.lines(r,e.opts);if(!i){var d=0,p=(n.lines-1)*(1-n.direction)/2,c,h=n.fps,m=h/n.speed,y=(1-n.opacity)/(m*n.trail/100),g=m/n.lines;(function v(){d++;for(var t=0;t>1)+"px"})}for(;r',e)}r.addRule(".spin-vml","behavior:url(#default#VML)");c.prototype.lines=function(e,i){var o=i.length+i.width,r=2*o;function s(){return f(t("group",{coordsize:r+" "+r,coordorigin:-o+" "+-o}),{width:r,height:r})}var a=-(i.width+i.length)*2+"px",l=f(s(),{position:"absolute",top:a,left:a}),u;function p(e,r,a){n(l,n(f(s(),{rotation:360/i.lines*e+"deg",left:~~r}),n(f(t("roundrect",{arcsize:i.corners}),{width:o,height:i.width,left:i.radius,top:-i.width>>1,filter:a}),t("fill",{color:d(i.color,e),opacity:i.opacity}),t("stroke",{opacity:0}))))}if(i.shadow)for(u=1;u<=i.lines;u++)p(u,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(u=1;u<=i.lines;u++)p(u);return n(e,l)};c.prototype.opacity=function(t,e,i,o){var n=t.firstChild;o=o.shadow&&o.lines||0;if(n&&e+o').text(settings.spinner[base].message); + $(id).after(message); + // Make UI changes. + spinner.spin(this); + $('#edit-next').hide(); + $('#edit-prev').hide(); + // Submit the form after a set timeout, this handles problems with + // safari, in that safari submit's immediately.. + if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { + $(':submit').attr('disabled', 'disabled'); + } + setTimeout(function() { + // Allow for the button to be clicked, then click it then + // prevent the default behavoir. + $(id).removeAttr('disabled') + .click() + .click(function(event) { + event.preventDefault(); + }); + }, 500); + } + return true; + }); + }); + } + } + }; +})(jQuery);