From 3819b4603374b2eb3e46c7f929ad39dae7448a2f Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 24 Apr 2015 16:27:31 -0400 Subject: [PATCH] webstaff: Add height adjustment hacks for a couple dojo interfaces Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- .../src/templates/staff/cat/catalog/t_catalog.tt2 | 2 +- .../web/js/ui/default/staff/services/eframe.js | 46 +++++++++++++++++----- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 index 3dc6fd2980..9c1bd14224 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 @@ -71,7 +71,7 @@ [% INCLUDE 'staff/cat/catalog/t_holds.tt2' %]
- +
diff --git a/Open-ILS/web/js/ui/default/staff/services/eframe.js b/Open-ILS/web/js/ui/default/staff/services/eframe.js index a1f0c8779b..5ef6fec4dd 100644 --- a/Open-ILS/web/js/ui/default/staff/services/eframe.js +++ b/Open-ILS/web/js/ui/default/staff/services/eframe.js @@ -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; }); } -- 2.11.0