You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2006/10/08 21:54:16 UTC

svn commit: r454197 [10/29] - in /incubator/roller/trunk/web: WEB-INF/classes/ roller-ui/authoring/editors/ roller-ui/authoring/editors/xinha/ roller-ui/authoring/editors/xinha/conf/ roller-ui/authoring/editors/xinha/contrib/ roller-ui/authoring/editor...

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/manager.js
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/manager.js?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/manager.js (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/manager.js Sun Oct  8 12:53:13 2006
@@ -0,0 +1,449 @@
+/**
+ * Functions for the ExtendedFileManager, used by manager.php only
+ * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz
+ * Version: Updated on 08-01-2005 by Afru
+ * Version: Updated on 20-06-2006 by Krzysztof Kotowicz
+ * Package: ExtendedFileManager (EFM 1.1.1)
+ * http://www.afrusoft.com/htmlarea
+ */
+
+function comboSelectValue(c, val) {
+    var ops = c.getElementsByTagName("option");
+    for (var i = ops.length; --i >= 0;) {
+        var op = ops[i];
+        op.selected = (op.value == val);
+    }
+    c.value = val;
+}
+
+//Translation
+function i18n(str) {
+    return HTMLArea._lc(str, 'ExtendedFileManager');
+}
+
+//set the alignment options
+function setAlign(align)
+{
+    var selection = document.getElementById('f_align');
+    for(var i = 0; i < selection.length; i++)
+    {
+        if(selection.options[i].value == align)
+        {
+            selection.selectedIndex = i;
+            break;
+        }
+    }
+}
+
+function onTargetChanged() {
+  var f = document.getElementById("f_other_target");
+  if (this.value == "_other") {
+    f.style.visibility = "visible";
+    f.select();
+    f.focus();
+  } else f.style.visibility = "hidden";
+}
+
+//initialise the form
+init = function ()
+{
+    if (manager_mode == "link")
+      __dlg_init(null,  {width:650,height:500});
+    else
+      __dlg_init(null,  {width:650,height:560});
+
+    __dlg_translate('ExtendedFileManager');
+
+    var uploadForm = document.getElementById('uploadForm');
+    if(uploadForm) uploadForm.target = 'imgManager';
+
+    if (manager_mode == 'image' && typeof colorPicker != "undefined" && document.getElementById('bgCol_pick')) {
+        // Hookup color pickers
+        var bgCol_pick = document.getElementById('bgCol_pick');
+        var f_backgroundColor = document.getElementById('f_backgroundColor');
+        var bgColPicker = new colorPicker({cellsize:'5px',callback:function(color){f_backgroundColor.value=color;}});
+        bgCol_pick.onclick = function() { bgColPicker.open('top,right', f_backgroundColor ); }
+
+        var bdCol_pick = document.getElementById('bdCol_pick');
+        var f_borderColor = document.getElementById('f_borderColor');
+        var bdColPicker = new colorPicker({cellsize:'5px',callback:function(color){f_borderColor.value=color;}});
+        bdCol_pick.onclick = function() { bdColPicker.open('top,right', f_borderColor ); }
+    }
+
+    var param = window.dialogArguments;
+
+    if(manager_mode=="image" && param)
+    {
+        var absoluteURL = new RegExp('^https?://');
+
+        if (param.f_url.length > 0 && !absoluteURL.test(param.f_url) && typeof param.baseHref == "string") {
+            // URL is not absolute, prepend baseHref
+            param.f_url = param.baseHref + param.f_url;
+        }
+
+        // strip base_url from url
+        var image_regex = new RegExp( '(https?://[^/]*)?' + base_url.replace(/\/$/, '') );
+        param.f_url = param.f_url.replace( image_regex, "" );
+
+        // The image URL may reference one of the automatically resized images
+        // (when the user alters the dimensions in the picker), clean that up
+        // so it looks right and we get back to a normal f_url
+        var rd = _resized_dir.replace(HTMLArea.RE_Specials, '\\$1');
+        var rp = _resized_prefix.replace(HTMLArea.RE_Specials, '\\$1');
+        var dreg = new RegExp('^(.*/)' + rd + '/' + rp + '_([0-9]+)x([0-9]+)_([^/]+)$');
+
+        if(dreg.test(param.f_url))
+        {
+          param.f_url    = RegExp.$1 + RegExp.$4;
+          param.f_width  = RegExp.$2;
+          param.f_height = RegExp.$3;
+        }
+
+        document.getElementById("f_url").value = param["f_url"];
+        document.getElementById("f_alt").value = param["f_alt"];
+        document.getElementById("f_title").value = param["f_title"];
+        document.getElementById("f_border").value = param["f_border"];
+        document.getElementById("f_width").value = param["f_width"];
+        document.getElementById("f_height").value = param["f_height"];
+        document.getElementById("f_margin").value = param["f_margin"];
+        document.getElementById("f_padding").value = param["f_padding"];
+        document.getElementById("f_borderColor").value = param["f_borderColor"];
+        document.getElementById("f_backgroundColor").value = param["f_backgroundColor"];
+
+        setAlign(param["f_align"]);
+
+        document.getElementById("f_url").focus();
+
+        document.getElementById("orginal_width").value = param["f_width"];
+        document.getElementById("orginal_height").value = param["f_height"];
+
+        // Locate to the correct directory
+        var dreg = new RegExp('^(.*/)([^/]+)$');
+        if (dreg.test(param['f_url']))
+        {
+          changeDir(RegExp.$1);
+          var dirPath = document.getElementById('dirPath');
+          for(var i = 0; i < dirPath.options.length; i++)
+          {
+            if(dirPath.options[i].value == encodeURIComponent(RegExp.$1))
+            {
+              dirPath.options[i].selected = true;
+              break;
+            }
+          }
+        }
+
+        document.getElementById('f_preview').src = _backend_url + '__function=thumbs&img=' + param.f_url;
+
+    }
+
+    else if(manager_mode=="link" && param)
+    {
+        var target_select = document.getElementById("f_target");
+        var use_target = true;
+
+        var absoluteURL = new RegExp('^https?://');
+
+        if (param.f_href.length > 0 && !absoluteURL.test(param.f_href) && typeof param.baseHref == "string") {
+            // URL is not absolute, prepend baseHref
+            param.f_href = param.baseHref + param.f_href;
+        }
+
+        // strip base_url from href
+        var href_regex = new RegExp( '(https?://[^/]*)?' + base_url.replace(/\/$/, '') );
+        param.f_href = param.f_href.replace( href_regex, "" );
+
+        // Locate to the correct directory
+        var dreg = new RegExp('^(.*/)([^/]+)$');
+        if (dreg.test(param['f_href']))
+        {
+          changeDir(RegExp.$1);
+          var dirPath = document.getElementById('dirPath');
+          for(var i = 0; i < dirPath.options.length; i++)
+          {
+            if(dirPath.options[i].value == encodeURIComponent(RegExp.$1))
+            {
+              dirPath.options[i].selected = true;
+              break;
+            }
+          }
+        }
+
+        if (param)
+        {
+            if ( typeof param["f_usetarget"] != "undefined" )
+            {
+                use_target = param["f_usetarget"];
+            }
+            if ( typeof param["f_href"] != "undefined" )
+            {
+                document.getElementById("f_href").value = param["f_href"];
+                document.getElementById("f_title").value = param["f_title"];
+                comboSelectValue(target_select, param["f_target"]);
+                if (target_select.value != param.f_target)
+                {
+                    var opt = document.createElement("option");
+                    opt.value = param.f_target;
+                    opt.innerHTML = opt.value;
+                    target_select.appendChild(opt);
+                    opt.selected = true;
+                }
+            }
+        }
+        if (! use_target)
+        {
+            document.getElementById("f_target_label").style.visibility = "hidden";
+            document.getElementById("f_target").style.visibility = "hidden";
+            document.getElementById("f_target_other").style.visibility = "hidden";
+        }
+
+        var opt = document.createElement("option");
+        opt.value = "_other";
+        opt.innerHTML = i18n("Other");
+        target_select.appendChild(opt);
+        target_select.onchange = onTargetChanged;
+        document.getElementById("f_href").focus();
+    }
+}
+
+function onCancel()
+{
+    __dlg_close(null);
+    return false;
+}
+
+function onOK()
+{
+    if(manager_mode=="image")
+    {
+        // pass data back to the calling window
+        var fields = ["f_url", "f_alt", "f_title", "f_align", "f_border", "f_margin", "f_padding", "f_height", "f_width", "f_borderColor", "f_backgroundColor"];
+        var param = new Object();
+        for (var i in fields)
+        {
+            var id = fields[i];
+            var el = document.getElementById(id);
+            if(id == "f_url" && el.value.indexOf('://') < 0 )
+                param[id] = makeURL(base_url,el.value);
+            else
+                param[id] = el.value;
+        }
+
+        // See if we need to resize the image
+        var origsize =
+        {
+          w:document.getElementById('orginal_width').value,
+          h:document.getElementById('orginal_height').value
+        }
+
+        if(  (origsize.w != param.f_width)
+          || (origsize.h != param.f_height) )
+        {
+          // Yup, need to resize
+          var resized = HTMLArea._geturlcontent(window.opener._editor_url + 'plugins/ExtendedFileManager/' + _backend_url + '&__function=resizer&img=' + encodeURIComponent(document.getElementById('f_url').value) + '&width=' + param.f_width + '&height=' + param.f_height);
+
+          // alert(resized);
+          resized = eval(resized);
+          if(resized)
+          {
+            param.f_url = makeURL(base_url, resized);
+          }
+        }
+
+        __dlg_close(param);
+        return false;
+    }
+    else if(manager_mode=="link")
+    {
+        var required = {
+            // f_href shouldn't be required or otherwise removing the link by entering an empty
+
+            // url isn't possible anymore.
+
+            // "f_href": i18n("You must enter the URL where this link points to")
+
+        };
+        for (var i in required) {
+        var el = document.getElementById(i);
+            if (!el.value) {
+              alert(required[i]);
+              el.focus();
+              return false;
+            }
+        }
+
+        // pass data back to the calling window
+        var fields = ["f_href", "f_title", "f_target" ];
+        var param = new Object();
+        for (var i in fields) {
+            var id = fields[i];
+            var el = document.getElementById(id);
+
+            if(id == "f_href" && el.value.indexOf('://') < 0 )
+                param[id] = makeURL(base_url,el.value);
+            else
+                param[id] = el.value;
+
+        }
+        if (param.f_target == "_other")
+            param.f_target = document.getElementById("f_other_target").value;
+
+//          alert(param.f_target);
+          __dlg_close(param);
+        return false;
+    }
+}
+
+//similar to the Files::makeFile() in Files.php
+function makeURL(pathA, pathB)
+{
+    if(pathA.substring(pathA.length-1) != '/')
+        pathA += '/';
+
+    if(pathB.charAt(0) == '/');
+        pathB = pathB.substring(1);
+
+    return pathA+pathB;
+}
+
+function updateDir(selection)
+{
+    var newDir = selection.options[selection.selectedIndex].value;
+    changeDir(newDir);
+}
+
+function goUpDir()
+{
+    var selection = document.getElementById('dirPath');
+    var currentDir = selection.options[selection.selectedIndex].text;
+    if(currentDir.length < 2)
+        return false;
+    var dirs = currentDir.split('/');
+
+    var search = '';
+
+    for(var i = 0; i < dirs.length - 2; i++)
+    {
+        search += dirs[i]+'/';
+    }
+
+    for(var i = 0; i < selection.length; i++)
+    {
+        var thisDir = selection.options[i].text;
+        if(thisDir == search)
+        {
+            selection.selectedIndex = i;
+            var newDir = selection.options[i].value;
+            changeDir(newDir);
+            break;
+        }
+    }
+}
+
+function changeDir(newDir)
+{
+    if(typeof imgManager != 'undefined')
+        imgManager.changeDir(newDir);
+}
+
+function updateView()
+{
+    refresh();
+}
+
+function toggleConstrains(constrains)
+{
+    var lockImage = document.getElementById('imgLock');
+    var constrains = document.getElementById('constrain_prop');
+
+    if(constrains.checked)
+    {
+        lockImage.src = "img/locked.gif";
+        checkConstrains('width')
+    }
+    else
+    {
+        lockImage.src = "img/unlocked.gif";
+    }
+}
+
+function checkConstrains(changed)
+{
+    //alert(document.form1.constrain_prop);
+    var constrains = document.getElementById('constrain_prop');
+
+    if(constrains.checked)
+    {
+        var obj = document.getElementById('orginal_width');
+        var orginal_width = parseInt(obj.value);
+        var obj = document.getElementById('orginal_height');
+        var orginal_height = parseInt(obj.value);
+
+        var widthObj = document.getElementById('f_width');
+        var heightObj = document.getElementById('f_height');
+
+        var width = parseInt(widthObj.value);
+        var height = parseInt(heightObj.value);
+
+        if(orginal_width > 0 && orginal_height > 0)
+        {
+            if(changed == 'width' && width > 0) {
+                heightObj.value = parseInt((width/orginal_width)*orginal_height);
+            }
+
+            if(changed == 'height' && height > 0) {
+                widthObj.value = parseInt((height/orginal_height)*orginal_width);
+            }
+        }
+    }
+}
+
+function showMessage(newMessage)
+{
+    var message = document.getElementById('message');
+    var messages = document.getElementById('messages');
+    if(message.firstChild)
+        message.removeChild(message.firstChild);
+
+    message.appendChild(document.createTextNode(i18n(newMessage)));
+
+    messages.style.display = "block";
+}
+
+function addEvent(obj, evType, fn)
+{
+    if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; }
+    else if (obj.attachEvent) {  var r = obj.attachEvent("on"+evType, fn);  return r;  }
+    else {  return false; }
+}
+
+function doUpload()
+{
+    var uploadForm = document.getElementById('uploadForm');
+    if(uploadForm)
+        showMessage('Uploading');
+}
+
+function refresh()
+{
+    var selection = document.getElementById('dirPath');
+    updateDir(selection);
+}
+
+function newFolder()
+{
+    var folder = prompt(i18n('Please enter name for new folder...'), i18n('Untitled'));
+    var selection = document.getElementById('dirPath');
+    var dir = selection.options[selection.selectedIndex].value;
+
+    if(folder == thumbdir)
+    {
+        alert(i18n('Invalid folder name, please choose another folder name.'));
+        return false;
+    }
+
+    if (folder && folder != '' && typeof imgManager != 'undefined')
+        imgManager.newFolder(dir, encodeURI(folder));
+}
+
+addEvent(window, 'load', init);
\ No newline at end of file

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/popup.js
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/popup.js?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/popup.js (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/popup.js Sun Oct  8 12:53:13 2006
@@ -0,0 +1,49 @@
+// htmlArea v3.0 - Copyright (c) 2002, 2003 interactivetools.com, inc.
+// This copyright notice MUST stay intact for use (see license.txt).
+//
+// Portions (c) dynarch.com, 2003
+//
+// A free WYSIWYG editor replacement for <textarea> fields.
+// For full source code and docs, visit http://www.interactivetools.com/
+//
+// Version 3.0 developed by Mihai Bazon.
+//   http://dynarch.com/mishoo
+//
+// $Id: popup.js 26 2004-03-31 02:35:21Z Wei Zhuo $
+
+function __dlg_onclose() {
+    if(opener.Dialog._return)
+        opener.Dialog._return(null);
+}
+
+function __dlg_translate(context) {
+    var types = ["span", "option", "td", "th", "button", "div", "label", "a","img", "legend"];
+    for (var type = 0; type < types.length; type++) {
+        var spans = document.getElementsByTagName(types[type]);
+        for (var i = spans.length; --i >= 0;) {
+            var span = spans[i];
+            if (span.firstChild && span.firstChild.data) {
+                var txt = HTMLArea._lc(span.firstChild.data, context);
+                if (txt)
+                    span.firstChild.data = txt;
+            }
+            if (span.title) {
+                var txt = HTMLArea._lc(span.title, context);
+                if (txt)
+                    span.title = txt;
+            }
+            if (span.alt) {
+                var txt = HTMLArea._lc(span.alt, context);
+                if (txt)
+                    span.alt = txt;
+            }
+        }
+    }
+    document.title = HTMLArea._lc(document.title, context);
+}
+
+// closes the dialog and passes the return info upper.
+function __dlg_close(val) {
+    opener.Dialog._return(val);
+    window.close();
+}
\ No newline at end of file

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/slider.js
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/slider.js?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/slider.js (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/slider.js Sun Oct  8 12:53:13 2006
@@ -0,0 +1,105 @@
+/**
+ * ImageEditor slider file.
+ * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz
+ * Version: Updated on 08-01-2005 by Afru
+ * Version: Updated on 20-06-2006 by Krzysztof Kotowicz
+ * Package: ExtendedFileManager (EFM 1.1.1)
+ * http://www.afrusoft.com/htmlarea
+ */
+
+var ie=document.all;
+var ns6=document.getElementById&&!document.all;
+
+document.onmouseup = captureStop;
+
+var currentSlider = null,sliderField = null;
+var rangeMin = null, rangeMax= null, sx = -1, sy = -1, initX=0;
+
+function getMouseXY(e) {
+
+    //alert('hello');
+    x = ns6? e.clientX: event.clientX
+    y = ns6? e.clientY: event.clientY
+
+    if (sx < 0) sx = x; if (sy < 0) sy = y;
+
+    var dx = initX +(x-sx);
+
+    if (dx <= rangeMin)
+        dx = rangeMin;
+    else if (dx >= rangeMax)
+        dx = rangeMax;
+
+    var range = (dx-rangeMin)/(rangeMax - rangeMin)*100;
+
+    if (currentSlider !=  null)
+        currentSlider.style.left = dx+"px";
+
+    if (sliderField != null)
+    {
+        sliderField.value = parseInt(range);
+    }
+    return false;
+
+}
+
+function initSlider()
+{
+    if (currentSlider == null)
+        currentSlider = document.getElementById('sliderbar');
+
+    if (sliderField == null)
+        sliderField = document.getElementById('quality');
+
+    if (rangeMin == null)
+        rangeMin = 3
+    if (rangeMax == null)
+    {
+        var track = document.getElementById('slidertrack');
+        rangeMax = parseInt(track.style.width);
+    }
+
+}
+
+function updateSlider(value)
+{
+    initSlider();
+
+    var newValue = parseInt(value)/100*(rangeMax-rangeMin);
+
+    if (newValue <= rangeMin)
+        newValue = rangeMin;
+    else if (newValue >= rangeMax)
+        newValue = rangeMax;
+
+    if (currentSlider !=  null)
+        currentSlider.style.left = newValue+"px";
+
+    var range = newValue/(rangeMax - rangeMin)*100;
+
+    if (sliderField != null)
+        sliderField.value = parseInt(range);
+}
+
+function captureStart()
+{
+
+    initSlider();
+
+    initX = parseInt(currentSlider.style.left);
+    if (initX > rangeMax)
+        initX = rangeMax;
+    else if (initX < rangeMin)
+        initX = rangeMin;
+
+    document.onmousemove = getMouseXY;
+
+    return false;
+}
+
+function captureStop()
+{
+    sx = -1; sy = -1;
+    document.onmousemove = null;
+    return false;
+}
\ No newline at end of file

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/wz_jsgraphics.js
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/wz_jsgraphics.js?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/wz_jsgraphics.js (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/assets/wz_jsgraphics.js Sun Oct  8 12:53:13 2006
@@ -0,0 +1,826 @@
+/***********************************************************************
+** Title.........:  Javascript Graphics
+** Version.......:  1.0
+** Author........:  Xiang Wei ZHUO <we...@zhuo.org>
+** Filename......:  wz_jsgraphics.js
+** Last changed..:  31 Aug 2003  
+** Notes.........:  Modified for Image Editor, added extra commands
+**/ 
+
+/* This notice must be untouched at all times.
+
+wz_jsgraphics.js    v. 2.03
+The latest version is available at
+http://www.walterzorn.com
+or http://www.devira.com
+or http://www.walterzorn.de
+
+Copyright (c) 2002-2003 Walter Zorn. All rights reserved.
+Created 3. 11. 2002 by Walter Zorn <wa...@kreuzotter.de>
+Last modified: 11. 6. 2003
+
+High Performance JavaScript Graphics Library.
+Provides methods
+- to draw lines, rectangles, ellipses, polygons
+  with specifiable line thickness,
+- to fill rectangles and ellipses
+- to draw text.
+NOTE: Operations, functions and branching have rather been optimized
+to efficiency and speed than to shortness of source code.
+
+This program is free software;
+you can redistribute it and/or modify it under the terms of the
+GNU General Public License as published by the Free Software Foundation;
+either version 2 of the License, or (at your option) any later version.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY;
+without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU General Public License
+at http://www.gnu.org/copyleft/gpl.html for more details.
+*/
+
+var jg_ihtm, jg_ie, jg_dom, jg_n4 = (document.layers && typeof document.classes != "undefined");
+
+function chkDHTM(x, i)
+{
+    x = document.body || null;
+    jg_ie = (x && typeof x.insertAdjacentHTML != "undefined");
+    jg_dom = (x && !jg_ie &&
+        typeof x.appendChild != "undefined" &&
+        typeof document.createRange != "undefined" &&
+        typeof (i = document.createRange()).setStartBefore != "undefined" &&
+        typeof i.createContextualFragment != "undefined");
+    jg_ihtm = (!jg_ie && !jg_dom && x && typeof x.innerHTML != "undefined");
+}
+
+function pntDoc()
+{
+    this.wnd.document.write(this.htm);
+    this.htm = '';
+}
+
+function pntCnvDom()
+{
+    var x = document.createRange();
+    x.setStartBefore(this.cnv);
+    x = x.createContextualFragment(this.htm);
+    this.cnv.appendChild(x);
+    this.htm = '';
+}
+
+function pntCnvIe()
+{
+    this.cnv.insertAdjacentHTML("BeforeEnd", this.htm);
+    this.htm = '';
+}
+
+function pntCnvIhtm()
+{
+    this.cnv.innerHTML += this.htm;
+    this.htm = '';
+}
+
+function pntCnv()
+{
+    this.htm = '';
+}
+
+function mkDiv(x, y, w, h)
+{
+    this.htm += '<div style="position:absolute;'+
+        'left:' + x + 'px;'+
+        'top:' + y + 'px;'+
+        'width:' + w + 'px;'+
+        'height:' + h + 'px;'+
+        'clip:rect(0,'+w+'px,'+h+'px,0);'+
+        'overflow:hidden;background-color:' + this.color + ';'+
+        '"><\/div>';
+
+    //alert(this.htm);
+}
+
+function mkDivPrint(x, y, w, h)
+{
+    this.htm += '<div style="position:absolute;'+
+        'border-left:' + w + 'px solid ' + this.color + ';'+
+        'left:' + x + 'px;'+
+        'top:' + y + 'px;'+
+        'width:' + w + 'px;'+
+        'height:' + h + 'px;'+
+        'clip:rect(0,'+w+'px,'+h+'px,0);'+
+        'overflow:hidden;background-color:' + this.color + ';'+
+        '"><\/div>';
+}
+
+function mkLyr(x, y, w, h)
+{
+    this.htm += '<layer '+
+        'left="' + x + '" '+
+        'top="' + y + '" '+
+        'width="' + w + '" '+
+        'height="' + h + '" '+
+        'bgcolor="' + this.color + '"><\/layer>\n';
+}
+
+function mkLbl(txt, x, y)
+{
+    this.htm += '<div style="position:absolute;white-space:nowrap;'+
+        'left:' + x + 'px;'+
+        'top:' + y + 'px;'+
+        'font-family:' +  this.ftFam + ';'+
+        'font-size:' + this.ftSz + ';'+
+        'color:' + this.color + ';' + this.ftSty + '">'+
+        txt +
+        '<\/div>';
+}
+
+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)
+        {
+            ++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)
+            {
+                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)
+            {
+                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 (s-0x3 > 0)
+        {
+            var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx;
+            _s = (!(s-0x4)? 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)
+        {
+            ++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-0x3 > 0)
+        {
+            var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy;
+            _s = (!(s-0x4)? 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)
+            {
+                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)
+            {
+                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)
+        {
+            if (drw) this.mkDiv(x, y, 1, 1);
+            drw = !drw;
+            if (p > 0)
+            {
+                y += yIncr;
+                p += pru;
+            }
+            else p += pr;
+            ++x;
+        }
+        if (drw) this.mkDiv(x, y, 1, 1);
+    }
+
+    else
+    {
+        var pr = dx<<1,
+        pru = pr - (dy<<1),
+        p = pr-dy;
+        while ((dy--) > 0)
+        {
+            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)+1,
+    cx = left+a, cy = top+b,
+    x = 0, y = b,
+    ox = 0, oy = b,
+    aa = (a*a)<<1, bb = (b*b)<<1,
+    st = (aa>>1)*(1-(b<<1)) + bb,
+    tt = (bb>>1) - aa*((b<<1)-1),
+    w, h;
+    while (y > 0)
+    {
+        if (st < 0)
+        {
+            st += bb*((x<<1)+0x3);
+            tt += (bb<<1)*(++x);
+        }
+        else if (tt < 0)
+        {
+            st += bb*((x<<1)+0x3) - (aa<<1)*(y-1);
+            tt += (bb<<1)*(++x) - aa*(((y--)<<1)-0x3);
+            w = x-ox;
+            h = oy-y;
+            if (w&0x2 && h&0x2)
+            {
+                this.mkOvQds(cx, cy, -x+0x2, ox+wod, -oy, oy-1+hod, 1, 1);
+                this.mkOvQds(cx, cy, -x+1, x-1+wod, -y-1, y+hod, 1, 1);
+            }
+            else this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, oy-h+hod, w, h);
+            ox = x;
+            oy = y;
+        }
+        else
+        {
+            tt -= aa*((y<<1)-0x3);
+            st -= (aa<<1)*(--y);
+        }
+    }
+    this.mkDiv(cx-a, cy-oy, a-ox+1, (oy<<1)+hod);
+    this.mkDiv(cx+ox+wod, cy-oy, a-ox+1, (oy<<1)+hod);
+}
+
+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)+1,
+    cx = left+a, cy = top+b,
+    x = 0, y = b,
+    aa = (a*a)<<1, bb = (b*b)<<1,
+    st = (aa>>1)*(1-(b<<1)) + bb,
+    tt = (bb>>1) - aa*((b<<1)-1);
+
+
+    if (s-0x4 < 0 && (!(s-0x2) || width-0x33 > 0 && height-0x33 > 0))
+    {
+        var ox = 0, oy = b,
+        w, h,
+        pxl, pxr, pxt, pxb, pxw;
+        while (y > 0)
+        {
+            if (st < 0)
+            {
+                st += bb*((x<<1)+0x3);
+                tt += (bb<<1)*(++x);
+            }
+            else if (tt < 0)
+            {
+                st += bb*((x<<1)+0x3) - (aa<<1)*(y-1);
+                tt += (bb<<1)*(++x) - aa*(((y--)<<1)-0x3);
+                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, ox-pxw+w+wod, -oy, -h+oy+hod, pxw, h);
+                ox = x;
+                oy = y;
+            }
+            else
+            {
+                tt -= aa*((y<<1)-0x3);
+                st -= (aa<<1)*(--y);
+            }
+        }
+        this.mkDiv(cx-a, cy-oy, s, (oy<<1)+hod);
+        this.mkDiv(cx+a+wod-s+1, cy-oy, s, (oy<<1)+hod);
+    }
+
+
+    else
+    {
+        var _a = (width-((s-1)<<1))>>1,
+        _b = (height-((s-1)<<1))>>1,
+        _x = 0, _y = _b,
+        _aa = (_a*_a)<<1, _bb = (_b*_b)<<1,
+        _st = (_aa>>1)*(1-(_b<<1)) + _bb,
+        _tt = (_bb>>1) - _aa*((_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)
+            {
+                st += bb*((x<<1)+0x3);
+                tt += (bb<<1)*(++x);
+                pxl[pxl.length] = x;
+                pxt[pxt.length] = y;
+            }
+            else if (tt < 0)
+            {
+                st += bb*((x<<1)+0x3) - (aa<<1)*(y-1);
+                tt += (bb<<1)*(++x) - aa*(((y--)<<1)-0x3);
+                pxl[pxl.length] = x;
+                pxt[pxt.length] = y;
+            }
+            else
+            {
+                tt -= aa*((y<<1)-0x3);
+                st -= (aa<<1)*(--y);
+            }
+
+            if (_y > 0)
+            {
+                if (_st < 0)
+                {
+                    _st += _bb*((_x<<1)+0x3);
+                    _tt += (_bb<<1)*(++_x);
+                    _pxb[_pxb.length] = _y-1;
+                }
+                else if (_tt < 0)
+                {
+                    _st += _bb*((_x<<1)+0x3) - (_aa<<1)*(_y-1);
+                    _tt += (_bb<<1)*(++_x) - _aa*(((_y--)<<1)-0x3);
+                    _pxb[_pxb.length] = _y-1;
+                }
+                else
+                {
+                    _tt -= _aa*((_y<<1)-0x3);
+                    _st -= (_aa<<1)*(--_y);
+                    _pxb[_pxb.length-1]--;
+                }
+            }
+        }
+
+        var ox = 0, 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+1, ox+wod, -oy, _oy+hod, x-ox, oy-_oy);
+                    ox = x;
+                    oy = pxt[i];
+                    _oy = _pxb[i];
+                }
+            }
+            else
+            {
+                x = pxl[i];
+                this.mkDiv(cx-x+1, 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,
+    cx = left+a, cy = top+b,
+    x = 0, y = b,
+    aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1,
+    st = (aa2>>1)*(1-(b<<1)) + bb,
+    tt = (bb>>1) - aa2*((b<<1)-1),
+    drw = true;
+    while (y > 0)
+    {
+        if (st < 0)
+        {
+            st += bb*((x<<1)+0x3);
+            tt += (bb<<1)*(++x);
+        }
+        else if (tt < 0)
+        {
+            st += bb*((x<<1)+0x3) - aa4*(y-1);
+            tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-0x3);
+        }
+        else
+        {
+            tt -= aa2*((y<<1)-0x3);
+            st -= aa4*(--y);
+        }
+        if (drw) this.mkOvQds(cx, cy, -x, x+wod, -y, y+hod, 1, 1);
+        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(id, wnd)
+{
+    this.setColor = new Function('arg', 'this.color = arg;');
+
+
+    this.getColor = new Function('return this.color');
+
+    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;
+        this.mkDiv = jg_n4? mkLyr : arg? mkDivPrint : 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, s)
+    {
+        var i = x.length-1; while (i >= 0)
+            this.drawLine(x[i], y[i], x[--i], y[i]);
+    };
+
+
+
+    this.fillRect = function(x, y, w, h)
+    {
+        this.mkDiv(x, y, w, h);
+    };
+
+
+    this.fillRectPattern = function(x, y, w, h, url)
+    {
+        this.htm += '<div style="position:absolute;'+
+            'left:' + x + 'px;'+
+            'top:' + y + 'px;'+
+            'width:' + w + 'px;'+
+            'height:' + h + 'px;'+
+            'clip:rect(0,'+w+'px,'+h+'px,0);'+
+            'overflow:hidden;'+
+            //'background-color:' + this.color + ';'+
+            "background-image: url('" + url + "');"+
+            "layer-background-image: url('" + url + "');"+
+            'z-index:100;"><\/div>';
+        //alert(this.htm);
+    }
+
+    this.drawHandle = function(x, y, w, h, cursor)
+    {
+        
+        this.htm += '<div style="position:absolute;'+
+        'left:' + x + 'px;'+
+        'top:' + y + 'px;'+
+        'width:' + w + 'px;'+
+        'height:' + h + 'px;'+
+        'clip:rect(0,'+w+'px,'+h+'px,0);'+
+        'padding: 2px;overflow:hidden;'+
+        "cursor: '" + cursor + "';"+
+        '" class="handleBox" id="' + cursor + '" ><\/div>';
+    }
+
+    this.drawHandleBox = function(x, y, w, h, cursor)
+    {
+        
+        this.htm += '<div style="position:absolute;'+
+        'left:' + x + 'px;'+
+        'top:' + y + 'px;'+
+        'width:' + w + 'px;'+
+        'height:' + h + 'px;'+
+        'clip:rect(0,'+(w+2)+'px,'+(h+2)+'px,0);'+
+        'overflow:hidden; border: solid 1px '+ this.color+';'+
+        "cursor: '" + cursor + "';"+
+        '" class="handleBox" id="' + cursor + '" ><\/div>';
+
+        
+    }
+
+    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)>>1, b = (h -= 1)>>1,
+        wod = (w&1)+1, hod = (h&1)+1,
+        cx = left+a, cy = top+b,
+        x = 0, y = b,
+        ox = 0, oy = b,
+        aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1,
+        st = (aa2>>1)*(1-(b<<1)) + bb,
+        tt = (bb>>1) - aa2*((b<<1)-1),
+        pxl, dw, dh;
+        if (w+1) while (y > 0)
+        {
+            if (st < 0)
+            {
+                st += bb*((x<<1)+0x3);
+                tt += (bb<<1)*(++x);
+            }
+            else if (tt < 0)
+            {
+                st += bb*((x<<1)+0x3) - aa4*(y-1);
+                pxl = cx-x;
+                dw = (x<<1)+wod;
+                tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-0x3);
+                dh = oy-y;
+                this.mkDiv(pxl, cy-oy, dw, dh);
+                this.mkDiv(pxl, cy+oy-dh+hod, dw, dh);
+                ox = x;
+                oy = y;
+            }
+            else
+            {
+                tt -= aa2*((y<<1)-0x3);
+                st -= aa4*(--y);
+            }
+        }
+        this.mkDiv(cx-a, cy-oy, w+1, (oy<<1)+hod);
+    };
+
+    this.drawString = mkLbl;
+
+    this.clear = function()
+    {
+        this.htm = "";
+        if (this.cnv) this.cnv.innerHTML = this.defhtm;
+        
+    };
+
+    this.mkOvQds = function(cx, cy, xl, xr, yt, yb, w, h)
+    {
+        this.mkDiv(xr+cx, yt+cy, w, h);
+        this.mkDiv(xr+cx, yb+cy, w, h);
+        this.mkDiv(xl+cx, yb+cy, w, h);
+        this.mkDiv(xl+cx, yt+cy, w, h);
+    };
+
+    this.setStroke(1);
+    this.setPrintable(false);
+    this.setFont('verdana,geneva,helvetica,sans-serif', String.fromCharCode(0x31, 0x32, 0x70, 0x78), Font.PLAIN);
+    this.color = '#000000';
+    this.htm = '';
+    this.wnd = wnd || window;
+
+    if (!(jg_ie || jg_dom || jg_ihtm)) chkDHTM();
+    if (typeof id != 'string' || !id) this.paint = pntDoc;
+    else
+    {
+        this.cnv = document.all? (this.wnd.document.all[id] || null)
+            : document.getElementById? (this.wnd.document.getElementById(id) || null)
+            : null;
+        this.defhtm = (this.cnv && this.cnv.innerHTML)? this.cnv.innerHTML : '';
+        this.paint = jg_dom? pntCnvDom : jg_ie? pntCnvIe : jg_ihtm? pntCnvIhtm : pntCnv;
+    }
+}
\ No newline at end of file

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/backend.php
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/backend.php?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/backend.php (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/backend.php Sun Oct  8 12:53:13 2006
@@ -0,0 +1,110 @@
+<?php 
+/**
+* Unified backend for ExtendedFileManager - copied from ImageManager
+*
+* Image Manager was originally developed by:
+*   Xiang Wei Zhuo, email: xiangweizhuo(at)hotmail.com Wei Shou.
+*
+* Unified backend sponsored by DTLink Software, http://www.dtlink.com
+* Implementation by Yermo Lamers, http://www.formvista.com
+*
+* (c) DTLink, LLC 2005.
+* Distributed under the same terms as HTMLArea itself.
+* This notice MUST stay intact for use (see license.txt).
+*
+* DESCRIPTION:
+*
+* Instead of using separate URL's for each function, ImageManager now
+* routes all requests to the server through this single, replaceable,
+* entry point. backend.php expects at least two URL variable parameters: 
+*
+* __plugin=ImageManager   for future expansion; identify the plugin being requested.
+* __function=thumbs|images|editorFrame|editor|manager  function being called.
+*
+* Having a single entry point that strictly adheres to a defined interface will 
+* make the backend code much easier to maintain and expand. It will make it easier
+* on integrators, not to mention it'll make it easier to have separate 
+* implementations of the backend in different languages (Perl, Python, ASP, etc.) 
+*
+* @see config.inc.php
+*/
+
+/**
+* ImageManager configuration
+*/
+
+require_once('config.inc.php');
+
+
+// Strip slashes if MQGPC is on
+set_magic_quotes_runtime(0);
+if(get_magic_quotes_gpc())
+{
+  $to_clean = array(&$_GET, &$_POST, &$_REQUEST, &$_COOKIE);
+  while(count($to_clean))
+  {
+    $cleaning =& $to_clean[array_pop($junk = array_keys($to_clean))];
+    unset($to_clean[array_pop($junk = array_keys($to_clean))]);
+    foreach(array_keys($cleaning) as $k)
+    {
+      if(is_array($cleaning[$k]))
+      {
+        $to_clean[] =& $cleaning[$k];
+      }
+      else
+      {
+        $cleaning[$k] = stripslashes($cleaning[$k]);
+      }
+    }
+  }
+}
+
+/**
+* ImageManager configuration
+*/
+
+$formVars = empty($_POST) ? $_GET : $_POST;
+
+// make sure the request is for us (this gives us the ability to eventually organize
+// a backend event handler system) For an include file the return doesn't make alot of
+// sense but eventually we'll want to turn all of this into at least functions 
+// separating out all the presentation HTML from the logic. (Right now all the HTML
+// used by ImageManager is in the same files as the PHP code ...)
+
+if ( @$formVars[ "__plugin" ] != "ExtendedFileManager" )
+	{
+	// not for us.
+
+	return true;
+	}
+
+// so we don't have to re-engineer the entire thing right now, since it's probably
+// going to get rewritten anyway, we just include the correct file based on the 
+// function request.
+
+switch ( @$formVars[ "__function" ] )
+	{
+
+	case "editor": 
+	case "editorFrame":
+	case "manager":
+	case "images":
+	case "thumbs":
+	case "resizer":
+
+		include_once $IMConfig['base_dir'] . '/' . $formVars['__function'] . '.php' ;
+		exit();
+		
+		break;
+
+	default:
+
+		break;
+
+	}	// end of switch.
+
+return false ;
+
+// END
+
+?>
\ No newline at end of file

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/config.inc.php
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/config.inc.php?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/config.inc.php (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/config.inc.php Sun Oct  8 12:53:13 2006
@@ -0,0 +1,375 @@
+<?php
+/**
+ * ExtendedFileManager configuration file.
+ * Authors: Wei Zhuo, Afru
+ * Version: Updated on 08-01-2005 by Afru
+ * Version 1.1.2: Updated on 04-07-2006 by Krzysztof Kotowicz <ko...@webworkers.pl>
+ * Package: ExtendedFileManager
+ * http://www.afrusoft.com/htmlarea
+ */
+
+/*  Configuration file usage:
+ *	There are two insertModes for this filemanager.
+ *	One is "image" and another is "link".
+ *	So you can assign config values as below
+ *
+ *	if($insertMode=="image") $IMConfig['property']=somevalueforimagemode;
+ *	else if($insertMode=="link") $IMConfig['property']=somevalueforlinkmode;
+ *
+ *	(or) you can directly as $IMConfig['property']=somevalueforbothmodes;
+ *
+ *	Best of Luck :) Afru.
+ */
+ 
+/*
+ *	Getting the mode for further differentiation
+ */
+
+if(empty($insertMode))
+    $insertMode="image";
+
+/**
+* Default backend URL
+*
+* URL to use for unified backend.
+*
+* The ?__plugin=ExtendedFileManager& is required.
+*/
+
+$IMConfig['backend_url'] = "backend.php?__plugin=ExtendedFileManager&";
+
+/**
+* Backend Installation Directory
+*
+* location of backend install; these are used to link to css and js
+* assets because we may have the front end installed in a different
+* directory than the backend. (i.e. nothing assumes that the frontend
+* and the backend are in the same directory)
+*/
+$IMConfig['base_dir'] = getcwd();
+$IMConfig['base_url'] = '';
+
+
+/*
+	 File system path to the directory you want to manage the images
+	 for multiple user systems, set it dynamically.
+
+	 NOTE: This directory requires write access by PHP. That is,
+		   PHP must be able to create files in this directory.
+		   Able to create directories is nice, but not necessary.
+*/
+$IMConfig['images_dir'] = 'demo_images';
+//You may set a different directory for the link mode; if you don't, the above setting will be used for both modes
+//$IMConfig['files_dir'] = 'demo_files';
+
+/*
+ The URL to the above path, the web browser needs to be able to see it.
+ It can be protected via .htaccess on apache or directory permissions on IIS,
+ check you web server documentation for futher information on directory protection
+ If this directory needs to be publicly accessiable, remove scripting capabilities
+ for this directory (i.e. disable PHP, Perl, CGI). We only want to store assets
+ in this directory and its subdirectories.
+*/
+$IMConfig['images_url'] = str_replace( "backend.php", "", $_SERVER["PHP_SELF"] ) . "demo_images";
+//$IMConfig['files_url'] = 'url/to/files_dir';
+
+/*
+  Possible values: true, false
+
+  TRUE - If PHP on the web server is in safe mode, set this to true.
+         SAFE MODE restrictions: directory creation will not be possible,
+		 only the GD library can be used, other libraries require
+		 Safe Mode to be off.
+
+  FALSE - Set to false if PHP on the web server is not in safe mode.
+*/
+$IMConfig['safe_mode'] = false;
+
+/*
+This specifies whether any image library is available to resize and edit images.TRUE - Thumbnails will be resized by image libraries and if there is no library, default thumbnail will be shown.
+FALSE - Thumbnails will be resized by browser ignoring image libraries.
+*/
+$IMConfig['img_library'] = true;
+
+
+/*
+View type when the File manager is in insert image mode.
+Valid values are "thumbview" and "listview".
+*/
+
+    
+if ($insertMode == 'image')
+	$IMConfig['view_type'] = "thumbview";
+	
+else if($insertMode == "link")
+	$IMConfig['view_type'] = "listview";
+
+$IMConfig['insert_mode'] = $insertMode;
+
+/* 
+ Possible values: 'GD', 'IM', or 'NetPBM'
+
+ The image manipulation library to use, either GD or ImageMagick or NetPBM.
+ If you have safe mode ON, or don't have the binaries to other packages, 
+ your choice is 'GD' only. Other packages require Safe Mode to be off.
+*/
+define('IMAGE_CLASS', 'GD');
+
+
+/*
+ After defining which library to use, if it is NetPBM or IM, you need to
+ specify where the binary for the selected library are. And of course
+ your server and PHP must be able to execute them (i.e. safe mode is OFF).
+ GD does not require the following definition.
+*/
+define('IMAGE_TRANSFORM_LIB_PATH', 'C:/"Program Files"/ImageMagick-5.5.7-Q16/');
+
+
+/*
+  The prefix for thumbnail files, something like .thumb will do. The
+  thumbnails files will be named as "prefix_imagefile.ext", that is,
+  prefix + orginal filename.
+*/
+$IMConfig['thumbnail_prefix'] = 't_';
+
+
+/*
+  Thumbnail can also be stored in a directory, this directory
+  will be created by PHP. If PHP is in safe mode, this parameter
+  is ignored, you can not create directories.
+
+  If you do not want to store thumbnails in a directory, set this
+  to false or empty string '';
+*/
+$IMConfig['thumbnail_dir'] = 't';
+
+/**
+* Resized prefix
+*
+* The prefix for resized files, something like .resized will do.  The
+* resized files will be named <prefix>_<width>x<height>_<original>
+* resized files are created when one changes the dimensions of an image
+* in the image manager selection dialog - the image is scaled when the
+* user clicks the ok button.
+*/
+
+$IMConfig['resized_prefix'] = '.resized';
+
+// -------------------------------------------------------------------------
+
+/**
+* Resized Directory
+*
+* Resized images may also be stored in a directory, except in safe mode.
+*/
+
+$IMConfig['resized_dir'] = '';
+
+/*
+  Possible values: true, false
+
+ TRUE -  Allow the user to create new sub-directories in the
+         $IMConfig['base_dir'].
+
+ FALSE - No directory creation.
+
+ NOTE: If $IMConfig['safe_mode'] = true, this parameter
+       is ignored, you can not create directories
+*/
+$IMConfig['allow_new_dir'] = true;
+
+
+/*
+  Possible values: true, false
+
+ TRUE -  Allow the user to edit image by image editor.
+
+ FALSE - No edit icon will be displayed.
+
+ NOTE: If $IMConfig['img_library'] = false, this parameter
+       is ignored, you can not edit images.
+*/
+$IMConfig['allow_edit_image'] = true;
+
+/*
+  Possible values: true, false
+
+ TRUE -  Allow the user to rename files.
+
+ FALSE - No rename icon will be displayed.
+
+*/
+$IMConfig['allow_rename'] = true;
+
+/*
+  Possible values: true, false
+
+  TRUE - Display color pickers for image background / border colors
+
+  FALSE - Don't display color pickers
+*/
+$IMConfig['use_color_pickers'] = true;
+
+/*
+  Possible values: true, false
+
+ TRUE -  Allow the user to set alt (alternative text) attribute.
+
+ FALSE - No input field for alt attribute will be displayed.
+
+ NOTE: The alt attribute is _obligatory_ for images, so <img alt="" /> will be inserted
+      if 'images_enable_alt' is set to false
+*/
+$IMConfig['images_enable_alt'] = true;
+
+/*
+  Possible values: true, false
+
+ TRUE -  Allow the user to set title attribute (usually displayed when mouse is over element).
+
+ FALSE - No input field for title attribute will be displayed.
+
+*/
+$IMConfig['images_enable_title'] = false;
+
+/*
+  Possible values: true, false
+
+ TRUE -  Allow the user to set align attribute.
+
+ FALSE - No selection box for align attribute will be displayed.
+
+*/
+$IMConfig['images_enable_align'] = true;
+
+/*
+  Possible values: true, false
+
+ TRUE -  Allow the user to set margin, padding, and border styles for the image
+
+ FALSE - No styling input fields will be displayed.
+
+*/
+$IMConfig['images_enable_styling'] = true;
+
+/*
+  Possible values: true, false
+
+ TRUE -   Allow the user to set target attribute for link (the window in which the link will be opened).
+
+ FALSE - No selection box for target attribute will be displayed.
+
+*/
+$IMConfig['link_enable_target'] = true;
+/*
+  Possible values: true, false
+
+  TRUE - Allow the user to upload files.
+
+  FALSE - No uploading allowed.
+*/
+$IMConfig['allow_upload'] = true;
+
+/* Maximum upload file size
+
+  Possible values: number, "max"
+
+  number - maximum size in Kilobytes.
+
+  "max"  - the maximum allowed by the server (the value is retrieved from the server configuration).
+*/
+$IMConfig['max_filesize_kb_image'] = 2000;
+
+$IMConfig['max_filesize_kb_link'] = 5000;
+
+/* Maximum upload folder size in Megabytes. Use 0 to disable limit */
+$IMConfig['max_foldersize_mb'] = 0;
+
+/*
+Allowed extensions that can be shown and allowed to upload.
+Available icons are for "doc,fla,gif,gz,html,jpg,js,mov,pdf,php,png,ppt,rar,txt,xls,zip"
+-Changed by AFRU.
+*/
+
+$IMConfig['allowed_image_extensions'] = array("jpg","gif","png","bmp");
+$IMConfig['allowed_link_extensions'] = array("jpg","gif","js","php","pdf","zip","txt","psd","png","html","swf","xml","xls");
+
+
+/*
+ The default thumbnail and list view icon in case thumbnails are not created and the files are of unknown.
+*/
+$IMConfig['default_thumbnail'] = 'icons/def.gif';
+$IMConfig['default_listicon'] = 'icons/def_small.gif';
+
+
+/*
+Only files with these extensions will be shown as thumbnails. All other files will be shown as icons.
+*/
+$IMConfig['thumbnail_extensions'] = array("jpg", "gif", "png", "bmp");
+
+/*
+  Thumbnail dimensions.
+*/
+$IMConfig['thumbnail_width'] = 84;
+$IMConfig['thumbnail_height'] = 84;
+
+/*
+  Image Editor temporary filename prefix.
+*/
+$IMConfig['tmp_prefix'] = '.editor_';
+
+
+// Standard PHP Backend Data Passing
+//  if data was passed using xinha_pass_to_php_backend() we merge the items
+//  provided into the Config
+require_once(realpath(dirname(__FILE__) . '/../../contrib/php-xinha.php'));
+if($passed_data = xinha_read_passed_data())
+{
+  $IMConfig = array_merge($IMConfig, $passed_data);
+  $IMConfig['backend_url'] .= xinha_passed_data_querystring() . '&';
+}
+// Deprecated config passing, don't use this way any more!
+elseif(isset($_REQUEST['backend_config']))
+{
+  if(get_magic_quotes_gpc()) {
+    $_REQUEST['backend_config'] = stripslashes($_REQUEST['backend_config']);
+  }
+
+  // Config specified from front end, check that it's valid
+  session_start();
+  if (!array_key_exists($_REQUEST['backend_config_secret_key_location'], $_SESSION))
+    die("Backend security error.");
+
+  $secret = $_SESSION[$_REQUEST['backend_config_secret_key_location']];
+
+  if($_REQUEST['backend_config_hash'] !== sha1($_REQUEST['backend_config'] . $secret))
+  {
+    die("Backend security error.");
+  }
+
+  $to_merge = unserialize($_REQUEST['backend_config']);
+  if(!is_array($to_merge))
+  {
+    die("Backend config syntax error.");
+  }
+
+  $IMConfig = array_merge($IMConfig, $to_merge);
+
+   // changed config settings keys in relation to ImageManager
+  $IMConfig['backend_url'] .= "backend_config=" . rawurlencode($_REQUEST['backend_config']) . '&';
+  $IMConfig['backend_url'] .= "backend_config_hash=" . rawurlencode($_REQUEST['backend_config_hash']) . '&';
+  $IMConfig['backend_url'] .= "backend_config_secret_key_location=" . rawurlencode($_REQUEST['backend_config_secret_key_location']) . '&';
+
+}
+if ($IMConfig['max_filesize_kb_link'] == "max")
+{
+  $IMConfig['max_filesize_kb_link'] = upload_max_filesize_kb();
+}
+
+if ($IMConfig['max_filesize_kb_image'] == "max")
+{
+  $IMConfig['max_filesize_kb_image'] = upload_max_filesize_kb();
+}
+// END
+
+?>

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/demo_images/bikerpeep.jpg
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/demo_images/bikerpeep.jpg?view=auto&rev=454197
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/demo_images/bikerpeep.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/demo_images/linux/linux.gif
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/demo_images/linux/linux.gif?view=auto&rev=454197
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/demo_images/linux/linux.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/demo_images/wesnoth078.jpg
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/demo_images/wesnoth078.jpg?view=auto&rev=454197
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/demo_images/wesnoth078.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/editor.php
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/editor.php?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/editor.php (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/editor.php Sun Oct  8 12:53:13 2006
@@ -0,0 +1,150 @@
+<?php
+/**
+ * ExtendedFileManager editor.php file.
+ * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz
+ * Version: Updated on 08-01-2005 by Afru
+ * Version: Updated on 21-06-2006 by Krzysztof Kotowicz
+ * Package: ExtendedFileManager (EFM 1.1.1)
+ * http://www.afrusoft.com/htmlarea
+ */
+if(isset($_REQUEST['mode'])) $insertMode=$_REQUEST['mode'];
+	if(!isset($insertMode)) $insertMode="image";
+
+require_once('config.inc.php');
+require_once('Classes/ExtendedFileManager.php');
+require_once('../ImageManager/Classes/ImageEditor.php');
+
+$manager = new ExtendedFileManager($IMConfig,$insertMode);
+$editor = new ImageEditor($manager);
+
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+	<title></title>
+	<link href="<?php print $IMConfig['base_url'];?>assets/editor.css" rel="stylesheet" type="text/css" />
+<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/slider.js"></script>
+<script type="text/javascript" src="../../popups/popup.js"></script>
+<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/popup.js"></script>
+<script type="text/javascript">
+/*<![CDATA[*/
+
+    var _backend_url = "<?php print $IMConfig['backend_url']."&mode=$insertMode"; ?>&";
+
+	if(window.opener)
+		HTMLArea = window.opener.HTMLArea;
+/*]]>*/
+</script>
+<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/editor.js"></script>
+</head>
+
+<body>
+<div id="indicator">
+<img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" id="indicator_image" height="20" width="20" alt="" />
+</div>
+<div id="tools">
+	<div id="tools_crop" style="display:none;">
+		<div id="tool_inputs">
+			<label for="cx">Start X:</label><input type="text" id="cx"  class="textInput" onchange="updateMarker('crop')"/>
+			<label for="cy">Start Y:</label><input type="text" id="cy" class="textInput" onchange="updateMarker('crop')"/>
+			<label for="cw">Width:</label><input type="text" id="cw" class="textInput" onchange="updateMarker('crop')"/>
+			<label for="ch">Height:</label><input type="text" id="ch" class="textInput" onchange="updateMarker('crop')"/>			<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
+		</div>	
+		<a href="javascript: editor.doSubmit('crop');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>
+		<a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>
+	</div>	
+	<div id="tools_scale" style="display:none;">
+		<div id="tool_inputs">
+			<label for="sw">Width:</label><input type="text" id="sw" class="textInput" onchange="checkConstrains('width')"/>
+			<a href="javascript:toggleConstraints();" title="Lock"><img src="<?php print $IMConfig['base_url'];?>img/islocked2.gif" id="scaleConstImg" height="14" width="8" alt="Lock" class="div" /></a><label for="sh">Height:</label>
+			<input type="text" id="sh" class="textInput" onchange="checkConstrains('height')"/>
+			<input type="checkbox" id="constProp" value="1" checked="checked" onclick="toggleConstraints()"/>
+			<label for="constProp">Constrain Proportions</label>
+			<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
+		</div>	
+		<a href="javascript: editor.doSubmit('scale');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>
+		<a href="javascript: editor.reset();" class="buttons" title="Cancle"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>
+	</div>	
+	<div id="tools_rotate" style="display:none;">
+		<div id="tool_inputs">
+			<select id="flip" name="flip" style="margin-left: 10px; vertical-align: middle;">
+              <option selected>Flip Image</option>
+              <option>-----------------</option>
+              <option value="hoz">Flip Horizontal</option>
+              <option value="ver">Flip Virtical</option>
+         </select>
+			<select name="rotate" onchange="rotatePreset(this)" style="margin-left: 20px; vertical-align: middle;">
+              <option selected>Rotate Image</option>
+              <option>-----------------</option>
+
+              <option value="180">Rotate 180 &deg;</option>
+              <option value="90">Rotate 90 &deg; CW</option>
+              <option value="-90">Rotate 90 &deg; CCW</option>
+         </select>
+			<label for="ra">Angle:</label><input type="text" id="ra" class="textInput" />
+			<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
+		</div>	
+		<a href="javascript: editor.doSubmit('rotate');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>
+		<a href="javascript: editor.reset();" class="buttons" title="Cancle"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>
+	</div>		
+	<div id="tools_measure" style="display:none;">
+		<div id="tool_inputs">
+			<label>X:</label><input type="text" class="measureStats" id="sx" />
+			<label>Y:</label><input type="text" class="measureStats" id="sy" />
+			<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
+			<label>W:</label><input type="text" class="measureStats" id="mw" />
+			<label>H:</label><input type="text" class="measureStats" id="mh" />
+			<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
+			<label>A:</label><input type="text" class="measureStats" id="ma" />		
+			<label>D:</label><input type="text" class="measureStats" id="md" />		
+			<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
+			<button type="button" onclick="editor.reset();" >Clear</button>
+		</div>	
+	</div>
+	<div id="tools_save" style="display:none;">
+		<div id="tool_inputs">
+			<label for="save_filename">Filename:</label><input type="text" id="save_filename" value="<?php echo $editor->getDefaultSaveFile();?>"/>
+			<select name="format" id="save_format" style="margin-left: 10px; vertical-align: middle;" onchange="updateFormat(this)">
+            <option value="" selected>Image Format</option>
+            <option value="">---------------------</option>
+            <option value="jpeg,85">JPEG High</option>
+            <option value="jpeg,60">JPEG Medium</option>
+            <option value="jpeg,35">JPEG Low</option>
+            <option value="png">PNG</option>
+			<?php if($editor->isGDGIFAble() != -1) { ?>
+            <option value="gif">GIF</option>
+			<?php } ?>
+         </select>
+			<label>Quality:</label>
+			<table style="display: inline; vertical-align: middle;" cellpadding="0" cellspacing="0">
+				<tr>
+				<td>
+					<div id="slidercasing"> 
+				<div id="slidertrack" style="width:100px"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="1" height="1" border="0" alt="track"></div>
+            <div id="sliderbar" style="left:85px" onmousedown="captureStart();"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="1" height="1" border="0" alt="track"></div>
+			</div>	
+				</td>
+				</tr>
+			</table>				
+			<input type="text" id="quality" onchange="updateSlider(this.value)" style="width: 2em;" value="85"/>
+			<img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" />
+		</div>	
+		<a href="javascript: editor.doSubmit('save');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a>
+		<a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>
+	</div>	
+</div>
+<div id="toolbar">
+<a href="javascript:toggle('crop')" id="icon_crop" title="Crop"><img src="<?php print $IMConfig['base_url'];?>img/crop.gif" height="20" width="20" alt="Crop" /><span>Crop</span></a>
+<a href="javascript:toggle('scale')" id="icon_scale" title="Resize"><img src="<?php print $IMConfig['base_url'];?>img/scale.gif" height="20" width="20" alt="Resize" /><span>Resize</span></a>
+<a href="javascript:toggle('rotate')" id="icon_rotate" title="Rotate"><img src="<?php print $IMConfig['base_url'];?>img/rotate.gif" height="20" width="20" alt="Rotate" /><span>Rotate</span></a>
+<a href="javascript:toggle('measure')" id="icon_measure" title="Measure"><img src="<?php print $IMConfig['base_url'];?>img/measure.gif" height="20" width="20" alt="Measure" /><span>Measure</span></a>
+<a href="javascript: toggleMarker();" title="Marker"><img id="markerImg" src="<?php print $IMConfig['base_url'];?>img/t_black.gif" height="20" width="20" alt="Marker" /><span>Marker</span></a>
+<a href="javascript:toggle('save')" id="icon_save" title="Save"><img src="<?php print $IMConfig['base_url'];?>img/save.gif" height="20" width="20" alt="Save" /><span>Save</span></a>
+</div>
+<div id="contents">
+<iframe src="<?php print $IMConfig['backend_url']; ?>__function=editorFrame&img=<?php if(isset($_GET['img'])) echo rawurlencode($_GET['img']); ?>&mode=<?php echo $insertMode ?>" name="editor" id="editor"  scrolling="auto" title="Image Editor" frameborder="0"></iframe>
+</div>
+<div id="bottom"></div>
+</body>
+</html>

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/editorFrame.php
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/editorFrame.php?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/editorFrame.php (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/editorFrame.php Sun Oct  8 12:53:13 2006
@@ -0,0 +1,82 @@
+<?php
+/**
+ * ExtendedFileManager editorframe.php file.
+ * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz
+ * Version: Updated on 08-01-2005 by Afru
+ * Version: Updated on 21-06-2006 by Krzysztof Kotowicz
+ * Package: ExtendedFileManager (EFM 1.1.1)
+ * http://www.afrusoft.com/htmlarea
+ */
+if(isset($_REQUEST['mode'])) $insertMode=$_REQUEST['mode'];
+	if(!isset($insertMode)) $insertMode="image";
+
+require_once('config.inc.php');
+require_once('Classes/ExtendedFileManager.php');
+require_once('../ImageManager/Classes/ImageEditor.php');
+
+$manager = new ExtendedFileManager($IMConfig,$insertMode);
+$editor = new ImageEditor($manager);
+$imageInfo = $editor->processImage();
+
+?>
+
+<html>
+<head>
+	<title></title>
+<link href="<?php print $IMConfig['base_url'];?>assets/editorFrame.css" rel="stylesheet" type="text/css" />
+<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/wz_jsgraphics.js"></script>
+<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/EditorContent.js"></script>
+<script type="text/javascript">
+    var _backend_url = "<?php print $IMConfig['backend_url']."&mode=$insertMode"; ?>&";
+
+    if(window.top)
+    	HTMLArea = window.top.HTMLArea;
+
+    function i18n(str) {
+        return HTMLArea._lc(str, 'ImageManager');
+    }
+
+	var mode = "<?php echo $editor->getAction(); ?>" //crop, scale, measure
+
+var currentImageFile = "<?php if(count($imageInfo)>0) echo rawurlencode($imageInfo['file']); ?>";
+
+<?php if ($editor->isFileSaved() == 1) { ?>
+	alert(i18n('File saved.'));
+
+    window.parent.opener.parent.refresh();
+    window.parent.opener.selectImage
+    (
+  	'<?php echo $imageInfo['saveFile'] ?>',
+  	'<?php echo $imageInfo['saveFile'] ?>'.replace(/^.*\/?([^\/]*)$/, '$1'),
+  	<?php echo $imageInfo['width'] ?>,
+  	<?php echo $imageInfo['height'] ?>
+  	);
+  	window.parent.close();
+  	
+<?php } else if ($editor->isFileSaved() == -1) { ?>
+	alert(i18n('File was not saved.'));
+<?php } ?>
+
+</script>
+<script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/editorFrame.js"></script>
+</head>
+
+<body>
+<div id="status"></div>
+<div id="ant" class="selection" style="visibility:hidden"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="0" height="0" border="0" alt="" id="cropContent"></div>
+<?php if ($editor->isGDEditable() == -1) { ?>
+	<div style="text-align:center; padding:10px;"><span class="error">GIF format is not supported, image editing not supported.</span></div>
+<?php } ?>
+<table height="100%" width="100%">
+	<tr>
+		<td>
+<?php if(count($imageInfo) > 0 && is_file($imageInfo['fullpath'])) { ?>
+	<span id="imgCanvas" class="crop"><img src="<?php echo $imageInfo['src']; ?>" <?php echo $imageInfo['dimensions']; ?> alt="" id="theImage" name="theImage"></span>
+<?php } else { ?>
+	<span class="error">No Image Available</span>
+<?php } ?>
+		</td>
+	</tr>
+</table>
+</body>
+</html>

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/extended-file-manager.js
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/extended-file-manager.js?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/extended-file-manager.js (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/extended-file-manager.js Sun Oct  8 12:53:13 2006
@@ -0,0 +1,339 @@
+/**
+ * ExtendedFileManager extended-file-manager.js file.
+ * Authors: Wei Zhuo, Afru
+ * Modified by: Krzysztof Kotowicz <ko...@webworkers.pl>
+ * Version: Updated on 08-01-2005 by Afru
+ * Version: Modified on 20-06-2006 by Krzysztof Kotowicz
+ * Package: ExtendedFileManager (EFM 1.1.1)
+ * http://www.afrusoft.com/htmlarea
+ */
+
+/**
+ * Installation example for ExtendedFileManager plugin.
+ *
+ *
+ *      HTMLArea.loadPlugin("ExtendedFileManager");
+ *      HTMLArea.onload = function() {
+ *      var myeditor = new HTMLArea("textarea_id");
+ *      myeditor.registerPlugin(ExtendedFileManager);
+ *      myeditor.generate();
+ *      };
+ *      HTMLArea.init();
+ *
+ *
+ * Then configure the config.inc.php file, that is all.
+ */
+
+/**
+ * It is pretty simple, this file over rides the HTMLArea.prototype._insertImage
+ * function with our own, only difference is the popupDialog url
+ * point that to the php script.
+ */
+
+function ExtendedFileManager(editor)
+{
+
+    this.editor = editor;
+
+    var cfg = editor.config;
+    var toolbar = cfg.toolbar;
+    var self = this;
+    
+    if (cfg.ExtendedFileManager.use_linker) {
+        cfg.registerButton({
+            id        : "linkfile",
+            tooltip   : HTMLArea._lc("Insert File Link",'ExtendedFileManager'),
+            image     : _editor_url + 'plugins/ExtendedFileManager/img/ed_linkfile.gif',
+            textMode  : false,
+            action    : function(editor) {
+                    editor._linkFile();
+                  }
+            });
+        cfg.addToolbarElement("linkfile", "createlink", 1);
+        };
+    }
+
+ExtendedFileManager._pluginInfo = {
+    name          : "ExtendedFileManager",
+    version       : "1.1.1",
+    developer     : "Afru, Krzysztof Kotowicz",
+    developer_url : "http://www.afrusoft.com/htmlarea/",
+    license       : "htmlArea"
+};
+
+HTMLArea.Config.prototype.ExtendedFileManager =
+{
+  'use_linker': true,
+  'backend'    : _editor_url + 'plugins/ExtendedFileManager/backend.php?__plugin=ExtendedFileManager&',
+  'backend_data' : null,
+  // deprecated keys, use passing data through e.g. xinha_pass_to_php_backend()
+  'backend_config'     : null,
+  'backend_config_hash': null,
+  'backend_config_secret_key_location': 'Xinha:ImageManager'
+};
+
+// Over ride the _insertImage function in htmlarea.js.
+// Open up the ExtendedFileManger script instead.
+HTMLArea.prototype._insertImage = function(image) {
+
+    var editor = this;  // for nested functions
+    var outparam = null;
+    if (typeof image == "undefined") {
+        image = this.getParentElement();
+        if (image && !/^img$/i.test(image.tagName))
+            image = null;
+    }
+
+    if (image) {
+        outparam = {
+            f_url    : HTMLArea.is_ie ? image.src : image.getAttribute("src"),
+            f_alt    : image.alt,
+            f_title  : image.title,
+            f_border : image.style.borderWidth ? image.style.borderWidth : image.border,
+            f_align  : image.align,
+            f_width  : image.width,
+            f_height  : image.height,
+            f_padding: image.style.padding,
+            f_margin : image.style.margin,
+            f_backgroundColor: image.style.backgroundColor,
+            f_borderColor: image.style.borderColor,
+            baseHref: editor.config.baseHref
+        };
+
+        // compress 'top right bottom left' syntax into one value if possible
+        outparam.f_border = shortSize(outparam.f_border);
+        outparam.f_padding = shortSize(outparam.f_padding);
+        outparam.f_margin = shortSize(outparam.f_margin);
+
+        // convert rgb() calls to rgb hex
+        outparam.f_backgroundColor = convertToHex(outparam.f_backgroundColor);
+        outparam.f_borderColor = convertToHex(outparam.f_borderColor);
+
+    }
+
+    var manager = editor.config.ExtendedFileManager.backend + '__function=manager';
+    if(editor.config.ExtendedFileManager.backend_config != null)
+    {
+      manager += '&backend_config='
+        + encodeURIComponent(editor.config.ExtendedFileManager.backend_config);
+      manager += '&backend_config_hash='
+        + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_hash);
+      manager += '&backend_config_secret_key_location='
+        + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_secret_key_location);
+    }
+
+    if(editor.config.ExtendedFileManager.backend_data != null)
+    {
+        for ( var i in editor.config.ExtendedFileManager.backend_data )
+        {
+            manager += '&' + i + '=' + encodeURIComponent(editor.config.ExtendedFileManager.backend_data[i]);
+        }
+    }
+
+    Dialog(manager, function(param){
+        if (!param)
+        {   // user must have pressed Cancel
+            return false;
+        }
+
+        var img = image;
+        if (!img) {
+            if (HTMLArea.is_ie) {
+                var sel = editor._getSelection();
+                var range = editor._createRange(sel);
+                editor._doc.execCommand("insertimage", false, param.f_url);
+                img = range.parentElement();
+                // wonder if this works...
+                if (img.tagName.toLowerCase() != "img") {
+                    img = img.previousSibling;
+                }
+
+            } else {
+                img = document.createElement('img');
+                img.src = param.f_url;
+                editor.insertNodeAtSelection(img);
+            }
+
+        } else {
+            img.src = param.f_url;
+        }
+
+        img.alt = img.alt ? img.alt : '';
+        
+        for (field in param)
+        {
+            var value = param[field];
+            switch (field)
+            {
+                case "f_alt"    : img.alt    = value; break;
+                case "f_title"  : img.title = value; break;
+                case "f_border" :
+                    img.style.borderWidth = /[^0-9]/.test(value) ? value : (value != '') ? (parseInt(value) + 'px') :'';
+                    if(img.style.borderWidth && !img.style.borderStyle)
+                    {
+                        img.style.borderStyle = 'solid';
+                    }
+                    else if (!img.style.borderWidth)
+                    {
+                    	img.style.border = '';
+                    }
+                    break;
+                case "f_borderColor": img.style.borderColor = value; break;
+                case "f_backgroundColor": img.style.backgroundColor = value; break;
+                case "f_align"  : img.align  = value; break;
+                case "f_width"  : img.width = parseInt(value || "0"); break;
+                case "f_height"  : img.height = parseInt(value || "0"); break;
+                case "f_padding": img.style.padding =
+                                          /[^0-9]/.test(value) ? value : (value != '') ? (parseInt(value) + 'px') :''; break;
+                case "f_margin": img.style.margin =
+                                          /[^0-9]/.test(value) ? value : (value != '') ? (parseInt(value) + 'px') :''; break;
+            }
+        }
+
+    }, outparam);
+
+};
+
+HTMLArea.prototype._linkFile = function(link) {
+
+    var editor = this;
+    var outparam = null;
+    if (typeof link == "undefined") {
+        link = this.getParentElement();
+        if (link) {
+            if (/^img$/i.test(link.tagName))
+                link = link.parentNode;
+            if (!/^a$/i.test(link.tagName))
+                link = null;
+        }
+    }
+    if (!link) {
+        var sel = editor._getSelection();
+        var range = editor._createRange(sel);
+        var compare = 0;
+        if (HTMLArea.is_ie) {
+            if ( sel.type == "Control" )
+                compare = range.length;
+            else
+                compare = range.compareEndPoints("StartToEnd", range);
+        } else {
+            compare = range.compareBoundaryPoints(range.START_TO_END, range);
+        }
+        if (compare == 0) {
+            alert(HTMLArea._lc("You must select some text before making a new link.", 'ExtendedFileManager'));
+            return;
+        }
+        outparam = {
+            f_href : '',
+            f_title : '',
+            f_target : '',
+            f_usetarget : editor.config.makeLinkShowsTarget,
+            baseHref: editor.config.baseHref
+        };
+    } else
+        outparam = {
+            f_href   : HTMLArea.is_ie ? link.href : link.getAttribute("href"),
+            f_title  : link.title,
+            f_target : link.target,
+            f_usetarget : editor.config.makeLinkShowsTarget,
+            baseHref: editor.config.baseHref
+        };
+
+    var manager = _editor_url + 'plugins/ExtendedFileManager/manager.php?mode=link';
+    if(editor.config.ExtendedFileManager.backend_config != null)
+    {
+       manager += '&backend_config='
+               + encodeURIComponent(editor.config.ExtendedFileManager.backend_config);
+       manager += '&backend_config_hash='
+               + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_hash);
+       manager += '&backend_config_secret_key_location='
+               + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_secret_key_location);
+    }
+
+    if(editor.config.ExtendedFileManager.backend_data != null)
+    {
+        for ( var i in editor.config.ExtendedFileManager.backend_data )
+        {
+            manager += '&' + i + '=' + encodeURIComponent(editor.config.ExtendedFileManager.backend_data[i]);
+        }
+    }
+
+
+    Dialog(manager, function(param){
+        if (!param)
+            return false;
+        var a = link;
+        if (!a) try {
+            editor._doc.execCommand("createlink", false, param.f_href);
+            a = editor.getParentElement();
+            var sel = editor._getSelection();
+            var range = editor._createRange(sel);
+            if (!HTMLArea.is_ie) {
+                a = range.startContainer;
+                if (!/^a$/i.test(a.tagName)) {
+                    a = a.nextSibling;
+                    if (a == null)
+                        a = range.startContainer.parentNode;
+                }
+            }
+        } catch(e) {}
+        else {
+            var href = param.f_href.trim();
+            editor.selectNodeContents(a);
+            if (href == "") {
+                editor._doc.execCommand("unlink", false, null);
+                editor.updateToolbar();
+                return false;
+            }
+            else {
+                a.href = href;
+            }
+        }
+        if (!(a && /^a$/i.test(a.tagName)))
+            return false;
+        a.target = param.f_target.trim();
+        a.title = param.f_title.trim();
+        editor.selectNodeContents(a);
+        editor.updateToolbar();
+    }, outparam);
+
+};
+
+function shortSize(cssSize)
+{
+    if(/ /.test(cssSize))
+    {
+        var sizes = cssSize.split(' ');
+        var useFirstSize = true;
+        for(var i = 1; i < sizes.length; i++)
+        {
+            if(sizes[0] != sizes[i])
+            {
+                useFirstSize = false;
+                break;
+            }
+        }
+        if(useFirstSize) cssSize = sizes[0];
+    }
+
+    return cssSize;
+}
+
+function convertToHex(color) {
+
+    if (typeof color == "string" && /, /.test.color)
+        color = color.replace(/, /, ','); // rgb(a, b) => rgb(a,b)
+
+    if (typeof color == "string" && / /.test.color) { // multiple values
+        var colors = color.split(' ');
+        var colorstring = '';
+        for (var i = 0; i < colors.length; i++) {
+            colorstring += HTMLArea._colorToRgb(colors[i]);
+            if (i + 1 < colors.length)
+                colorstring += " ";
+        }
+        return colorstring;
+    }
+
+    return HTMLArea._colorToRgb(color);
+}

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/icons/def.gif
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/icons/def.gif?view=auto&rev=454197
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/icons/def.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/icons/def_small.gif
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/icons/def_small.gif?view=auto&rev=454197
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/icons/def_small.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/icons/doc.gif
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/icons/doc.gif?view=auto&rev=454197
==============================================================================
Binary file - no diff available.

Propchange: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/ExtendedFileManager/icons/doc.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream