eggification
[PlinnDocument.git] / Products / PlinnDocument / skins / static / git-logo.png
diff --git a/skins/layout_objects.js b/skins/layout_objects.js
deleted file mode 100644 (file)
index 2d4ca89..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-// (c) Benoît PIN 2006-2007
-// http://plinn.org
-// Licence GPL
-
-var ELEMENTS_POOL = {};
-
-function initElementsPool() {
-       // Element pool (for cloning)
-       ELEMENTS_POOL["DIV_ELEMENT"]    = {"node" : document.getElementById("div"),
-                                                                          "beforeDraw" : null,
-                                                                          "getRawData" : null,
-                                                                          "putData" : null };
-
-       imgBeforeDraw = function() {
-               if (!this.node.src) {
-                       var dispatch = document.getElementById("ImgDispatcher");
-                       var strRatio = dispatch.value.split("_", 1)[0];
-                       var src = dispatch.value.substring(strRatio.length+1);
-                       this.ratio = new Number(strRatio).valueOf();
-                       this.node.src = PLINN_DOCUMENT_URL + '/' + src;
-                       var w = this.width;
-                       var size = (this.ratio > 1) ?
-                               new Point(w, Math.round(w * this.ratio)) :
-                               new Point(Math.round(w / this.ratio), w);
-                       
-                       this.resizeTo(size);
-               }
-       }
-
-       ELEMENTS_POOL["IMG_ELEMENT"]    = {"node" : document.getElementById("img"),
-                                                                          "beforeDraw" : imgBeforeDraw,
-                                                                          "getRawData" : function() {
-                                                                                       var src = this.node.src;
-                                                                                       src = src.split('/');
-                                                                                       return "attachments/" + src[src.length - 2] + "/getThumbnail";
-                                                                                       },
-                                                                          "putData" : function(raw) {
-                                                                                       this.node.src = PLINN_DOCUMENT_URL+"/attachments/"+raw;
-                                                                                       }
-                                                                           };
-
-       epozBeforeDraw = function() {
-               var rect = this
-               var iframe = this.node.childNodes[0];
-               var name = String(Math.floor(Math.random() * 10000));
-               addListener(iframe, 'load', function(){initTextRectangle(iframe, name, rect);});
-               
-               var ta = this.node.childNodes[1];
-               ta.name = name;
-               ta.id = name;
-       }
-
-       ELEMENTS_POOL["EPOZ_ELEMENT"]   = {"node" : document.getElementById("epoz"),
-                                                                          "beforeDraw" : epozBeforeDraw,
-                                                                          "getRawData" : function() {
-                                                                                       return this.node.childNodes[0].contentWindow.document.body.innerHTML;
-                                                                                       },
-                                                                          "putData" : function(raw) {
-                                                                                       this.node.childNodes[1].value = raw;
-                                                                                       }
-                                                                               };
-
-       for (var i = 0 ; i < ELEMENTS_POOL.length ; i++)
-               ELEMENTS_POOL[i].removeAttribute("id");
-}
-
-function Rectangle(upperLeftCorner, width, height, elementKey, ddOptions, ratio) {
-       this.meta_type = "Rectangle"; // ;-)
-       this.upperLeftCorner = upperLeftCorner;
-       this.width = width;
-       this.height = height;
-       this.elementKey = elementKey;
-       this.node = ELEMENTS_POOL[elementKey]["node"].cloneNode(true);
-       with (this.node.style) {
-               width="100%";
-               height="100%";
-       }
-       this.beforeDraw = ELEMENTS_POOL[elementKey]["beforeDraw"];
-       this.getRawData = ELEMENTS_POOL[elementKey]["getRawData"];
-       this.ddOptions = (!ddOptions) ? 11 : ddOptions; // 11-> drag, resize, delete
-       this.ratio = ratio;
-       
-       this.hostDiv = document.createElement("div");
-       this.hostDiv.appendChild(this.node);
-       
-       this.resizeHandle = document.createElement("span");
-       this.resizeHandle.className = "resize_handle";
-       this.hostDiv.appendChild(this.resizeHandle);
-       
-       if((this.ddOptions & 8) == 8) { // move allowed
-               this.movDelHandle = document.createElement("div");
-               this.movDelHandle.className = "rectangle_header";
-               var delImg = document.createElement("img");
-               delImg.src = "delete_rectangle.gif";
-               delImg.className = "rectangle_delimg";
-               delImg.onmouseover=function(){this.src="delete_rectangle_hover.gif";}
-               delImg.onmouseout=function(){this.src="delete_rectangle.gif";}
-               this.movDelHandle.appendChild(delImg);
-               this.hostDiv.appendChild(this.movDelHandle);
-               this.movDelHandle.rectangle = this;
-               delImg.rectangle = this;
-               
-       }
-       
-       // backward references
-       this.style = this.hostDiv.style;
-       this.node.rectangle = this;
-       this.hostDiv.rectangle = this;
-       this.resizeHandle.rectangle = this;
-}
-
-Rectangle.prototype.showHandles = function() {
-       if (this.resizeHandle)
-               this.resizeHandle.style.visibility = "visible";
-       if (this.movDelHandle)
-               this.movDelHandle.style.visibility = "visible";
-};
-
-Rectangle.prototype.hideHandles = function() {
-       if (this.resizeHandle)
-               this.resizeHandle.style.visibility = "hidden";
-       if (this.movDelHandle)
-               this.movDelHandle.style.visibility = "hidden";
-};
-
-Rectangle.prototype._mac_moveDelHandle = function() {
-       // fix height
-       var epozWindow = this.node.childNodes[0].contentWindow;
-       if (epozWindow.scrollMaxY)
-               this.resizeHandle.style.right = "15px";
-       else
-               this.resizeHandle.style.right = "0px";
-
-       // fix width
-       if (epozWindow.scrollMaxX)
-               this.resizeHandle.style.bottom = "15px";
-       else
-               this.resizeHandle.style.bottom = "0px";
-};
-       
-
-Rectangle.prototype.draw = function(container, position) {
-       if (this.beforeDraw)
-               this.beforeDraw();
-       var style = this.style;
-       style.left = String(this.upperLeftCorner.x) + "px"; 
-       style.top = String(this.upperLeftCorner.y) + "px";
-       style.width = String(this.width) + "px";
-       style.height = String(this.height) + "px";
-       
-       style.display="block";
-       var pos;
-       if (!position)
-               pos = "absolute";
-       else
-               pos = position;
-       style.position = pos;
-       setBorderStyle(this, "solid");
-       setBorderWidth(this, "1px");
-       style.visibility = "inherit";
-/*     style.overflow = "hidden";*/
-       if (container.meta_type == "Rectangle")
-               setBorderColor(this, container.style.borderTopColor);
-       
-       container.appendChild(this.hostDiv);
-};
-
-
-Rectangle.prototype.moveTo = function(upperLeftCorner) {
-       this.upperLeftCorner = upperLeftCorner;
-       var style = this.style;
-       style.left = String(this.upperLeftCorner.x) + "px"; 
-       style.top = String(this.upperLeftCorner.y) + "px";
-};
-
-Rectangle.prototype.resizeTo = function(size, cancelOnresize) {
-       if (size.x >= 10)
-               this.width = size.x;
-       if (size.y >= 10)
-               this.height = size.y;
-               
-       var style = this.style;
-       style.width = String(this.width) + "px";
-       style.height = String(this.height) + "px";
-       if (this.onresize && !cancelOnresize)
-               this.onresize();
-};
-
-Rectangle.prototype.appendChild = function(node) {
-       this.node.appendChild(node);
-};
-
-Rectangle.prototype.setId = function(id) {
-       this.node.id = id;
-};
-
-
-
-function initTextRectangle(iframe, name, rect) {
-       var ta = iframe.nextSibling; // ta -> textarea
-       var data = ta.value;
-       
-       if (browser.isGecko) {
-               // Just a few cleanups for Mozilla
-               data = data.replace(/<strong>/ig,'<b>');
-               data = data.replace(/<strong(\s[^>]*)>/ig,'<b$1>');
-               data = data.replace(/<\/strong>/ig,'</b>');
-               
-               data = data.replace(/<em>/ig,'<i>');
-               data = data.replace(/<em(\s[^>]*)>/ig,'<i$1>');
-               data = data.replace(/<\/em>/ig,'</i>');
-       }
-
-       // change iframe id
-       iframe.id = IFramePrefix + name;
-       iframe.style.border = "0px none transparent";
-
-
-       iframe.contentWindow.document.body.innerHTML = data;
-       iframe.contentWindow.document.id = DocPrefix + name;
-       addListener(iframe, "click", handlePlinnEpozRedirect);
-       if (browser.isMac) {
-               addListener(iframe.contentWindow.document, 'overflow', function(){rect._mac_moveDelHandle();});
-               addListener(iframe.contentWindow.document, 'underflow', function(){rect._mac_moveDelHandle();});
-       }
-
-       if (browser.isGecko) {
-               scriptExpr = 'EnableDesignMode("' + iframe.id + '");';
-               window.setTimeout(scriptExpr, 10);
-       }
-}
-
-// « overloads »
-
-function handlePlinnEpozRedirect(evt) {
-       redirectPlinnEpoz(getTargetedObject(evt));
-}
-
-function redirectPlinnEpoz(iframe) {
-       if(EpozElement) {
-               if (EpozElement == iframe)
-                       return;
-               unwrapPlinnEpozVariables();
-       }
-
-       // update Epoz variables        
-       wrapPlinnEpozVariables(iframe);
-       EpozElement.contentWindow.focus();
-}
-
-function wrapPlinnEpozVariables(iframe) {
-       fieldId = iframe.contentWindow.document.id.slice(DocPrefixLength);
-       
-       iframe.id = Epoz ;
-       EpozElement=iframe;
-       EpozTextArea = document.getElementById(fieldId);
-}
-
-
-function unwrapPlinnEpozVariables() {
-       if (!EpozElement) // no redirection happens yet.
-               return;
-       try {
-       fieldId = EpozElement.contentWindow.document.id.slice(DocPrefixLength);
-       }
-       catch (e) { }
-       
-       EpozElement.id = IFramePrefix + fieldId;
-}