webstaff: Add height adjustment hacks for a couple dojo interfaces
authorMike Rylander <mrylander@gmail.com>
Fri, 24 Apr 2015 20:27:31 +0000 (16:27 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 17 Aug 2015 22:56:50 +0000 (22:56 +0000)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2
Open-ILS/web/js/ui/default/staff/services/eframe.js

index 3dc6fd2..9c1bd14 100644 (file)
@@ -71,7 +71,7 @@
       [% INCLUDE 'staff/cat/catalog/t_holds.tt2' %]
     </div>
     <div ng-if="record_tab == 'monoparts'">
-      <eg-embed-frame frame="parts_iframe" save-space="350" url="parts_url"></eg-embed-frame>
+      <eg-embed-frame save-space="350" url="parts_url"></eg-embed-frame>
     </div>
   </div>
 </div>
index a1f0c87..5ef6fec 100644 (file)
@@ -76,35 +76,63 @@ angular.module('egCoreMod')
             $scope.egEmbedFrameLoader = function(iframe) {
 
                 $scope.frame = {dom:iframe};
+                $scope.iframe = iframe;
 
                 // Reset the iframe height to the final content height.
-                $scope.height = $scope.frame.dom.contentWindow.document.body.scrollHeight;
+                $scope.height = $scope.iframe.contentWindow.document.body.scrollHeight;
 
-                var page = iframe.contentWindow.location.href;
+                var page = $scope.iframe.contentWindow.location.href;
                 console.debug('egEmbedFrameLoader(): ' + page);
 
                 // reload ifram page w/o reloading the entire UI
                 $scope.reload = function() {
-                    iframe.contentWindow.location.replace(
-                        iframe.contentWindow.location);
+                    $scope.iframe.contentWindow.location.replace(
+                        $scope.iframe.contentWindow.location);
                 }
 
                 // tell the iframe'd window its inside the staff client
-                iframe.contentWindow.IAMXUL = true;
+                $scope.iframe.contentWindow.IAMXUL = true;
 
                 // also tell it it's inside the browser client, which 
                 // may be needed in a few special cases.
-                iframe.contentWindow.IAMBROWSER /* hear me roar */ = true; 
+                $scope.iframe.contentWindow.IAMBROWSER /* hear me roar */ = true; 
 
                 // XUL has a dump() function which is occasinally called 
                 // from embedded browsers.
-                iframe.contentWindow.dump = function(msg) {
+                $scope.iframe.contentWindow.dump = function(msg) {
                     console.debug('egEmbedFrame:dump(): ' + msg);
                 }
 
+                // Adjust the height again if the iframe loads the openils.Util Dojo module
+                $timeout(function () {
+                    if ($scope.iframe.contentWindow.openils && $scope.iframe.contentWindow.openils.Util) {
+
+                        // HACK! for patron reg page
+                        var e = $scope.iframe.contentWindow.document.getElementById('myForm');
+                        var extra = 50;
+                        
+                        // HACK! for vandelay
+                        if (!e) {
+                            e = $scope.iframe.contentWindow.document.getElementById('vl-body-wrapper');
+                            extra = 50;
+                        }
+
+                        if (!e) {
+                            e = $scope.iframe.contentWindow.document.body;
+                            extra = 0;
+                        }
+
+                        $scope.iframe.contentWindow.openils.Util.addOnLoad( function() {
+                            var old_height = $scope.height;
+                            $scope.height = e.scrollHeight + extra;
+                            $scope.$apply();
+                        });
+                    }
+                });
+
                 // define a few commonly used stock xulG handlers. 
                 
-                iframe.contentWindow.xulG = {
+                $scope.iframe.contentWindow.xulG = {
                     // patron search
                     spawn_search : function(search) {
                         open_tab('/circ/patron/search?search=' 
@@ -213,7 +241,7 @@ angular.module('egCoreMod')
                 if ($scope.handlers) {
                     $scope.handlers.reload = $scope.reload;
                     angular.forEach($scope.handlers, function(val, key) {
-                        iframe.contentWindow.xulG[key] = val;
+                        $scope.iframe.contentWindow.xulG[key] = val;
                     });
                 }