123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- dojo.provide("tm1.iwidget.utilities.IFrame");
- dojo.require("bux.Helper");
- dojo.require("bux.Encodings");
- dojo.declare("tm1.iwidget.utilities.IFrame", dijit._Widget, {
- url: null,
- frameTitle: null,
- resizeZone: null,
- iframe: null,
- constructor: function(params) {
- },
- setUrl: function(url) {
- this.url = url;
- if (this.iframe) {
- this.iframe.src = this.prepareUrl(url);
- }
- },
- prepareUrl: function(url) {
- if (url === null || url === "") {
- return url;
- }
-
- url = bux.Helper.normalizeURL(url);
- return url;
- },
- setFrameTitle: function(title) {
- this.frameTitle = title;
- if (this.iframe) {
- this.iframe.title = bux.Encodings.htmlencode(title);
- }
- },
- startup: function() {
- this.inherited(arguments);
- var dn = this.domNode;
- var url = this.url;
- this.resizeZone = dn.ownerDocument.createElement("div");
- dn.appendChild(this.resizeZone);
- dn = (this.iframe = dojo.doc.createElement('iframe'));
- dn.id = this.id + "_iframe";
- dn.style.border = "none";
- dn.style.width = "100%";
- dn.frameBorder = 0;
- dn.tabIndex = 0;
- dn.title = this.frameTitle;
- dn.setAttribute('src', this.prepareUrl(url));
- this.resizeZone.appendChild(dn);
- if (dojo.isWebKit) {
- setTimeout(function() {
- dn.setAttribute('src', this.prepareUrl(url));
- }, 0);
- }
- },
- resize: function(size) {
- dijit.layout._LayoutWidget.prototype.resize.apply(this, arguments);
- if (dojo.isWebKit) {
- this.domNode.style.display = "none";
- setTimeout(dojo.hitch(this, function(){
- this.domNode.style.display = "";
- }), 1);
- }
- },
- layout: function() {
- this.resizeZone.style.height = this._contentBox.h + "px";
- if (this.iframe) {
- this.iframe.style.height = "100%";
- }
- }
- });
|