Make reports functional in Firefox, IE.

This commit is contained in:
Greg Von Kuster
2008-06-04 17:44:12 +00:00
parent bef6fd40e3
commit 928bc214de
6 changed files with 5052 additions and 40 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,166 @@
// =========================================================================
// ie7-recalc.js
// =========================================================================
(function() {
/* ---------------------------------------------------------------------
This allows refreshing of IE7 style rules. If you modify the DOM
you can update IE7 by calling document.recalc().
This should be the LAST module included.
--------------------------------------------------------------------- */
if (!IE7.loaded) return;
// remove all IE7 classes from an element
CLASSES = /\sie7_class\d+/g;
IE7.CSS.extend({
// store for elements that have style properties calculated
elements: {},
handlers: [],
// clear IE7 classes and styles
reset: function() {
this.removeEventHandlers();
// reset IE7 classes here
var elements = this.elements;
for (var i in elements) elements[i].runtimeStyle.cssText = "";
this.elements = {};
// reset runtimeStyle here
var elements = IE7.Rule.elements;
for (var i in elements) {
with (elements[i]) className = className.replace(CLASSES, "");
}
IE7.Rule.elements = {};
},
reload: function() {
this.rules = [];
this.getInlineStyles();
this.screen.load();
if (this.print) this.print.load();
this.refresh();
this.trash();
},
addRecalc: function(propertyName, test, handler, replacement) {
// call the ancestor method to add a wrapped recalc method
this.base(propertyName, test, function(element) {
// execute the original recalc method
handler(element);
// store a reference to this element so we can clear its style later
IE7.CSS.elements[element.uniqueID] = element;
}, replacement);
},
recalc: function() {
// clear IE7 styles and classes
this.reset();
// execute the ancestor method to perform recalculations
this.base();
},
addEventHandler: function(element, type, handler) {
element.attachEvent(type, handler);
// store the handler so it can be detached later
this.handlers.push(arguments);
},
removeEventHandlers: function() {
var handler;
while (handler = this.handlers.pop()) {
handler[0].detachEvent(handler[1], handler[2]);
}
},
getInlineStyles: function() {
// load inline styles
var styleSheets = document.getElementsByTagName("style"), styleSheet;
for (var i = styleSheets.length - 1; (styleSheet = styleSheets[i]); i--) {
if (!styleSheet.disabled && !styleSheet.ie7) {
var cssText = styleSheet.cssText || styleSheet.innerHTML;
this.styles.push(cssText);
styleSheet.cssText = cssText;
}
}
},
trash: function() {
// trash the old style sheets
var styleSheets = document.styleSheets, styleSheet, i;
for (i = 0; i < styleSheets.length; i++) {
styleSheet = styleSheets[i];
if (!styleSheet.ie7 && !styleSheet.cssText) {
styleSheet.cssText = styleSheet.cssText;
}
}
this.base();
},
getText: function(styleSheet) {
return styleSheet.cssText || this.base(styleSheet);
}
});
// remove event handlers (they eat memory)
IE7.CSS.addEventHandler(window, "onunload", function() {
IE7.CSS.removeEventHandlers();
});
// store all elements with an IE7 class assigned
IE7.Rule.elements = {};
IE7.Rule.prototype.extend({
add: function(element) {
// execute the ancestor "add" method
this.base(element);
// store a reference to this element so we can clear its classes later
IE7.Rule.elements[element.uniqueID] = element;
}
});
// store created pseudo elements
if (IE7.PseudoElement) {
IE7.PseudoElement.hash = {};
IE7.PseudoElement.prototype.extend({
create: function(target) {
var key = this.selector + ":" + target.uniqueID;
if (!IE7.PseudoElement.hash[key]) {
IE7.PseudoElement.hash[key] = true;
this.base(target);
}
}
});
}
IE7.HTML.extend({
elements: {},
addRecalc: function(selector, handler) {
// call the ancestor method to add a wrapped recalc method
this.base(selector, function(element) {
if (!this.elements[element.uniqueID]) {
// execute the original recalc method
handler(element);
// store a reference to this element so that
// it is not "fixed" again
this.elements[element.uniqueID] = element;
}
});
}
});
// allow refreshing of IE7 fixes
document.recalc = function(reload) {
if (IE7.CSS.screen) {
if (reload) IE7.CSS.reload();
IE7.recalc();
}
};
})();
+21 -25
View File
@@ -1,31 +1,27 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>${self.title()}</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
${self.stylesheets()}
${self.javascripts()}
</head>
<body>
${next.body()}
</body>
</html>
<head>
<title>${self.title()}</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
${self.stylesheets()}
${self.javascripts()}
</head>
## Default title
<%def name="title()"></%def>
<body>
${next.body()}
</body>
</html>
## Default title
<%def name="title()"></%def>
## Default stylesheets
<%def name="stylesheets()">
## Default stylesheets
<%def name="stylesheets()">
<link href="${h.url_for('/static/style/base.css')}" rel="stylesheet" type="text/css" />
</%def>
</%def>
## Default javascripts
<%def name="javascripts()">
## <!--[if lt IE 7]>
## <script type='text/javascript' src="/static/scripts/IE7.js"> </script>
## <![endif]-->
<script type="text/javascript" src="${h.url_for('/static/scripts/jquery.js')}"></script>
<script type="text/javascript" src="${h.url_for('/static/scripts/galaxy.base.js')}"></script>
</%def>
## Default javascripts
<%def name="javascripts()">
## <!--[if lt IE 7]>
## <script type='text/javascript' src="/static/scripts/IE7.js"> </script>
## <![endif]-->
</%def>
@@ -0,0 +1,51 @@
## This needs to be on the first line, otherwise IE6 goes into quirks mode
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
## Default title
<%def name="title()">Galaxy Reports</%def>
## Default stylesheets
<%def name="stylesheets()">
</%def>
## Default javascripts
<%def name="javascripts()">
<!--[if lt IE 7]>
<script type='text/javascript' src="/static/scripts/IE7.js"> </script>
<script type='text/javascript' src="/static/scripts/ie7-recalc.js"> </script>
<![endif]-->
</%def>
## Default late-load javascripts
<%def name="late_javascripts()">
</%def>
## Masthead
<%def name="masthead()">
<iframe name="galaxy_masthead" src="${h.url_for( 'masthead' )}" width="38" height="100%" frameborder="0" scroll="no" style="margin: 0; border: 0 none; width: 100%; height: 38px; overflow: hidden;"> </iframe>
</%def>
## Document
<html lang="en">
<head>
<title>${self.title()}</title>
${self.javascripts()}
${self.stylesheets()}
</head>
<body scroll="no">
## Background displays first
<div id="background"></div>
## Layer iframes over backgrounds
<div id="masthead">
${self.masthead()}
</div>
<div id="center">
${self.center_panel()}
</div>
## Allow other body level elements
${next.body()}
</body>
## Scripts can be loaded later since they progressively add features to
## the panels, but do not change layout
${self.late_javascripts()}
</html>
@@ -1,15 +1,8 @@
<%inherit file="/base.mako"/>
<%def name="title()">Galaxy Reports Main</%def>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Galaxy Reports Main</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="${h.url_for('/static/style/base.css')}" rel="stylesheet" type="text/css" />
</head>
<frameset rows="36,*" border="0" framespacing="0" frameborder="0">
<frame name="masthead" src="${h.url_for('masthead')}" frameborder="0" border="0" framespacing="0">
<frame name="main_frame" src="${h.url_for('main_frame')}" border="3" framespacing="3" frameborder="1">
</frameset>
</html>
<%inherit file="/base_panels.mako"/>
<%def name="center_panel()">
## Display the reports in the middle frame
<%
center_url = h.url_for( 'main_frame' )
%>
<iframe name="main_frame" id="main_frame" frameborder="0" style="position: absolute; width: 100%; height: 100%;" src="${center_url}"> </iframe>
</%def>