Skip to content

Instantly share code, notes, and snippets.

@gocha
Created August 16, 2018 02:40
Show Gist options
  • Save gocha/d9ac370699b111e77e9ab877c887f889 to your computer and use it in GitHub Desktop.
Save gocha/d9ac370699b111e77e9ab877c887f889 to your computer and use it in GitHub Desktop.
Oracle Database 11: Patch for the SQL monitor report to allow modern browsers to load the Flash viewer
--- emviewers/scripts/loadswf.js.orig Thu Aug 16 11:26:42 2018
+++ emviewers/scripts/loadswf.js Thu Aug 16 11:40:06 2018
@@ -2,6 +2,13 @@
// This array should be modified everytime a new viewer is supported or when a
// new version of a viewer is introduced.
//
+// requires:
+// swfobject 2.3 (swfobject.js and expressInstall.swf) <https://github.com/swfobject/swfobject>
+// patch for chrome 55 <https://github.com/swfobject/swfobject/pull/59>
+// and also do not forget to import swfobject.js instead of legacy flashver.js (modify your saved report html by hand)
+//
+// Express install might not work properly. I have no convern with it.
+//
var viewerMap =
{
"sqlmonitor" : [ "11", "12" ], // SQL monitor
@@ -16,19 +23,6 @@
};
-// minimum version of the flash player we need
-var requiredMajorVersion = 10;
-var requiredMinorVersion = 0;
-var requiredRevision = 0;
-
-// detect if flash player is available or not
-var hasProductInstall = DetectFlashVer(6, 0, 65);
-var hasRequestedVersion = DetectFlashVer(requiredMajorVersion,
- requiredMinorVersion,
- requiredRevision);
-var url_xml = 'historyUrl=history.htm%3F&lconid=' + lc_id +
- '&model='+ encodeURIComponent(document.body.innerHTML) +'';
-
// extract db_version and component name from the XML
var matchVersion = document.body.innerHTML.match(/db_version="([\d\.]*)"/);
var matchComponent = document.body.innerHTML.match(/orarep\/(\w*)\//);
@@ -199,67 +193,46 @@
}
-// main logic
-if ( hasProductInstall && !hasRequestedVersion )
-{
- var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
- var MMredirectURL = window.location;
- document.title = document.title.slice(0, 47) +
- " - Flash Player Installation";
- var MMdoctitle = document.title;
- AC_FL_RunContent(
- "src", "emviewers/scripts/playerProductInstall",
- "FlashVars", url_xml,
- "width", "100%",
- "height", "100%",
- "align", "middle",
- "id", viewer_component,
- "quality", "high",
- "bgcolor", "#FFFFFF",
- "name", viewer_component,
- "allowScriptAccess","always",
- "type", "application/x-shockwave-flash",
- "pluginspage", "http://www.adobe.com/go/getflashplayer"
- );
-}
-else if (hasRequestedVersion)
-{
- // determine viewer swf file. Allow one to overwrite default using
- // viewer_swf variable
- var viewer_file = (typeof(viewer_swf) == 'string')?
- viewer_swf : findViewerFile(viewer_component, viewer_db_version);
-
- // alert('Viewing file with ' + viewer_file);
-
- if (!viewer_file)
- {
- if (viewer_component != '')
- alert('Sorry, viewer name \"' + viewer_component +
- '\" is not yet supported...');
- else
- alert('Sorry, cannot not display report: unknown report type');
- }
+// determine viewer swf file. Allow one to overwrite default using
+// viewer_swf variable
+var viewer_file = (typeof(viewer_swf) == 'string')?
+ viewer_swf : findViewerFile(viewer_component, viewer_db_version);
+// alert('Viewing file with ' + viewer_file);
+
+if (!viewer_file)
+{
+ if (viewer_component != '')
+ alert('Sorry, viewer name \"' + viewer_component +
+ '\" is not yet supported...');
else
- {
- AC_FL_RunContent(
- "src", viewer_file,
- "width", "100%",
- "height", "100%",
- "align", "middle",
- "id", viewer_component,
- "quality", "high",
- "bgcolor", "#FFFFFF",
- "name", viewer_component,
- "flashvars", url_xml,
- "allowScriptAccess","always",
- "type", "application/x-shockwave-flash",
- "pluginspage", "http://www.adobe.com/go/getflashplayer");
- }
+ alert('Sorry, cannot not display report: unknown report type');
}
else
{
- var alternateContent = 'Fail to display EM Standalone report. '
- + 'This content requires the Adobe Flash Player. '
- + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
- document.write(alternateContent);
+ // main logic
+ var params = {
+ allowscriptaccess: "always",
+ bgcolor: "#FFFFFF",
+ quality: "high"
+ };
+ var flashvars = {
+ historyUrl: "history.htm%3F",
+ lconid: lc_id,
+ model: encodeURIComponent(document.body.innerHTML)
+ };
+ var attributes = {
+ align: "middle",
+ id: viewer_component,
+ name: viewer_component
+ };
+ var el = document.createElement("div");
+ swfobject.embedSWF(viewer_file + ".swf", el, "100%", "100%", 10, "expressInstall.swf", flashvars, params, attributes, function callbackFn(e) {
+ if (!e.success) {
+ var alternateContent = 'Fail to display EM Standalone report. '
+ + 'This content requires the Adobe Flash Player. '
+ + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
+ el.innerHTML = alternateContent;
+ }
+ });
+ document.body.appendChild(el);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment