[ 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_ie.js (source)

   1  /*
   2      DynAPI Distribution
   3      DynLayer IE 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  p = DynLayer.prototype;
  11  p._create = function() {
  12      if (this.parent && !this.elm) {            
  13          DynElement._flagPreCreate(this);        
  14          var elm, parentElement;
  15          parentElement = this.parent.elm;
  16  //        if(dynapi.ua.v<5){
  17              parentElement.insertAdjacentHTML("beforeEnd",this.getOuterHTML());
  18              elm = parentElement.children[parentElement.children.length-1];
  19  /*        }
  20          else {
  21              // this method is more efficient for ie5+. any comment?
  22              //elm=document.createElement('DIV');
  23              elm=this._getDOMObject();
  24              elm.id=this.id;
  25              if(this._className) elm.className=this._class;
  26              if(!this._noStyle) {
  27                  var css = elm.style;
  28                  css.position=(this._position||'absolute');
  29                  if (this.x) css.pixelLeft = this.x;
  30                  if (this.y) css.pixelTop = this.y;
  31                  if (this.w) css.width = this.w;
  32                  if (this.h) css.height = this.h;
  33                  if (this.bgColor) css.backgroundColor = this.bgColor;
  34                  if (this.z) css.zIndex = this.z;
  35                  if (this._cursor) css.cursor = this._cursor;
  36                  if (this._overflow) css.overflow = this._overflow;            
  37                  if (this.bgImage!=null) css.backgroundImage='url('+this.bgImage+')';
  38                  //if (this.bgImage==null && this.html==null) css.backgroundImage='';
  39                  if (this.clip) css.clip='rect('+this.clip[0]+'px '+this.clip[1]+'px '+this.clip[2]+'px '+this.clip[3]+'px)';
  40                  else if (this.w!=null && this.h!=null) css.clip='rect(0px '+this.w+'px '+this.h+'px 0px)';        
  41                  css.visibility=(this.visible==false)? 'hidden':'inherit';
  42                  // border - set by BorderManager
  43                  if(this._cssBorTop){
  44                      css.borderTop = this._cssBorTop||'';
  45                      css.borderRight = this._cssBorRight||''; 
  46                      css.borderBottom = this._cssBorBottom||'';
  47                      css.borderLeft = this._cssBorLeft||'';
  48                  }
  49              }
  50              try {
  51                  elm.innerHTML = this.getInnerHTML();
  52              }
  53              catch (e)
  54              {
  55              }
  56              //alert(elm.outerHTML);
  57              parentElement.appendChild(elm);
  58          }
  59  */        DynLayer._assignElement(this,elm);
  60          DynElement._flagCreate(this);
  61      }
  62  };
  63  p._getDOMObject = function()
  64  {
  65      return document.createElement('DIV');
  66  }
  67  
  68  DynLayer._assignElement = function(dlyr,elm,divs) {
  69      if (!elm ) {
  70          elm = (divs)? divs[dlyr.id] : dlyr.parent.elm.all[dlyr.id];
  71          if (!elm){
  72              if(dlyr.isInline) dlyr._create();  // force create() for missing inline layer
  73              return;
  74          }
  75      }
  76      dlyr.elm = elm;
  77      dlyr.css = elm.style;
  78      dlyr.doc = dlyr.parent.doc;
  79      dlyr.elm._dynobj = dlyr;
  80      dlyr._dyndoc = dlyr.parent._dyndoc;
  81      if(dlyr._blkBoardElm) dlyr._blkBoardElm = (divs)? divs[dlyr.id+'_blkboard'] : dlyr.parent.elm.all[dlyr.id+'_blkboard'];
  82  
  83      // COMMENTED OUT TO PERMIT CSS PRIORITY
  84      // by Raphael Pereira <raphael@think-e.com.br>
  85      if (0 && dlyr.html!=null && dlyr.html!='' && (dlyr.w==null || dlyr.h==null)) {
  86          var cw = (dlyr.w==null)? dlyr.getContentWidth() : null;
  87          var ch = (dlyr.h==null)? dlyr.getContentHeight() : null;
  88          dlyr.setSize(cw,ch);
  89      }
  90      
  91      var i,ch=dlyr.children; 
  92      for (i=0;i<ch.length;i++) DynLayer._assignElement(ch[i],null,divs);
  93  
  94      if (dlyr._textSelectable==false) elm.onselectstart = dynapi.functions.Deny;
  95  
  96      // prevent dragging of images
  97      //if (elm.all.tags("img").length) elm.ondragstart = dynapi.functions.False;
  98  
  99      // Box Fix - for Border Manager
 100      if (dlyr._needBoxFix) BorderManager.FixBoxModel(dlyr);
 101  
 102      if (dlyr._hasKeyEvents) dlyr.captureKeyEvents();
 103      if (dlyr._hasMouseEvents) dlyr.captureMouseEvents();
 104      
 105  };
 106  p.enableBlackboard = function(){
 107      if (!this._created) this._blkBoardElm=true;
 108      else if(!this._blkBoardElm){
 109          var h='',elm = this.elm;
 110          if(this.html!=null) h=this.html;
 111          elm.insertAdjacentHTML("beforeEnd",'<div id="'+this.id+'_blkboard">'+h+'</div>');
 112          this._blkBoardElm = elm.children[elm.children.length-1];
 113      }
 114  };
 115  p.setLocation=function(x,y) {
 116      var cx = (x!=null && x!=this.x);
 117      var cy = (y!=null && y!=this.y);
 118      if (cx) this.x = x||0;
 119      if (cy) this.y = y||0;
 120      if (this.css!=null) {
 121          if (cx) this.css.pixelLeft = this.x;
 122          if (cy) this.css.pixelTop = this.y;
 123          // adjust parent size after being moved
 124          if((cx||cy) && this.parent._aSz) this.parent._adjustSize();        
 125      }
 126      if(this._hasLocationEvents) this.invokeEvent('locationchange');
 127      return (cx||cy);
 128  };
 129  p.setPageLocation = function(x,y) {
 130      if (this.isChild) {
 131          if (dynapi.ua.v>=5) {
 132              if (cx) this.css.pixelLeft = this.x;
 133              if (cy) this.css.pixelTop = this.y;
 134          }
 135          else {
 136              if (cx) this.css.left = this.x+"px";
 137              if (cy) this.css.top = this.y+"px";
 138          }
 139      }
 140      return this.setLocation(x,y);
 141  };
 142  p.setHTML = function(html) {
 143      if (html!=this.html) {
 144          this.html = html;
 145          if (this.css) {
 146              var elm = (this._blkBoardElm)? this._blkBoardElm:this.elm;
 147              elm.innerHTML = html;
 148              this._adjustSize();
 149          }
 150      }
 151      if(this._hasContentEvents) this.invokeEvent('contentchange');    
 152  };
 153  p.setTextSelectable=function(b) {
 154      this._textSelectable = b;
 155      if (this.elm) this.elm.onselectstart = b? dynapi.functions.Allow : dynapi.functions.Deny;
 156      if (!b) this.setCursor('default');
 157      // && this.captureMouseEvents && !this._hasMouseEvents) this.captureMouseEvents();
 158  };
 159  p.getCursor = function() {return this._cursor};
 160  p.setCursor = function(c) {
 161      if (!c) c = 'default';
 162      else c=(c+'').toLowerCase();
 163      if (this._cursor!=c) {
 164          this._cursor = c;
 165          if (this.css) this.css.cursor = c;
 166      }
 167  };
 168  p.getContentWidth=function() {
 169      if (this.elm==null) return 0;
 170      else {
 171          var w,tw = this.css.width;
 172          this.css.width='auto'; // force ie to get width
 173          if (dynapi.ua.platform=="mac") w = this.elm.offsetWidth;
 174          else w = parseInt(this.elm.scrollWidth);
 175          this.css.width=tw;
 176          return w;
 177      };
 178  };
 179  p.getContentHeight=function() {
 180      if (this.elm==null) return 0;
 181      else {
 182          if (dynapi.ua.platform=="mac") return this.elm.offsetHeight;
 183          return parseInt(this.elm.scrollHeight);
 184          
 185      }
 186  };
 187  p.setOverflow = function(s)
 188  {
 189      if(!s) s='';
 190      this._overflow=s;
 191      if(this.css) this.css.overflow=s;
 192      else this._cssOverflow=' overflow:'+s+';';
 193  }


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