[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpgwapi/js/dynapi/api/ -> dynlayer_opera.js (source)

   1  /*
   2      DynAPI Distribution
   3      DynLayer Opera Specific Functions
   4  
   5      The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
   6      
   7      requires: dynapi.api.DynLayerBase
   8  */
   9  
  10  // Warning: Avoid using document.all collection as it has been reported 
  11  // that on some platforms when opera is set to an identity other than IE 
  12  // the all[] collection is not available 
  13  
  14  p = DynLayer.prototype;
  15  p._create = function() {
  16      if (this.parent && !this.elm) {
  17          DynElement._flagPreCreate(this);
  18          var elm, parentElement;
  19          parentElement = this.parent.elm;
  20          
  21          // this method is more efficient for opera7+
  22          parentElement.insertAdjacentHTML("beforeEnd",this.getOuterHTML());
  23          elm = parentElement.children[parentElement.children.length-1];
  24          
  25          DynLayer._assignElement(this,elm);
  26          DynElement._flagCreate(this);
  27      }
  28  };
  29  DynLayer._assignElement = function(dlyr,elm,divs) {
  30      if (!elm ) {
  31          elm = (divs)? divs[dlyr.id] : dlyr.parent.doc.getElementById(dlyr.id);
  32          if (!elm){
  33              if(dlyr.isInline) dlyr._create();  // force create() for missing inline layer
  34              return;
  35          }
  36      }
  37      dlyr.elm = elm;
  38      dlyr.css = elm.style;
  39      dlyr.doc = dlyr.parent.doc;
  40      dlyr.elm._dynobj = dlyr;
  41      dlyr._dyndoc = dlyr.parent._dyndoc;
  42      if(dlyr._blkBoardElm) dlyr._blkBoardElm = (divs)? divs[dlyr.id+'_blkboard'] : dlyr.parent.doc.getElementById(dlyr.id+'_blkboard');
  43  
  44      // COMMENTED OUT TO PERMIT CSS PRIORITY
  45      // by Raphael Pereira <raphael@think-e.com.br>
  46      if (0 && dlyr.html!=null && dlyr.html!='' && (dlyr.w==null || dlyr.h==null)) {
  47          var cw = (dlyr.w==null)? dlyr.getContentWidth() : null;
  48          var ch = (dlyr.h==null)? dlyr.getContentHeight() : null;
  49          //var cw = (dlyr.w==null)? dlyr.getElmWidth() : null;
  50          //var ch = (dlyr.h==null)? dlyr.getElmHeight() : null;
  51          dlyr.setSize(cw,ch);
  52      }
  53  
  54      var i,ch=dlyr.children; 
  55      for (i=0;i<ch.length;i++) DynLayer._assignElement(ch[i],null,divs);
  56  
  57      if (this._textSelectable==false) elm.onselectstart = dynapi.functions.Disallow;
  58  
  59      // Box Fix - for Border Manager
  60      if (dlyr._needBoxFix) BorderManager.FixBoxModel(dlyr);
  61  
  62      if (dlyr._hasKeyEvents) dlyr.captureKeyEvents();
  63      if (dlyr._hasMouseEvents) dlyr.captureMouseEvents();    
  64  };
  65  p.enableBlackboard = function(){
  66      if (!this._created) this._blkBoardElm=true;
  67      else if(!this._blkBoardElm){
  68          var h='',elm = this.elm;
  69          if(this.html!=null) h=this.html;
  70          elm.insertAdjacentHTML("beforeEnd",'<div id="'+this.id+'_blkboard">'+h+'</div>');
  71          this._blkBoardElm = elm.children[elm.children.length-1];
  72      }
  73  };
  74  p.setLocation=function(x,y) {
  75      var cx = (x!=null && x!=this.x);
  76      var cy = (y!=null && y!=this.y);
  77      if (cx) this.x = x||0;
  78      if (cy) this.y = y||0;
  79      if (this.css!=null) {
  80          if (cx) this.css.pixelLeft = this.x;
  81          if (cy) this.css.pixelTop = this.y;
  82          // adjust parent size after being sized
  83          if((cx||cy) && this.parent._aSz) this.parent._adjustSize();        
  84      }
  85      if(this._hasLocationEvents) this.invokeEvent('locationchange');        
  86      return (cx||cy);
  87  };
  88  p.setPageLocation = function(x,y) {
  89      if (this.isChild) {
  90          if (dynapi.ua.v>=5) {
  91              if (cx) this.css.pixelLeft = this.x;
  92              if (cy) this.css.pixelTop = this.y;
  93          }
  94          else {
  95              if (cx) this.css.left = this.x+"px";
  96              if (cy) this.css.top = this.y+"px";
  97          }
  98      }
  99      return this.setLocation(x,y);
 100  };
 101  p.setHTML = function(html) {
 102      if (html!=this.html) {
 103          this.html = html;
 104          if (this.css) {
 105              var elm = (this._blkBoardElm)? this._blkBoardElm:this.elm;
 106              elm.innerHTML = html;
 107              this._adjustSize();
 108          }
 109      }
 110      if(this._hasContentEvents) this.invokeEvent('contentchange');
 111  };
 112  p.setTextSelectable=function(b) {
 113      this._textSelectable = b;
 114      if (this.elm) this.elm.onselectstart = b? dynapi.functions.Allow : dynapi.functions.Deny;
 115      if (!b) this.setCursor('default');
 116      // && this.captureMouseEvents && !this._hasMouseEvents) this.captureMouseEvents();
 117  };
 118  p.getCursor = function() {return this._cursor};
 119  p.setCursor = function(c) {
 120      if (!c) c = 'default';
 121      else c=(c+'').toLowerCase();
 122      if (this._cursor!=c) {
 123          this._cursor = c;
 124          if (this.css) this.css.cursor = c;
 125      }        
 126  };
 127  p.getContentWidth=function() {
 128      if (this.elm==null) return 0;
 129      else {
 130          var tw=this.css.width;
 131          var w,to = this.css.overflow;
 132          this.css.width='auto';
 133          this.css.overflow='auto';
 134          w = parseInt(this.elm.scrollWidth);
 135          this.css.width=tw;
 136          this.css.overflow=to;
 137          return w;
 138          
 139      };
 140  };
 141  p.getContentHeight=function() {
 142      if (this.elm==null) return 0;
 143      else {
 144          if (dynapi.ua.platform=="mac") return this.elm.offsetHeight;
 145          return parseInt(this.elm.scrollHeight);
 146      }
 147  };


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7