<\/div>';
+}
+
+function _mkDivIe(x, y, w, h)
+{
+ this.htm += '%%'+this.color+';'+x+';'+y+';'+w+';'+h+';';
+}
+
+function _mkDivPrt(x, y, w, h)
+{
+ this.htm += '
<\/div>';
+}
+
+var _regex = /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;
+function _htmRpc()
+{
+ return this.htm.replace(
+ _regex,
+ '
\n');
+}
+
+function _htmPrtRpc()
+{
+ return this.htm.replace(
+ _regex,
+ '
\n');
+}
+
+function _mkLin(x1, y1, x2, y2)
+{
+ if(x1 > x2)
+ {
+ var _x2 = x2;
+ var _y2 = y2;
+ x2 = x1;
+ y2 = y1;
+ x1 = _x2;
+ y1 = _y2;
+ }
+ var dx = x2-x1, dy = Math.abs(y2-y1),
+ x = x1, y = y1,
+ yIncr = (y1 > y2)? -1 : 1;
+
+ if(dx >= dy)
+ {
+ var pr = dy<<1,
+ pru = pr - (dx<<1),
+ p = pr-dx,
+ ox = x;
+ while(dx > 0)
+ {--dx;
+ ++x;
+ if(p > 0)
+ {
+ this._mkDiv(ox, y, x-ox, 1);
+ y += yIncr;
+ p += pru;
+ ox = x;
+ }
+ else p += pr;
+ }
+ this._mkDiv(ox, y, x2-ox+1, 1);
+ }
+
+ else
+ {
+ var pr = dx<<1,
+ pru = pr - (dy<<1),
+ p = pr-dy,
+ oy = y;
+ if(y2 <= y1)
+ {
+ while(dy > 0)
+ {--dy;
+ if(p > 0)
+ {
+ this._mkDiv(x++, y, 1, oy-y+1);
+ y += yIncr;
+ p += pru;
+ oy = y;
+ }
+ else
+ {
+ y += yIncr;
+ p += pr;
+ }
+ }
+ this._mkDiv(x2, y2, 1, oy-y2+1);
+ }
+ else
+ {
+ while(dy > 0)
+ {--dy;
+ y += yIncr;
+ if(p > 0)
+ {
+ this._mkDiv(x++, oy, 1, y-oy);
+ p += pru;
+ oy = y;
+ }
+ else p += pr;
+ }
+ this._mkDiv(x2, oy, 1, y2-oy+1);
+ }
+ }
+}
+
+function _mkLin2D(x1, y1, x2, y2)
+{
+ if(x1 > x2)
+ {
+ var _x2 = x2;
+ var _y2 = y2;
+ x2 = x1;
+ y2 = y1;
+ x1 = _x2;
+ y1 = _y2;
+ }
+ var dx = x2-x1, dy = Math.abs(y2-y1),
+ x = x1, y = y1,
+ yIncr = (y1 > y2)? -1 : 1;
+
+ var s = this.stroke;
+ if(dx >= dy)
+ {
+ if(dx > 0 && s-3 > 0)
+ {
+ var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx;
+ _s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;
+ }
+ else var _s = s;
+ var ad = Math.ceil(s/2);
+
+ var pr = dy<<1,
+ pru = pr - (dx<<1),
+ p = pr-dx,
+ ox = x;
+ while(dx > 0)
+ {--dx;
+ ++x;
+ if(p > 0)
+ {
+ this._mkDiv(ox, y, x-ox+ad, _s);
+ y += yIncr;
+ p += pru;
+ ox = x;
+ }
+ else p += pr;
+ }
+ this._mkDiv(ox, y, x2-ox+ad+1, _s);
+ }
+
+ else
+ {
+ if(s-3 > 0)
+ {
+ var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy;
+ _s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;
+ }
+ else var _s = s;
+ var ad = Math.round(s/2);
+
+ var pr = dx<<1,
+ pru = pr - (dy<<1),
+ p = pr-dy,
+ oy = y;
+ if(y2 <= y1)
+ {
+ ++ad;
+ while(dy > 0)
+ {--dy;
+ if(p > 0)
+ {
+ this._mkDiv(x++, y, _s, oy-y+ad);
+ y += yIncr;
+ p += pru;
+ oy = y;
+ }
+ else
+ {
+ y += yIncr;
+ p += pr;
+ }
+ }
+ this._mkDiv(x2, y2, _s, oy-y2+ad);
+ }
+ else
+ {
+ while(dy > 0)
+ {--dy;
+ y += yIncr;
+ if(p > 0)
+ {
+ this._mkDiv(x++, oy, _s, y-oy+ad);
+ p += pru;
+ oy = y;
+ }
+ else p += pr;
+ }
+ this._mkDiv(x2, oy, _s, y2-oy+ad+1);
+ }
+ }
+}
+
+function _mkLinDott(x1, y1, x2, y2)
+{
+ if(x1 > x2)
+ {
+ var _x2 = x2;
+ var _y2 = y2;
+ x2 = x1;
+ y2 = y1;
+ x1 = _x2;
+ y1 = _y2;
+ }
+ var dx = x2-x1, dy = Math.abs(y2-y1),
+ x = x1, y = y1,
+ yIncr = (y1 > y2)? -1 : 1,
+ drw = true;
+ if(dx >= dy)
+ {
+ var pr = dy<<1,
+ pru = pr - (dx<<1),
+ p = pr-dx;
+ while(dx > 0)
+ {--dx;
+ if(drw) this._mkDiv(x, y, 1, 1);
+ drw = !drw;
+ if(p > 0)
+ {
+ y += yIncr;
+ p += pru;
+ }
+ else p += pr;
+ ++x;
+ }
+ }
+ else
+ {
+ var pr = dx<<1,
+ pru = pr - (dy<<1),
+ p = pr-dy;
+ while(dy > 0)
+ {--dy;
+ if(drw) this._mkDiv(x, y, 1, 1);
+ drw = !drw;
+ y += yIncr;
+ if(p > 0)
+ {
+ ++x;
+ p += pru;
+ }
+ else p += pr;
+ }
+ }
+ if(drw) this._mkDiv(x, y, 1, 1);
+}
+
+function _mkOv(left, top, width, height)
+{
+ var a = (++width)>>1, b = (++height)>>1,
+ wod = width&1, hod = height&1,
+ cx = left+a, cy = top+b,
+ x = 0, y = b,
+ ox = 0, oy = b,
+ aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
+ st = (aa2>>1)*(1-(b<<1)) + bb2,
+ tt = (bb2>>1) - aa2*((b<<1)-1),
+ w, h;
+ while(y > 0)
+ {
+ if(st < 0)
+ {
+ st += bb2*((x<<1)+3);
+ tt += bb4*(++x);
+ }
+ else if(tt < 0)
+ {
+ st += bb2*((x<<1)+3) - aa4*(y-1);
+ tt += bb4*(++x) - aa2*(((y--)<<1)-3);
+ w = x-ox;
+ h = oy-y;
+ if((w&2) && (h&2))
+ {
+ this._mkOvQds(cx, cy, x-2, y+2, 1, 1, wod, hod);
+ this._mkOvQds(cx, cy, x-1, y+1, 1, 1, wod, hod);
+ }
+ else this._mkOvQds(cx, cy, x-1, oy, w, h, wod, hod);
+ ox = x;
+ oy = y;
+ }
+ else
+ {
+ tt -= aa2*((y<<1)-3);
+ st -= aa4*(--y);
+ }
+ }
+ w = a-ox+1;
+ h = (oy<<1)+hod;
+ y = cy-oy;
+ this._mkDiv(cx-a, y, w, h);
+ this._mkDiv(cx+ox+wod-1, y, w, h);
+}
+
+function _mkOv2D(left, top, width, height)
+{
+ var s = this.stroke;
+ width += s+1;
+ height += s+1;
+ var a = width>>1, b = height>>1,
+ wod = width&1, hod = height&1,
+ cx = left+a, cy = top+b,
+ x = 0, y = b,
+ aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
+ st = (aa2>>1)*(1-(b<<1)) + bb2,
+ tt = (bb2>>1) - aa2*((b<<1)-1);
+
+ if(s-4 < 0 && (!(s-2) || width-51 > 0 && height-51 > 0))
+ {
+ var ox = 0, oy = b,
+ w, h,
+ pxw;
+ while(y > 0)
+ {
+ if(st < 0)
+ {
+ st += bb2*((x<<1)+3);
+ tt += bb4*(++x);
+ }
+ else if(tt < 0)
+ {
+ st += bb2*((x<<1)+3) - aa4*(y-1);
+ tt += bb4*(++x) - aa2*(((y--)<<1)-3);
+ w = x-ox;
+ h = oy-y;
+
+ if(w-1)
+ {
+ pxw = w+1+(s&1);
+ h = s;
+ }
+ else if(h-1)
+ {
+ pxw = s;
+ h += 1+(s&1);
+ }
+ else pxw = h = s;
+ this._mkOvQds(cx, cy, x-1, oy, pxw, h, wod, hod);
+ ox = x;
+ oy = y;
+ }
+ else
+ {
+ tt -= aa2*((y<<1)-3);
+ st -= aa4*(--y);
+ }
+ }
+ this._mkDiv(cx-a, cy-oy, s, (oy<<1)+hod);
+ this._mkDiv(cx+a+wod-s, cy-oy, s, (oy<<1)+hod);
+ }
+
+ else
+ {
+ var _a = (width-(s<<1))>>1,
+ _b = (height-(s<<1))>>1,
+ _x = 0, _y = _b,
+ _aa2 = (_a*_a)<<1, _aa4 = _aa2<<1, _bb2 = (_b*_b)<<1, _bb4 = _bb2<<1,
+ _st = (_aa2>>1)*(1-(_b<<1)) + _bb2,
+ _tt = (_bb2>>1) - _aa2*((_b<<1)-1),
+
+ pxl = new Array(),
+ pxt = new Array(),
+ _pxb = new Array();
+ pxl[0] = 0;
+ pxt[0] = b;
+ _pxb[0] = _b-1;
+ while(y > 0)
+ {
+ if(st < 0)
+ {
+ pxl[pxl.length] = x;
+ pxt[pxt.length] = y;
+ st += bb2*((x<<1)+3);
+ tt += bb4*(++x);
+ }
+ else if(tt < 0)
+ {
+ pxl[pxl.length] = x;
+ st += bb2*((x<<1)+3) - aa4*(y-1);
+ tt += bb4*(++x) - aa2*(((y--)<<1)-3);
+ pxt[pxt.length] = y;
+ }
+ else
+ {
+ tt -= aa2*((y<<1)-3);
+ st -= aa4*(--y);
+ }
+
+ if(_y > 0)
+ {
+ if(_st < 0)
+ {
+ _st += _bb2*((_x<<1)+3);
+ _tt += _bb4*(++_x);
+ _pxb[_pxb.length] = _y-1;
+ }
+ else if(_tt < 0)
+ {
+ _st += _bb2*((_x<<1)+3) - _aa4*(_y-1);
+ _tt += _bb4*(++_x) - _aa2*(((_y--)<<1)-3);
+ _pxb[_pxb.length] = _y-1;
+ }
+ else
+ {
+ _tt -= _aa2*((_y<<1)-3);
+ _st -= _aa4*(--_y);
+ _pxb[_pxb.length-1]--;
+ }
+ }
+ }
+
+ var ox = -wod, oy = b,
+ _oy = _pxb[0],
+ l = pxl.length,
+ w, h;
+ for(var i = 0; i < l; i++)
+ {
+ if(typeof _pxb[i] != "undefined")
+ {
+ if(_pxb[i] < _oy || pxt[i] < oy)
+ {
+ x = pxl[i];
+ this._mkOvQds(cx, cy, x, oy, x-ox, oy-_oy, wod, hod);
+ ox = x;
+ oy = pxt[i];
+ _oy = _pxb[i];
+ }
+ }
+ else
+ {
+ x = pxl[i];
+ this._mkDiv(cx-x, cy-oy, 1, (oy<<1)+hod);
+ this._mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);
+ ox = x;
+ oy = pxt[i];
+ }
+ }
+ this._mkDiv(cx-a, cy-oy, 1, (oy<<1)+hod);
+ this._mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);
+ }
+}
+
+function _mkOvDott(left, top, width, height)
+{
+ var a = (++width)>>1, b = (++height)>>1,
+ wod = width&1, hod = height&1, hodu = hod^1,
+ cx = left+a, cy = top+b,
+ x = 0, y = b,
+ aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
+ st = (aa2>>1)*(1-(b<<1)) + bb2,
+ tt = (bb2>>1) - aa2*((b<<1)-1),
+ drw = true;
+ while(y > 0)
+ {
+ if(st < 0)
+ {
+ st += bb2*((x<<1)+3);
+ tt += bb4*(++x);
+ }
+ else if(tt < 0)
+ {
+ st += bb2*((x<<1)+3) - aa4*(y-1);
+ tt += bb4*(++x) - aa2*(((y--)<<1)-3);
+ }
+ else
+ {
+ tt -= aa2*((y<<1)-3);
+ st -= aa4*(--y);
+ }
+ if(drw && y >= hodu) this._mkOvQds(cx, cy, x, y, 1, 1, wod, hod);
+ drw = !drw;
+ }
+}
+
+function _mkRect(x, y, w, h)
+{
+ var s = this.stroke;
+ this._mkDiv(x, y, w, s);
+ this._mkDiv(x+w, y, s, h);
+ this._mkDiv(x, y+h, w+s, s);
+ this._mkDiv(x, y+s, s, h-s);
+}
+
+function _mkRectDott(x, y, w, h)
+{
+ this.drawLine(x, y, x+w, y);
+ this.drawLine(x+w, y, x+w, y+h);
+ this.drawLine(x, y+h, x+w, y+h);
+ this.drawLine(x, y, x, y+h);
+}
+
+function jsgFont()
+{
+ this.PLAIN = 'font-weight:normal;';
+ this.BOLD = 'font-weight:bold;';
+ this.ITALIC = 'font-style:italic;';
+ this.ITALIC_BOLD = this.ITALIC + this.BOLD;
+ this.BOLD_ITALIC = this.ITALIC_BOLD;
+}
+var Font = new jsgFont();
+
+function jsgStroke()
+{
+ this.DOTTED = -1;
+}
+var Stroke = new jsgStroke();
+
+function jsGraphics(cnv, wnd)
+{
+ this.setColor = function(x)
+ {
+ this.color = x.toLowerCase();
+ };
+
+ this.setStroke = function(x)
+ {
+ this.stroke = x;
+ if(!(x+1))
+ {
+ this.drawLine = _mkLinDott;
+ this._mkOv = _mkOvDott;
+ this.drawRect = _mkRectDott;
+ }
+ else if(x-1 > 0)
+ {
+ this.drawLine = _mkLin2D;
+ this._mkOv = _mkOv2D;
+ this.drawRect = _mkRect;
+ }
+ else
+ {
+ this.drawLine = _mkLin;
+ this._mkOv = _mkOv;
+ this.drawRect = _mkRect;
+ }
+ };
+
+ this.setPrintable = function(arg)
+ {
+ this.printable = arg;
+ if(jg_fast)
+ {
+ this._mkDiv = _mkDivIe;
+ this._htmRpc = arg? _htmPrtRpc : _htmRpc;
+ }
+ else this._mkDiv = arg? _mkDivPrt : _mkDiv;
+ };
+
+ this.setFont = function(fam, sz, sty)
+ {
+ this.ftFam = fam;
+ this.ftSz = sz;
+ this.ftSty = sty || Font.PLAIN;
+ };
+
+ this.drawPolyline = this.drawPolyLine = function(x, y)
+ {
+ for (var i=x.length - 1; i;)
+ {--i;
+ this.drawLine(x[i], y[i], x[i+1], y[i+1]);
+ }
+ };
+/************** Xinha added *******************************************/
+
+ this.setColor = new Function('arg', 'this.color = arg;');
+ this.getColor = new Function('return this.color');
+
+ this.fillRect = function(x, y, w, h)
+ {
+ this._mkDiv(x, y, w, h);
+ };
+
+ this.fillRectPattern = function(x, y, w, h, url)
+ {
+ this.htm += '
<\/div>';
+ //alert(this.htm);
+ };
+
+ this.drawHandle = function(x, y, w, h, cursor)
+ {
+
+ this.htm += '
<\/div>';
+ };
+
+ this.drawHandleBox = function(x, y, w, h, cursor)
+ {
+
+ this.htm += '
<\/div>';
+ };
+
+/************** end Xinha added *******************************************/
+ this.drawPolygon = function(x, y)
+ {
+ this.drawPolyline(x, y);
+ this.drawLine(x[x.length-1], y[x.length-1], x[0], y[0]);
+ };
+
+ this.drawEllipse = this.drawOval = function(x, y, w, h)
+ {
+ this._mkOv(x, y, w, h);
+ };
+
+ this.fillEllipse = this.fillOval = function(left, top, w, h)
+ {
+ var a = w>>1, b = h>>1,
+ wod = w&1, hod = h&1,
+ cx = left+a, cy = top+b,
+ x = 0, y = b, oy = b,
+ aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
+ st = (aa2>>1)*(1-(b<<1)) + bb2,
+ tt = (bb2>>1) - aa2*((b<<1)-1),
+ xl, dw, dh;
+ if(w) while(y > 0)
+ {
+ if(st < 0)
+ {
+ st += bb2*((x<<1)+3);
+ tt += bb4*(++x);
+ }
+ else if(tt < 0)
+ {
+ st += bb2*((x<<1)+3) - aa4*(y-1);
+ xl = cx-x;
+ dw = (x<<1)+wod;
+ tt += bb4*(++x) - aa2*(((y--)<<1)-3);
+ dh = oy-y;
+ this._mkDiv(xl, cy-oy, dw, dh);
+ this._mkDiv(xl, cy+y+hod, dw, dh);
+ oy = y;
+ }
+ else
+ {
+ tt -= aa2*((y<<1)-3);
+ st -= aa4*(--y);
+ }
+ }
+ this._mkDiv(cx-a, cy-oy, w, (oy<<1)+hod);
+ };
+
+ this.fillArc = function(iL, iT, iW, iH, fAngA, fAngZ)
+ {
+ var a = iW>>1, b = iH>>1,
+ iOdds = (iW&1) | ((iH&1) << 16),
+ cx = iL+a, cy = iT+b,
+ x = 0, y = b, ox = x, oy = y,
+ aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
+ st = (aa2>>1)*(1-(b<<1)) + bb2,
+ tt = (bb2>>1) - aa2*((b<<1)-1),
+ // Vars for radial boundary lines
+ xEndA, yEndA, xEndZ, yEndZ,
+ iSects = (1 << (Math.floor((fAngA %= 360.0)/180.0) << 3))
+ | (2 << (Math.floor((fAngZ %= 360.0)/180.0) << 3))
+ | ((fAngA >= fAngZ) << 16),
+ aBndA = new Array(b+1), aBndZ = new Array(b+1);
+
+ // Set up radial boundary lines
+ fAngA *= Math.PI/180.0;
+ fAngZ *= Math.PI/180.0;
+ xEndA = cx+Math.round(a*Math.cos(fAngA));
+ yEndA = cy+Math.round(-b*Math.sin(fAngA));
+ _mkLinVirt(aBndA, cx, cy, xEndA, yEndA);
+ xEndZ = cx+Math.round(a*Math.cos(fAngZ));
+ yEndZ = cy+Math.round(-b*Math.sin(fAngZ));
+ _mkLinVirt(aBndZ, cx, cy, xEndZ, yEndZ);
+
+ while(y > 0)
+ {
+ if(st < 0) // Advance x
+ {
+ st += bb2*((x<<1)+3);
+ tt += bb4*(++x);
+ }
+ else if(tt < 0) // Advance x and y
+ {
+ st += bb2*((x<<1)+3) - aa4*(y-1);
+ ox = x;
+ tt += bb4*(++x) - aa2*(((y--)<<1)-3);
+ this._mkArcDiv(ox, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects);
+ oy = y;
+ }
+ else // Advance y
+ {
+ tt -= aa2*((y<<1)-3);
+ st -= aa4*(--y);
+ if(y && (aBndA[y] != aBndA[y-1] || aBndZ[y] != aBndZ[y-1]))
+ {
+ this._mkArcDiv(x, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects);
+ ox = x;
+ oy = y;
+ }
+ }
+ }
+ this._mkArcDiv(x, 0, oy, cx, cy, iOdds, aBndA, aBndZ, iSects);
+ if(iOdds >> 16) // Odd height
+ {
+ if(iSects >> 16) // Start-angle > end-angle
+ {
+ var xl = (yEndA <= cy || yEndZ > cy)? (cx - x) : cx;
+ this._mkDiv(xl, cy, x + cx - xl + (iOdds & 0xffff), 1);
+ }
+ else if((iSects & 0x01) && yEndZ > cy)
+ this._mkDiv(cx - x, cy, x, 1);
+ }
+ };
+
+/* fillPolygon method, implemented by Matthieu Haller.
+This javascript function is an adaptation of the gdImageFilledPolygon for Walter Zorn lib.
+C source of GD 1.8.4 found at http://www.boutell.com/gd/
+
+THANKS to Kirsten Schulz for the polygon fixes!
+
+The intersection finding technique of this code could be improved
+by remembering the previous intertersection, and by using the slope.
+That could help to adjust intersections to produce a nice
+interior_extrema. */
+ this.fillPolygon = function(array_x, array_y)
+ {
+ var i;
+ var y;
+ var miny, maxy;
+ var x1, y1;
+ var x2, y2;
+ var ind1, ind2;
+ var ints;
+
+ var n = array_x.length;
+ if(!n) return;
+
+ miny = array_y[0];
+ maxy = array_y[0];
+ for(i = 1; i < n; i++)
+ {
+ if(array_y[i] < miny)
+ miny = array_y[i];
+
+ if(array_y[i] > maxy)
+ maxy = array_y[i];
+ }
+ for(y = miny; y <= maxy; y++)
+ {
+ var polyInts = new Array();
+ ints = 0;
+ for(i = 0; i < n; i++)
+ {
+ if(!i)
+ {
+ ind1 = n-1;
+ ind2 = 0;
+ }
+ else
+ {
+ ind1 = i-1;
+ ind2 = i;
+ }
+ y1 = array_y[ind1];
+ y2 = array_y[ind2];
+ if(y1 < y2)
+ {
+ x1 = array_x[ind1];
+ x2 = array_x[ind2];
+ }
+ else if(y1 > y2)
+ {
+ y2 = array_y[ind1];
+ y1 = array_y[ind2];
+ x2 = array_x[ind1];
+ x1 = array_x[ind2];
+ }
+ else continue;
+
+ // Modified 11. 2. 2004 Walter Zorn
+ if((y >= y1) && (y < y2))
+ polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);
+
+ else if((y == maxy) && (y > y1) && (y <= y2))
+ polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);
+ }
+ polyInts.sort(_CompInt);
+ for(i = 0; i < ints; i+=2)
+ this._mkDiv(polyInts[i], y, polyInts[i+1]-polyInts[i]+1, 1);
+ }
+ };
+
+ this.drawString = function(txt, x, y)
+ {
+ this.htm += '
'+
+ txt +
+ '<\/div>';
+ };
+
+/* drawStringRect() added by Rick Blommers.
+Allows to specify the size of the text rectangle and to align the
+text both horizontally (e.g. right) and vertically within that rectangle */
+ this.drawStringRect = function(txt, x, y, width, halign)
+ {
+ this.htm += '
'+
+ txt +
+ '<\/div>';
+ };
+
+ this.drawImage = function(imgSrc, x, y, w, h, a)
+ {
+ this.htm += '
'+
+ '

'+
+ '<\/div>';
+ };
+
+ this.clear = function()
+ {
+ this.htm = "";
+ if(this.cnv) this.cnv.innerHTML = "";
+ };
+
+ this._mkOvQds = function(cx, cy, x, y, w, h, wod, hod)
+ {
+ var xl = cx - x, xr = cx + x + wod - w, yt = cy - y, yb = cy + y + hod - h;
+ if(xr > xl+w)
+ {
+ this._mkDiv(xr, yt, w, h);
+ this._mkDiv(xr, yb, w, h);
+ }
+ else
+ w = xr - xl + w;
+ this._mkDiv(xl, yt, w, h);
+ this._mkDiv(xl, yb, w, h);
+ };
+
+ this._mkArcDiv = function(x, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects)
+ {
+ var xrDef = cx + x + (iOdds & 0xffff), y2, h = oy - y, xl, xr, w;
+
+ if(!h) h = 1;
+ x = cx - x;
+
+ if(iSects & 0xff0000) // Start-angle > end-angle
+ {
+ y2 = cy - y - h;
+ if(iSects & 0x00ff)
+ {
+ if(iSects & 0x02)
+ {
+ xl = Math.max(x, aBndZ[y]);
+ w = xrDef - xl;
+ if(w > 0) this._mkDiv(xl, y2, w, h);
+ }
+ if(iSects & 0x01)
+ {
+ xr = Math.min(xrDef, aBndA[y]);
+ w = xr - x;
+ if(w > 0) this._mkDiv(x, y2, w, h);
+ }
+ }
+ else
+ this._mkDiv(x, y2, xrDef - x, h);
+ y2 = cy + y + (iOdds >> 16);
+ if(iSects & 0xff00)
+ {
+ if(iSects & 0x0100)
+ {
+ xl = Math.max(x, aBndA[y]);
+ w = xrDef - xl;
+ if(w > 0) this._mkDiv(xl, y2, w, h);
+ }
+ if(iSects & 0x0200)
+ {
+ xr = Math.min(xrDef, aBndZ[y]);
+ w = xr - x;
+ if(w > 0) this._mkDiv(x, y2, w, h);
+ }
+ }
+ else
+ this._mkDiv(x, y2, xrDef - x, h);
+ }
+ else
+ {
+ if(iSects & 0x00ff)
+ {
+ if(iSects & 0x02)
+ xl = Math.max(x, aBndZ[y]);
+ else
+ xl = x;
+ if(iSects & 0x01)
+ xr = Math.min(xrDef, aBndA[y]);
+ else
+ xr = xrDef;
+ y2 = cy - y - h;
+ w = xr - xl;
+ if(w > 0) this._mkDiv(xl, y2, w, h);
+ }
+ if(iSects & 0xff00)
+ {
+ if(iSects & 0x0100)
+ xl = Math.max(x, aBndA[y]);
+ else
+ xl = x;
+ if(iSects & 0x0200)
+ xr = Math.min(xrDef, aBndZ[y]);
+ else
+ xr = xrDef;
+ y2 = cy + y + (iOdds >> 16);
+ w = xr - xl;
+ if(w > 0) this._mkDiv(xl, y2, w, h);
+ }
+ }
+ };
+
+ this.setStroke(1);
+ this.setFont("verdana,geneva,helvetica,sans-serif", "12px", Font.PLAIN);
+ this.color = "#000000";
+ this.htm = "";
+ this.wnd = wnd || window;
+
+ if(!jg_ok) _chkDHTM();
+ if(jg_ok)
+ {
+ if(cnv)
+ {
+ if(typeof(cnv) == "string")
+ this.cont = document.all? (this.wnd.document.all[cnv] || null)
+ : document.getElementById? (this.wnd.document.getElementById(cnv) || null)
+ : null;
+ else if(cnv == window.document)
+ this.cont = document.getElementsByTagName("body")[0];
+ // If cnv is a direct reference to a canvas DOM node
+ // (option suggested by Andreas Luleich)
+ else this.cont = cnv;
+ // Create new canvas inside container DIV. Thus the drawing and clearing
+ // methods won't interfere with the container's inner html.
+ // Solution suggested by Vladimir.
+ this.cnv = this.wnd.document.createElement("div");
+ this.cnv.style.fontSize=0;
+ this.cont.appendChild(this.cnv);
+ this.paint = jg_dom? _pntCnvDom : _pntCnvIe;
+ }
+ else
+ this.paint = _pntDoc;
+ }
+ else
+ this.paint = _pntN;
+
+ this.setPrintable(false);
+}
+
+function _mkLinVirt(aLin, x1, y1, x2, y2)
+{
+ var dx = Math.abs(x2-x1), dy = Math.abs(y2-y1),
+ x = x1, y = y1,
+ xIncr = (x1 > x2)? -1 : 1,
+ yIncr = (y1 > y2)? -1 : 1,
+ p,
+ i = 0;
+ if(dx >= dy)
+ {
+ var pr = dy<<1,
+ pru = pr - (dx<<1);
+ p = pr-dx;
+ while(dx > 0)
+ {--dx;
+ if(p > 0) // Increment y
+ {
+ aLin[i++] = x;
+ y += yIncr;
+ p += pru;
+ }
+ else p += pr;
+ x += xIncr;
+ }
+ }
+ else
+ {
+ var pr = dx<<1,
+ pru = pr - (dy<<1);
+ p = pr-dy;
+ while(dy > 0)
+ {--dy;
+ y += yIncr;
+ aLin[i++] = x;
+ if(p > 0) // Increment x
+ {
+ x += xIncr;
+ p += pru;
+ }
+ else p += pr;
+ }
+ }
+ for(var len = aLin.length, i = len-i; i;)
+ aLin[len-(i--)] = x;
+};
+
+function _CompInt(x, y)
+{
+ return(x - y);
+}
+
Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/demo_images/.htaccess
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/demo_images/.htaccess,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/demo_images/.htaccess 16 Jan 2009 09:05:47 -0000 1.2
+++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/demo_images/.htaccess 23 May 2010 11:58:33 -0000 1.3
@@ -1,4 +1,11 @@
- php_flag engine off
+ php_flag engine off
-AddType text/html .html .htm .shtml .php .php3 .phtml .phtm .pl .py .cgi
\ No newline at end of file
+AddType text/html .html .htm .shtml .php .php3 .php4 .php5 .php6 .php7 .php8 .phtml .phtm .pl .py .cgi
+RemoveHandler .php
+RemoveHandler .php8
+RemoveHandler .php7
+RemoveHandler .php6
+RemoveHandler .php5
+RemoveHandler .php4
+RemoveHandler .php3
\ No newline at end of file
Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/lang/da.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/lang/da.js,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/ExtendedFileManager/lang/da.js 23 May 2010 11:58:33 -0000 1.1
@@ -0,0 +1,119 @@
+// I18N constants
+// LANG: "de", ENCODING: UTF-8
+// translated: Bjarke M. Lauridsen, http://www.detailx.dk, detailx@gmail.com
+{
+ "File Manager": "Fil Manager",
+ "Insert Image": "Indsæt billede",
+ "Directory": "Mappe",
+ "Directory Up": "Mappe op",
+ "New Folder": "Ny mappe",
+ "Trash": "Papirkurv",
+ "Edit": "Rediger",
+ "Image File": "Billedfil",
+ "Upload": "Upload",
+ "Width": "Bredde",
+ "Height": "Højde",
+ "Width:": "Bredde:",
+ "Height:": "Højde:",
+ "Constrain Proportions": "Korrekt størrelsesforhold",
+ "Border": "Ramme",
+ "Margin": "Margen",
+ "Padding": "Spaltefyld",
+ "Refresh": "Opdater",
+ "Uploading...": "Uploader...",
+ "Uploading": "Uploader",
+ "Crop": "Beskær",
+ "Resize": "Ændre størrelse",
+ "Rotate": "Rotere",
+ "Measure": "Målebånd",
+ "Marker": "Markør",
+ "Toggle marker color" : "Skift markørfarve",
+ "Save": "Gem",
+ "Filename:": "Filnavn:",
+ "Image Format": "Billedformat:",
+ "Quality:": "Kvalitet",
+ "JPEG High": "JPEG høj",
+ "JPEG Medium": "JPEG mellem",
+ "JPEG Low": "JPEG lav",
+ "File saved.": "Filen blev gemt.",
+ "File was not saved.": "Filen blev ikke gemt.",
+ "Start X:": "Start X",
+ "Start Y:": "Start Y",
+ "Lock": "Lås",
+ "Flip Image": "Vend billede",
+ "Flip Horizontal": "Vend vandret",
+ "Flip Vertical": "Vend lodret",
+ "Rotate Image": "Drej billede",
+ "Rotate 180 °": "Drej 180°",
+ "Rotate 90 ° CW": "Drej 90° med uret",
+ "Rotate 90 ° CCW": "Drej 90° mod uret",
+ "Angle:": "Vinkel:",
+ "W:": "W:",
+ "Clear": "Fortryd",
+ "Loading": "Henter",
+ "Invalid base directory:": "Ugyldig base mappe:",
+ 'Delete file "$file"?': 'Slet filen "$file"?',
+ "Please delete all files/folders inside the folder you wish to delete first.": "Slet venligst alle filer/mapper i mappen før den slettes.",
+ 'Delete folder "$dir"?': 'Slet mappen "$dir"?',
+ "Folder Name:": "Mappenavn",
+ "No Files Found": "Ingen filer fundet",
+ "Invalid folder name, please choose another folder name.": "Ugyldigt mappenavn, vælg venligst et andet navn.",
+ "GIF format is not supported, image editing not supported.": "GIF-Format ikke understøttet - kan ikke redigeres.",
+ "No Image Available": "Ingen billeder tilgængelig",
+ "No Image selected.": "Ingen billeder valgt.",
+ "Description:": "Beskrivelse:",
+ "Align": "Placering",
+ "Margin": "Margen",
+ "Padding": "Spaltefyld",
+ "Border": "Ramme",
+ "Color": "Farve",
+ "Border Color": "Rammefarve",
+ "Upload": "Upload",
+ "Alt": "Alt",
+ "File Name": "Filnavn",
+ "Thumbnail View": "Miniatureportræt",
+ "List View": "Listevisning",
+ "Title (tooltip)": "Titel (Tooltip)",
+ "Target Window": "Mål",
+ "Name": "Navn",
+ "Size": "Størrelse",
+ "Date Modified": "Dato for redigering",
+ "Total Size": "Samlet størrelse",
+ "Free Space": "Fri plads",
+ "Positioning of this image" : "Billedets position",
+ "Insert File Link": "Indsæt fil-link",
+ "Untitled": "Ubetitlet",
+ 'Please enter name for new folder...': "Indtast venligst navn på ny mappe...",
+ "You must select some text before making a new link.": "Vælg venligst noget tekst før du laver et nyt link.",
+ "Folder is not empty. Please delete all Files and Subfolders inside.": "Mappen er ikke tom. Slet venligst alle filer og undermappermapper i mappen først.",
+ "Image Size": "Billedstørrelse",
+ "Other" : "Andre...",
+ "Rename": "Omdøb",
+ "Please enter new name for this file...": "Indtast venligst et nyt navn til denne fil...",
+ "Unable to rename file. File of the same name already exists or\nfolder doesn't have write permission.": "Filen kan ikke omdøbes. En fil med samme navn eksisterer allerede, \neller mappen har ikke skriverettigheder.",
+ "Cancelled rename.": "Fortryd omdøbning.",
+ 'File "$file" successfully uploaded.': 'Filen "$file" blev uploadet.',
+ "Cannot upload. Maximum folder size reached. Delete unwanted files and try again.":"Kan ikke uploade. Den maksimale mappestørrelse er nået. Slet uønskede filer og prøv igen.",
+ "Maximum file size [$max_size KB] exceeded.":"Maksimal filstørrelse [$max_size KB] overskredet.",
+ "Cannot upload $extension Files. Permission denied.": "Kan ikke uploade $extension. Tilladelse nægtet.",
+ "Unable to upload File. \nEither Maximum file size [$max_size KB] exceeded or\nFolder doesn\'t have write permission.":"Ikke muligt at uploade filen.\nEnten er den maksimale filstørrelse på [$max_size KB] nået\neller mappen har ikke skriverettigheder.",
+ "Total Size : $max_foldersize_mb MB, Free Space: $free_space": "Maks størrelse: $max_foldersize_mb MB, Fri plads: $free_space",
+ "Please enter new name for this folder...":"Indtast venligst et nyt navn til denne mappe...",
+
+ "Cut":"Klip",
+ "Copy":"Kopier",
+ "Paste":"Sæt ind",
+
+ 'Copy "$file" from "$dir" here': 'Kopier "$file" fra "$dir" her',
+ 'Copy folder "$file" from "$dir" here' : 'Kopier mappe "$file" fra "$dir" her',
+ 'Move "$file" from "$dir" here':'Flyt "$file" fra "$dir" her',
+ 'Move folder "$file" from "$dir" here':'Flyt mappe "$file" fra "$dir" her',
+
+ "Source file/folder not found.":"Kilde- fil/mappe ikke fundet",
+ "Paste failed.\nMaybe folder doesn't have write permission.": "Sæt ind fejlede.\nMåske har mappen ikke skriverettigheder.",
+ "Could not create destination folder.":"Kunne ikke lave destinationsmappe.",
+ "Destination file/folder already exists.":"Destinations- fil/mappe findes allerede",
+ "File pasted OK.": "File pasted OK.",
+
+ "Filesize:" : "Filstørrelse:"
+};
Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FindReplace/fr_engine.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FindReplace/fr_engine.js,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FindReplace/fr_engine.js 27 Mar 2009 08:20:43 -0000 1.7
+++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FindReplace/fr_engine.js 23 May 2010 11:58:33 -0000 1.8
@@ -1,3 +1,149 @@
-/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
-/* This file is part of version 0.96beta2 released Fri, 20 Mar 2009 11:01:14 +0100 */
-var FindReplace=window.opener.FindReplace;var editor=FindReplace.editor;var is_mo=window.opener.Xinha.is_gecko;var tosearch="";var pater=null;var buffer=null;var matches=0;var replaces=0;var fr_spans=new Array();function _lc(a){return(window.opener.Xinha._lc(a,"FindReplace"))}function execSearch(params){var ihtml=editor._doc.body.innerHTML;if(buffer==null){buffer=ihtml}if(params.fr_pattern!=tosearch){if(tosearch!=""){clearDoc()}tosearch=params.fr_pattern}if(matches==0){er=params.fr_words?"/(?!<[^>]*)(\\b"+params.fr_pattern+"\\b)(?![^<]*>)/g":"/(?!<[^>]*)("+params.fr_pattern+")(?![^<]*>)/g";if(!params.fr_matchcase){er+="i"}pater=eval(er);var tago="
";var tagc="";var newHtml=ihtml.replace(pater,tago+"$1"+tagc);editor.setHTML(newHtml);var getallspans=editor._doc.body.getElementsByTagName("span");for(var i=0;i
=fr_spans.length-1);if(e||!f){var d=_lc("Done")+":\n\n";if(matches>0){if(matches==1){d+=matches+" "+_lc("found item")}else{d+=matches+" "+_lc("found items")}if(replaces>0){if(replaces==1){d+=",\n"+replaces+" "+_lc("replaced item")}else{d+=",\n"+replaces+" "+_lc("replaced items")}}hiliteAll();disab("fr_hiliteall",false)}else{d+='"'+g+'" '+_lc("not found")}alert(d+".")}}function clearDoc(){var a=editor._doc.body.innerHTML;var b=/(]*id=.?frmark[^>]*>)([^<>]*)(<\/span>)/gi;editor._doc.body.innerHTML=a.replace(b,"$2");pater=null;tosearch="";fr_spans=new Array();matches=0;replaces=0;disab("fr_hiliteall,fr_clear",true)}function clearMarks(){var c=editor._doc.body.getElementsByTagName("span");for(var b=0;b]*)(\\b"+params['fr_pattern']+"\\b)(?![^<]*>)/g" :
+ "/(?!<[^>]*)("+params['fr_pattern']+")(?![^<]*>)/g";
+ if(!params['fr_matchcase'])
+ er += "i";
+
+ pater = eval(er);
+
+ var tago = '';
+ var tagc = '';
+ var newHtml = ihtml.replace(pater,tago+"$1"+tagc);
+
+ editor.setHTML(newHtml);
+
+ var getallspans = editor._doc.body.getElementsByTagName("span");
+ for (var i = 0; i < getallspans.length; i++)
+ if(/^frmark/.test(getallspans[i].id))
+ fr_spans.push(getallspans[i]);
+ }
+
+spanWalker(params['fr_pattern'],params['fr_replacement'],params['fr_replaceall']);
+}
+
+function spanWalker(pattern,replacement,replaceall) {
+var foundtrue = false;
+clearMarks();
+
+ for (var i = matches; i < fr_spans.length; i++) {
+ var elm = fr_spans[i];
+ foundtrue = true;
+ if(!(/[0-9]$/.test(elm.id))) {
+ matches++;
+ disab('fr_clear',false);
+ elm.id = 'frmark_'+matches;
+ elm.style.color = 'white';
+ elm.style.backgroundColor = 'highlight';
+ elm.style.fontWeight = 'bold';
+ elm.scrollIntoView(false);
+ if(/\w/.test(replacement)) {
+ if(replaceall || confirm(_lc("Substitute this occurrence?"))) {
+ elm.firstChild.replaceData(0,elm.firstChild.data.length,replacement);
+ replaces++;
+ disab('fr_undo',false);
+ }
+ if(replaceall) {
+ clearMarks();
+ continue;
+ }
+ }
+ break;
+ }
+ }
+ var last = (i >= fr_spans.length - 1);
+ if(last || !foundtrue) { // EOF
+ var message = _lc("Done")+':\n\n';
+ if(matches > 0) {
+ if(matches == 1) message += matches+' '+_lc("found item");
+ else message += matches+' '+_lc("found items");
+ if(replaces > 0) {
+ if(replaces == 1) message += ',\n'+replaces+' '+_lc("replaced item");
+ else message += ',\n'+replaces+' '+_lc("replaced items");
+ }
+ hiliteAll();
+ disab('fr_hiliteall',false);
+ } else { message += '"'+pattern+'" '+_lc("not found"); }
+ alert(message+'.');
+ }
+}
+
+function clearDoc() {
+var doc = editor._doc.body.innerHTML;
+var er = /(]*id=.?frmark[^>]*>)([^<>]*)(<\/span>)/gi;
+editor._doc.body.innerHTML = doc.replace(er,"$2");
+pater = null;
+tosearch = '';
+fr_spans = new Array();
+matches = 0;
+replaces = 0;
+disab("fr_hiliteall,fr_clear",true);
+}
+
+function clearMarks() {
+var getall = editor._doc.body.getElementsByTagName("span");
+ for (var i = 0; i < getall.length; i++) {
+ var elm = getall[i];
+ if(/^frmark/.test(elm.id)) {
+ var objStyle = editor._doc.getElementById(elm.id).style;
+ objStyle.backgroundColor = "";
+ objStyle.color = "";
+ objStyle.fontWeight = "";
+ }
+ }
+}
+
+function hiliteAll() {
+var getall = editor._doc.body.getElementsByTagName("span");
+ for (var i = 0; i < getall.length; i++) {
+ var elm = getall[i];
+ if(/^frmark/.test(elm.id)) {
+ var objStyle = editor._doc.getElementById(elm.id).style;
+ objStyle.backgroundColor = "highlight";
+ objStyle.color = "white";
+ objStyle.fontWeight = "bold";
+ }
+ }
+}
+
+function resetContents() {
+ if(buffer == null) return;
+var transp = editor._doc.body.innerHTML;
+editor._doc.body.innerHTML = buffer;
+buffer = transp;
+}
+
+function disab(elms,toset) {
+var names = elms.split(/[,; ]+/);
+ for(var i = 0; i < names.length; i++)
+ document.getElementById(names[i]).disabled = toset;
+}
\ No newline at end of file
Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FormOperations/FormOperations.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FormOperations/FormOperations.js,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FormOperations/FormOperations.js 27 Mar 2009 08:20:43 -0000 1.2
+++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FormOperations/FormOperations.js 23 May 2010 11:58:33 -0000 1.3
@@ -1,3 +1,756 @@
-/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
-/* This file is part of version 0.96beta2 released Fri, 20 Mar 2009 11:01:14 +0100 */
-Xinha.Config.prototype.FormOperations={multiple_field_format:"php",allow_edit_form:false,default_form_action:Xinha.getPluginDir("FormOperations")+"/formmail.php",default_form_html:Xinha._geturlcontent(Xinha.getPluginDir("FormOperations")+"/default_form.html")};FormOperations._pluginInfo={name:"FormOperations",version:"1.0",developer:"James Sleeman",developer_url:"http://www.gogo.co.nz/",c_owner:"Gogo Internet Services",license:"htmlArea",sponsor:"Gogo Internet Services",sponsor_url:"http://www.gogo.co.nz/"};function FormOperations(b){this.editor=b;this.panel=false;this.html=false;this.ready=false;this.activeElement=null;this._preparePanel();b.config.pageStyleSheets.push(Xinha.getPluginDir("FormOperations")+"/iframe.css");var c=["separator","insert_form","insert_text_field","insert_textarea_field","insert_select_field","insert_cb_field","insert_rb_field","insert_button"];this.editor.config.toolbar.push(c);function a(e){var g=Xinha.uniq("fo");e=e.replace(/^<([^ \/>]+)/i,'<$1 id="'+g+'"');b.insertHTML(e);var f=b._doc.getElementById(g);f.setAttribute("id","");b.selectNodeContents(f);b.updateToolbar();return f}var d=b.imgURL("buttons.gif","FormOperations");FormOperations.prototype._lc=function(e){return Xinha._lc(e,"FormOperations")};this.editor.config.btnList.insert_form=[this._lc("Insert a Form."),[d,0,0],false,function(){var e=null;if(b.config.FormOperations.default_form_html){e=a(b.config.FormOperations.default_form_html)}else{e=a("")}if(b.config.FormOperations.default_form_action&&!e.action){e.action=b.config.FormOperations.default_form_action}}];this.editor.config.btnList.insert_text_field=[this._lc("Insert a text, password or hidden field."),[d,1,0],false,function(){a('')},"form"];this.editor.config.btnList.insert_textarea_field=[this._lc("Insert a multi-line text field."),[d,2,0],false,function(){a("")},"form"];this.editor.config.btnList.insert_select_field=[this._lc("Insert a select field."),[d,3,0],false,function(){a('')},"form"];this.editor.config.btnList.insert_cb_field=[this._lc("Insert a check box."),[d,4,0],false,function(){a('')},"form"];this.editor.config.btnList.insert_rb_field=[this._lc("Insert a radio button."),[d,5,0],false,function(){a('')},"form"];this.editor.config.btnList.insert_button=[this._lc("Insert a submit/reset button."),[d,6,0],false,function(){a('')},"form"]}FormOperations.prototype.onGenerate=function(){if(Xinha.is_gecko){var a=this.editor;var b=this.editor._doc;Xinha._addEvents(b,["mousemove"],function(c){return a._editorEvent(c)})}};FormOperations.prototype._preparePanel=function(){var a=this;if(this.html==false){Xinha._getback(Xinha.getPluginDir("FormOperations")+"/panel.html",function(b){a.html=b;a._preparePanel()});return false}if(typeof Xinha.Dialog=="undefined"){Xinha._loadback(_editor_url+"modules/Dialogs/XinhaDialog.js",function(){a._preparePanel()});return false}if(typeof Xinha.PanelDialog=="undefined"){Xinha._loadback(_editor_url+"modules/Dialogs/panel-dialog.js",function(){a._preparePanel()});return false}this.panel=new Xinha.PanelDialog(this.editor,"bottom",this.html,"FormOperations");this.panel.hide();this.ready=true};FormOperations.prototype.onUpdateToolbar=function(){if(!this.ready){return true}var b=this.editor._activeElement(this.editor._getSelection());if(b!=null){if(b==this.activeElement){return true}var a=b.tagName.toLowerCase();this.hideAll();if(a==="form"){if(this.editor.config.FormOperations.allow_edit_form){this.showForm(b)}else{this.panel.hide();this.activeElement=null;this.panel.hide();return true}}else{if(this.editor.config.FormOperations.allow_edit_form&&typeof b.form!="undefined"&&b.form){this.showForm(b.form)}switch(a){case"form":this.showForm(b);break;case"input":switch(b.getAttribute("type").toLowerCase()){case"text":case"password":case"hidden":this.showText(b);break;case"radio":case"checkbox":this.showCbRd(b);break;case"submit":case"reset":case"button":this.showButton(b);break}break;case"textarea":this.showTextarea(b);break;case"select":this.showSelect(b);break;default:this.activeElement=null;this.panel.hide();return true}}this.panel.show();this.activeElement=b;return true}else{this.activeElement=null;this.panel.hide();return true}};FormOperations.prototype.hideAll=function(){this.panel.getElementById("fs_form").style.display="none";this.panel.getElementById("fs_text").style.display="none";this.panel.getElementById("fs_textarea").style.display="none";this.panel.getElementById("fs_select").style.display="none";this.panel.getElementById("fs_cbrd").style.display="none";this.panel.getElementById("fs_button").style.display="none"};FormOperations.prototype.showForm=function(a){this.panel.getElementById("fs_form").style.display="";var c={action:a.action,method:a.method.toUpperCase()};this.panel.setValues(c);var b=a;this.panel.getElementById("action").onkeyup=function(){b.action=this.value};this.panel.getElementById("method").onchange=function(){b.method=this.options[this.selectedIndex].value}};FormOperations.prototype.showText=function(b){this.panel.getElementById("fs_text").style.display="";var e={text_name:this.deformatName(b,b.name),text_value:b.value,text_type:b.type.toLowerCase(),text_width:b.style.width?parseFloat(b.style.width.replace(/[^0-9.]/,"")):"",text_width_units:b.style.width?b.style.width.replace(/[0-9.]/,"").toLowerCase():"ex",text_maxlength:b.maxlength?b.maxlength:""};this.panel.setValues(e);var d=b;var c=this;this.panel.getElementById("text_name").onkeyup=function(){d.name=c.formatName(d,this.value)};this.panel.getElementById("text_value").onkeyup=function(){d.value=this.value};this.panel.getElementById("text_type").onchange=function(){if(!Xinha.is_ie){d.type=this.options[this.selectedIndex].value}else{var h=c.editor._doc.createElement("div");if(!/type=/.test(d.outerHTML)){h.innerHTML=d.outerHTML.replace(/0?j.size:1),select_height_units:j.style.height?j.style.height.replace(/[0-9.]/,"").toLowerCase():"items"};this.panel.setValues(f);var b=j;var e=this;this.panel.getElementById("select_name").onkeyup=function(){b.name=e.formatName(b,this.value)};this.panel.getElementById("select_multiple").onclick=function(){b.multiple=this.checked};var k=this.panel.getElementById("select_width");var d=this.panel.getElementById("select_width_units");this.panel.getElementById("select_width").onkeyup=this.panel.getElementById("select_width_units").onchange=function(){if(!k.value||isNaN(parseFloat(k.value))){b.style.width=""}b.style.width=parseFloat(k.value)+d.options[d.selectedIndex].value};var c=this.panel.getElementById("select_height");var g=this.panel.getElementById("select_height_units");this.panel.getElementById("select_height").onkeyup=this.panel.getElementById("select_height_units").onchange=function(){if(!c.value||isNaN(parseFloat(c.value))){b.style.height="";return}if(g.selectedIndex==0){b.style.height="";b.size=parseInt(c.value)}else{b.style.height=parseFloat(c.value)+g.options[g.selectedIndex].value}};var a=this.panel.getElementById("select_options");this.arrayToOpts(this.optsToArray(j.options),a.options);this.panel.getElementById("add_option").onclick=function(){var h=prompt(Xinha._lc("Enter the name for new option.","FormOperations"));if(h==null){return}var l=new Option(h);var i=e.optsToArray(a.options);if(a.selectedIndex>=0){i.splice(a.selectedIndex,0,l)}else{i.push(l)}e.arrayToOpts(i,j.options);e.arrayToOpts(i,a.options)};this.panel.getElementById("del_option").onclick=function(){var m=e.optsToArray(a.options);var l=[];for(var h=0;h0)){return}var i=e.optsToArray(a.options);var h=i.splice(a.selectedIndex,1).pop();i.splice(a.selectedIndex-1,0,h);e.arrayToOpts(i,j.options);e.arrayToOpts(i,a.options)};this.panel.getElementById("down_option").onclick=function(){if(a.selectedIndex==a.options.length-1){return}var i=e.optsToArray(a.options);var h=i.splice(a.selectedIndex,1).pop();i.splice(a.selectedIndex+1,0,h);e.arrayToOpts(i,j.options);e.arrayToOpts(i,a.options)};this.panel.getElementById("select_options").onchange=function(){e.arrayToOpts(e.optsToArray(a.options),j.options)}};FormOperations.prototype.optsToArray=function(d){var b=[];for(var c=0;c=0;c--){d[c]=null}for(var c=0;c FieldName[]
+ // 'unmodified' => FieldName
+ 'multiple_field_format': 'php',
+ 'allow_edit_form' : false,
+ 'default_form_action' : Xinha.getPluginDir('FormOperations') + '/formmail.php',
+ 'default_form_html' : Xinha._geturlcontent(Xinha.getPluginDir('FormOperations') + '/default_form.html')
+};
+
+FormOperations._pluginInfo =
+{
+ name : "FormOperations",
+ version : "1.0",
+ developer: "James Sleeman",
+ developer_url: "http://www.gogo.co.nz/",
+ c_owner : "Gogo Internet Services",
+ license : "htmlArea",
+ sponsor : "Gogo Internet Services",
+ sponsor_url : "http://www.gogo.co.nz/"
+};
+
+function FormOperations(editor)
+{
+ this.editor = editor;
+ this.panel = false;
+ this.html = false;
+ this.ready = false;
+ this.activeElement = null;
+ this._preparePanel();
+
+
+ editor.config.pageStyleSheets.push(Xinha.getPluginDir('FormOperations') + '/iframe.css');
+
+ var toolbar =
+ [
+ 'separator',
+ 'insert_form',
+ 'insert_text_field',
+ 'insert_textarea_field',
+ 'insert_select_field',
+ 'insert_cb_field',
+ 'insert_rb_field',
+ 'insert_button'
+ ];
+
+ this.editor.config.toolbar.push(toolbar);
+
+ function pasteAndSelect(htmlTag)
+ {
+ var id = Xinha.uniq('fo');
+ htmlTag = htmlTag.replace(/^<([^ \/>]+)/i, '<$1 id="'+id+'"');
+ editor.insertHTML(htmlTag);
+ var el = editor._doc.getElementById(id);
+ el.setAttribute('id', '');
+ editor.selectNodeContents(el);
+ editor.updateToolbar();
+ return el;
+ }
+
+ var buttonsImage = editor.imgURL('buttons.gif', 'FormOperations');
+
+ FormOperations.prototype._lc = function(string) {
+ return Xinha._lc(string, 'FormOperations');
+ };
+
+ this.editor.config.btnList.insert_form =
+ [ this._lc("Insert a Form."),
+ [buttonsImage, 0, 0],
+ false,
+ function()
+ {
+ var form = null;
+ if(editor.config.FormOperations.default_form_html)
+ {
+ form = pasteAndSelect(editor.config.FormOperations.default_form_html);
+ }
+ else
+ {
+ form = pasteAndSelect('');
+ }
+
+ if(editor.config.FormOperations.default_form_action && !form.action)
+ {
+ form.action = editor.config.FormOperations.default_form_action;
+ }
+ }
+ ];
+
+ this.editor.config.btnList.insert_text_field =
+ [ this._lc("Insert a text, password or hidden field."),
+ [buttonsImage, 1, 0],
+ false,
+ function()
+ {
+ pasteAndSelect('');
+ },
+ 'form'
+ ];
+
+ this.editor.config.btnList.insert_textarea_field =
+ [ this._lc("Insert a multi-line text field."),
+ [buttonsImage, 2, 0],
+ false,
+ function()
+ {
+ pasteAndSelect('');
+ },
+ 'form'
+ ];
+
+ this.editor.config.btnList.insert_select_field =
+ [ this._lc("Insert a select field."),
+ [buttonsImage, 3, 0],
+ false,
+ function()
+ {
+ pasteAndSelect('');
+ },
+ 'form'
+ ];
+
+ this.editor.config.btnList.insert_cb_field =
+ [ this._lc("Insert a check box."),
+ [buttonsImage, 4, 0],
+ false,
+ function()
+ {
+ pasteAndSelect('');
+ },
+ 'form'
+ ];
+
+ this.editor.config.btnList.insert_rb_field =
+ [ this._lc("Insert a radio button."),
+ [buttonsImage, 5, 0],
+ false,
+ function()
+ {
+ pasteAndSelect('');
+ },
+ 'form'
+ ];
+
+ this.editor.config.btnList.insert_button =
+ [ this._lc("Insert a submit/reset button."),
+ [buttonsImage, 6, 0],
+ false,
+ function()
+ {
+ pasteAndSelect('');
+ },
+ 'form'
+ ];
+}
+
+FormOperations.prototype.onGenerate = function()
+{
+ // Gecko does not register click events on select lists inside the iframe
+ // so the only way of detecting that is to do an event on mouse move.
+ if( Xinha.is_gecko)
+ {
+ var editor = this.editor;
+ var doc = this.editor._doc;
+ Xinha._addEvents
+ (doc, ["mousemove"],
+ function (event) {
+ return editor._editorEvent(event);
+ });
+ }
+};
+
+FormOperations.prototype._preparePanel = function ()
+{
+ var fo = this;
+ if(this.html == false)
+ {
+
+ Xinha._getback(Xinha.getPluginDir('FormOperations') + '/panel.html',
+ function(txt)
+ {
+ fo.html = txt;
+ fo._preparePanel();
+ }
+ );
+ return false;
+ }
+
+ if(typeof Xinha.Dialog == 'undefined')
+ {
+ Xinha._loadback
+ (_editor_url + 'modules/Dialogs/XinhaDialog.js', function() { fo._preparePanel(); } );
+ return false;
+ }
+
+ if(typeof Xinha.PanelDialog == 'undefined')
+ {
+ Xinha._loadback
+ (_editor_url + 'modules/Dialogs/panel-dialog.js', function() { fo._preparePanel(); } );
+ return false;
+ }
+
+
+
+ this.panel = new Xinha.PanelDialog(this.editor,'bottom',this.html,'FormOperations');
+ this.panel.hide();
+ this.ready = true;
+};
+
+FormOperations.prototype.onUpdateToolbar = function()
+{
+ if(!this.ready) return true;
+ var activeElement = this.editor._activeElement(this.editor._getSelection());
+ if(activeElement != null)
+ {
+ if(activeElement == this.activeElement) return true;
+
+ var tag = activeElement.tagName.toLowerCase();
+
+ this.hideAll();
+ if(tag === 'form')
+ {
+ if(this.editor.config.FormOperations.allow_edit_form)
+ {
+ this.showForm(activeElement);
+ }
+ else
+ {
+ this.panel.hide();
+ this.activeElement = null;
+ this.panel.hide();
+ return true;
+ }
+ }
+ else
+ {
+
+ if(this.editor.config.FormOperations.allow_edit_form && typeof activeElement.form != 'undefined' && activeElement.form)
+ {
+ this.showForm(activeElement.form);
+ }
+
+ switch(tag)
+ {
+ case 'form':
+ {
+ this.showForm(activeElement);
+ }
+ break;
+
+ case 'input':
+ {
+ switch(activeElement.getAttribute('type').toLowerCase())
+ {
+ case 'text' :
+ case 'password':
+ case 'hidden' :
+ {
+ this.showText(activeElement);
+ }
+ break;
+
+ case 'radio' :
+ case 'checkbox':
+ {
+ this.showCbRd(activeElement);
+ }
+ break;
+
+ case 'submit' :
+ case 'reset' :
+ case 'button' :
+ {
+ this.showButton(activeElement);
+ }
+ break;
+ }
+ }
+ break;
+
+ case 'textarea':
+ {
+ this.showTextarea(activeElement);
+ }
+ break;
+
+ case 'select':
+ {
+ this.showSelect(activeElement);
+ }
+ break;
+
+ default:
+ {
+ this.activeElement = null;
+ this.panel.hide();
+ return true;
+ }
+ }
+ }
+
+ this.panel.show();
+
+ //this.editor.scrollToElement(activeElement);
+ this.activeElement = activeElement;
+ return true;
+ }
+ else
+ {
+ this.activeElement = null;
+ this.panel.hide();
+ return true;
+ }
+};
+
+
+FormOperations.prototype.hideAll = function()
+{
+ this.panel.getElementById('fs_form').style.display = 'none';
+ this.panel.getElementById('fs_text').style.display = 'none';
+ this.panel.getElementById('fs_textarea').style.display = 'none';
+ this.panel.getElementById('fs_select').style.display = 'none';
+ this.panel.getElementById('fs_cbrd').style.display = 'none';
+ this.panel.getElementById('fs_button').style.display = 'none';
+};
+
+FormOperations.prototype.showForm = function(form)
+{
+ this.panel.getElementById('fs_form').style.display = '';
+ var vals =
+ {
+ 'action' : form.action,
+ 'method' : form.method.toUpperCase()
+ }
+ this.panel.setValues(vals);
+ var f = form;
+ this.panel.getElementById('action').onkeyup = function () { f.action = this.value; };
+ this.panel.getElementById('method').onchange = function () { f.method = this.options[this.selectedIndex].value; };
+};
+
+FormOperations.prototype.showText = function (input)
+{
+ this.panel.getElementById('fs_text').style.display = '';
+
+ var vals =
+ {
+ 'text_name' : this.deformatName(input, input.name),
+ 'text_value' : input.value,
+ 'text_type' : input.type.toLowerCase(),
+ 'text_width' : input.style.width ? parseFloat(input.style.width.replace(/[^0-9.]/, '')) : '',
+ 'text_width_units': input.style.width ? input.style.width.replace(/[0-9.]/, '').toLowerCase() : 'ex',
+ 'text_maxlength' : input.maxlength ? input.maxlength : ''
+ }
+ this.panel.setValues(vals);
+
+ var i = input;
+ var fo = this;
+
+ this.panel.getElementById('text_name').onkeyup = function () { i.name = fo.formatName(i, this.value); }
+ this.panel.getElementById('text_value').onkeyup = function () { i.value = this.value; }
+ this.panel.getElementById('text_type').onchange = function ()
+ {
+ if(!Xinha.is_ie)
+ {
+ i.type = this.options[this.selectedIndex].value;
+ }
+ else
+ {
+ // IE does not permit modifications of the type of a form field once it is set
+ // We therefor have to destroy and recreate it. I swear, if I ever
+ // meet any of the Internet Explorer development team I'm gonna
+ // kick them in the nuts!
+ var tmpContainer = fo.editor._doc.createElement('div');
+ if(!/type=/.test(i.outerHTML))
+ {
+ tmpContainer.innerHTML = i.outerHTML.replace(/ 0 ? input.size : 1),
+ 'select_height_units': input.style.height ? input.style.height.replace(/[0-9.]/, '').toLowerCase() : 'items'
+ };
+
+ this.panel.setValues(vals);
+
+ var i = input;
+ var fo = this;
+ this.panel.getElementById('select_name').onkeyup = function () { i.name = fo.formatName(i, this.value); };
+ this.panel.getElementById('select_multiple').onclick = function () { i.multiple = this.checked; };
+
+ var w = this.panel.getElementById('select_width');
+ var wu = this.panel.getElementById('select_width_units');
+
+ this.panel.getElementById('select_width').onkeyup =
+ this.panel.getElementById('select_width_units').onchange =
+ function ()
+ {
+ if(!w.value || isNaN(parseFloat(w.value)))
+ {
+ i.style.width = '';
+ }
+ i.style.width = parseFloat(w.value) + wu.options[wu.selectedIndex].value;
+ };
+
+ var h = this.panel.getElementById('select_height');
+ var hu = this.panel.getElementById('select_height_units');
+
+ this.panel.getElementById('select_height').onkeyup =
+ this.panel.getElementById('select_height_units').onchange =
+ function ()
+ {
+ if(!h.value || isNaN(parseFloat(h.value)))
+ {
+ i.style.height = '';
+ return;
+ }
+
+ if(hu.selectedIndex == 0)
+ {
+ i.style.height = '';
+ i.size = parseInt(h.value);
+ }
+ else
+ {
+ i.style.height = parseFloat(h.value) + hu.options[hu.selectedIndex].value;
+ }
+ };
+
+
+ var fo_sel = this.panel.getElementById('select_options');
+ this.arrayToOpts(this.optsToArray(input.options), fo_sel.options);
+
+ this.panel.getElementById('add_option').onclick =
+ function()
+ {
+ var txt = prompt(Xinha._lc("Enter the name for new option.", 'FormOperations'));
+ if(txt == null) return;
+ var newOpt = new Option(txt);
+ var opts = fo.optsToArray(fo_sel.options);
+ if(fo_sel.selectedIndex >= 0)
+ {
+ opts.splice(fo_sel.selectedIndex, 0, newOpt);
+ }
+ else
+ {
+ opts.push(newOpt);
+ }
+ fo.arrayToOpts(opts, input.options);
+ fo.arrayToOpts(opts, fo_sel.options);
+ };
+
+ this.panel.getElementById('del_option').onclick =
+ function()
+ {
+ var opts = fo.optsToArray(fo_sel.options);
+ var newOpts = [ ];
+ for(var i = 0; i < opts.length; i++)
+ {
+ if(opts[i].selected) continue;
+ newOpts.push(opts[i]);
+ }
+ fo.arrayToOpts(newOpts, input.options);
+ fo.arrayToOpts(newOpts, fo_sel.options);
+ };
+
+ this.panel.getElementById('up_option').onclick =
+ function()
+ {
+ if(!(fo_sel.selectedIndex > 0)) return;
+ var opts = fo.optsToArray(fo_sel.options);
+ var move = opts.splice(fo_sel.selectedIndex, 1).pop();
+ opts.splice(fo_sel.selectedIndex - 1, 0, move);
+ fo.arrayToOpts(opts, input.options);
+ fo.arrayToOpts(opts, fo_sel.options);
+ };
+
+ this.panel.getElementById('down_option').onclick =
+ function()
+ {
+ if(fo_sel.selectedIndex == fo_sel.options.length - 1) return;
+ var opts = fo.optsToArray(fo_sel.options);
+ var move = opts.splice(fo_sel.selectedIndex, 1).pop();
+ opts.splice(fo_sel.selectedIndex+1, 0, move);
+ fo.arrayToOpts(opts, input.options);
+ fo.arrayToOpts(opts, fo_sel.options);
+ };
+
+ this.panel.getElementById('select_options').onchange =
+ function()
+ {
+ fo.arrayToOpts(fo.optsToArray(fo_sel.options), input.options);
+ };
+};
+
+FormOperations.prototype.optsToArray = function(o)
+{
+ var a = [ ];
+ for(var i = 0; i < o.length; i++)
+ {
+ a.push(
+ {
+ 'text' : o[i].text,
+ 'value' : o[i].value,
+ 'defaultSelected' : o[i].defaultSelected,
+ 'selected' : o[i].selected
+ }
+ );
+ }
+ return a;
+};
+
+FormOperations.prototype.arrayToOpts = function(a, o)
+{
+ for(var i = o.length -1; i >= 0; i--)
+ {
+ o[i] = null;
+ }
+
+ for(var i = 0; i < a.length; i++)
+ {
+ o[i] = new Option(a[i].text, a[i].value, a[i].defaultSelected, a[i].selected);
+ }
+};
+
+FormOperations.prototype.formatName = function(input, name)
+{
+
+ // Multiple name
+ var mname = name;
+ switch(this.editor.config.FormOperations.multiple_field_format)
+ {
+ case 'php':
+ {
+ mname += '[]';
+ }
+ break;
+
+ case 'unmodified':
+ {
+ // Leave as is.
+ }
+ break;
+
+ default:
+ {
+ throw("Unknown multiple field format " + this.editor.config.FormOperations.multiple_field_format);
+ }
+ }
+
+ if
+ (
+ (input.tagName.toLowerCase() == 'select' && input.multiple)
+ || (input.tagName.toLowerCase() == 'input' && input.type.toLowerCase() == 'checkbox')
+ )
+ {
+ name = mname;
+ }
+
+ return name;
+};
+
+FormOperations.prototype.deformatName = function(input, name)
+{
+ if(this.editor.config.FormOperations.multiple_field_format == 'php')
+ {
+ name = name.replace(/\[\]$/, '');
+ }
+
+ return name;
+};
\ No newline at end of file
Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Forms/Forms.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Forms/Forms.js,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Forms/Forms.js 27 Mar 2009 08:20:43 -0000 1.2
+++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Forms/Forms.js 23 May 2010 11:58:33 -0000 1.3
@@ -1,3 +1,353 @@
-/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
-/* This file is part of version 0.96beta2 released Fri, 20 Mar 2009 11:01:14 +0100 */
-function Forms(e){this.editor=e;var a=e.config;var h=Forms.btnList;var b=this;var f=["linebreak"];for(var d=0;d";h.surroundHTML(m," ")}}},g)}else{var b="";if(typeof c=="undefined"){c=h.getParentElement();var o=c.tagName.toLowerCase();if(c&&(o=="legend")){c=c.parentElement;o=c.tagName.toLowerCase()}if(c&&!(o=="textarea"||o=="select"||o=="input"||o=="label"||o=="fieldset")){c=null}}if(c){k=c.tagName.toLowerCase();g.f_name=c.name;b=c.tagName;if(k=="input"){g.f_type=c.type;k=c.type}switch(k){case"textarea":g.f_cols=c.cols;g.f_rows=c.rows;g.f_text=c.innerHTML;g.f_wrap=c.getAttribute("wrap");g.f_readOnly=c.getAttribute("readOnly");g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");g.f_accesskey=c.getAttribute("accesskey");break;case"select":g.f_size=parseInt(c.size);g.f_multiple=c.getAttribute("multiple");g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");var l=new Array();for(var d=0;d<=c.options.length-1;d++){l[d]=new n(c.options[d].text,c.options[d].value)}g.f_options=l;break;case"text":case"password":g.f_value=c.value;g.f_size=c.size;g.f_maxLength=c.maxLength;g.f_readOnly=c.getAttribute("readOnly");g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");g.f_accesskey=c.getAttribute("accesskey");break;case"hidden":g.f_value=c.value;break;case"submit":case"reset":g.f_value=c.value;g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");g.f_accesskey=c.getAttribute("accesskey");break;case"checkbox":case"radio":g.f_value=c.value;g.f_checked=c.checked;g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");g.f_accesskey=c.getAttribute("accesskey");break;case"button":g.f_value=c.value;g.f_onclick=c.getAttribute("onclick");g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");g.f_accesskey=c.getAttribute("accesskey");break;case"image":g.f_value=c.value;g.f_src=c.src;g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");g.f_accesskey=c.getAttribute("accesskey");break;case"file":g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");g.f_accesskey=c.getAttribute("accesskey");break;case"label":g.f_text=c.innerHTML;g.f_for=c.getAttribute("for");g.f_accesskey=c.getAttribute("accesskey");break;case"fieldset":if(c.firstChild.tagName.toLowerCase()=="legend"){g.f_text=c.firstChild.innerHTML}else{g.f_text=""}break}}else{g.f_name="";switch(e){case"textarea":case"select":case"label":case"fieldset":b=e;break;default:b="input";g.f_type=e;break}g.f_options="";g.f_cols="20";g.f_rows="4";g.f_multiple="false";g.f_value="";g.f_size="";g.f_maxLength="";g.f_checked="";g.f_src="";g.f_onclick="";g.f_wrap="";g.f_readOnly="false";g.f_disabled="false";g.f_tabindex="";g.f_accesskey="";g.f_for="";g.f_text="";g.f_legend=""}h._popupDialog("plugin://Forms/"+b+".html",function(q){if(q){if(q.f_cols){if(isNaN(parseInt(q.f_cols,10))||parseInt(q.f_cols,10)<=0){q.f_cols=""}}if(q.f_rows){if(isNaN(parseInt(q.f_rows,10))||parseInt(q.f_rows,10)<=0){q.f_rows=""}}if(q.f_size){if(isNaN(parseInt(q.f_size,10))||parseInt(q.f_size,10)<=0){q.f_size=""}}if(q.f_maxlength){if(isNaN(parseInt(q.f_maxLength,10))||parseInt(q.f_maxLength,10)<=0){q.f_maxLength=""}}if(c){for(field in q){if((field=="f_text")||(field=="f_options")||(field=="f_onclick")||(field=="f_checked")){continue}if(q[field]!=""){c.setAttribute(field.substring(2,20),q[field])}else{c.removeAttribute(field.substring(2,20))}}if(k=="textarea"){c.innerHTML=q.f_text}else{if(k=="select"){c.options.length=0;var p=q.f_options;for(d=0;d<=p.length-1;d++){c.options[d]=new Option(p[d].text,p[d].value)}}else{if(k=="label"){c.innerHTML=q.f_text}else{if(k=="fieldset"){if(g.f_text!=""){if(c.firstChild.tagName.toLowerCase()=="legend"){c.firstChild.innerHTML=q.f_text}}else{}}else{if((k=="checkbox")||(k=="radio")){if(q.f_checked!=""){c.checked=true}else{c.checked=false}}else{if(q.f_onclick){c.onclick="";if(q.f_onclick!=""){c.onclick=q.f_onclick}}}}}}}}else{var i="";for(field in q){if(!q[field]){continue}if((q[field]=="")||(field=="f_text")||(field=="f_options")){continue}i+=" "+field.substring(2,20)+'="'+q[field]+'"'}if(k=="textarea"){i=""}else{if(k=="select"){i=""}else{if(k=="label"){i=""}else{if(k=="fieldset"){i=""}else{i='"}}}}h.insertHTML(i)}}},g)}};
\ No newline at end of file
+// Form plugin for Xinha
+// Distributed under the same terms as HTMLArea itself.
+// This notice MUST stay intact for use (see license.txt).
+
+
+function Forms(editor) {
+ this.editor = editor;
+ var cfg = editor.config;
+ var bl = Forms.btnList;
+ var self = this;
+ // register the toolbar buttons provided by this plugin
+ var toolbar = ["linebreak"];
+ for (var i = 0; i < bl.length; ++i) {
+ var btn = bl[i];
+ if (!btn) {
+ toolbar.push("separator");
+ } else {
+ var id = btn[0];
+ if (i<3)
+ cfg.registerButton(id, this._lc(btn[1]), editor.imgURL("ed_" + btn[0] + ".gif", "Forms"), false,
+ function(editor, id) {
+ // dispatch button press event
+ self.buttonPress(editor, id);
+ });
+ else
+ cfg.registerButton(id, this._lc(btn[1]), editor.imgURL("ed_" + btn[0] + ".gif", "Forms"), false,
+ function(editor, id) {
+ // dispatch button press event
+ self.buttonPress(editor, id);
+ },"form");
+ toolbar.push(id);
+ }
+ }
+ // add a new line in the toolbar
+ cfg.toolbar.push(toolbar);
+}
+
+Forms._pluginInfo = {
+ name : "Forms",
+ origin : "version: 1.0, by Nelson Bright, BrightWork, Inc., http://www.brightworkweb.com",
+ version : "2.0",
+ developer : "Udo Schmal",
+ developer_url : "",
+ sponsor : "L.N.Schaffrath NeueMedien",
+ sponsor_url : "http://www.schaffrath-neuemedien.de/",
+ c_owner : "Udo Schmal & Schaffrath-NeueMedien",
+ license : "htmlArea"
+};
+
+// the list of buttons added by this plugin
+Forms.btnList = [
+ // form properties button
+ null, // separator
+ ["form", "Form"],
+ null, // separator
+ // form elements
+ ["textarea", "Textarea"],
+ ["select", "Selection Field"],
+ ["checkbox", "Checkbox"],
+ ["radio", "Radio Button"],
+ ["text", "Text Field"],
+ ["password", "Password Field"],
+ ["file", "File Field"],
+ ["button", "Button"],
+ ["submit", "Submit Button"],
+ ["reset", "Reset Button"],
+ ["image", "Image Button"],
+ ["hidden", "Hidden Field"],
+ ["label", "Label"],
+ ["fieldset", "Field Set"]
+ ];
+
+Forms.prototype._lc = function(string) {
+ return Xinha._lc(string, 'Forms');
+};
+
+Forms.prototype.onGenerate = function() {
+ this.editor.addEditorStylesheet(Xinha.getPluginDir("Forms") + '/forms.css');
+};
+
+Forms.prototype.buttonPress = function(editor,button_id, node) {
+ function optionValues(text,value) {
+ this.text = text;
+ this.value = value;
+ }
+ var outparam = new Object();
+ var type = button_id;
+ var sel = editor._getSelection();
+ var range = editor._createRange(sel);
+ if (button_id=="form") { //Form
+ // see if selection is inside an existing 'form' tag
+ var pe = editor.getParentElement();
+ var frm = null;
+ while (pe && (pe.nodeType == 1) && (pe.tagName.toLowerCase() != 'body')) {
+ if(pe.tagName.toLowerCase() == "form") {
+ frm = pe;
+ break;
+ } else
+ pe = pe.parentNode;
+ }
+ if (frm) {
+ outparam.f_name = frm.name;
+ outparam.f_action = frm.action;
+ outparam.f_method = frm.method;
+ outparam.f_enctype = frm.enctype;
+ outparam.f_target = frm.target;
+ } else {;
+ outparam.f_name = "";
+ outparam.f_action = "";
+ outparam.f_method = "";
+ outparam.f_enctype = "";
+ outparam.f_target = "";
+ }
+ editor._popupDialog("plugin://Forms/form", function(param) {
+ if (param) {
+ if(frm) {
+ frm.name = param["f_name"];
+ frm.setAttribute("action", param["f_action"]);
+ frm.setAttribute("method", param["f_method"]);
+ frm.setAttribute("enctype",param["f_enctype"]);
+ frm.setAttribute("target", param["f_target"]);
+ } else {
+ frm = '');
+ }
+ }
+ }, outparam);
+
+ } else { // form element (checkbox, radio, text, password, textarea, select, button, submit, reset, image, hidden)
+ var tagName = "";
+ // see if selection is an form element
+ if (typeof node == "undefined") {
+ node = editor.getParentElement();
+ var tag = node.tagName.toLowerCase()
+ if (node && (tag == "legend")) {
+ node = node.parentElement;
+ tag = node.tagName.toLowerCase();
+ }
+ if (node && !(tag == "textarea" || tag == "select" || tag == "input" || tag == "label" || tag == "fieldset"))
+ node = null;
+ }
+
+ if(node) {
+ type = node.tagName.toLowerCase();
+ outparam.f_name = node.name;
+ tagName = node.tagName;
+ if (type == "input") {
+ outparam.f_type = node.type;
+ type = node.type;
+ }
+ switch (type) {
+ case "textarea":
+ outparam.f_cols = node.cols;
+ outparam.f_rows = node.rows;
+ outparam.f_text = node.innerHTML;
+ outparam.f_wrap = node.getAttribute("wrap");
+ outparam.f_readOnly = node.getAttribute("readOnly");
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "select":
+ outparam.f_size = parseInt(node.size);
+ outparam.f_multiple = node.getAttribute("multiple");
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ var a_options = new Array();
+ for (var i=0; i<=node.options.length-1; i++) {
+ a_options[i] = new optionValues(node.options[i].text, node.options[i].value);
+ }
+ outparam.f_options = a_options;
+ break;
+ case "text":
+ case "password":
+ outparam.f_value = node.value;
+ outparam.f_size = node.size;
+ outparam.f_maxLength = node.maxLength;
+ outparam.f_readOnly = node.getAttribute("readOnly");
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "hidden":
+ outparam.f_value = node.value;
+ break;
+ case "submit":
+ case "reset":
+ outparam.f_value = node.value;
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "checkbox":
+ case "radio":
+ outparam.f_value = node.value;
+ outparam.f_checked = node.checked;
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "button":
+ outparam.f_value = node.value;
+ outparam.f_onclick = node.getAttribute("onclick");
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "image":
+ outparam.f_value = node.value;
+ outparam.f_src = node.src;
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "file":
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "label":
+ outparam.f_text = node.innerHTML;
+ outparam.f_for = node.getAttribute("for");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "fieldset":
+ if(node.firstChild.tagName.toLowerCase()=="legend")
+ outparam.f_text = node.firstChild.innerHTML;
+ else
+ outparam.f_text = "";
+ break;
+ }
+ } else {
+ outparam.f_name = "";
+ switch (button_id) {
+ case "textarea":
+ case "select":
+ case "label":
+ case "fieldset":
+ tagName = button_id;
+ break;
+ default:
+ tagName = "input";
+ outparam.f_type = button_id;
+ break;
+ }
+ outparam.f_options = "";
+ outparam.f_cols = "20";
+ outparam.f_rows = "4";
+ outparam.f_multiple = "false";
+ outparam.f_value = "";
+ outparam.f_size = "";
+ outparam.f_maxLength = "";
+ outparam.f_checked = "";
+ outparam.f_src = "";
+ outparam.f_onclick = "";
+ outparam.f_wrap = "";
+ outparam.f_readOnly = "false";
+ outparam.f_disabled = "false";
+ outparam.f_tabindex = "";
+ outparam.f_accesskey = "";
+ outparam.f_for = "";
+ outparam.f_text = "";
+ outparam.f_legend = "";
+ }
+ editor._popupDialog("plugin://Forms/" + tagName + ".html", function(param) {
+ if (param) {
+ if(param["f_cols"])
+ if (isNaN(parseInt(param["f_cols"],10)) || parseInt(param["f_cols"],10) <= 0)
+ param["f_cols"] = "";
+ if(param["f_rows"])
+ if(isNaN(parseInt(param["f_rows"],10)) || parseInt(param["f_rows"],10) <= 0)
+ param["f_rows"] = "";
+ if(param["f_size"])
+ if(isNaN(parseInt(param["f_size"],10)) || parseInt(param["f_size"],10) <= 0)
+ param["f_size"] = "";
+ if(param["f_maxlength"])
+ if(isNaN(parseInt(param["f_maxLength"],10)) || parseInt(param["f_maxLength"],10) <= 0)
+ param["f_maxLength"] = "";
+ if(node) {
+ //prepare existing Element
+ for (field in param) {
+ //alert(field.substring(2,20) + '=' + param[field]); //to be silent! by htanaka
+ if ((field=="f_text") || (field=="f_options") || (field=="f_onclick") || (field=="f_checked"))continue;
+ if (param[field] != "")
+ node.setAttribute(field.substring(2,20), param[field]);
+ else
+ node.removeAttribute(field.substring(2,20));
+ }
+ if (type == "textarea") {
+ node.innerHTML = param["f_text"];
+ } else if(type == "select") {
+ node.options.length = 0;
+ var optionsList = param["f_options"];
+ for (i=0; i<= optionsList.length-1; i++) {
+ node.options[i] = new Option(optionsList[i].text, optionsList[i].value)
+ }
+ } else if(type == "label") {
+ node.innerHTML = param["f_text"];
+ } else if(type == "fieldset") {
+ if(outparam.f_text != "") {
+ if(node.firstChild.tagName.toLowerCase()=="legend")
+ node.firstChild.innerHTML = param["f_text"];
+ } else {}// not implemented jet
+ } else if((type == "checkbox") || (type == "radio")) { //input
+ if(param["f_checked"]!="")
+ node.checked = true;
+ else
+ node.checked = false;
+ } else {
+ if(param["f_onclick"]){
+ node.onclick = "";
+ if(param["f_onclick"]!="")
+ node.onclick = param["f_onclick"];
+ }
+ }
+ } else {
+ //create Element
+ var text = "";
+ for (field in param) {
+ if (!param[field]) continue;
+ if ((param[field]=="") || (field=="f_text")|| (field=="f_options"))continue;
+ text += " " + field.substring(2,20) + '="' + param[field] + '"';
+ }
+
+ if(type == "textarea") {
+ text = '';
+ } else if(type == "select") {
+ text = '';
+ } else if(type == "label") {
+ text = '';
+ } else if(type == "fieldset") {
+ text = '';
+ } else {
+ text = '';
+ }
+ editor.insertHTML(text);
+ }
+ }
+ }, outparam);
+ }
+};
\ No newline at end of file
Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Forms/forms.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Forms/Attic/forms.js,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Forms/forms.js 27 Mar 2009 08:20:43 -0000 1.8
+++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/Forms/forms.js 23 May 2010 11:58:33 -0000 1.9
@@ -1,3 +1,353 @@
-/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
-/* This file is part of version 0.96beta2 released Fri, 20 Mar 2009 11:01:14 +0100 */
-function Forms(e){this.editor=e;var a=e.config;var h=Forms.btnList;var b=this;var f=["linebreak"];for(var d=0;d";h.surroundHTML(m," ")}}},g)}else{var b="";if(typeof c=="undefined"){c=h.getParentElement();var o=c.tagName.toLowerCase();if(c&&(o=="legend")){c=c.parentElement;o=c.tagName.toLowerCase()}if(c&&!(o=="textarea"||o=="select"||o=="input"||o=="label"||o=="fieldset")){c=null}}if(c){k=c.tagName.toLowerCase();g.f_name=c.name;b=c.tagName;if(k=="input"){g.f_type=c.type;k=c.type}switch(k){case"textarea":g.f_cols=c.cols;g.f_rows=c.rows;g.f_text=c.innerHTML;g.f_wrap=c.getAttribute("wrap");g.f_readOnly=c.getAttribute("readOnly");g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");g.f_accesskey=c.getAttribute("accesskey");break;case"select":g.f_size=parseInt(c.size);g.f_multiple=c.getAttribute("multiple");g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");var l=new Array();for(var d=0;d<=c.options.length-1;d++){l[d]=new n(c.options[d].text,c.options[d].value)}g.f_options=l;break;case"text":case"password":g.f_value=c.value;g.f_size=c.size;g.f_maxLength=c.maxLength;g.f_readOnly=c.getAttribute("readOnly");g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");g.f_accesskey=c.getAttribute("accesskey");break;case"hidden":g.f_value=c.value;break;case"submit":case"reset":g.f_value=c.value;g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");g.f_accesskey=c.getAttribute("accesskey");break;case"checkbox":case"radio":g.f_value=c.value;g.f_checked=c.checked;g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");g.f_accesskey=c.getAttribute("accesskey");break;case"button":g.f_value=c.value;g.f_onclick=c.getAttribute("onclick");g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");g.f_accesskey=c.getAttribute("accesskey");break;case"image":g.f_value=c.value;g.f_src=c.src;g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");g.f_accesskey=c.getAttribute("accesskey");break;case"file":g.f_disabled=c.getAttribute("disabled");g.f_tabindex=c.getAttribute("tabindex");g.f_accesskey=c.getAttribute("accesskey");break;case"label":g.f_text=c.innerHTML;g.f_for=c.getAttribute("for");g.f_accesskey=c.getAttribute("accesskey");break;case"fieldset":if(c.firstChild.tagName.toLowerCase()=="legend"){g.f_text=c.firstChild.innerHTML}else{g.f_text=""}break}}else{g.f_name="";switch(e){case"textarea":case"select":case"label":case"fieldset":b=e;break;default:b="input";g.f_type=e;break}g.f_options="";g.f_cols="20";g.f_rows="4";g.f_multiple="false";g.f_value="";g.f_size="";g.f_maxLength="";g.f_checked="";g.f_src="";g.f_onclick="";g.f_wrap="";g.f_readOnly="false";g.f_disabled="false";g.f_tabindex="";g.f_accesskey="";g.f_for="";g.f_text="";g.f_legend=""}h._popupDialog("plugin://Forms/"+b+".html",function(q){if(q){if(q.f_cols){if(isNaN(parseInt(q.f_cols,10))||parseInt(q.f_cols,10)<=0){q.f_cols=""}}if(q.f_rows){if(isNaN(parseInt(q.f_rows,10))||parseInt(q.f_rows,10)<=0){q.f_rows=""}}if(q.f_size){if(isNaN(parseInt(q.f_size,10))||parseInt(q.f_size,10)<=0){q.f_size=""}}if(q.f_maxlength){if(isNaN(parseInt(q.f_maxLength,10))||parseInt(q.f_maxLength,10)<=0){q.f_maxLength=""}}if(c){for(field in q){if((field=="f_text")||(field=="f_options")||(field=="f_onclick")||(field=="f_checked")){continue}if(q[field]!=""){c.setAttribute(field.substring(2,20),q[field])}else{c.removeAttribute(field.substring(2,20))}}if(k=="textarea"){c.innerHTML=q.f_text}else{if(k=="select"){c.options.length=0;var p=q.f_options;for(d=0;d<=p.length-1;d++){c.options[d]=new Option(p[d].text,p[d].value)}}else{if(k=="label"){c.innerHTML=q.f_text}else{if(k=="fieldset"){if(g.f_text!=""){if(c.firstChild.tagName.toLowerCase()=="legend"){c.firstChild.innerHTML=q.f_text}}else{}}else{if((k=="checkbox")||(k=="radio")){if(q.f_checked!=""){c.checked=true}else{c.checked=false}}else{if(q.f_onclick){c.onclick="";if(q.f_onclick!=""){c.onclick=q.f_onclick}}}}}}}}else{var i="";for(field in q){if(!q[field]){continue}if((q[field]=="")||(field=="f_text")||(field=="f_options")){continue}i+=" "+field.substring(2,20)+'="'+q[field]+'"'}if(k=="textarea"){i=""}else{if(k=="select"){i=""}else{if(k=="label"){i=""}else{if(k=="fieldset"){i=""}else{i='"}}}}h.insertHTML(i)}}},g)}};
\ No newline at end of file
+// Form plugin for Xinha
+// Distributed under the same terms as HTMLArea itself.
+// This notice MUST stay intact for use (see license.txt).
+
+
+function Forms(editor) {
+ this.editor = editor;
+ var cfg = editor.config;
+ var bl = Forms.btnList;
+ var self = this;
+ // register the toolbar buttons provided by this plugin
+ var toolbar = ["linebreak"];
+ for (var i = 0; i < bl.length; ++i) {
+ var btn = bl[i];
+ if (!btn) {
+ toolbar.push("separator");
+ } else {
+ var id = btn[0];
+ if (i<3)
+ cfg.registerButton(id, this._lc(btn[1]), editor.imgURL("ed_" + btn[0] + ".gif", "Forms"), false,
+ function(editor, id) {
+ // dispatch button press event
+ self.buttonPress(editor, id);
+ });
+ else
+ cfg.registerButton(id, this._lc(btn[1]), editor.imgURL("ed_" + btn[0] + ".gif", "Forms"), false,
+ function(editor, id) {
+ // dispatch button press event
+ self.buttonPress(editor, id);
+ },"form");
+ toolbar.push(id);
+ }
+ }
+ // add a new line in the toolbar
+ cfg.toolbar.push(toolbar);
+}
+
+Forms._pluginInfo = {
+ name : "Forms",
+ origin : "version: 1.0, by Nelson Bright, BrightWork, Inc., http://www.brightworkweb.com",
+ version : "2.0",
+ developer : "Udo Schmal",
+ developer_url : "",
+ sponsor : "L.N.Schaffrath NeueMedien",
+ sponsor_url : "http://www.schaffrath-neuemedien.de/",
+ c_owner : "Udo Schmal & Schaffrath-NeueMedien",
+ license : "htmlArea"
+};
+
+// the list of buttons added by this plugin
+Forms.btnList = [
+ // form properties button
+ null, // separator
+ ["form", "Form"],
+ null, // separator
+ // form elements
+ ["textarea", "Textarea"],
+ ["select", "Selection Field"],
+ ["checkbox", "Checkbox"],
+ ["radio", "Radio Button"],
+ ["text", "Text Field"],
+ ["password", "Password Field"],
+ ["file", "File Field"],
+ ["button", "Button"],
+ ["submit", "Submit Button"],
+ ["reset", "Reset Button"],
+ ["image", "Image Button"],
+ ["hidden", "Hidden Field"],
+ ["label", "Label"],
+ ["fieldset", "Field Set"]
+ ];
+
+Forms.prototype._lc = function(string) {
+ return Xinha._lc(string, 'Forms');
+};
+
+Forms.prototype.onGenerate = function() {
+ this.editor.addEditorStylesheet(Xinha.getPluginDir("Forms") + '/forms.css');
+};
+
+Forms.prototype.buttonPress = function(editor,button_id, node) {
+ function optionValues(text,value) {
+ this.text = text;
+ this.value = value;
+ }
+ var outparam = new Object();
+ var type = button_id;
+ var sel = editor._getSelection();
+ var range = editor._createRange(sel);
+ if (button_id=="form") { //Form
+ // see if selection is inside an existing 'form' tag
+ var pe = editor.getParentElement();
+ var frm = null;
+ while (pe && (pe.nodeType == 1) && (pe.tagName.toLowerCase() != 'body')) {
+ if(pe.tagName.toLowerCase() == "form") {
+ frm = pe;
+ break;
+ } else
+ pe = pe.parentNode;
+ }
+ if (frm) {
+ outparam.f_name = frm.name;
+ outparam.f_action = frm.action;
+ outparam.f_method = frm.method;
+ outparam.f_enctype = frm.enctype;
+ outparam.f_target = frm.target;
+ } else {;
+ outparam.f_name = "";
+ outparam.f_action = "";
+ outparam.f_method = "";
+ outparam.f_enctype = "";
+ outparam.f_target = "";
+ }
+ editor._popupDialog("plugin://Forms/form", function(param) {
+ if (param) {
+ if(frm) {
+ frm.name = param["f_name"];
+ frm.setAttribute("action", param["f_action"]);
+ frm.setAttribute("method", param["f_method"]);
+ frm.setAttribute("enctype",param["f_enctype"]);
+ frm.setAttribute("target", param["f_target"]);
+ } else {
+ frm = '');
+ }
+ }
+ }, outparam);
+
+ } else { // form element (checkbox, radio, text, password, textarea, select, button, submit, reset, image, hidden)
+ var tagName = "";
+ // see if selection is an form element
+ if (typeof node == "undefined") {
+ node = editor.getParentElement();
+ var tag = node.tagName.toLowerCase()
+ if (node && (tag == "legend")) {
+ node = node.parentElement;
+ tag = node.tagName.toLowerCase();
+ }
+ if (node && !(tag == "textarea" || tag == "select" || tag == "input" || tag == "label" || tag == "fieldset"))
+ node = null;
+ }
+
+ if(node) {
+ type = node.tagName.toLowerCase();
+ outparam.f_name = node.name;
+ tagName = node.tagName;
+ if (type == "input") {
+ outparam.f_type = node.type;
+ type = node.type;
+ }
+ switch (type) {
+ case "textarea":
+ outparam.f_cols = node.cols;
+ outparam.f_rows = node.rows;
+ outparam.f_text = node.innerHTML;
+ outparam.f_wrap = node.getAttribute("wrap");
+ outparam.f_readOnly = node.getAttribute("readOnly");
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "select":
+ outparam.f_size = parseInt(node.size);
+ outparam.f_multiple = node.getAttribute("multiple");
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ var a_options = new Array();
+ for (var i=0; i<=node.options.length-1; i++) {
+ a_options[i] = new optionValues(node.options[i].text, node.options[i].value);
+ }
+ outparam.f_options = a_options;
+ break;
+ case "text":
+ case "password":
+ outparam.f_value = node.value;
+ outparam.f_size = node.size;
+ outparam.f_maxLength = node.maxLength;
+ outparam.f_readOnly = node.getAttribute("readOnly");
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "hidden":
+ outparam.f_value = node.value;
+ break;
+ case "submit":
+ case "reset":
+ outparam.f_value = node.value;
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "checkbox":
+ case "radio":
+ outparam.f_value = node.value;
+ outparam.f_checked = node.checked;
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "button":
+ outparam.f_value = node.value;
+ outparam.f_onclick = node.getAttribute("onclick");
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "image":
+ outparam.f_value = node.value;
+ outparam.f_src = node.src;
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "file":
+ outparam.f_disabled = node.getAttribute("disabled");
+ outparam.f_tabindex = node.getAttribute("tabindex");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "label":
+ outparam.f_text = node.innerHTML;
+ outparam.f_for = node.getAttribute("for");
+ outparam.f_accesskey = node.getAttribute("accesskey");
+ break;
+ case "fieldset":
+ if(node.firstChild.tagName.toLowerCase()=="legend")
+ outparam.f_text = node.firstChild.innerHTML;
+ else
+ outparam.f_text = "";
+ break;
+ }
+ } else {
+ outparam.f_name = "";
+ switch (button_id) {
+ case "textarea":
+ case "select":
+ case "label":
+ case "fieldset":
+ tagName = button_id;
+ break;
+ default:
+ tagName = "input";
+ outparam.f_type = button_id;
+ break;
+ }
+ outparam.f_options = "";
+ outparam.f_cols = "20";
+ outparam.f_rows = "4";
+ outparam.f_multiple = "false";
+ outparam.f_value = "";
+ outparam.f_size = "";
+ outparam.f_maxLength = "";
+ outparam.f_checked = "";
+ outparam.f_src = "";
+ outparam.f_onclick = "";
+ outparam.f_wrap = "";
+ outparam.f_readOnly = "false";
+ outparam.f_disabled = "false";
+ outparam.f_tabindex = "";
+ outparam.f_accesskey = "";
+ outparam.f_for = "";
+ outparam.f_text = "";
+ outparam.f_legend = "";
+ }
+ editor._popupDialog("plugin://Forms/" + tagName + ".html", function(param) {
+ if (param) {
+ if(param["f_cols"])
+ if (isNaN(parseInt(param["f_cols"],10)) || parseInt(param["f_cols"],10) <= 0)
+ param["f_cols"] = "";
+ if(param["f_rows"])
+ if(isNaN(parseInt(param["f_rows"],10)) || parseInt(param["f_rows"],10) <= 0)
+ param["f_rows"] = "";
+ if(param["f_size"])
+ if(isNaN(parseInt(param["f_size"],10)) || parseInt(param["f_size"],10) <= 0)
+ param["f_size"] = "";
+ if(param["f_maxlength"])
+ if(isNaN(parseInt(param["f_maxLength"],10)) || parseInt(param["f_maxLength"],10) <= 0)
+ param["f_maxLength"] = "";
+ if(node) {
+ //prepare existing Element
+ for (field in param) {
+ //alert(field.substring(2,20) + '=' + param[field]); //to be silent! by htanaka
+ if ((field=="f_text") || (field=="f_options") || (field=="f_onclick") || (field=="f_checked"))continue;
+ if (param[field] != "")
+ node.setAttribute(field.substring(2,20), param[field]);
+ else
+ node.removeAttribute(field.substring(2,20));
+ }
+ if (type == "textarea") {
+ node.innerHTML = param["f_text"];
+ } else if(type == "select") {
+ node.options.length = 0;
+ var optionsList = param["f_options"];
+ for (i=0; i<= optionsList.length-1; i++) {
+ node.options[i] = new Option(optionsList[i].text, optionsList[i].value)
+ }
+ } else if(type == "label") {
+ node.innerHTML = param["f_text"];
+ } else if(type == "fieldset") {
+ if(outparam.f_text != "") {
+ if(node.firstChild.tagName.toLowerCase()=="legend")
+ node.firstChild.innerHTML = param["f_text"];
+ } else {}// not implemented jet
+ } else if((type == "checkbox") || (type == "radio")) { //input
+ if(param["f_checked"]!="")
+ node.checked = true;
+ else
+ node.checked = false;
+ } else {
+ if(param["f_onclick"]){
+ node.onclick = "";
+ if(param["f_onclick"]!="")
+ node.onclick = param["f_onclick"];
+ }
+ }
+ } else {
+ //create Element
+ var text = "";
+ for (field in param) {
+ if (!param[field]) continue;
+ if ((param[field]=="") || (field=="f_text")|| (field=="f_options"))continue;
+ text += " " + field.substring(2,20) + '="' + param[field] + '"';
+ }
+
+ if(type == "textarea") {
+ text = '';
+ } else if(type == "select") {
+ text = '';
+ } else if(type == "label") {
+ text = '';
+ } else if(type == "fieldset") {
+ text = '';
+ } else {
+ text = '';
+ }
+ editor.insertHTML(text);
+ }
+ }
+ }, outparam);
+ }
+};
\ No newline at end of file
Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FullPage/FullPage.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FullPage/FullPage.js,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FullPage/FullPage.js 27 Mar 2009 08:20:44 -0000 1.2
+++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FullPage/FullPage.js 23 May 2010 11:58:33 -0000 1.3
@@ -1,3 +1,209 @@
-/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
-/* This file is part of version 0.96beta2 released Fri, 20 Mar 2009 11:01:14 +0100 */
-function FullPage(c){this.editor=c;var a=c.config;a.fullPage=true;var b=this;a.registerButton("FP-docprop",this._lc("Document properties"),c.imgURL("docprop.gif","FullPage"),false,function(d,e){b.buttonPress(d,e)});a.addToolbarElement(["separator","FP-docprop"],"separator",-1)}FullPage._pluginInfo={name:"FullPage",version:"1.0",developer:"Mihai Bazon",developer_url:"http://dynarch.com/mishoo/",c_owner:"Mihai Bazon",sponsor:"Thycotic Software Ltd.",sponsor_url:"http://thycotic.com",license:"htmlArea"};FullPage.prototype._lc=function(a){return Xinha._lc(a,"FullPage")};FullPage.prototype.buttonPress=function(e,a){var q=this;switch(a){case"FP-docprop":var k=e._doc;var n=k.getElementsByTagName("link");var l="";var j="";var d="";var m="";var b="";for(var c=n.length;--c>=0;){var g=n[c];if(/stylesheet/i.test(g.rel)){if(/alternate/i.test(g.rel)){j=g.href}else{l=g.href}}}var f=k.getElementsByTagName("meta");for(var c=f.length;--c>=0;){var p=f[c];if(/content-type/i.test(p.httpEquiv)){r=/^text\/html; *charset=(.*)$/i.exec(p.content);b=r[1]}else{if((/keywords/i.test(p.name))||(/keywords/i.test(p.id))){d=p.content}else{if((/description/i.test(p.name))||(/description/i.test(p.id))){m=p.content}}}}var h=k.getElementsByTagName("title")[0];h=h?h.innerHTML:"";var o={f_doctype:e.doctype,f_title:h,f_body_bgcolor:Xinha._colorToRgb(k.body.style.backgroundColor),f_body_fgcolor:Xinha._colorToRgb(k.body.style.color),f_base_style:l,f_alt_style:j,f_charset:b,f_keywords:d,f_description:m,editor:e};e._popupDialog("plugin://FullPage/docprop",function(i){q.setDocProp(i)},o);break}};FullPage.prototype.setDocProp=function(q){var j="";var u=this.editor._doc;var d=u.getElementsByTagName("head")[0];var b=u.getElementsByTagName("link");var a=u.getElementsByTagName("meta");var o=null;var n=null;var c=null;var f=null;var g=null;var l=null;for(var m=b.length;--m>=0;){var e=b[m];if(/stylesheet/i.test(e.rel)){if(/alternate/i.test(e.rel)){n=e}else{o=e}}}for(var m=a.length;--m>=0;){var h=a[m];if(/content-type/i.test(h.httpEquiv)){r=/^text\/html; *charset=(.*)$/i.exec(h.content);c=r[1];f=h}else{if((/keywords/i.test(h.name))||(/keywords/i.test(h.id))){g=h}else{if((/description/i.test(h.name))||(/description/i.test(h.id))){l=h}}}}function k(v){var i=u.createElement("link");i.rel=v?"alternate stylesheet":"stylesheet";d.appendChild(i);return i}function p(i,v,w){var x=u.createElement("meta");if(i!=""){x.httpEquiv=i}if(v!=""){x.name=v}if(v!=""){x.id=v}x.content=w;d.appendChild(x);return x}if(!o&&q.f_base_style){o=k(false)}if(q.f_base_style){o.href=q.f_base_style}else{if(o){d.removeChild(o)}}if(!n&&q.f_alt_style){n=k(true)}if(q.f_alt_style){n.href=q.f_alt_style}else{if(n){d.removeChild(n)}}if(f){d.removeChild(f);f=null}if(!f&&q.f_charset){f=p("Content-Type","","text/html; charset="+q.f_charset)}if(!g&&q.f_keywords){g=p("","keywords",q.f_keywords)}else{if(q.f_keywords){g.content=q.f_keywords}else{if(g){d.removeChild(g)}}}if(!l&&q.f_description){l=p("","description",q.f_description)}else{if(q.f_description){l.content=q.f_description}else{if(l){d.removeChild(l)}}}for(var m in q){var t=q[m];switch(m){case"f_title":var s=u.getElementsByTagName("title")[0];if(!s){s=u.createElement("title");d.appendChild(s)}else{while(node=s.lastChild){s.removeChild(node)}}if(!Xinha.is_ie){s.appendChild(u.createTextNode(t))}else{u.title=t}break;case"f_doctype":this.editor.setDoctype(t);break;case"f_body_bgcolor":u.body.style.backgroundColor=t;break;case"f_body_fgcolor":u.body.style.color=t;break}}};
\ No newline at end of file
+// FullPage Plugin for HTMLArea-3.0
+// Implementation by Mihai Bazon. Sponsored by http://thycotic.com
+//
+// htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc.
+// This notice MUST stay intact for use (see license.txt).
+//
+// A free WYSIWYG editor replacement for