Changeset 937
- Timestamp:
- 01/20/08 23:13:25 (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 23 modified
-
XinhaCore.js (modified) (1 diff)
-
XinhaLoader.js (modified) (1 diff)
-
examples/XinhaConfig.js (modified) (3 diffs)
-
plugins/ExtendedFileManager/assets/EditorContent.js (modified) (24 diffs)
-
plugins/ExtendedFileManager/assets/dragTableCols.js (added)
-
plugins/ExtendedFileManager/assets/editor.css (modified) (4 diffs)
-
plugins/ExtendedFileManager/assets/editor.js (modified) (8 diffs)
-
plugins/ExtendedFileManager/assets/editorFrame.css (modified) (1 diff)
-
plugins/ExtendedFileManager/assets/editorFrame.js (modified) (4 diffs)
-
plugins/ExtendedFileManager/assets/imagelist.css (modified) (2 diffs)
-
plugins/ExtendedFileManager/assets/manager.css (modified) (1 diff)
-
plugins/ExtendedFileManager/assets/manager.js (modified) (5 diffs)
-
plugins/ExtendedFileManager/assets/popup.js (modified) (1 diff)
-
plugins/ExtendedFileManager/assets/wz_jsgraphics.js (modified) (6 diffs)
-
plugins/ExtendedFileManager/config.inc.php (modified) (4 diffs)
-
plugins/ExtendedFileManager/editor.php (added)
-
plugins/ExtendedFileManager/editorFrame.php (modified) (2 diffs)
-
plugins/ExtendedFileManager/extended-file-manager.js (modified) (5 diffs)
-
plugins/ExtendedFileManager/images.php (modified) (12 diffs)
-
plugins/ExtendedFileManager/lang/de.js (modified) (2 diffs)
-
plugins/ExtendedFileManager/manager.php (modified) (7 diffs)
-
plugins/ImageManager/Classes/GD.php (modified) (9 diffs)
-
plugins/ImageManager/Classes/IM.php (modified) (2 diffs)
-
plugins/ImageManager/Classes/ImageEditor.php (modified) (7 diffs)
-
plugins/ImageManager/editor.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/XinhaCore.js
r933 r937 5341 5341 }; 5342 5342 5343 /** Adds a function that is executed in the moment the DOM is ready, but as opposed to window.onload before images etc. have been loaded 5344 * http://dean.edwards.name/weblog/2006/06/again/ 5345 * @public 5346 * @author Dean Edwards/Matthias Miller/ John Resig / Raimund Meyer 5347 * @param {Function} func the function to be executed 5348 * @param {Window} scope the window that is listened to 5349 */ 5350 Xinha.addOnloadHandler = function (func, scope) 5351 { 5352 scope = scope ? scope : window; 5353 5354 var init = function () 5355 { 5356 // quit if this function has already been called 5357 if (arguments.callee.done) return; 5358 // flag this function so we don't do the same thing twice 5359 arguments.callee.done = true; 5360 // kill the timer 5361 if (_timer) clearInterval(_timer); 5362 5363 func(); 5364 } 5365 if (Xinha.is_ie) 5366 { 5367 scope.document.write("<sc"+"ript id=__ie_onload defer src=javascript:void(0)><\/script>"); 5368 var script = scope.document.getElementById("__ie_onload"); 5369 script.onreadystatechange = function() 5370 { 5371 if (this.readyState == "loaded") // We want this as early as possible, so I changed 'complete' to 'loaded', because otherwise it fired even after window.onload 5372 { 5373 this.parentNode.removeChild(script); 5374 init(); // call the onload handler 5375 } 5376 }; 5377 } 5378 else if (/applewebkit|KHTML/i.test(navigator.userAgent) ) /* Safari/WebKit/KHTML */ 5379 { 5380 var _timer = scope.setInterval(function() 5381 { 5382 if (/loaded|complete/.test(scope.document.readyState)) 5383 { 5384 init(); // call the onload handler 5385 } 5386 }, 10); 5387 } 5388 else /* for Mozilla/Opera9 */ 5389 { 5390 scope.document.addEventListener("DOMContentLoaded", init, false); 5391 5392 } 5393 Xinha._addEvent(scope, 'load', init); // incase anything went wrong 5394 }; 5395 5343 5396 /** 5344 5397 * Adds a standard "DOM-0" event listener to an element. -
trunk/XinhaLoader.js
r917 r937 174 174 } 175 175 } 176 Xinha.addOnloadHandler = function (func) 177 { 178 // Dean Edwards/Matthias Miller/John Resig 179 // http://dean.edwards.name/weblog/2006/06/again/ 180 181 var init = function () 182 { 183 // quit if this function has already been called 184 if (arguments.callee.done) return; 185 // flag this function so we don't do the same thing twice 186 arguments.callee.done = true; 187 // kill the timer 188 if (_timer) clearInterval(_timer); 189 190 func.call(); 191 } 192 if (Xinha.is_ie) 193 { 194 document.write("<sc"+"ript id=__ie_onload defer src=javascript:void(0)><\/script>"); 195 var script = document.getElementById("__ie_onload"); 196 script.onreadystatechange = function() 197 { 198 if (this.readyState == "complete") 199 { 200 init(); // call the onload handler 201 } 202 }; 203 } 204 else if (/WebKit/i.test(navigator.userAgent)) 205 { 206 var _timer = setInterval(function() 207 { 208 if (/loaded|complete/.test(document.readyState)) 209 { 210 init(); // call the onload handler 211 } 212 }, 10); 213 } 214 else /* for Mozilla/Opera9 */ 215 { 216 document.addEventListener("DOMContentLoaded", init, false); 217 } 218 } -
trunk/examples/XinhaConfig.js
r836 r937 16 16 * current page will just be skipped. 17 17 ************************************************************************/ 18 18 19 19 xinha_editors = xinha_editors ? xinha_editors : 20 20 [ … … 64 64 65 65 xinha_config = xinha_config ? xinha_config() : new Xinha.Config(); 66 67 66 68 67 // To adjust the styling inside the editor, we can load an external stylesheet like this … … 109 108 } 110 109 111 Xinha._addEvent(window,'load', xinha_init); // this executes the xinha_init function on page load 112 // and does not interfere with window.onload properties set by other scripts 110 Xinha.addOnloadHandler(xinha_init); // this executes the xinha_init function on page load 111 // and does not interfere with window.onload properties set by other scripts 112 -
trunk/plugins/ExtendedFileManager/assets/EditorContent.js
r795 r937 4 4 * Version: Updated on 08-01-2005 by Afru 5 5 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 6 * Package: ExtendedFileManager (EFM 1.1.1) 6 * Version: Updated on 04-11-2007 by Raimund Meyer 7 * Package: ExtendedFileManager (EFM 1.4) 7 8 * http://www.afrusoft.com/htmlarea 8 9 */ … … 47 48 if(el) {e=(document.layers)?el:el.style; 48 49 var xx=parseInt(x+ox+a),yy=parseInt(y+oy+b); 49 //alert(xx+":"+yy);50 50 if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)>4){xx+="px";yy+="px";} 51 51 if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){ … … 53 53 xx+="px";yy+="px";}e.left=xx;e.top=yy;} 54 54 pic_x = parseInt(xx); pic_y = parseInt(yy); 55 //alert(xx+":"+yy);56 55 } 57 56 } … … 65 64 function init_resize() 66 65 { 67 if(mode == "scale")68 {66 //if(mode == "scale") 67 //{ 69 68 P7_Snap('theImage','ant',0,0); 70 69 … … 88 87 drawBoundHandle(); 89 88 jg_doc.paint(); 90 }89 //} 91 90 } 92 91 … … 99 98 if (markerImg.src.indexOf("img/t_white.gif")>0) 100 99 toggleMarker() ; 100 var theImage = document.getElementById('theImage'); 101 theImage._width = theImage.width; 102 theImage._height = theImage.height; 101 103 } 102 104 … … 141 143 function toggleMarker() 142 144 { 143 //alert("Toggle");144 145 if (ant == null) 145 146 ant = MM_findObj("ant"); … … 163 164 if (dragapproved) 164 165 { 165 //z.style.left=ns6? temp1+e.clientX-x: temp1+event.clientX-x 166 //z.style.top=ns6? temp2+e.clientY-y : temp2+event.clientY-y 167 var w = ns6? temp1+e.clientX - x : temp1+event.clientX - x; 168 var h = ns6? temp2+e.clientY - y : temp2+event.clientY - y; 169 170 //alert(canvas.style.left); 171 /*if (status !=null) 172 { 173 status.innerHTML = "x:"+x+" y:"+y+" w:"+w+" h:"+h+" can_h:"+pic_height; 174 status.innerHTML += " can_w:"+pic_width+" px:"+pic_x+" py:"+pic_y; 175 status.innerHTML += " pix:"+image.style.left+" piy:"+image.style.top+" obj:"+obj.id; 176 }*/ 177 178 /*jg_doc.clear(); 179 jg_doc.fillRectPattern(0,0,Math.abs(w),Math.abs(h),pattern); 180 jg_doc.paint(); 181 */ 166 var w = ns6? temp1+e.pageX - x : temp1+event.clientX + document.body.scrollLeft- x; 167 var h = ns6? temp2+e.pageY - y : temp2+event.clientY + document.body.scrollTop - y; 168 182 169 if (ant != null) 183 170 { … … 218 205 var dy =ns6? oa_y + e.clientY-y : oa_y + event.clientY-y 219 206 220 /*if (status !=null)221 {222 status.innerHTML = "x:"+x+" y:"+y+" dx:"+dx+" dy:"+dy;223 }*/224 225 207 ant.style.left = dx; 226 208 ant.style.top = dy; … … 232 214 } 233 215 234 //Code add for constraints by Fr édéric Klee <fklee@isuisse.com>216 //Code add for constraints by Frédéric Klee <fklee@isuisse.com> 235 217 function moveHandle(e) 236 218 { … … 370 352 content.height = 0; 371 353 } 372 //alert(content.width+":"+content.height);373 354 } 374 355 resizeHandle = firedobj.id; 375 376 /*if(status!=null) {377 status.innerHTML = " obj:"+firedobj.id;378 }*/379 356 380 357 x=ns6? e.clientX: event.clientX … … 411 388 content.height = 0; 412 389 } 413 //alert(content.width+":"+content.height);414 390 } 415 391 … … 440 416 temp1=parseInt(z.style.left+0) 441 417 temp2=parseInt(z.style.top+0) 442 x=ns6? e.clientX: event.clientX 443 y=ns6? e.clientY: event.clientY 418 419 x=ns6? e.pageX: event.clientX + document.body.scrollLeft 420 y=ns6? e.pageY: event.clientY + document.body.scrollTop 444 421 document.onmousemove=move 445 422 return false … … 453 430 canvas = MM_findObj("imgCanvas"); 454 431 455 x=ns6? e.clientX: event.clientX 456 y=ns6? e.clientY: event.clientY 457 458 //jg_doc.draw 432 x=ns6? e.pageX: event.clientX + document.body.scrollLeft 433 y=ns6? e.pageY: event.clientY + document.body.scrollTop 434 459 435 dragapproved=true 460 436 document.onmousemove=measure … … 468 444 if (dragapproved) 469 445 { 470 mx2 = ns6? e. clientX : event.clientX;471 my2 = ns6? e. clientY : event.clientY;446 mx2 = ns6? e.pageX : event.clientX + document.body.scrollLeft; 447 my2 = ns6? e.pageY : event.clientY + document.body.scrollTop; 472 448 473 449 jg_doc.clear(); … … 569 545 jg_doc.drawHandleBox(ax-4, ay+ah/2-4,8,8,"w-resize"); //left middle 570 546 jg_doc.drawHandleBox(ax+aw-4, ay+ah/2-4,8,8,"e-resize"); //right middle 571 572 //jg_doc.paint();573 547 } 574 548 … … 578 552 return false; 579 553 } 580 554 var zoom = 100 / parseInt( window.parent.document.getElementById('zoom').value, 10 ); 581 555 if(mode == "measure") { 582 //alert(pic_x); 556 583 557 mx1 = x - pic_x; 584 558 my1 = y - pic_y; … … 599 573 600 574 if (m_sx != null && !isNaN(mx1)) 601 m_sx.value = mx1 +"px";575 m_sx.value = mx1 * zoom +"px"; 602 576 if (m_sy != null && !isNaN(my1)) 603 m_sy.value = my1 +"px";577 m_sy.value = my1 * zoom+"px"; 604 578 if(m_w != null && !isNaN(mw)) 605 m_w.value = mw + "px";579 m_w.value = mw * zoom + "px"; 606 580 if(m_h != null && !isNaN(mh)) 607 m_h.value = mh + "px";581 m_h.value = mh * zoom + "px"; 608 582 609 583 if(m_d != null && !isNaN(md)) 610 m_d.value = md + "px";584 m_d.value = md * zoom + "px"; 611 585 if(m_a != null && !isNaN(ma)) 612 586 m_a.value = ma + ""; … … 615 589 r_ra.value = ma; 616 590 617 //alert("mx1:"+mx1+" my1"+my1);618 591 return false; 619 592 } … … 644 617 if(mode == 'crop') { 645 618 if(t_cx != null) 646 t_cx.value = cx ;619 t_cx.value = cx * zoom ; 647 620 if (t_cy != null) 648 t_cy.value = cy ;621 t_cy.value = cy * zoom ; 649 622 if(t_cw != null) 650 t_cw.value = cw ;623 t_cw.value = cw * zoom ; 651 624 if (t_ch != null) 652 t_ch.value = ch ;625 t_ch.value = ch * zoom ; 653 626 } 654 627 else if(mode == 'scale') { … … 662 635 } 663 636 if (s_sw != null) 664 s_sw.value = sw ;637 s_sw.value = sw * zoom ; 665 638 if (s_sh != null) 666 s_sh.value = sh; 667 } 668 639 s_sh.value = sh * zoom ; 640 } 669 641 } 670 642 … … 698 670 content.height = ah-1; 699 671 } 700 //alert(content.width+":"+content.height);701 672 } 702 673 if(mode == "crop") { … … 718 689 } 719 690 else if(mode == "scale") { 720 //alert("Resizing: iw:"+image.width+" nw:"+aw);721 691 document.theImage.height = ah; 722 692 document.theImage.width = aw; … … 725 695 726 696 P7_Snap('theImage','ant',0,0); 727 728 //alert("After Resizing: iw:"+image.width+" nw:"+aw);729 697 } 730 698 -
trunk/plugins/ExtendedFileManager/assets/editor.css
r677 r937 8 8 #indicator 9 9 { 10 width: 2 5px;10 width: 20px; 11 11 height: 20px; 12 12 background-color: #eef; 13 13 padding: 15px 20px; 14 position: absolute;15 left: 0; top: 0;16 14 } 17 15 * html #indicator … … 21 19 #tools 22 20 { 23 width: 600px;24 height: 50px;25 21 background-color: #eef; 26 22 padding: 0; 27 position: absolute;28 left: 63px;29 23 border-left: 1px solid white; 30 24 border-bottom: 1px solid white; … … 32 26 #toolbar 33 27 { 34 width: 53px;35 height: 435px;36 28 background-color: #eef; 37 float: left;38 29 text-align: center; 39 30 padding: 5px; 40 position: absolute;41 top: 50px;42 31 border-top: 1px solid white; 43 32 border-right: 1px solid white; 33 vertical-align: top; 34 width:50px; 44 35 } 45 36 46 37 #contents 47 38 { 48 width: 600px; 49 height: 445px; 50 position: absolute; 51 left: 64px; top: 51px; 39 position: relative; 52 40 } 53 41 54 42 #editor 55 43 { 56 width: 600px;57 height: 445px;44 width: 100%; 45 height: 100%; 58 46 } 59 47 … … 120 108 vertical-align: middle; 121 109 } 122 #tools #tool_inputs110 #tools .tool_inputs 123 111 { 124 112 padding-top: 10px; -
trunk/plugins/ExtendedFileManager/assets/editor.js
r677 r937 4 4 * Version: Updated on 08-01-2005 by Afru 5 5 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 6 * Package: ExtendedFileManager (EFM 1.1.1)7 * http://www.afrusoft.com/htmlarea6 * Version: Updated on 20-01-2008 by Raimund Meyer 7 * Package: ExtendedFileManager (EFM 1.4) 8 8 */ 9 9 … … 40 40 41 41 //constraints on the scale, 42 //code by Fr édéric Klee <fklee@isuisse.com>42 //code by Frédéric Klee <fklee@isuisse.com> 43 43 if(action == 'scale') 44 44 { 45 45 var theImage = editor.window.document.getElementById('theImage'); 46 orginal_width = theImage. width ;47 orginal_height = theImage. height;46 orginal_width = theImage._width ; 47 orginal_height = theImage._height; 48 48 49 49 var w = document.getElementById('sw'); … … 52 52 h.value = orginal_height ; 53 53 } 54 54 if ( action == 'save' ) 55 { 56 var formatSelect = document.getElementById('save_format'); 57 var format = document.getElementById('save_filename').value.match(/\.(gif|png|jpe?g)/i)[1].toLowerCase(); 58 switch ( format ) 59 { 60 case 'png': 61 formatSelect.selectedIndex = '3'; 62 break; 63 case 'gif': 64 formatSelect.selectedIndex = '4'; 65 break; 66 default: 67 formatSelect.selectedIndex = '0'; 68 break; 69 } 70 formatSelect.onchange(); 71 } 55 72 } 56 73 } … … 70 87 } 71 88 72 //Togggle constraints, by Fr édéric Klee <fklee@isuisse.com>89 //Togggle constraints, by Frédéric Klee <fklee@isuisse.com> 73 90 function toggleConstraints() 74 91 { … … 92 109 } 93 110 94 //check the constraints, by Fr édéric Klee <fklee@isuisse.com>111 //check the constraints, by Frédéric Klee <fklee@isuisse.com> 95 112 function checkConstrains(changed) 96 113 { … … 133 150 } 134 151 152 function rotateSubActionSelect(selection) 153 { 154 var value = selection.options[selection.selectedIndex].value; 155 156 var rotate_preset_select = document.getElementById('rotate_preset_select'); 157 var flip = document.getElementById('flip'); 158 var angle = document.getElementById('ra').parentNode; 159 160 switch (value) 161 { 162 case 'rotate': 163 rotate_preset_select.style.display = ''; 164 flip.style.display = 'none'; 165 angle.style.display = ''; 166 break; 167 case 'flip': 168 rotate_preset_select.style.display = 'none'; 169 flip.style.display = ''; 170 angle.style.display = 'none'; 171 break; 172 } 173 } 135 174 function rotatePreset(selection) 136 175 { … … 148 187 149 188 var values = selected.split(","); 189 if ( values[0] != 'jpeg' ) document.getElementById('slider').style.display = 'none'; 190 else document.getElementById('slider').style.display = 'inline'; 150 191 if(values.length >1) { 151 192 updateSlider(parseInt(values[1])); 152 193 } 153 194 195 } 196 function zoom() 197 { 198 var theImage = editor.window.document.getElementById('theImage'); 199 var value = document.getElementById('zoom').value; 200 theImage.width = theImage._width * parseInt( value, 10 ) / 100; 201 theImage.height = theImage._height * parseInt( value, 10 )/ 100; 202 editor.reset(); 203 editor.pic_width = null; 204 editor.pic_height = null; 154 205 } 155 206 function addEvent(obj, evType, fn) … … 160 211 } 161 212 162 init = function() 163 { 164 var bottom = document.getElementById('bottom'); 213 var init = function() 214 { 165 215 if(window.opener) 166 216 { 167 __ dlg_init(null, {width: 673, height: 531});217 __xinha_dlg_init(); 168 218 __dlg_translate('ExtendedFileManager'); 169 219 } 170 } 171 172 addEvent(window, 'load', init); 220 addEvent(window, 'resize', winOnResize); 221 try { window.moveTo(0,0); } catch (e) {} 222 window.resizeTo(window.screen.availWidth,window.screen.availHeight); 223 winOnResize(); 224 } 225 function winOnResize () 226 { 227 if ( typeof editor.reset == 'function' && typeof editor.ant != 'undefined' ) editor.reset(); 228 var win = Xinha.viewportSize(window); 229 document.getElementById("contents").style.height = win.y - parseInt(document.getElementById("indicator").offsetHeight,10) - 5 + 'px'; 230 } 231 Xinha.addOnloadHandler( init, window ); -
trunk/plugins/ExtendedFileManager/assets/editorFrame.css
r677 r937 7 7 .handleBox{ z-index:105; } 8 8 .error { font-size:large; font-weight:bold; color:#c00; font-family: Helvetica, sans-serif; } 9 10 #n-resize {cursor: n-resize } 11 #s-resize {cursor: s-resize } 12 #w-resize {cursor: w-resize } 13 #e-resize {cursor: e-resize } 14 #nw-resize {cursor: nw-resize } 15 #sw-resize {cursor: sw-resize } 16 #ne-resize {cursor: ne-resize } 17 #se-resize {cursor: se-resize } -
trunk/plugins/ExtendedFileManager/assets/editorFrame.js
r677 r937 4 4 * Version: Updated on 08-01-2005 by Afru 5 5 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 6 * Package: ExtendedFileManager (EFM 1.1.1) 6 * Version: Updated on 20-01-2008 by Raimund Meyer 7 * Package: ExtendedFileManager (EFM 1.4) 7 8 * http://www.afrusoft.com/htmlarea 8 9 */ … … 49 50 else if (action == 'rotate') 50 51 { 51 var flip = topDoc.getElementById('flip');52 var rotate_sub_action = topDoc.getElementById('rotate_sub_action'); 52 53 53 if( flip.value == 'hoz' || flip.value == 'ver')54 location.href = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=flip¶ms="+ flip.value;54 if(rotate_sub_action.value == 'flip') 55 location.href = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=flip¶ms="+topDoc.getElementById('flip').value; 55 56 else if (isNaN(parseFloat(r_ra.value))==false) 56 57 location.href = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=rotate¶ms="+parseFloat(r_ra.value); … … 69 70 { 70 71 var filename = encodeURI(s_file.value); 71 var quality = parseInt(s_quality.value);72 var url = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=save¶ms="+format[0]+","+quality+"&file="+filename;73 //alert(url);74 location.href = url;72 var quality = parseInt(s_quality.value); 73 var format = s_format.value.split(","); 74 var url = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=save¶ms="+format[0]+","+quality+"&file="+filename; 75 location.href = url; 75 76 } 76 77 } 78 else if (action == 'preview') { 79 var s_format = topDoc.getElementById('save_format'); 80 var s_quality = topDoc.getElementById('quality'); 81 var quality = parseInt(s_quality.value); 82 var format = s_format.value.split(","); 83 var url = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=preview¶ms="+format[0]+","+quality+"&file="+filename; 84 location.href = url; 85 } 77 86 } 78 87 … … 90 99 jg_doc = new jsGraphics("imgCanvas"); // draw directly into document 91 100 jg_doc.setColor("#000000"); // black 92 101 93 102 initEditor(); 103 if (window.parent.document.getElementById('zoom').value != '100') window.parent.zoom(); 104 reset(); 105 window.parent.document.getElementById('filesize').innerHTML = fileSize; 94 106 }; 95 107 -
trunk/plugins/ExtendedFileManager/assets/imagelist.css
r677 r937 30 30 padding:5px; 31 31 text-decoration:none; 32 overflow:hidden; 32 33 } 33 34 … … 42 43 } 43 44 44 .listview { width:100% }45 .listview { width:100%; } 45 46 .listview td, .listview th { text-align:left; font-size:small; } 46 .listview td.actions { text-align: right; }47 .listview td.actions { text-align: right;width:111px } 47 48 .listview td.actions img { border:0; } 48 49 49 .listview thead th {background-color: ButtonFace; border: 1px solid threedface; border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; padding-top:2px; padding-bottom:2px; padding-left: 5px; padding-right: 5px; font-size: 9pt; font-family: "MS Sans Serif", Geneva, sans-serif;}50 .listview tbody td, .listview tbody th { padding-top:2px; padding-left: 3px; font-size: 9pt; font-family: "MS Sans Serif", Geneva, sans-serif;}50 .listview thead th {background-color: ButtonFace; border: 1px solid threedface; border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; padding-top:2px; padding-bottom:2px; padding-left: 5px; padding-right: 5px; font-size: 9pt; font-family: "MS Sans Serif", "Bitstream Vera Sans", Geneva, Sans, sans-serif;font-weight:normal} 51 .listview tbody td, .listview tbody th {overflow:hidden; padding-top:2px; padding-left: 3px; font-size: 9pt; font-family: "MS Sans Serif", "Bitstream Vera Sans", Geneva, Sans, sans-serif;} 51 52 .listview tbody a, listview tbody a:visited { font-weight: normal; text-decoration: none; color: #000; border:0px; padding:2px;} 52 53 .listview tbody a:hover { background-color:#0B256B; color:#fff;} 53 54 54 .listview tbody tr:hover {background-color: rgb(221,221,255) ;55 .listview tbody tr:hover {background-color: rgb(221,221,255)}; -
trunk/plugins/ExtendedFileManager/assets/manager.css
r770 r937 18 18 .buttons { width: 70px; text-align: center; } 19 19 .clearboth{ clear: both; } 20 #messages { position: relative; left: 175px; top: 115px; background-color: white; width:200px; float: left; margin-top: -52px; border: 1px solid #ccc; text-align: center; padding: 15px; }20 #messages {opacity:0.8;filter:Alpha(opacity=85);position:relative;height:20px;margin-bottom:-30px;background-color: white; border: none; text-align: center; padding: 5px; } 21 21 #message { font-size: 15px; font-weight: bold; color: #69c; } 22 22 iframe { border:1px inset; border-right:none; border-left:none; border-bottom:none; } 23 23 #controls {padding-bottom:10px;} 24 24 table { margin-top:10px; } 25 25 th, td { padding-right:3px; text-align:left; font-family:small-caption,helvetica,sans-serif; } -
trunk/plugins/ExtendedFileManager/assets/manager.js
r918 r937 5 5 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 6 6 * Version: Updated on 17-11-2006 by Raimund Meyer 7 * Package: ExtendedFileManager (EFM 1.1.3) 7 * Version: Updated on 20-01-2008 by Raimund Meyer 8 * Package: ExtendedFileManager (EFM 1.4) 8 9 * http://www.afrusoft.com/htmlarea 9 10 */ … … 46 47 } 47 48 48 //initialise the form 49 50 if (manager_mode == "link")51 {52 var offsetForInputs = (Xinha.is_ie) ? 165 : 150; 53 } 54 else 55 { 56 var offsetForInputs = (Xinha.is_ie) ? 230 : 210;57 } 58 59 var h = 100 // space above files 60 + 250 // files iframe 61 + offsetForInputs; 62 63 var win_dim = {width:650,height:h}; 64 window.resizeTo(win_dim.width,win_dim.height);65 if (!Xinha.is_ie)66 {67 var x = opener.screenX + (opener.outerWidth - win_dim.width) / 2;68 var y = opener.screenY + (opener.outerHeight - win_dim.height) / 2;69 }70 else 71 {//IE does not have window.outer... , so center it on the screen at least 72 var x = (self.screen.availWidth - win_dim.width) / 2;73 var y = (self.screen.availHeight - win_dim.height) / 2; 74 }75 window.moveTo(x,y); 76 77 init = function () 78 { 79 80 81 __dlg_init(null, {width:650,height:h}); 82 49 function init () 50 { 51 if (typeof imgManager == 'undefined' ) 52 { 53 setTimeout(init,10); // sometimes we are too hasty 54 return; 55 } 56 57 var w = 650; 58 var h = 200; 59 60 window.resizeTo(w,h); 61 var pageSize = Xinha.pageSize (window); 62 63 h = pageSize['y'] + 60; 64 65 window.resizeTo(w,h); 66 if ( Xinha.ie_version == 7 ) 67 { 68 window.resizeBy( 0, 40); 69 h += 40; 70 } 71 if (!Xinha.is_ie) 72 { 73 var x = opener.screenX + (opener.outerWidth - w) / 2; 74 var y = opener.screenY + (opener.outerHeight -h) / 2; 75 } 76 else 77 {//IE does not have window.outer... , so center it on the screen at least 78 var x = (self.screen.availWidth -w) / 2; 79 var y = (self.screen.availHeight - h) / 2; 80 } 81 window.moveTo(x,y); 82 83 __xinha_dlg_init(); 83 84 __dlg_translate('ExtendedFileManager'); 84 85 … … 221 222 } 222 223 } 224 iframeUrl = window.location.href.replace(_backend_url ,iframeUrl ); 223 225 if ( startDir ) 224 {225 Xinha._addEvent(imgManager,'load', function () { 226 changeDir(startDir);227 var dirPath = document.getElementById('dirPath'); 228 for(var i = 0; i < dirPath.options.length; i++) 229 { 230 if(dirPath.options[i].value == encodeURIComponent(startDir)) 231 { 232 dirPath.options[i].selected = true;233 break; 234 }235 } 236 });237 } 226 { 227 iframeUrl += '&dir=' + startDir; 228 var dirPath = document.getElementById('dirPath'); 229 for(var i = 0; i < dirPath.options.length; i++) 230 { 231 if(dirPath.options[i].value == encodeURIComponent(startDir)) 232 { 233 dirPath.options[i].selected = true; 234 break; 235 } 236 } 237 }; 238 imgManager.location.replace( iframeUrl ); 239 238 240 if (manager_mode == 'image' && typeof Xinha.colorPicker != "undefined" && document.getElementById('f_backgroundColor') && document.getElementById('f_backgroundColor').type == 'text') { 239 241 // Hookup color pickers … … 249 251 new Xinha.colorPicker.InputBinding(document.getElementById('f_borderColor'),pickerConfig); 250 252 } 253 setTimeout(function() { addEvent(window, 'resize', resize); }, 500); 251 254 } 252 255 … … 548 551 { 549 552 var win = Xinha.viewportSize(window); 550 document.getElementById('imgManager').style.height = parseInt( win.y - 130 - offsetForInputs, 10 ) + 'px'; 551 553 var m = document.getElementById('messages'); 554 var messagesHeight = (m && m.style.display != 'none' ) ? parseInt( document.getElementById('messages').offsetHeight, 10 ) : 0; 555 document.getElementById('imgManager').style.height = parseInt( win.y - 130 - document.getElementById('controls').offsetHeight, 10 ) - messagesHeight + 'px'; 552 556 return true; 553 557 } 554 addEvent(window, 'resize', resize); 555 if (Xinha.is_gecko) 556 {// this runs the init function (translation) before all the images in the iframe have loaded 557 document.addEventListener("DOMContentLoaded", init, false); 558 } 559 else 560 { 561 addEvent(window, 'load', init); 562 } 558 559 Xinha.addOnloadHandler( init, window ); -
trunk/plugins/ExtendedFileManager/assets/popup.js
r799 r937 16 16 opener.Dialog._return(null); 17 17 } 18 function __dlg_init( bottom, win_dim ) { 19 __xinha_dlg_init(win_dim); 20 } 18 21 22 function __xinha_dlg_init( win_dim ) { 23 if(window.__dlg_init_done) return true; 24 25 if(window.opener._editor_skin) { 26 var head = document.getElementsByTagName("head")[0]; 27 var link = document.createElement("link"); 28 link.type = "text/css"; 29 link.href = window.opener._editor_url + 'skins/' + window.opener._editor_skin + '/skin.css'; 30 link.rel = "stylesheet"; 31 head.appendChild(link); 32 } 33 window.dialogArguments = opener.Dialog._arguments; 34 35 Xinha.addDom0Event(document.body, 'keypress', __dlg_close_on_esc); 36 window.__dlg_init_done = true; 37 } 19 38 function __dlg_translate(context) { 20 39 var types = ["span", "option", "td", "th", "button", "div", "label", "a","img", "legend"]; -
trunk/plugins/ExtendedFileManager/assets/wz_jsgraphics.js
r677 r937 1 1 /*********************************************************************** 2 ** Title.........: Javascript Graphics3 ** Version.......: 1.04 ** Author........: Xiang Wei ZHUO <wei@zhuo.org>5 2 ** Filename......: wz_jsgraphics.js 6 ** Last changed..: 31 Aug 20037 ** Notes.........: Modified for Image Editor, added extra commands3 ** Last changed..: 2 November 2007 by Raimund Meyer updated to new version 4 ** Notes.........: Modified by Xiang Wei ZHUO <wei@zhuo.org> for Image Editor, added extra commands l. 690-740 8 5 **/ 9 6 10 7 /* This notice must be untouched at all times. 11 8 12 wz_jsgraphics.js v. 2.039 wz_jsgraphics.js v. 3.02 13 10 The latest version is available at 14 11 http://www.walterzorn.com … … 16 13 or http://www.walterzorn.de 17 14 18 Copyright (c) 2002-2003 Walter Zorn. All rights reserved. 19 Created 3. 11. 2002 by Walter Zorn <walter@kreuzotter.de> 20 Last modified: 11. 6. 2003 15 Copyright (c) 2002-2004 Walter Zorn. All rights reserved. 16 Created 3. 11. 2002 by Walter Zorn (Web: http://www.walterzorn.com ) 17 Last modified: 26. 10. 2007 18 19 Performance optimizations for Internet Explorer 20 by Thomas Frank and John Holdsworth. 21 fillPolygon method implemented by Matthieu Haller. 21 22 22 23 High Performance JavaScript Graphics Library. 23 24 Provides methods 24 25 - to draw lines, rectangles, ellipses, polygons 25 with specifiable line thickness,26 - to fill rectangles and ellipses26 with specifiable line thickness, 27 - to fill rectangles, polygons, ellipses and arcs 27 28 - to draw text. 28 29 NOTE: Operations, functions and branching have rather been optimized 29 30 to efficiency and speed than to shortness of source code. 30 31 31 This program is free software; 32 you can redistribute it and/or modify it under the terms of the 33 GNU General Public License as published by the Free Software Foundation; 34 either version 2 of the License, or (at your option) any later version. 35 This program is distributed in the hope that it will be useful, 36 but WITHOUT ANY WARRANTY; 37 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 38 See the GNU General Public License 39 at http://www.gnu.org/copyleft/gpl.html for more details. 32 LICENSE: LGPL 33 34 This library is free software; you can redistribute it and/or 35 modify it under the terms of the GNU Lesser General Public 36 License (LGPL) as published by the Free Software Foundation; either 37 version 2.1 of the License, or (at your option) any later version. 38 39 This library is distributed in the hope that it will be useful, 40 but WITHOUT ANY WARRANTY; without even the implied warranty of 41 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 42 Lesser General Public License for more details. 43 44 You should have received a copy of the GNU Lesser General Public 45 License along with this library; if not, write to the Free Software 46 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA, 47 or see http://www.gnu.org/copyleft/lesser.html 40 48 */ 41 49 42 var jg_ihtm, jg_ie, jg_dom, jg_n4 = (document.layers && typeof document.classes != "undefined"); 43 44 function chkDHTM(x, i) 45 { 46 x = document.body || null; 47 jg_ie = (x && typeof x.insertAdjacentHTML != "undefined"); 48 jg_dom = (x && !jg_ie && 49 typeof x.appendChild != "undefined" && 50 typeof document.createRange != "undefined" && 51 typeof (i = document.createRange()).setStartBefore != "undefined" && 52 typeof i.createContextualFragment != "undefined"); 53 jg_ihtm = (!jg_ie && !jg_dom && x && typeof x.innerHTML != "undefined"); 54 } 55 56 function pntDoc() 57 { 58 this.wnd.document.write(this.htm); 59 this.htm = ''; 60 } 61 62 function pntCnvDom() 63 { 64 var x = document.createRange(); 65 x.setStartBefore(this.cnv); 66 x = x.createContextualFragment(this.htm); 67 this.cnv.appendChild(x); 68 this.htm = ''; 69 } 70 71 function pntCnvIe() 72 { 73 this.cnv.insertAdjacentHTML("BeforeEnd", this.htm); 74 this.htm = ''; 75 } 76 77 function pntCnvIhtm() 78 { 79 this.cnv.innerHTML += this.htm; 80 this.htm = ''; 81 } 82 83 function pntCnv() 84 { 85 this.htm = ''; 86 } 87 88 function mkDiv(x, y, w, h) 89 { 90 this.htm += '<div style="position:absolute;'+ 91 'left:' + x + 'px;'+ 92 'top:' + y + 'px;'+ 93 'width:' + w + 'px;'+ 94 'height:' + h + 'px;'+ 95 'clip:rect(0,'+w+'px,'+h+'px,0);'+ 96 'overflow:hidden;background-color:' + this.color + ';'+ 97 '"><\/div>'; 98 99 //alert(this.htm); 100 } 101 102 function mkDivPrint(x, y, w, h) 103 { 104 this.htm += '<div style="position:absolute;'+ 105 'border-left:' + w + 'px solid ' + this.color + ';'+ 106 'left:' + x + 'px;'+ 107 'top:' + y + 'px;'+ 108 'width:' + w + 'px;'+ 109 'height:' + h + 'px;'+ 110 'clip:rect(0,'+w+'px,'+h+'px,0);'+ 111 'overflow:hidden;background-color:' + this.color + ';'+ 112 '"><\/div>'; 113 } 114 115 function mkLyr(x, y, w, h) 116 { 117 this.htm += '<layer '+ 118 'left="' + x + '" '+ 119 'top="' + y + '" '+ 120 'width="' + w + '" '+ 121 'height="' + h + '" '+ 122 'bgcolor="' + this.color + '"><\/layer>\n'; 123 } 124 125 function mkLbl(txt, x, y) 126 { 127 this.htm += '<div style="position:absolute;white-space:nowrap;'+ 128 'left:' + x + 'px;'+ 129 'top:' + y + 'px;'+ 130 'font-family:' + this.ftFam + ';'+ 131 'font-size:' + this.ftSz + ';'+ 132 'color:' + this.color + ';' + this.ftSty + '">'+ 133 txt + 134 '<\/div>'; 135 } 136 137 function mkLin(x1, y1, x2, y2) 138 { 139 if (x1 > x2) 140 { 141 var _x2 = x2; 142 var _y2 = y2; 143 x2 = x1; 144 y2 = y1; 145 x1 = _x2; 146 y1 = _y2; 147 } 148 var dx = x2-x1, dy = Math.abs(y2-y1), 149 x = x1, y = y1, 150 yIncr = (y1 > y2)? -1 : 1; 151 152 if (dx >= dy) 153 { 154 var pr = dy<<1, 155 pru = pr - (dx<<1), 156 p = pr-dx, 157 ox = x; 158 while ((dx--) > 0) 159 { 160 ++x; 161 if (p > 0) 162 { 163 this.mkDiv(ox, y, x-ox, 1); 164 y += yIncr; 165 p += pru; 166 ox = x; 167 } 168 else p += pr; 169 } 170 this.mkDiv(ox, y, x2-ox+1, 1); 171 } 172 173 else 174 { 175 var pr = dx<<1, 176 pru = pr - (dy<<1), 177 p = pr-dy, 178 oy = y; 179 if (y2 <= y1) 180 { 181 while ((dy--) > 0) 182 { 183 if (p > 0) 184 { 185 this.mkDiv(x++, y, 1, oy-y+1); 186 y += yIncr; 187 p += pru; 188 oy = y; 189 } 190 else 191 { 192 y += yIncr; 193 p += pr; 194 } 195 } 196 this.mkDiv(x2, y2, 1, oy-y2+1); 197 } 198 else 199 { 200 while ((dy--) > 0) 201 { 202 y += yIncr; 203 if (p > 0) 204 { 205 this.mkDiv(x++, oy, 1, y-oy); 206 p += pru; 207 oy = y; 208 } 209 else p += pr; 210 } 211 this.mkDiv(x2, oy, 1, y2-oy+1); 212 } 213 } 214 } 215 216 function mkLin2D(x1, y1, x2, y2) 217 { 218 if (x1 > x2) 219 { 220 var _x2 = x2; 221 var _y2 = y2; 222 x2 = x1; 223 y2 = y1; 224 x1 = _x2; 225 y1 = _y2; 226 } 227 var dx = x2-x1, dy = Math.abs(y2-y1), 228 x = x1, y = y1, 229 yIncr = (y1 > y2)? -1 : 1; 230 231 232 var s = this.stroke; 233 if (dx >= dy) 234 { 235 if (s-0x3 > 0) 236 { 237 var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx; 238 _s = (!(s-0x4)? Math.ceil(_s) : Math.round(_s)) + 1; 239 } 240 else var _s = s; 241 var ad = Math.ceil(s/2); 242 243 var pr = dy<<1, 244 pru = pr - (dx<<1), 245 p = pr-dx, 246 ox = x; 247 while ((dx--) > 0) 248 { 249 ++x; 250 if (p > 0) 251 { 252 this.mkDiv(ox, y, x-ox+ad, _s); 253 y += yIncr; 254 p += pru; 255 ox = x; 256 } 257 else p += pr; 258 } 259 this.mkDiv(ox, y, x2-ox+ad+1, _s); 260 } 261 262 else 263 { 264 if (s-0x3 > 0) 265 { 266 var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy; 267 _s = (!(s-0x4)? Math.ceil(_s) : Math.round(_s)) + 1; 268 } 269 else var _s = s; 270 var ad = Math.round(s/2); 271 272 var pr = dx<<1, 273 pru = pr - (dy<<1), 274 p = pr-dy, 275 oy = y; 276 if (y2 <= y1) 277 { 278 ++ad; 279 while ((dy--) > 0) 280 { 281 if (p > 0) 282 { 283 this.mkDiv(x++, y, _s, oy-y+ad); 284 y += yIncr; 285 p += pru; 286 oy = y; 287 } 288 else 289 { 290 y += yIncr; 291 p += pr; 292 } 293 } 294 this.mkDiv(x2, y2, _s, oy-y2+ad); 295 } 296 else 297 { 298 while ((dy--) > 0) 299 { 300 y += yIncr; 301 if (p > 0) 302 { 303 this.mkDiv(x++, oy, _s, y-oy+ad); 304 p += pru; 305 oy = y; 306 } 307 else p += pr; 308 } 309 this.mkDiv(x2, oy, _s, y2-oy+ad+1); 310 } 311 } 312 } 313 314 function mkLinDott(x1, y1, x2, y2) 315 { 316 if (x1 > x2) 317 { 318 var _x2 = x2; 319 var _y2 = y2; 320 x2 = x1; 321 y2 = y1; 322 x1 = _x2; 323 y1 = _y2; 324 } 325 var dx = x2-x1, dy = Math.abs(y2-y1), 326 x = x1, y = y1, 327 yIncr = (y1 > y2)? -1 : 1, 328 drw = true; 329 if (dx >= dy) 330 { 331 var pr = dy<<1, 332 pru = pr - (dx<<1), 333 p = pr-dx; 334 while ((dx--) > 0) 335 { 336 if (drw) this.mkDiv(x, y, 1, 1); 337 drw = !drw; 338 if (p > 0) 339 { 340 y += yIncr; 341 p += pru; 342 } 343 else p += pr; 344 ++x; 345 } 346 if (drw) this.mkDiv(x, y, 1, 1); 347 } 348 349 else 350 { 351 var pr = dx<<1, 352 pru = pr - (dy<<1), 353 p = pr-dy; 354 while ((dy--) > 0) 355 { 356 if (drw) this.mkDiv(x, y, 1, 1); 357 drw = !drw; 358 y += yIncr; 359 if (p > 0) 360 { 361 ++x; 362 p += pru; 363 } 364 else p += pr; 365 } 366 if (drw) this.mkDiv(x, y, 1, 1); 367 } 368 } 369 370 function mkOv(left, top, width, height) 371 { 372 var a = width>>1, b = height>>1, 373 wod = width&1, hod = (height&1)+1, 374 cx = left+a, cy = top+b, 375 x = 0, y = b, 376 ox = 0, oy = b, 377 aa = (a*a)<<1, bb = (b*b)<<1, 378 st = (aa>>1)*(1-(b<<1)) + bb, 379 tt = (bb>>1) - aa*((b<<1)-1), 380 w, h; 381 while (y > 0) 382 { 383 if (st < 0) 384 { 385 st += bb*((x<<1)+0x3); 386 tt += (bb<<1)*(++x); 387 } 388 else if (tt < 0) 389 { 390 st += bb*((x<<1)+0x3) - (aa<<1)*(y-1); 391 tt += (bb<<1)*(++x) - aa*(((y--)<<1)-0x3); 392 w = x-ox; 393 h = oy-y; 394 if (w&0x2 && h&0x2) 395 { 396 this.mkOvQds(cx, cy, -x+0x2, ox+wod, -oy, oy-1+hod, 1, 1); 397 this.mkOvQds(cx, cy, -x+1, x-1+wod, -y-1, y+hod, 1, 1); 398 } 399 else this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, oy-h+hod, w, h); 400 ox = x; 401 oy = y; 402 } 403 else 404 { 405 tt -= aa*((y<<1)-0x3); 406 st -= (aa<<1)*(--y); 407 } 408 } 409 this.mkDiv(cx-a, cy-oy, a-ox+1, (oy<<1)+hod); 410 this.mkDiv(cx+ox+wod, cy-oy, a-ox+1, (oy<<1)+hod); 411 } 412 413 function mkOv2D(left, top, width, height) 414 { 415 var s = this.stroke; 416 width += s-1; 417 height += s-1; 418 var a = width>>1, b = height>>1, 419 wod = width&1, hod = (height&1)+1, 420 cx = left+a, cy = top+b, 421 x = 0, y = b, 422 aa = (a*a)<<1, bb = (b*b)<<1, 423 st = (aa>>1)*(1-(b<<1)) + bb, 424 tt = (bb>>1) - aa*((b<<1)-1); 425 426 427 if (s-0x4 < 0 && (!(s-0x2) || width-0x33 > 0 && height-0x33 > 0)) 428 { 429 var ox = 0, oy = b, 430 w, h, 431 pxl, pxr, pxt, pxb, pxw; 432 while (y > 0) 433 { 434 if (st < 0) 435 { 436 st += bb*((x<<1)+0x3); 437 tt += (bb<<1)*(++x); 438 } 439 else if (tt < 0) 440 { 441 st += bb*((x<<1)+0x3) - (aa<<1)*(y-1); 442 tt += (bb<<1)*(++x) - aa*(((y--)<<1)-0x3); 443 w = x-ox; 444 h = oy-y; 445 446 if (w-1) 447 { 448 pxw = w+1+(s&1); 449 h = s; 450 } 451 else if (h-1) 452 { 453 pxw = s; 454 h += 1+(s&1); 455 } 456 else pxw = h = s; 457 this.mkOvQds(cx, cy, -x+1, ox-pxw+w+wod, -oy, -h+oy+hod, pxw, h); 458 ox = x; 459 oy = y; 460 } 461 else 462 { 463 tt -= aa*((y<<1)-0x3); 464 st -= (aa<<1)*(--y); 465 } 466 } 467 this.mkDiv(cx-a, cy-oy, s, (oy<<1)+hod); 468 this.mkDiv(cx+a+wod-s+1, cy-oy, s, (oy<<1)+hod); 469 } 470 471 472 else 473 { 474 var _a = (width-((s-1)<<1))>>1, 475 _b = (height-((s-1)<<1))>>1, 476 _x = 0, _y = _b, 477 _aa = (_a*_a)<<1, _bb = (_b*_b)<<1, 478 _st = (_aa>>1)*(1-(_b<<1)) + _bb, 479 _tt = (_bb>>1) - _aa*((_b<<1)-1), 480 481 pxl = new Array(), 482 pxt = new Array(), 483 _pxb = new Array(); 484 pxl[0] = 0; 485 pxt[0] = b; 486 _pxb[0] = _b-1; 487 while (y > 0) 488 { 489 if (st < 0) 490 { 491 st += bb*((x<<1)+0x3); 492 tt += (bb<<1)*(++x); 493 pxl[pxl.length] = x; 494 pxt[pxt.length] = y; 495 } 496 else if (tt < 0) 497 { 498 st += bb*((x<<1)+0x3) - (aa<<1)*(y-1); 499 tt += (bb<<1)*(++x) - aa*(((y--)<<1)-0x3); 500 pxl[pxl.length] = x; 501 pxt[pxt.length] = y; 502 } 503 else 504 { 505 tt -= aa*((y<<1)-0x3); 506 st -= (aa<<1)*(--y); 507 } 508 509 if (_y > 0) 510 { 511 if (_st < 0) 512 { 513 _st += _bb*((_x<<1)+0x3); 514 _tt += (_bb<<1)*(++_x); 515 _pxb[_pxb.length] = _y-1; 516 } 517 else if (_tt < 0) 518 { 519 _st += _bb*((_x<<1)+0x3) - (_aa<<1)*(_y-1); 520 _tt += (_bb<<1)*(++_x) - _aa*(((_y--)<<1)-0x3); 521 _pxb[_pxb.length] = _y-1; 522 } 523 else 524 { 525 _tt -= _aa*((_y<<1)-0x3); 526 _st -= (_aa<<1)*(--_y); 527 _pxb[_pxb.length-1]--; 528 } 529 } 530 } 531 532 var ox = 0, oy = b, 533 _oy = _pxb[0], 534 l = pxl.length, 535 w, h; 536 for (var i = 0; i < l; i++) 537 { 538 if (typeof _pxb[i] != "undefined") 539 { 540 if (_pxb[i] < _oy || pxt[i] < oy) 541 { 542 x = pxl[i]; 543 this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, _oy+hod, x-ox, oy-_oy); 544 ox = x; 545 oy = pxt[i]; 546 _oy = _pxb[i]; 547 } 548 } 549 else 550 { 551 x = pxl[i]; 552 this.mkDiv(cx-x+1, cy-oy, 1, (oy<<1)+hod); 553 this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod); 554 ox = x; 555 oy = pxt[i]; 556 } 557 } 558 this.mkDiv(cx-a, cy-oy, 1, (oy<<1)+hod); 559 this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod); 560 } 561 } 562 563 function mkOvDott(left, top, width, height) 564 { 565 var a = width>>1, b = height>>1, 566 wod = width&1, hod = height&1, 567 cx = left+a, cy = top+b, 568 x = 0, y = b, 569 aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1, 570 st = (aa2>>1)*(1-(b<<1)) + bb, 571 tt = (bb>>1) - aa2*((b<<1)-1), 572 drw = true; 573 while (y > 0) 574 { 575 if (st < 0) 576 { 577 st += bb*((x<<1)+0x3); 578 tt += (bb<<1)*(++x); 579 } 580 else if (tt < 0) 581 { 582 st += bb*((x<<1)+0x3) - aa4*(y-1); 583 tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-0x3); 584 } 585 else 586 { 587 tt -= aa2*((y<<1)-0x3); 588 st -= aa4*(--y); 589 } 590 if (drw) this.mkOvQds(cx, cy, -x, x+wod, -y, y+hod, 1, 1); 591 drw = !drw; 592 } 593 } 594 595 function mkRect(x, y, w, h) 596 { 597 var s = this.stroke; 598 this.mkDiv(x, y, w, s); 599 this.mkDiv(x+w, y, s, h); 600 this.mkDiv(x, y+h, w+s, s); 601 this.mkDiv(x, y+s, s, h-s); 602 } 603 604 function mkRectDott(x, y, w, h) 605 { 606 this.drawLine(x, y, x+w, y); 607 this.drawLine(x+w, y, x+w, y+h); 608 this.drawLine(x, y+h, x+w, y+h); 609 this.drawLine(x, y, x, y+h); 50 51 var jg_ok, jg_ie, jg_fast, jg_dom, jg_moz; 52 53 54 function _chkDHTM(x, i) 55 { 56 x = document.body || null; 57 jg_ie = x && typeof x.insertAdjacentHTML != "undefined" && document.createElement; 58 jg_dom = (x && !jg_ie && 59 typeof x.appendChild != "undefined" && 60 typeof document.createRange != "undefined" && 61 typeof (i = document.createRange()).setStartBefore != "undefined" && 62 typeof i.createContextualFragment != "undefined"); 63 jg_fast = jg_ie && document.all && !window.opera; 64 jg_moz = jg_dom && typeof x.style.MozOpacity != "undefined"; 65 jg_ok = !!(jg_ie || jg_dom); 66 } 67 68 function _pntCnvDom() 69 { 70 var x = this.wnd.document.createRange(); 71 x.setStartBefore(this.cnv); 72 x = x.createContextualFragment(jg_fast? this._htmRpc() : this.htm); 73 if(this.cnv) this.cnv.appendChild(x); 74 this.htm = ""; 75 } 76 77 function _pntCnvIe() 78 { 79 if(this.cnv) this.cnv.insertAdjacentHTML("BeforeEnd", jg_fast? this._htmRpc() : this.htm); 80 this.htm = ""; 81 } 82 83 function _pntDoc() 84 { 85 this.wnd.document.write(jg_fast? this._htmRpc() : this.htm); 86 this.htm = ''; 87 } 88 89 function _pntN() 90 { 91 ; 92 } 93 94 function _mkDiv(x, y, w, h) 95 { 96 this.htm += '<div style="position:absolute;'+ 97 'left:' + x + 'px;'+ 98 'top:' + y + 'px;'+ 99 'width:' + w + 'px;'+ 100 'height:' + h + 'px;'+ 101 'clip:rect(0,'+w+'px,'+h+'px,0);'+ 102 'background-color:' + this.color + 103 (!jg_moz? ';overflow:hidden' : '')+ 104 ';"><\/div>'; 105 } 106 107 function _mkDivIe(x, y, w, h) 108 { 109 this.htm += '%%'+this.color+';'+x+';'+y+';'+w+';'+h+';'; 110 } 111 112 function _mkDivPrt(x, y, w, h) 113 { 114 this.htm += '<div style="position:absolute;'+ 115 'border-left:' + w + 'px solid ' + this.color + ';'+ 116 'left:' + x + 'px;'+ 117 'top:' + y + 'px;'+ 118 'width:0px;'+ 119 'height:' + h + 'px;'+ 120 'clip:rect(0,'+w+'px,'+h+'px,0);'+ 121 'background-color:' + this.color + 122 (!jg_moz? ';overflow:hidden' : '')+ 123 ';"><\/div>'; 124 } 125 126 var _regex = /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g; 127 function _htmRpc() 128 { 129 return this.htm.replace( 130 _regex, 131 '<div style="overflow:hidden;position:absolute;background-color:'+ 132 '$1;left:$2;top:$3;width:$4;height:$5"></div>\n'); 133 } 134 135 function _htmPrtRpc() 136 { 137 return this.htm.replace( 138 _regex, 139 '<div style="overflow:hidden;position:absolute;background-color:'+ 140 '$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1"></div>\n'); 141 } 142 143 function _mkLin(x1, y1, x2, y2) 144 { 145 if(x1 > x2) 146 { 147 var _x2 = x2; 148 var _y2 = y2; 149 x2 = x1; 150 y2 = y1; 151 x1 = _x2; 152 y1 = _y2; 153 } 154 var dx = x2-x1, dy = Math.abs(y2-y1), 155 x = x1, y = y1, 156 yIncr = (y1 > y2)? -1 : 1; 157 158 if(dx >= dy) 159 { 160 var pr = dy<<1, 161 pru = pr - (dx<<1), 162 p = pr-dx, 163 ox = x; 164 while(dx > 0) 165 {--dx; 166 ++x; 167 if(p > 0) 168 { 169 this._mkDiv(ox, y, x-ox, 1); 170 y += yIncr; 171 p += pru; 172 ox = x; 173 } 174 else p += pr; 175 } 176 this._mkDiv(ox, y, x2-ox+1, 1); 177 } 178 179 else 180 { 181 var pr = dx<<1, 182 pru = pr - (dy<<1), 183 p = pr-dy, 184 oy = y; 185 if(y2 <= y1) 186 { 187 while(dy > 0) 188 {--dy; 189 if(p > 0) 190 { 191 this._mkDiv(x++, y, 1, oy-y+1); 192 y += yIncr; 193 p += pru; 194 oy = y; 195 } 196 else 197 { 198 y += yIncr; 199 p += pr; 200 } 201 } 202 this._mkDiv(x2, y2, 1, oy-y2+1); 203 } 204 else 205 { 206 while(dy > 0) 207 {--dy; 208 y += yIncr; 209 if(p > 0) 210 { 211 this._mkDiv(x++, oy, 1, y-oy); 212 p += pru; 213 oy = y; 214 } 215 else p += pr; 216 } 217 this._mkDiv(x2, oy, 1, y2-oy+1); 218 } 219 } 220 } 221 222 function _mkLin2D(x1, y1, x2, y2) 223 { 224 if(x1 > x2) 225 { 226 var _x2 = x2; 227 var _y2 = y2; 228 x2 = x1; 229 y2 = y1; 230 x1 = _x2; 231 y1 = _y2; 232 } 233 var dx = x2-x1, dy = Math.abs(y2-y1), 234 x = x1, y = y1, 235 yIncr = (y1 > y2)? -1 : 1; 236 237 var s = this.stroke; 238 if(dx >= dy) 239 { 240 if(dx > 0 && s-3 > 0) 241 { 242 var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx; 243 _s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1; 244 } 245 else var _s = s; 246 var ad = Math.ceil(s/2); 247 248 var pr = dy<<1, 249 pru = pr - (dx<<1), 250 p = pr-dx, 251 ox = x; 252 while(dx > 0) 253 {--dx; 254 ++x; 255 if(p > 0) 256 { 257 this._mkDiv(ox, y, x-ox+ad, _s); 258 y += yIncr; 259 p += pru; 260 ox = x; 261 } 262 else p += pr; 263 } 264 this._mkDiv(ox, y, x2-ox+ad+1, _s); 265 } 266 267 else 268 { 269 if(s-3 > 0) 270 { 271 var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy; 272 _s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1; 273 } 274 else var _s = s; 275 var ad = Math.round(s/2); 276 277 var pr = dx<<1, 278 pru = pr - (dy<<1), 279 p = pr-dy, 280 oy = y; 281 if(y2 <= y1) 282 { 283 ++ad; 284 while(dy > 0) 285 {--dy; 286 if(p > 0) 287 { 288 this._mkDiv(x++, y, _s, oy-y+ad); 289 y += yIncr; 290 p += pru; 291 oy = y; 292 } 293 else 294 { 295 y += yIncr; 296 p += pr; 297 } 298 } 299 this._mkDiv(x2, y2, _s, oy-y2+ad); 300 } 301 else 302 { 303 while(dy > 0) 304 {--dy; 305 y += yIncr; 306 if(p > 0) 307 { 308 this._mkDiv(x++, oy, _s, y-oy+ad); 309 p += pru; 310 oy = y; 311 } 312 else p += pr; 313 } 314 this._mkDiv(x2, oy, _s, y2-oy+ad+1); 315 } 316 } 317 } 318 319 function _mkLinDott(x1, y1, x2, y2) 320 { 321 if(x1 > x2) 322 { 323 var _x2 = x2; 324 var _y2 = y2; 325 x2 = x1; 326 y2 = y1; 327 x1 = _x2; 328 y1 = _y2; 329 } 330 var dx = x2-x1, dy = Math.abs(y2-y1), 331 x = x1, y = y1, 332 yIncr = (y1 > y2)? -1 : 1, 333 drw = true; 334 if(dx >= dy) 335 { 336 var pr = dy<<1, 337 pru = pr - (dx<<1), 338 p = pr-dx; 339 while(dx > 0) 340 {--dx; 341 if(drw) this._mkDiv(x, y, 1, 1); 342 drw = !drw; 343 if(p > 0) 344 { 345 y += yIncr; 346 p += pru; 347 } 348 else p += pr; 349 ++x; 350 } 351 } 352 else 353 { 354 var pr = dx<<1, 355 pru = pr - (dy<<1), 356 p = pr-dy; 357 while(dy > 0) 358 {--dy; 359 if(drw) this._mkDiv(x, y, 1, 1); 360 drw = !drw; 361 y += yIncr; 362 if(p > 0) 363 { 364 ++x; 365 p += pru; 366 } 367 else p += pr; 368 } 369 } 370 if(drw) this._mkDiv(x, y, 1, 1); 371 } 372 373 function _mkOv(left, top, width, height) 374 { 375 var a = (++width)>>1, b = (++height)>>1, 376 wod = width&1, hod = height&1, 377 cx = left+a, cy = top+b, 378 x = 0, y = b, 379 ox = 0, oy = b, 380 aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1, 381 st = (aa2>>1)*(1-(b<<1)) + bb2, 382 tt = (bb2>>1) - aa2*((b<<1)-1), 383 w, h; 384 while(y > 0) 385 { 386 if(st < 0) 387 { 388 st += bb2*((x<<1)+3); 389 tt += bb4*(++x); 390 } 391 else if(tt < 0) 392 { 393 st += bb2*((x<<1)+3) - aa4*(y-1); 394 tt += bb4*(++x) - aa2*(((y--)<<1)-3); 395 w = x-ox; 396 h = oy-y; 397 if((w&2) && (h&2)) 398 { 399 this._mkOvQds(cx, cy, x-2, y+2, 1, 1, wod, hod); 400 this._mkOvQds(cx, cy, x-1, y+1, 1, 1, wod, hod); 401 } 402 else this._mkOvQds(cx, cy, x-1, oy, w, h, wod, hod); 403 ox = x; 404 oy = y; 405 } 406 else 407 { 408 tt -= aa2*((y<<1)-3); 409 st -= aa4*(--y); 410 } 411 } 412 w = a-ox+1; 413 h = (oy<<1)+hod; 414 y = cy-oy; 415 this._mkDiv(cx-a, y, w, h); 416 this._mkDiv(cx+ox+wod-1, y, w, h); 417 } 418 419 function _mkOv2D(left, top, width, height) 420 { 421 var s = this.stroke; 422 width += s+1; 423 height += s+1; 424 var a = width>>1, b = height>>1, 425 wod = width&1, hod = height&1, 426 cx = left+a, cy = top+b, 427 x = 0, y = b, 428 aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1, 429 st = (aa2>>1)*(1-(b<<1)) + bb2, 430 tt = (bb2>>1) - aa2*((b<<1)-1); 431 432 if(s-4 < 0 && (!(s-2) || width-51 > 0 && height-51 > 0)) 433 { 434 var ox = 0, oy = b, 435 w, h, 436 pxw; 437 while(y > 0) 438 { 439 if(st < 0) 440 { 441 st += bb2*((x<<1)+3); 442 tt += bb4*(++x); 443 } 444 else if(tt < 0) 445 { 446 st += bb2*((x<<1)+3) - aa4*(y-1); 447 tt += bb4*(++x) - aa2*(((y--)<<1)-3); 448 w = x-ox; 449 h = oy-y; 450 451 if(w-1) 452 { 453 pxw = w+1+(s&1); 454 h = s; 455 } 456 else if(h-1) 457 { 458 pxw = s; 459 h += 1+(s&1); 460 } 461 else pxw = h = s; 462 this._mkOvQds(cx, cy, x-1, oy, pxw, h, wod, hod); 463 ox = x; 464 oy = y; 465 } 466 else 467 { 468 tt -= aa2*((y<<1)-3); 469 st -= aa4*(--y); 470 } 471 } 472 this._mkDiv(cx-a, cy-oy, s, (oy<<1)+hod); 473 this._mkDiv(cx+a+wod-s, cy-oy, s, (oy<<1)+hod); 474 } 475 476 else 477 { 478 var _a = (width-(s<<1))>>1, 479 _b = (height-(s<<1))>>1, 480 _x = 0, _y = _b, 481 _aa2 = (_a*_a)<<1, _aa4 = _aa2<<1, _bb2 = (_b*_b)<<1, _bb4 = _bb2<<1, 482 _st = (_aa2>>1)*(1-(_b<<1)) + _bb2, 483 _tt = (_bb2>>1) - _aa2*((_b<<1)-1), 484 485 pxl = new Array(), 486 pxt = new Array(), 487 _pxb = new Array(); 488 pxl[0] = 0; 489 pxt[0] = b; 490 _pxb[0] = _b-1; 491 while(y > 0) 492 { 493 if(st < 0) 494 { 495 pxl[pxl.length] = x; 496 pxt[pxt.length] = y; 497 st += bb2*((x<<1)+3); 498 tt += bb4*(++x); 499 } 500 else if(tt < 0) 501 { 502 pxl[pxl.length] = x; 503 st += bb2*((x<<1)+3) - aa4*(y-1); 504 tt += bb4*(++x) - aa2*(((y--)<<1)-3); 505 pxt[pxt.length] = y; 506 } 507 else 508 { 509 tt -= aa2*((y<<1)-3); 510 st -= aa4*(--y); 511 } 512 513 if(_y > 0) 514 { 515 if(_st < 0) 516 { 517 _st += _bb2*((_x<<1)+3); 518 _tt += _bb4*(++_x); 519 _pxb[_pxb.length] = _y-1; 520 } 521 else if(_tt < 0) 522 { 523 _st += _bb2*((_x<<1)+3) - _aa4*(_y-1); 524 _tt += _bb4*(++_x) - _aa2*(((_y--)<<1)-3); 525 _pxb[_pxb.length] = _y-1; 526 } 527 else 528 { 529 _tt -= _aa2*((_y<<1)-3); 530 _st -= _aa4*(--_y); 531 _pxb[_pxb.length-1]--; 532 } 533 } 534 } 535 536 var ox = -wod, oy = b, 537 _oy = _pxb[0], 538 l = pxl.length, 539 w, h; 540 for(var i = 0; i < l; i++) 541 { 542 if(typeof _pxb[i] != "undefined") 543 { 544 if(_pxb[i] < _oy || pxt[i] < oy) 545 { 546 x = pxl[i]; 547 this._mkOvQds(cx, cy, x, oy, x-ox, oy-_oy, wod, hod); 548 ox = x; 549 oy = pxt[i]; 550 _oy = _pxb[i]; 551 } 552 } 553 else 554 { 555 x = pxl[i]; 556 this._mkDiv(cx-x, cy-oy, 1, (oy<<1)+hod); 557 this._mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod); 558 ox = x; 559 oy = pxt[i]; 560 } 561 } 562 this._mkDiv(cx-a, cy-oy, 1, (oy<<1)+hod); 563 this._mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod); 564 } 565 } 566 567 function _mkOvDott(left, top, width, height) 568 { 569 var a = (++width)>>1, b = (++height)>>1, 570 wod = width&1, hod = height&1, hodu = hod^1, 571 cx = left+a, cy = top+b, 572 x = 0, y = b, 573 aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1, 574 st = (aa2>>1)*(1-(b<<1)) + bb2, 575 tt = (bb2>>1) - aa2*((b<<1)-1), 576 drw = true; 577 while(y > 0) 578 { 579 if(st < 0) 580 { 581 st += bb2*((x<<1)+3); 582 tt += bb4*(++x); 583 } 584 else if(tt < 0) 585 { 586 st += bb2*((x<<1)+3) - aa4*(y-1); 587 tt += bb4*(++x) - aa2*(((y--)<<1)-3); 588 } 589 else 590 { 591 tt -= aa2*((y<<1)-3); 592 st -= aa4*(--y); 593 } 594 if(drw && y >= hodu) this._mkOvQds(cx, cy, x, y, 1, 1, wod, hod); 595 drw = !drw; 596 } 597 } 598 599 function _mkRect(x, y, w, h) 600 { 601 var s = this.stroke; 602 this._mkDiv(x, y, w, s); 603 this._mkDiv(x+w, y, s, h); 604 this._mkDiv(x, y+h, w+s, s); 605 this._mkDiv(x, y+s, s, h-s); 606 } 607 608 function _mkRectDott(x, y, w, h) 609 { 610 this.drawLine(x, y, x+w, y); 611 this.drawLine(x+w, y, x+w, y+h); 612 this.drawLine(x, y+h, x+w, y+h); 613 this.drawLine(x, y, x, y+h); 610 614 } 611 615 612 616 function jsgFont() 613 617 { 614 this.PLAIN = 'font-weight:normal;';615 this.BOLD = 'font-weight:bold;';616 this.ITALIC = 'font-style:italic;';617 this.ITALIC_BOLD = this.ITALIC + this.BOLD;618 this.BOLD_ITALIC = this.ITALIC_BOLD;618 this.PLAIN = 'font-weight:normal;'; 619 this.BOLD = 'font-weight:bold;'; 620 this.ITALIC = 'font-style:italic;'; 621 this.ITALIC_BOLD = this.ITALIC + this.BOLD; 622 this.BOLD_ITALIC = this.ITALIC_BOLD; 619 623 } 620 624 var Font = new jsgFont(); … … 622 626 function jsgStroke() 623 627 { 624 this.DOTTED = -1; 625 } 626 628 this.DOTTED = -1; 629 } 627 630 var Stroke = new jsgStroke(); 628 631 629 function jsGraphics(id, wnd) 630 { 631 this.setColor = new Function('arg', 'this.color = arg;'); 632 633 632 function jsGraphics(cnv, wnd) 633 { 634 this.setColor = function(x) 635 { 636 this.color = x.toLowerCase(); 637 }; 638 639 this.setStroke = function(x) 640 { 641 this.stroke = x; 642 if(!(x+1)) 643 { 644 this.drawLine = _mkLinDott; 645 this._mkOv = _mkOvDott; 646 this.drawRect = _mkRectDott; 647 } 648 else if(x-1 > 0) 649 { 650 this.drawLine = _mkLin2D; 651 this._mkOv = _mkOv2D; 652 this.drawRect = _mkRect; 653 } 654 else 655 { 656 this.drawLine = _mkLin; 657 this._mkOv = _mkOv; 658 this.drawRect = _mkRect; 659 } 660 }; 661 662 this.setPrintable = function(arg) 663 { 664 this.printable = arg; 665 if(jg_fast) 666 { 667 this._mkDiv = _mkDivIe; 668 this._htmRpc = arg? _htmPrtRpc : _htmRpc; 669 } 670 else this._mkDiv = arg? _mkDivPrt : _mkDiv; 671 }; 672 673 this.setFont = function(fam, sz, sty) 674 { 675 this.ftFam = fam; 676 this.ftSz = sz; 677 this.ftSty = sty || Font.PLAIN; 678 }; 679 680 this.drawPolyline = this.drawPolyLine = function(x, y) 681 { 682 for (var i=x.length - 1; i;) 683 {--i; 684 this.drawLine(x[i], y[i], x[i+1], y[i+1]); 685 } 686 }; 687 /************** Xinha added *******************************************/ 688 689 this.setColor = new Function('arg', 'this.color = arg;'); 634 690 this.getColor = new Function('return this.color'); 635 691 636 this.setStroke = function(x) 637 { 638 this.stroke = x; 639 if (!(x+1)) 640 { 641 this.drawLine = mkLinDott; 642 this.mkOv = mkOvDott; 643 this.drawRect = mkRectDott; 644 } 645 else if (x-1 > 0) 646 { 647 this.drawLine = mkLin2D; 648 this.mkOv = mkOv2D; 649 this.drawRect = mkRect; 650 } 651 else 652 { 653 this.drawLine = mkLin; 654 this.mkOv = mkOv; 655 this.drawRect = mkRect; 656 } 657 }; 658 659 660 661 this.setPrintable = function(arg) 662 { 663 this.printable = arg; 664 this.mkDiv = jg_n4? mkLyr : arg? mkDivPrint : mkDiv; 665 }; 666 667 668 669 this.setFont = function(fam, sz, sty) 670 { 671 this.ftFam = fam; 672 this.ftSz = sz; 673 this.ftSty = sty || Font.PLAIN; 674 }; 675 676 677 678 this.drawPolyline = this.drawPolyLine = function(x, y, s) 679 { 680 var i = x.length-1; while (i >= 0) 681 this.drawLine(x[i], y[i], x[--i], y[i]); 682 }; 683 684 685 686 this.fillRect = function(x, y, w, h) 687 { 688 this.mkDiv(x, y, w, h); 689 }; 690 691 692 this.fillRect = function(x, y, w, h) 693 { 694 this._mkDiv(x, y, w, h); 695 }; 696 692 697 this.fillRectPattern = function(x, y, w, h, url) 693 698 { … … 704 709 'z-index:100;"><\/div>'; 705 710 //alert(this.htm); 706 } 711 }; 707 712 708 713 this.drawHandle = function(x, y, w, h, cursor) … … 718 723 "cursor: '" + cursor + "';"+ 719 724 '" class="handleBox" id="' + cursor + '" ><\/div>'; 720 } 721 722 this.drawHandleBox = function(x, y, w, h, cursor)725 }; 726 727 this.drawHandleBox = function(x, y, w, h, cursor) 723 728 { 724 729 … … 732 737 "cursor: '" + cursor + "';"+ 733 738 '" class="handleBox" id="' + cursor + '" ><\/div>'; 734 735 736 }737 738 this.drawPolygon = function(x, y)739 {740 this.drawPolyline(x, y);741 this.drawLine(x[x.length-1], y[x.length-1], x[0], y[0]);742 739 }; 743 740 744 745 746 this.drawEllipse = this.drawOval = function(x, y, w, h) 747 { 748 this.mkOv(x, y, w, h); 749 }; 750 751 752 753 this.fillEllipse = this.fillOval = function(left, top, w, h) 754 { 755 var a = (w -= 1)>>1, b = (h -= 1)>>1, 756 wod = (w&1)+1, hod = (h&1)+1, 757 cx = left+a, cy = top+b, 758 x = 0, y = b, 759 ox = 0, oy = b, 760 aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1, 761 st = (aa2>>1)*(1-(b<<1)) + bb, 762 tt = (bb>>1) - aa2*((b<<1)-1), 763 pxl, dw, dh; 764 if (w+1) while (y > 0) 765 { 766 if (st < 0) 767 { 768 st += bb*((x<<1)+0x3); 769 tt += (bb<<1)*(++x); 770 } 771 else if (tt < 0) 772 { 773 st += bb*((x<<1)+0x3) - aa4*(y-1); 774 pxl = cx-x; 775 dw = (x<<1)+wod; 776 tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-0x3); 777 dh = oy-y; 778 this.mkDiv(pxl, cy-oy, dw, dh); 779 this.mkDiv(pxl, cy+oy-dh+hod, dw, dh); 780 ox = x; 781 oy = y; 782 } 783 else 784 { 785 tt -= aa2*((y<<1)-0x3); 786 st -= aa4*(--y); 787 } 788 } 789 this.mkDiv(cx-a, cy-oy, w+1, (oy<<1)+hod); 790 }; 791 792 this.drawString = mkLbl; 793 794 this.clear = function() 795 { 796 this.htm = ""; 797 if (this.cnv) this.cnv.innerHTML = this.defhtm; 798 799 }; 800 801 this.mkOvQds = function(cx, cy, xl, xr, yt, yb, w, h) 802 { 803 this.mkDiv(xr+cx, yt+cy, w, h); 804 this.mkDiv(xr+cx, yb+cy, w, h); 805 this.mkDiv(xl+cx, yb+cy, w, h); 806 this.mkDiv(xl+cx, yt+cy, w, h); 807 }; 808 809 this.setStroke(1); 810 this.setPrintable(false); 811 this.setFont('verdana,geneva,helvetica,sans-serif', String.fromCharCode(0x31, 0x32, 0x70, 0x78), Font.PLAIN); 812 this.color = '#000000'; 813 this.htm = ''; 814 this.wnd = wnd || window; 815 816 if (!(jg_ie || jg_dom || jg_ihtm)) chkDHTM(); 817 if (typeof id != 'string' || !id) this.paint = pntDoc; 818 else 819 { 820 this.cnv = document.all? (this.wnd.document.all[id] || null) 821 : document.getElementById? (this.wnd.document.getElementById(id) || null) 822 : null; 823 this.defhtm = (this.cnv && this.cnv.innerHTML)? this.cnv.innerHTML : ''; 824 this.paint = jg_dom? pntCnvDom : jg_ie? pntCnvIe : jg_ihtm? pntCnvIhtm : pntCnv; 825 } 826 } 741 /************** end Xinha added *******************************************/ 742 this.drawPolygon = function(x, y) 743 { 744 this.drawPolyline(x, y); 745 this.drawLine(x[x.length-1], y[x.length-1], x[0], y[0]); 746 }; 747 748 this.drawEllipse = this.drawOval = function(x, y, w, h) 749 { 750 this._mkOv(x, y, w, h); 751 }; 752 753 this.fillEllipse = this.fillOval = function(left, top, w, h) 754 { 755 var a = w>>1, b = h>>1, 756 wod = w&1, hod = h&1, 757 cx = left+a, cy = top+b, 758 x = 0, y = b, oy = b, 759 aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1, 760 st = (aa2>>1)*(1-(b<<1)) + bb2, 761 tt = (bb2>>1) - aa2*((b<<1)-1), 762 xl, dw, dh; 763 if(w) while(y > 0) 764 { 765 if(st < 0) 766 { 767 st += bb2*((x<<1)+3); 768 tt += bb4*(++x); 769 } 770 else if(tt < 0) 771 { 772 st += bb2*((x<<1)+3) - aa4*(y-1); 773 xl = cx-x; 774 dw = (x<<1)+wod; 775 tt += bb4*(++x) - aa2*(((y--)<<1)-3); 776 dh = oy-y; 777 this._mkDiv(xl, cy-oy, dw, dh); 778 this._mkDiv(xl, cy+y+hod, dw, dh); 779 oy = y; 780 } 781 else 782 { 783 tt -= aa2*((y<<1)-3); 784 st -= aa4*(--y); 785 } 786 } 787 this._mkDiv(cx-a, cy-oy, w, (oy<<1)+hod); 788 }; 789 790 this.fillArc = function(iL, iT, iW, iH, fAngA, fAngZ) 791 { 792 var a = iW>>1, b = iH>>1, 793 iOdds = (iW&1) | ((iH&1) << 16), 794 cx = iL+a, cy = iT+b, 795 x = 0, y = b, ox = x, oy = y, 796 aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1, 797 st = (aa2>>1)*(1-(b<<1)) + bb2, 798 tt = (bb2>>1) - aa2*((b<<1)-1), 799 // Vars for radial boundary lines 800 xEndA, yEndA, xEndZ, yEndZ, 801 iSects = (1 << (Math.floor((fAngA %= 360.0)/180.0) << 3)) 802 | (2 << (Math.floor((fAngZ %= 360.0)/180.0) << 3)) 803 | ((fAngA >= fAngZ) << 16), 804 aBndA = new Array(b+1), aBndZ = new Array(b+1); 805 806 // Set up radial boundary lines 807 fAngA *= Math.PI/180.0; 808 fAngZ *= Math.PI/180.0; 809 xEndA = cx+Math.round(a*Math.cos(fAngA)); 810 yEndA = cy+Math.round(-b*Math.sin(fAngA)); 811 _mkLinVirt(aBndA, cx, cy, xEndA, yEndA); 812 xEndZ = cx+Math.round(a*Math.cos(fAngZ)); 813 yEndZ = cy+Math.round(-b*Math.sin(fAngZ)); 814 _mkLinVirt(aBndZ, cx, cy, xEndZ, yEndZ); 815 816 while(y > 0) 817 { 818 if(st < 0) // Advance x 819 { 820 st += bb2*((x<<1)+3); 821 tt += bb4*(++x); 822 } 823 else if(tt < 0) // Advance x and y 824 { 825 st += bb2*((x<<1)+3) - aa4*(y-1); 826 ox = x; 827 tt += bb4*(++x) - aa2*(((y--)<<1)-3); 828 this._mkArcDiv(ox, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects); 829 oy = y; 830 } 831 else // Advance y 832 { 833 tt -= aa2*((y<<1)-3); 834 st -= aa4*(--y); 835 if(y && (aBndA[y] != aBndA[y-1] || aBndZ[y] != aBndZ[y-1])) 836 { 837 this._mkArcDiv(x, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects); 838 ox = x; 839 oy = y; 840 } 841 } 842 } 843 this._mkArcDiv(x, 0, oy, cx, cy, iOdds, aBndA, aBndZ, iSects); 844 if(iOdds >> 16) // Odd height 845 { 846 if(iSects >> 16) // Start-angle > end-angle 847 { 848 var xl = (yEndA <= cy || yEndZ > cy)? (cx - x) : cx; 849 this._mkDiv(xl, cy, x + cx - xl + (iOdds & 0xffff), 1); 850 } 851 else if((iSects & 0x01) && yEndZ > cy) 852 this._mkDiv(cx - x, cy, x, 1); 853 } 854 }; 855 856 /* fillPolygon method, implemented by Matthieu Haller. 857 This javascript function is an adaptation of the gdImageFilledPolygon for Walter Zorn lib. 858 C source of GD 1.8.4 found at http://www.boutell.com/gd/ 859 860 THANKS to Kirsten Schulz for the polygon fixes! 861 862 The intersection finding technique of this code could be improved 863 by remembering the previous intertersection, and by using the slope. 864 That could help to adjust intersections to produce a nice 865 interior_extrema. */ 866 this.fillPolygon = function(array_x, array_y) 867 { 868 var i; 869 var y; 870 var miny, maxy; 871 var x1, y1; 872 var x2, y2; 873 var ind1, ind2; 874 var ints; 875 876 var n = array_x.length; 877 if(!n) return; 878 879 miny = array_y[0]; 880 maxy = array_y[0]; 881 for(i = 1; i < n; i++) 882 { 883 if(array_y[i] < miny) 884 miny = array_y[i]; 885 886 if(array_y[i] > maxy) 887 maxy = array_y[i]; 888 } 889 for(y = miny; y <= maxy; y++) 890 { 891 var polyInts = new Array(); 892 ints = 0; 893 for(i = 0; i < n; i++) 894 { 895 if(!i) 896 { 897 ind1 = n-1; 898 ind2 = 0; 899 } 900 else 901 { 902 ind1 = i-1; 903 ind2 = i; 904 } 905 y1 = array_y[ind1]; 906 y2 = array_y[ind2]; 907 if(y1 < y2) 908 { 909 x1 = array_x[ind1]; 910 x2 = array_x[ind2]; 911 } 912 else if(y1 > y2) 913 { 914 y2 = array_y[ind1]; 915 y1 = array_y[ind2]; 916 x2 = array_x[ind1]; 917 x1 = array_x[ind2]; 918 } 919 else continue; 920 921 // Modified 11. 2. 2004 Walter Zorn 922 if((y >= y1) && (y < y2)) 923 polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1); 924 925 else if((y == maxy) && (y > y1) && (y <= y2)) 926 polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1); 927 } 928 polyInts.sort(_CompInt); 929 for(i = 0; i < ints; i+=2) 930 this._mkDiv(polyInts[i], y, polyInts[i+1]-polyInts[i]+1, 1); 931 } 932 }; 933 934 this.drawString = function(txt, x, y) 935 { 936 this.htm += '<div style="position:absolute;white-space:nowrap;'+ 937 'left:' + x + 'px;'+ 938 'top:' + y + 'px;'+ 939 'font-family:' + this.ftFam + ';'+ 940 'font-size:' + this.ftSz + ';'+ 941 'color:' + this.color + ';' + this.ftSty + '">'+ 942 txt + 943 '<\/div>'; 944 }; 945 946 /* drawStringRect() added by Rick Blommers. 947 Allows to specify the size of the text rectangle and to align the 948 text both horizontally (e.g. right) and vertically within that rectangle */ 949 this.drawStringRect = function(txt, x, y, width, halign) 950 { 951 this.htm += '<div style="position:absolute;overflow:hidden;'+ 952 'left:' + x + 'px;'+ 953 'top:' + y + 'px;'+ 954 'width:'+width +'px;'+ 955 'text-align:'+halign+';'+ 956 'font-family:' + this.ftFam + ';'+ 957 'font-size:' + this.ftSz + ';'+ 958 'color:' + this.color + ';' + this.ftSty + '">'+ 959 txt + 960 '<\/div>'; 961 }; 962 963 this.drawImage = function(imgSrc, x, y, w, h, a) 964 { 965 this.htm += '<div style="position:absolute;'+ 966 'left:' + x + 'px;'+ 967 'top:' + y + 'px;'+ 968 'width:' + w + 'px;'+ 969 'height:' + h + 'px;">'+ 970 '<img src="' + imgSrc + '" width="' + w + '" height="' + h + '"' + (a? (' '+a) : '') + '>'+ 971 '<\/div>'; 972 }; 973 974 this.clear = function() 975 { 976 this.htm = ""; 977 if(this.cnv) this.cnv.innerHTML = ""; 978 }; 979 980 this._mkOvQds = function(cx, cy, x, y, w, h, wod, hod) 981 { 982 var xl = cx - x, xr = cx + x + wod - w, yt = cy - y, yb = cy + y + hod - h; 983 if(xr > xl+w) 984 { 985 this._mkDiv(xr, yt, w, h); 986 this._mkDiv(xr, yb, w, h); 987 } 988 else 989 w = xr - xl + w; 990 this._mkDiv(xl, yt, w, h); 991 this._mkDiv(xl, yb, w, h); 992 }; 993 994 this._mkArcDiv = function(x, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects) 995 { 996 var xrDef = cx + x + (iOdds & 0xffff), y2, h = oy - y, xl, xr, w; 997 998 if(!h) h = 1; 999 x = cx - x; 1000 1001 if(iSects & 0xff0000) // Start-angle > end-angle 1002 { 1003 y2 = cy - y - h; 1004 if(iSects & 0x00ff) 1005 { 1006 if(iSects & 0x02) 1007 { 1008 xl = Math.max(x, aBndZ[y]); 1009 w = xrDef - xl; 1010 if(w > 0) this._mkDiv(xl, y2, w, h); 1011 } 1012 if(iSects & 0x01) 1013 { 1014 xr = Math.min(xrDef, aBndA[y]); 1015 w = xr - x; 1016 if(w > 0) this._mkDiv(x, y2, w, h); 1017 } 1018 } 1019 else 1020 this._mkDiv(x, y2, xrDef - x, h); 1021 y2 = cy + y + (iOdds >> 16); 1022 if(iSects & 0xff00) 1023 { 1024 if(iSects & 0x0100) 1025 { 1026 xl = Math.max(x, aBndA[y]); 1027 w = xrDef - xl; 1028 if(w > 0) this._mkDiv(xl, y2, w, h); 1029 } 1030 if(iSects & 0x0200) 1031 { 1032 xr = Math.min(xrDef, aBndZ[y]); 1033 w = xr - x; 1034 if(w > 0) this._mkDiv(x, y2, w, h); 1035 } 1036 } 1037 else 1038 this._mkDiv(x, y2, xrDef - x, h); 1039 } 1040 else 1041 { 1042 if(iSects & 0x00ff) 1043 { 1044 if(iSects & 0x02) 1045 xl = Math.max(x, aBndZ[y]); 1046 else 1047 xl = x; 1048 if(iSects & 0x01) 1049 xr = Math.min(xrDef, aBndA[y]); 1050 else 1051 xr = xrDef; 1052 y2 = cy - y - h; 1053 w = xr - xl; 1054 if(w > 0) this._mkDiv(xl, y2, w, h); 1055 } 1056 if(iSects & 0xff00) 1057 { 1058 if(iSects & 0x0100) 1059 xl = Math.max(x, aBndA[y]); 1060 else 1061 xl = x; 1062 if(iSects & 0x0200) 1063 xr = Math.min(xrDef, aBndZ[y]); 1064 else 1065 xr = xrDef; 1066 y2 = cy + y + (iOdds >> 16); 1067 w = xr - xl; 1068 if(w > 0) this._mkDiv(xl, y2, w, h); 1069 } 1070 } 1071 }; 1072 1073 this.setStroke(1); 1074 this.setFont("verdana,geneva,helvetica,sans-serif", "12px", Font.PLAIN); 1075 this.color = "#000000"; 1076 this.htm = ""; 1077 this.wnd = wnd || window; 1078 1079 if(!jg_ok) _chkDHTM(); 1080 if(jg_ok) 1081 { 1082 if(cnv) 1083 { 1084 if(typeof(cnv) == "string") 1085 this.cont = document.all? (this.wnd.document.all[cnv] || null) 1086 : document.getElementById? (this.wnd.document.getElementById(cnv) || null) 1087 : null; 1088 else if(cnv == window.document) 1089 this.cont = document.getElementsByTagName("body")[0]; 1090 // If cnv is a direct reference to a canvas DOM node 1091 // (option suggested by Andreas Luleich) 1092 else this.cont = cnv; 1093 // Create new canvas inside container DIV. Thus the drawing and clearing 1094 // methods won't interfere with the container's inner html. 1095 // Solution suggested by Vladimir. 1096 this.cnv = this.wnd.document.createElement("div"); 1097 this.cnv.style.fontSize=0; 1098 this.cont.appendChild(this.cnv); 1099 this.paint = jg_dom? _pntCnvDom : _pntCnvIe; 1100 } 1101 else 1102 this.paint = _pntDoc; 1103 } 1104 else 1105 this.paint = _pntN; 1106 1107 this.setPrintable(false); 1108 } 1109 1110 function _mkLinVirt(aLin, x1, y1, x2, y2) 1111 { 1112 var dx = Math.abs(x2-x1), dy = Math.abs(y2-y1), 1113 x = x1, y = y1, 1114 xIncr = (x1 > x2)? -1 : 1, 1115 yIncr = (y1 > y2)? -1 : 1, 1116 p, 1117 i = 0; 1118 if(dx >= dy) 1119 { 1120 var pr = dy<<1, 1121 pru = pr - (dx<<1); 1122 p = pr-dx; 1123 while(dx > 0) 1124 {--dx; 1125 if(p > 0) // Increment y 1126 { 1127 aLin[i++] = x; 1128 y += yIncr; 1129 p += pru; 1130 } 1131 else p += pr; 1132 x += xIncr; 1133 } 1134 } 1135 else 1136 { 1137 var pr = dx<<1, 1138 pru = pr - (dy<<1); 1139 p = pr-dy; 1140 while(dy > 0) 1141 {--dy; 1142 y += yIncr; 1143 aLin[i++] = x; 1144 if(p > 0) // Increment x 1145 { 1146 x += xIncr; 1147 p += pru; 1148 } 1149 else p += pr; 1150 } 1151 } 1152 for(var len = aLin.length, i = len-i; i;) 1153 aLin[len-(i--)] = x; 1154 }; 1155 1156 function _CompInt(x, y) 1157 { 1158 return(x - y); 1159 } 1160 -
trunk/plugins/ExtendedFileManager/config.inc.php
r717 r937 26 26 */ 27 27 28 if( empty($insertMode))29 $insertMode="image";28 if(isset($_REQUEST['mode'])) $insertMode=$_REQUEST['mode']; 29 if(!isset($insertMode)) $insertMode="image"; 30 30 31 31 /** … … 65 65 /* 66 66 The URL to the above path, the web browser needs to be able to see it. 67 It can be protected via .htaccess on apache or directory permissions on IIS, 68 check you web server documentation for futher information on directory protection 69 If this directory needs to be publicly accessiable, remove scripting capabilities 70 for this directory (i.e. disable PHP, Perl, CGI). We only want to store assets 71 in this directory and its subdirectories. 67 Please remove scripting capabilities in this directory 68 for this directory (i.e. disable PHP, Perl, CGI; see .htaccess file in demo_images folder). 72 69 */ 73 70 $IMConfig['images_url'] = str_replace( array("backend.php","manager.php"), "", $_SERVER["PHP_SELF"] ) . $IMConfig['images_dir']; 74 71 //$IMConfig['files_url'] = 'url/to/files_dir'; 75 72 73 /* 74 Format of the Date Modified in list view. 75 It has to be a string understood by the PHP date() function (for possible values see http://http://php.net/manual/en/function.date.php) 76 */ 77 $IMConfig['date_format'] = "d.m.y H:i"; 76 78 /* 77 79 Possible values: true, false … … 123 125 GD does not require the following definition. 124 126 */ 125 define('IMAGE_TRANSFORM_LIB_PATH', 'C:/"Program Files"/ImageMagick-5.5.7-Q16/'); 127 define('IMAGE_TRANSFORM_LIB_PATH', '/usr/bin/'); 128 //define('IMAGE_TRANSFORM_LIB_PATH', 'C:/"Program Files"/ImageMagick-5.5.7-Q16/'); 126 129 127 130 … … 288 291 "max" - the maximum allowed by the server (the value is retrieved from the server configuration). 289 292 */ 290 $IMConfig['max_filesize_kb_image'] = 200 0000;293 $IMConfig['max_filesize_kb_image'] = 200; 291 294 292 295 $IMConfig['max_filesize_kb_link'] = 5000; -
trunk/plugins/ExtendedFileManager/editorFrame.php
r681 r937 5 5 * Version: Updated on 08-01-2005 by Afru 6 6 * Version: Updated on 21-06-2006 by Krzysztof Kotowicz 7 * Package: ExtendedFileManager (EFM 1.1.1) 7 * Version: Updated on 20-01-2008 by Raimund Meyer 8 * Package: ExtendedFileManager (EFM 1.4) 8 9 * http://www.afrusoft.com/htmlarea 9 10 */ … … 38 39 39 40 var mode = "<?php echo $editor->getAction(); ?>" //crop, scale, measure 40 41 var currentImageFile = "<?php if(count($imageInfo)>0) echo rawurlencode($imageInfo['file']); ?>"; 41 var currentImageFile = "<?php if(count($imageInfo)>0) echo rawurlencode($imageInfo['file']); ?>"; 42 var fileSize = "<?php echo (round($imageInfo['filesize'] / 1024,1)).' KB' ?>"; 43 42 44 43 45 <?php if ($editor->isFileSaved() == 1) { ?> -
trunk/plugins/ExtendedFileManager/extended-file-manager.js
r887 r937 1 1 /** 2 2 * ExtendedFileManager extended-file-manager.js file. 3 * Authors: Wei Zhuo, Afru 3 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz, Raimund Meyer 4 4 * Modified by: Krzysztof Kotowicz <koto@webworkers.pl> 5 5 * Version: Updated on 08-01-2005 by Afru 6 6 * Version: Modified on 20-06-2006 by Krzysztof Kotowicz 7 * Package: ExtendedFileManager (EFM 1.1.1) 8 * http://www.afrusoft.com/htmlarea 7 * Version: Updated on 29-10-2006 by Raimund Meyer 8 * Version: Updated on 20-01-2008 by Raimund Meyer 9 * Package: ExtendedFileManager (EFM 1.4) 9 10 */ 10 11 … … 35 36 cfg.addToolbarElement("linkfile", "createlink", 1); 36 37 }; 37 } 38 39 var manager = editor.config.ExtendedFileManager.backend + '__function=manager'; 40 if(cfg.ExtendedFileManager.backend_config != null) 41 { 42 manager += '&backend_config=' 43 + encodeURIComponent(cfg.ExtendedFileManager.backend_config); 44 manager += '&backend_config_hash=' 45 + encodeURIComponent(cfg.ExtendedFileManager.backend_config_hash); 46 manager += '&backend_config_secret_key_location=' 47 + encodeURIComponent(cfg.ExtendedFileManager.backend_config_secret_key_location); 48 } 49 50 if(cfg.ExtendedFileManager.backend_data != null) 51 { 52 for ( var i in cfg.ExtendedFileManager.backend_data ) 53 { 54 manager += '&' + i + '=' + encodeURIComponent(cfg.ExtendedFileManager.backend_data[i]); 55 } 56 } 57 cfg.ExtendedFileManager.manager = manager; 58 } 38 59 39 60 ExtendedFileManager._pluginInfo = { 40 61 name : "ExtendedFileManager", 41 version : "1. 1.1",42 developer : "Afru, Krzysztof Kotowicz ",43 developer_url : "http:// www.afrusoft.com/htmlarea/",62 version : "1.4", 63 developer : "Afru, Krzysztof Kotowicz, Raimund Meyer", 64 developer_url : "http://xinha.org", 44 65 license : "htmlArea" 45 66 }; … … 97 118 98 119 } 99 100 var manager = editor.config.ExtendedFileManager.backend + '__function=manager'; 101 if(editor.config.ExtendedFileManager.backend_config != null) 102 { 103 manager += '&backend_config=' 104 + encodeURIComponent(editor.config.ExtendedFileManager.backend_config); 105 manager += '&backend_config_hash=' 106 + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_hash); 107 manager += '&backend_config_secret_key_location=' 108 + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_secret_key_location); 109 } 110 111 if(editor.config.ExtendedFileManager.backend_data != null) 112 { 113 for ( var i in editor.config.ExtendedFileManager.backend_data ) 114 { 115 manager += '&' + i + '=' + encodeURIComponent(editor.config.ExtendedFileManager.backend_data[i]); 116 } 117 } 118 119 Dialog(manager, function(param){ 120 Dialog(this.config.ExtendedFileManager.manager, function(param){ 120 121 if (!param) 121 122 { // user must have pressed Cancel … … 247 248 }; 248 249 249 var manager = _editor_url + 'plugins/ExtendedFileManager/manager.php?mode=link'; 250 if(editor.config.ExtendedFileManager.backend_config != null) 251 { 252 manager += '&backend_config=' 253 + encodeURIComponent(editor.config.ExtendedFileManager.backend_config); 254 manager += '&backend_config_hash=' 255 + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_hash); 256 manager += '&backend_config_secret_key_location=' 257 + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_secret_key_location); 258 } 259 260 if(editor.config.ExtendedFileManager.backend_data != null) 261 { 262 for ( var i in editor.config.ExtendedFileManager.backend_data ) 263 { 264 manager += '&' + i + '=' + encodeURIComponent(editor.config.ExtendedFileManager.backend_data[i]); 265 } 266 } 267 268 269 Dialog(manager, function(param){ 250 Dialog(this.config.ExtendedFileManager.manager+'&mode=link', function(param){ 270 251 if (!param) 271 252 return false; … … 304 285 editor.updateToolbar(); 305 286 }, outparam); 306 307 287 }; 308 288 -
trunk/plugins/ExtendedFileManager/images.php
r841 r937 6 6 * Version: Updated on 04-07-2006 by Krzysztof Kotowicz 7 7 * Version: Updated on 29-10-2006 by Raimund Meyer 8 * Package: ExtendedFileManager (EFM 1.1.3) 8 * Version: Updated on 20-01-2008 by Raimund Meyer 9 * Package: ExtendedFileManager (EFM 1.4) 9 10 * http://www.afrusoft.com/htmlarea 10 11 */ … … 15 16 require_once('config.inc.php'); 16 17 require_once('Classes/ExtendedFileManager.php'); 17 18 $backend_url_enc = htmlspecialchars( $IMConfig['backend_url'] ); 18 19 //default path is / 19 20 $relative = '/'; … … 67 68 function drawDirs_Files($list, &$manager) 68 69 { 69 global $relative, $afruViewType, $IMConfig, $insertMode ;70 global $relative, $afruViewType, $IMConfig, $insertMode,$backend_url_enc; 70 71 71 72 switch ($afruViewType) { … … 73 74 $maxNameLength = 30; 74 75 ?> 75 <table class="listview" >76 <table class="listview" id="listview"> 76 77 <thead> 77 <tr><th colspan="2">Name</th><th>Size</th><th>Image Size</th><th>Date Modified</th><th> </th></tr></thead>78 <tr><th>Name</th><th>Size</th><th>Image Size</th><th>Date Modified</th><th> </th></tr></thead> 78 79 <tbody> 79 80 <?php … … 82 83 { ?> 83 84 <tr> 84 <td>< img src="<?php print $IMConfig['base_url'];?>icons/folder_small.gif" alt="" /></td>85 <th nowrap="nowrap"><a href="<?php print $IMConfig['backend_url']; ?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo rawurlencode($path); ?>&viewtype=<?php echo $afruViewType; ?>" onclick="updateDir('<?php echo $path; ?>')" title="<?php echo $dir['entry']; ?>">85 <td><span width="20px"><img src="<?php print $IMConfig['base_url'];?>icons/folder_small.gif" alt="" /></span> 86 <a href="<?php print $backend_url_enc; ?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo rawurlencode($path); ?>&viewtype=<?php echo $afruViewType; ?>" onclick="updateDir('<?php echo $path; ?>')" title="<?php echo $dir['entry']; ?>"> 86 87 <?php 87 88 if(strlen($dir['entry'])>$maxNameLength) echo substr($dir['entry'],0,$maxNameLength)."..."; else echo $dir['entry']; 88 89 ?> 89 90 </a></th> 90 <td colspan="2" nowrap="nowrap">Folder</td>91 92 <td nowrap="nowrap"><?php echo date("d.m.y H:i",$dir['stat']['mtime']); ?></td>93 94 <td class="actions" nowrap="nowrap">95 <a href="<?php print $ IMConfig['backend_url']; ?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo $relative; ?>&deld=<?php echo rawurlencode($path); ?>&viewtype=<?php echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteDir('<?php echo $dir['entry']; ?>', <?php echo $dir['count']; ?>);" style="border:0px;"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash" border="0" /></a>91 <td colspan="2" >Folder</td> 92 93 <td ><?php echo date($IMConfig['date_format'],$dir['stat']['mtime']); ?></td> 94 95 <td class="actions" > 96 <a href="<?php print $backend_url_enc; ?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo $relative; ?>&deld=<?php echo rawurlencode($path); ?>&viewtype=<?php echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteDir('<?php echo $dir['entry']; ?>', <?php echo $dir['count']; ?>);" style="border:0px;"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash" border="0" /></a> 96 97 <?php if ($IMConfig['allow_rename']) { ?> 97 98 <a href="#" title="Rename" onclick="renameDir('<?php echo rawurlencode($dir['entry']);?>'); return false;"><img src="<?php print $IMConfig['base_url'];?>img/edit_rename.gif" height="15" width="15" alt="Rename" border="0" /></a> … … 113 114 ?> 114 115 <tr> 115 <td>< img src="<?php print $IMConfig['base_url']; if(is_file('icons/'.$file['ext'].'_small.gif')) echo "icons/".$file['ext']."_small.gif"; else echo $IMConfig['default_listicon']; ?>" alt="" /></td>116 <th><a href="#" class="thumb" style="cursor: pointer;" ondblclick="this.onclick();window.top.onOK();" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo preg_replace('#\..{3,4}$#', '', $entry); ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);return false;" title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>" <?php if ($insertMode == 'image') { ?> onmouseover="showPreview('<?php echo $file['relative'];?>')" onmouseout="showPreview(window.parent.document.getElementById('f_url').value)" <?php } ?> >116 <td><span width="20px"><img src="<?php print $IMConfig['base_url']; if(is_file('icons/'.$file['ext'].'_small.gif')) echo "icons/".$file['ext']."_small.gif"; else echo $IMConfig['default_listicon']; ?>" alt="" /></span> 117 <a href="#" class="thumb" style="cursor: pointer;" ondblclick="this.onclick();window.top.onOK();" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo preg_replace('#\..{3,4}$#', '', $entry); ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);return false;" title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>" <?php if ($insertMode == 'image') { ?> onmouseover="showPreview('<?php echo $file['relative'];?>')" onmouseout="showPreview(window.parent.document.getElementById('f_url').value)" <?php } ?> > 117 118 <?php 118 119 if(strlen($entry)>$maxNameLength) echo substr($entry,0,$maxNameLength)."..."; else echo $entry; 119 120 ?> 120 </a></t h>121 </a></td> 121 122 <td><?php echo Files::formatSize($file['stat']['size']); ?></td> 122 123 <td><?php if($file['image'][0] > 0){ echo $file['image'][0].'x'.$file['image'][1]; } ?></td> 123 <td nowrap="nowrap"><?php echo date("d.m.y H:i",$file['stat']['mtime']); ?></td>124 <td ><?php echo date($IMConfig['date_format'],$file['stat']['mtime']); ?></td> 124 125 <td class="actions"> 125 126 <?php if($IMConfig['img_library'] && $IMConfig['allow_edit_image'] && $file['image'][0] > 0) { ?> 126 127 <a href="javascript:;" title="Edit" onclick="editImage('<?php echo rawurlencode($file['relative']);?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_pencil.gif" height="15" width="15" alt="Edit" border="0" /></a> 127 128 <?php } ?> 128 <a href="<?php print $ IMConfig['backend_url']; ?>__function=images&dir=<?php echo $relative; ?>&delf=<?php echo rawurlencode($file['relative']);?>&mode=<?php echo $insertMode;?>&viewtype=<?php echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash" border="0" /></a>129 <a href="<?php print $backend_url_enc; ?>__function=images&dir=<?php echo $relative; ?>&delf=<?php echo rawurlencode($file['relative']);?>&mode=<?php echo $insertMode;?>&viewtype=<?php echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash" border="0" /></a> 129 130 <?php if ($IMConfig['allow_rename']) { ?> 130 131 <a href="#" title="Rename" onclick="renameFile('<?php echo rawurlencode($file['relative']);?>'); return false;"><img src="<?php print $IMConfig['base_url'];?>img/edit_rename.gif" height="15" width="15" alt="Rename" border="0" /></a> … … 151 152 { ?> 152 153 <div class="dir_holder"> 153 <a class="dir" href="<?php print $ IMConfig['backend_url'];?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo rawurlencode($path); ?>&viewtype=<?php echo $afruViewType; ?>" onclick="updateDir('<?php echo $path; ?>')" title="<?php echo $dir['entry']; ?>"><img src="<?php print $IMConfig['base_url'];?>img/folder.gif" height="80" width="80" alt="<?php echo $dir['entry']; ?>" /></a>154 <a class="dir" href="<?php print $backend_url_enc;?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo rawurlencode($path); ?>&viewtype=<?php echo $afruViewType; ?>" onclick="updateDir('<?php echo $path; ?>')" title="<?php echo $dir['entry']; ?>"><img src="<?php print $IMConfig['base_url'];?>img/folder.gif" height="80" width="80" alt="<?php echo $dir['entry']; ?>" /></a> 154 155 155 156 <div class="fileName"> … … 160 161 </div> 161 162 <div class="edit"> 162 <a href="<?php print $ IMConfig['backend_url'];?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo $relative; ?>&deld=<?php echo rawurlencode($path); ?>&viewtype=<?php echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteDir('<?php echo $dir['entry']; ?>', <?php echo $dir['count']; ?>);"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash" /></a>163 <a href="<?php print $backend_url_enc;?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo $relative; ?>&deld=<?php echo rawurlencode($path); ?>&viewtype=<?php echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteDir('<?php echo $dir['entry']; ?>', <?php echo $dir['count']; ?>);"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash" /></a> 163 164 <?php if ($IMConfig['allow_rename']) { ?> 164 165 <a href="#" title="Rename" onclick="renameDir('<?php echo rawurlencode($dir['entry']);?>'); return false;"><img src="<?php print $IMConfig['base_url'];?>img/edit_rename.gif" height="15" width="15" alt="Rename" border="0" /></a> … … 194 195 <a href="javascript:;" title="Edit" onclick="editImage('<?php echo rawurlencode($file['relative']);?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_pencil.gif" height="15" width="15" alt="Edit" /></a> 195 196 <?php $thisFileNameLength -= 3; } ?> 196 <a href="<?php print $ IMConfig['backend_url']; ?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo $relative; ?>&delf=<?php echo rawurlencode($file['relative']);?>&viewtype=<?php echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash" /></a>197 <a href="<?php print $backend_url_enc; ?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo $relative; ?>&delf=<?php echo rawurlencode($file['relative']);?>&viewtype=<?php echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash" /></a> 197 198 <?php if ($IMConfig['allow_rename']) { ?> 198 199 <a href="#" title="Rename" onclick="renameFile('<?php echo rawurlencode($file['relative']);?>'); return false;"><img src="<?php print $IMConfig['base_url'];?>img/edit_rename.gif" height="15" width="15" alt="Rename" /></a> … … 264 265 var topDoc = window.top.document; 265 266 var messages = topDoc.getElementById('messages'); 266 if(messages) 267 if (messages) 268 { 267 269 messages.style.display = "none"; 270 } 271 //window.parent.resize(); 268 272 } 269 273 … … 273 277 274 278 hideMessage(); 275 276 <?php 279 <?php if ($afruViewType == 'listview') 280 print "var d = new dragTableCols('listview');"; 281 277 282 if(isset($uploadStatus) && !is_numeric($uploadStatus) && !is_bool($uploadStatus)) 278 283 echo "alert(i18n('$uploadStatus'));"; … … 375 380 //--> 376 381 </script> 377 382 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/dragTableCols.js"></script> 378 383 </head> 379 384 -
trunk/plugins/ExtendedFileManager/lang/de.js
r841 r937 27 27 "Rotate": "Drehen", 28 28 "Measure": "MaÃe", 29 "Marker": "Marker", 29 "Marker": "Rahmen", 30 "Toggle marker color" : "Farbe der Markierung umschalten", 30 31 "Save": "Speichern", 31 32 "Filename:": "Dateiname:", … … 113 114 "Could not create destination folder.":"Konnte Zielordner nicht erstellen.", 114 115 "Destination file/folder already exists.":"Zieldatei/-ordner existiert bereits", 115 "File pasted OK.": "File pasted OK." 116 "File pasted OK.": "File pasted OK.", 117 118 "Filesize:" : "DateigröÃe:" 116 119 }; -
trunk/plugins/ExtendedFileManager/manager.php
r857 r937 6 6 * Version: Updated on 04-07-2006 by Krzysztof Kotowicz 7 7 * Version: Updated on 29-10-2006 by Raimund Meyer 8 * Package: ExtendedFileManager (EFM 1.1.3) 8 * Version: Updated on 20-01-2008 by Raimund Meyer 9 * Package: ExtendedFileManager (EFM 1.4) 9 10 * http://www.afrusoft.com/htmlarea 10 11 */ … … 105 106 ?> 106 107 108 var iframeUrl = '<?php print $IMConfig['backend_url']; ?>__function=images&mode=<?php echo $insertMode;?>&viewtype=<?php echo $IMConfig['view_type'] ?>'; 109 107 110 /* ]]> */ 108 111 </script> … … 111 114 <body class="dialog" > 112 115 <div class="title">Insert <?php echo ($insertMode == 'image' ? 'Image' : 'File Link') ?></div> 113 <form action="<?php print $IMConfig['backend_url']; ?>" id="uploadForm" method="post" enctype="multipart/form-data">116 <form action="<?php print htmlspecialchars($IMConfig['backend_url']); ?>" id="uploadForm" method="post" enctype="multipart/form-data"> 114 117 <input type="hidden" name="__plugin" value="ExtendedFileManager" /> 115 118 <input type="hidden" name="__function" value="images" /> … … 119 122 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 120 123 <tr> 121 <td nowrap style="padding:10px;">124 <td nowrap="nowrap" style="padding:10px;"> 122 125 123 126 <label for="dirPath">Directory</label> … … 137 140 <span id="pasteBtn"></span> 138 141 139 <select name="viewtype" id="viewtype" on Change="updateView()">140 <option value="thumbview" <?php if($IMConfig['view_type']=="thumbview") echo "selected";?> >Thumbnail View</option>141 <option value="listview" <?php if($IMConfig['view_type']=="listview") echo "selected";?> >List View</option>142 <select name="viewtype" id="viewtype" onchange="updateView()"> 143 <option value="thumbview" <?php if($IMConfig['view_type']=="thumbview") echo 'selected="selected"';?> >Thumbnail View</option> 144 <option value="listview" <?php if($IMConfig['view_type']=="listview") echo 'selected="selected"';?> >List View</option> 142 145 </select> 143 146 </td> … … 145 148 <tr><td style="padding:10px; padding-top:0px;"> 146 149 <div id="messages"><span id="message">Loading</span><img src="<?php print $IMConfig['base_url'];?>img/dots.gif" width="22" height="12" alt="..." /></div> 147 <iframe src=" <?php print $IMConfig['backend_url']; ?>__function=images&mode=<?php echo $insertMode;?>&viewtype=<?php echo $IMConfig['view_type'] ?>" name="imgManager" id="imgManager" class="imageFrame" scrolling="auto" title="Image Selection" frameborder="0"></iframe>150 <iframe src="about:blank" name="imgManager" id="imgManager" class="imageFrame" scrolling="auto" title="Image Selection" frameborder="0"></iframe> 148 151 </td></tr> 149 152 </table> 150 153 </fieldset> 151 154 <!-- image properties --> 155 <div id="controls"> 152 156 <table class="inputTable"> 153 157 <tr> 154 <td align="right" nowrap ><label for="f_url"><?php if($insertMode=='image') echo 'File Name'; else echo 'URL';?></label></td>158 <td align="right" nowrap="nowrap"><label for="f_url"><?php if($insertMode=='image') echo 'File Name'; else echo 'URL';?></label></td> 155 159 <td colspan="5"><input type="text" id="<?php if($insertMode=='image') echo 'f_url'; else echo 'f_href';?>" class="largelWidth" value="" /></td> 156 160 <td rowspan="<?php echo $num_rows ?>" colspan="2" valign="top" align="center"><?php if($insertMode=='image') { ?> … … 274 278 <button type="button" class="buttons" onclick="return onCancel();">Cancel</button> 275 279 </div> 280 </div> 276 281 </form> 277 282 </body> -
trunk/plugins/ImageManager/Classes/GD.php
r709 r937 83 83 $this->_get_image_details($image); 84 84 $functionName = 'ImageCreateFrom' . $this->type; 85 85 86 if(function_exists($functionName)) 86 87 { 87 88 $this->imageHandle = $functionName($this->image); 89 if ( $this->type == 'png') 90 { 91 imageAlphaBlending($this->imageHandle, false); 92 imageSaveAlpha($this->imageHandle, true); 93 } 88 94 } 89 95 } // End load … … 158 164 { 159 165 if(function_exists('imagerotate')) { 160 $white = imagecolorallocate ($this->imageHandle, 255, 255, 255);166 $white = imagecolorallocatealpha ($this->imageHandle, 255, 255, 255, 127); 161 167 $this->imageHandle = imagerotate($this->imageHandle, $angle, $white); 162 168 return true; … … 165 171 if ( $options==null ){ 166 172 $autoresize = true; 167 $color_mask = array( 255,255,0);173 $color_mask = array(105,255,255); 168 174 } else { 169 175 extract( $options ); … … 240 246 } 241 247 242 $img2 = @ imagecreate($width2,$height2);248 $img2 = @$this->newImgPreserveAlpha( imagecreateTrueColor($width2,$height2) ); 243 249 244 250 if ( !is_resource($img2) ){ … … 253 259 imagepalettecopy($img2,$img); 254 260 255 $mask = imagecolorresolve($img2,$color_mask[0],$color_mask[1],$color_mask[2]); 256 261 $mask = imagecolorallocatealpha ($img2,$color_mask[0],$color_mask[1],$color_mask[2],127); 257 262 // use simple lines copy for axes angles 258 263 switch((int)($angle)){ … … 344 349 } 345 350 if(function_exists('ImageCreateTrueColor')){ 346 $new_img =ImageCreateTrueColor($new_x,$new_y);351 $new_img = $this->newImgPreserveAlpha( ImageCreateTrueColor($new_x,$new_y) ); 347 352 } else { 348 353 $new_img =ImageCreate($new_x,$new_y); 349 354 } 355 350 356 if(function_exists('ImageCopyResampled')){ 351 357 ImageCopyResampled($new_img, $this->imageHandle, 0, 0, 0, 0, $new_x, $new_y, $this->img_x, $this->img_y); … … 353 359 ImageCopyResized($new_img, $this->imageHandle, 0, 0, 0, 0, $new_x, $new_y, $this->img_x, $this->img_y); 354 360 } 361 355 362 $this->old_image = $this->imageHandle; 356 363 $this->imageHandle = $new_img; … … 373 380 { 374 381 if(function_exists('ImageCreateTrueColor')){ 375 $new_img = ImageCreateTrueColor($new_width,$new_height);382 $new_img = $this->newImgPreserveAlpha(ImageCreateTrueColor($new_width,$new_height)); 376 383 } else { 377 384 $new_img =ImageCreate($new_width,$new_height); … … 434 441 ImageGammaCorrect($this->imageHandle, 1.0, $outputgamma); 435 442 } 443 function paletteToTrueColorWithTransparency() 444 { 445 $oldImg = $this->imageHandle; 446 $newImg = $this->newImgPreserveAlpha( imagecreatetruecolor($this->img_x,$this->img_y) ); 447 imagecopy($newImg,$oldImg,0,0,0,0,$this->img_x,$this->img_y); 448 449 $this->imageHandle = $newImg; 450 } 451 452 function newImgPreserveAlpha($newImg) 453 { 454 if ( $this->type == 'jpeg') return $newImg; 455 456 // Turn off transparency blending (temporarily) 457 imagealphablending($newImg, false); 458 459 // Create a new transparent color for image 460 if ( $transparent = imagecolortransparent($this->imageHandle) >= 0 ) 461 { 462 if (imageistruecolor($this->imageHandle)) 463 { 464 $red = ($transparent & 0xFF0000) >> 16; 465 $green = ($transparent & 0x00FF00) >> 8; 466 $blue = ($transparent & 0x0000FF); 467 $color_values = array('red' => $red, 'green' => $green, 'blue' => $blue); 468 } 469 else 470 { 471 $color_values = imagecolorsforindex($this->imageHandle,$transparent); 472 473 } 474 $color_values = imagecolorsforindex($this->imageHandle,$transparent); 475 $color = imagecolorallocatealpha($newImg, $color_values['red'],$color_values['green'],$color_values['blue'], 127); 476 $colort = imagecolorallocate($newImg, $color_values['red'],$color_values['green'],$color_values['blue']); 477 } 478 else 479 { 480 $color = imagecolorallocatealpha($newImg, 252, 2, 252, 127); 481 $colort = imagecolorallocate($newImg, 252, 2, 252); 482 } 483 imagecolortransparent($newImg,$colort); 484 485 // Completely fill the background of the new image with allocated color. 486 imagefill($newImg, 0, 0, $color); 487 488 // Restore transparency blending 489 imagesavealpha($newImg, true); 490 491 return $newImg; 492 } 493 494 function preserveTransparencyForPalette() 495 { 496 $new_img = imagecreatetruecolor($this->img_x,$this->img_y); 497 $truecolor = imageistruecolor($this->imageHandle); 498 $transparent = imagecolorallocate($new_img, 252,2,252); // nasty pinkish purple that hopefully doesn't exist in the image 499 500 imagecolortransparent($new_img, $transparent); 501 for ($i=0;$i<$this->img_y;$i++) 502 { 503 for ($j=0;$j<$this->img_x;$j++) 504 { 505 $c = imagecolorat($this->imageHandle,$j, $i); 506 if ($truecolor) 507 { 508 $a = ($c >> 24) & 0xFF; 509 $r = ($c >> 16) & 0xFF; 510 $g = ($c >> 8) & 0xFF; 511 $b = $c & 0xFF; 512 $color_values = array('red' => $r, 'green' => $g, 'blue' => $b, 'alpha' => $a); 513 } 514 else 515 { 516 $color_values = imagecolorsforindex($this->imageHandle,$transparent); 517 } 518 if ($color_values['alpha'] >= 126) 519 { 520 imagesetpixel($new_img, $j, $i, $transparent); 521 } 522 else 523 { 524 imagesetpixel($new_img, $j, $i, $c); 525 } 526 } 527 } 528 $this->imageHandle = $new_img; 529 } 436 530 437 531 /** -
trunk/plugins/ImageManager/Classes/IM.php
r709 r937 179 179 $this->command['gamma'] = "-gamma $outputgamma"; 180 180 } 181 181 182 function reduce_colors($number = 256) 183 { 184 $this->command['colors'] = "-colors $number"; 185 } 182 186 /** 183 187 * Save the image file … … 214 218 if ($type == '') { 215 219 header('Content-type: image/' . $this->type); 216 passthru(IMAGE_TRANSFORM_LIB_PATH . ' convert' . implode(' ', $this->command) . " -quality $quality " . escapeshellarg($this->image) . ' ' . strtoupper($this->type) . ":-");220 passthru(IMAGE_TRANSFORM_LIB_PATH . ' ' . implode(' ', $this->command) . " -quality $quality " . escapeshellarg($this->image) . ' ' . strtoupper($this->type) . ":-"); 217 221 } else { 218 222 header('Content-type: image/' . $type); -
trunk/plugins/ImageManager/Classes/ImageEditor.php
r709 r937 95 95 $image['file'] = $relative; 96 96 $image['fullpath'] = $fullpath; 97 $image['filesize'] = @filesize($fullpath); 97 98 } 98 99 … … 119 120 $params = $_GET['params']; 120 121 121 $values = explode(',',$params ,4);122 $values = explode(',',$params); 122 123 $saveFile = $this->getSaveFileName($values[0]); 123 124 124 125 $img = Image_Transform::factory(IMAGE_CLASS); 125 126 $img->load($fullpath); 126 127 if ( is_callable($img,'paletteToTrueColorWithTransparency') && !imageistruecolor( $img->imageHandle)) 128 { 129 $img->paletteToTrueColorWithTransparency(); 130 } 127 131 switch ($action) 128 132 { … … 154 158 //we need to make the relative path once more. 155 159 $newSaveFile = $this->makeRelative($relative, $newSaveFile); 156 $image['saveFile'] = $newSaveFile;160 $image['saveFile'] = $newSaveFile; 157 161 $newSaveFullpath = $this->manager->getFullPath($newSaveFile); 162 if ( $values[0] == 'gif' && is_callable(array($img, 'preserveTransparencyForPalette'))) 163 { 164 $img->preserveTransparencyForPalette(); 165 } 158 166 $img->save($newSaveFullpath, $values[0], $quality); 159 167 if(is_file($newSaveFullpath)) … … 163 171 } 164 172 break; 173 case 'preview': 174 $quality = intval($values[1]); 175 176 177 $image['file'] = $relative; 178 $image['fullpath'] = $fullpath; 179 180 //create the tmp image file 181 $filename = $this->createUnique($fullpath); 182 $newRelative = $this->makeRelative($relative, $filename); 183 $newFullpath = $this->manager->getFullPath($newRelative); 184 $newURL = $this->manager->getFileURL($newRelative); 185 186 187 if ( $values[0] == 'gif' && is_callable(array($img, 'preserveTransparencyForPalette'))) 188 { 189 $img->preserveTransparencyForPalette(); 190 } 191 $img->save($newFullpath, $values[0] ); 192 $img->free(); 193 194 //get the image information 195 $imgInfo = @getimagesize($newFullpath); 196 197 $image['src'] = $newURL; 198 $image['width'] = $imgInfo[0]; 199 $image['height'] = $imgInfo[1]; 200 $image['dimensions'] = $imgInfo[3]; 201 $image['file'] = $relative; 202 $image['fullpath'] = $fullpath; 203 $image['filesize'] = @filesize($newFullpath); 204 205 Return $image; 206 207 break; 165 208 } 166 209 … … 170 213 $newFullpath = $this->manager->getFullPath($newRelative); 171 214 $newURL = $this->manager->getFileURL($newRelative); 172 215 173 216 //save the file. 174 $img->save($newFullpath );217 $img->save($newFullpath, 'png' ); 175 218 $img->free(); 176 219 … … 179 222 180 223 $image['src'] = $newURL; 181 $image['width'] = $imgInfo[0];182 $image['height'] = $imgInfo[1];224 $image['width'] = $imgInfo[0]; 225 $image['height'] = $imgInfo[1]; 183 226 $image['dimensions'] = $imgInfo[3]; 184 227 $image['file'] = $newRelative; 185 228 $image['fullpath'] = $newFullpath; 186 229 $image['filesize'] = @filesize($newFullpath); 230 $image['type'] = image_type_to_mime_type($imgInfo[2]); 231 187 232 Return $image; 188 233 … … 418 463 419 464 $fullpath = $this->manager->getFullPath($relative); 420 465 421 466 $type = $this->getImageType($fullpath); 422 467 if($type != 'gif') 423 468 Return 0; 424 469 425 if(function_exists('ImageCreateFrom' +$type)426 && function_exists('image' +$type))470 if(function_exists('ImageCreateFrom'.$type) 471 && function_exists('image'.$type)) 427 472 Return 1; 428 473 else -
trunk/plugins/ImageManager/editor.php
r677 r937 25 25 <link href="<?php print $IMConfig['base_url'];?>assets/editor.css" rel="stylesheet" type="text/css" /> 26 26 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/slider.js"></script> 27 <script type="text/javascript" src="../../popups/popup.js"></script> 27 28 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/popup.js"></script> 28 29 <script type="text/javascript">
