LP#1797923 Browser client iframe initial loading page
authorBill Erickson <berickxx@gmail.com>
Mon, 15 Oct 2018 15:43:33 +0000 (11:43 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Wed, 24 Oct 2018 16:18:52 +0000 (12:18 -0400)
Apply a default value to the browser client iframe URL so the iframe
does not attempt to load a copy of the current page.  The default value
points to a simple loading page, displying "Loading..." plus our
standard spinny gif.

Progress gif copied from web/opac/images/ to web/images/ to avoid
dependence on the old opac directory.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jason Boyer <jboyer@library.in.gov>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>

Open-ILS/src/templates/staff/loading.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/share/t_eframe.tt2
Open-ILS/web/images/progressbar_green.gif [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/services/eframe.js

diff --git a/Open-ILS/src/templates/staff/loading.tt2 b/Open-ILS/src/templates/staff/loading.tt2
new file mode 100644 (file)
index 0000000..5ce0352
--- /dev/null
@@ -0,0 +1,9 @@
+<html>
+  <body>
+    <div style="width:100%; padding: 20px; text-align:center">
+      [% l('Loading...') %]
+      <img src="[% ctx.media_prefix %]/images/progressbar_green.gif"
+        title="[% l('Page Loading') %]"/>
+    </div>
+  </body>
+</html>
index 8bb274d..1a117fa 100644 (file)
@@ -1,11 +1,14 @@
 <div class="eg-embed-frame">
   <button type="button" class="btn btn-default btn-xs" ng-show="allowEscape &&  showIframe" ng-click="escapeEmbed()">[% l('Open in New Window') %]</button>
   <button type="button" class="btn btn-default btn-xs" ng-show="allowEscape && !showIframe" ng-click="restoreEmbed()">[% l('Re-embed') %]</button>
-  <!-- height is calculated at render time -->
+  <!--
+    'src' is replaced by the controller, after linking, and as soon as a
+    value is available.  height is calculated at render time.
+  -->
   <iframe 
     ng-show="showIframe"
     ng-attr-style="{{ autoresize ? undefined : 'height:' + height + 'px' }}"
-    src="{{url}}">
+    src="/eg/staff/loading">
   </iframe>
 </div>
 
diff --git a/Open-ILS/web/images/progressbar_green.gif b/Open-ILS/web/images/progressbar_green.gif
new file mode 100644 (file)
index 0000000..f864d5f
Binary files /dev/null and b/Open-ILS/web/images/progressbar_green.gif differ
index 5096165..bf27b88 100644 (file)
@@ -111,6 +111,26 @@ angular.module('egCoreMod')
                 var page = $scope.iframe.contentWindow.location.href;
                 console.debug('egEmbedFrameLoader(): ' + page);
 
+                if (page.match(/eg\/staff\/loading$/)) { // loading page
+
+                    // If we have a startup-time URL, apply it now.
+                    if ($scope.url) {
+                        console.debug('Applying initial URL: ' + $scope.url);
+                        iframe.contentWindow.location.href = $scope.url;
+                    }
+
+                    // Watch for future URL changes
+                    $scope.$watch('url', function(newVal, oldVal) {
+                        if (newVal && newVal != oldVal) {
+                            iframe.contentWindow.location.href = newVal;
+                        }
+                    });
+
+                    // Nothing more is needed until the iframe is
+                    // loaded once more with a real URL.
+                    return;
+                }
+
                 // reload ifram page w/o reloading the entire UI
                 $scope.reload = function() {
                     $scope.iframe.contentWindow.location.replace(