Remove s9y image editor from 2k11 admin theme.

This removes the proof-of-concept image editor from 2k11 – as far
as I can see/do that. @onli should probably have a look at whether
there are other code parts which need/should be removed along with
this.
This commit is contained in:
Matthias Mees 2013-07-02 12:15:36 +02:00
parent eaa8a29d2d
commit 26d4b32987
9 changed files with 0 additions and 635 deletions

View File

@ -1,6 +1,3 @@
{if $case_imgedit}
<span class="msg_notice"><span class="icon-info-circled"></span> {$CONST.PREFERENCE_USE_JS_WARNING}</span>
{/if}
{if $case_sync}
<h2>{$CONST.CREATE_THUMBS}</h2>
{if !$perm_adminImagesSync}

View File

@ -1,173 +0,0 @@
#zoomslider {
position: relative;
display: block;
width: 10px; /* If you change the width of this, also change the JavaScript variable "slider_width"!!! */
height: 100px;
border: 1px solid yellow;
background-color: yellow;
color: black;
margin-left: auto;
margin-right: auto;
text-align: center;
margin-top: 5px;
margin-bottom: 5px;
}
#zoombutton {
position: absolute;
display: inline;
background-color: red;
margin: 0px;
padding: 0px;
border: 0px;
cursor: move;
z-index: 4;
visibility: hidden;
}
.smallcaps {
font-family: Verdana;
font-size: 7pt;
color: white;
}
.nospace {
margin: 0px;
padding: 0px;
}
.button {
border: 1px solid gray;
font-family: Verdana;
font-size: 7pt;
color: white;
background-color: #303030;
padding: 3px;
}
.specialbutton {
border: 1px solid gray;
font-family: Verdana;
font-size: 8pt;
color: white;
background-color: red;
padding: 3px;
margin: 5px;
}
.small {
width: 25px;
margin-top: 5px;
}
.center {
margin-left: auto;
margin-right: auto;
text-align: center;
vertical-align: middle;
}
.center span {
position: relative;
top: -5px;
}
#imgedit {
position: absolute;
left: 10px;
top: 25px;
margin: 15px;
padding: 5px;
}
#outer {
display: block;
position: absolute;
z-index: 1;
}
#backdrop {
display: block;
position: absolute;
z-index: 2;
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=55);
-moz-opacity: 0.55;
}
#overlay {
position: absolute;
display: block;
z-index: 3;
cursor: move;
overflow: hidden;
}
#harea {
position: absolute;
display: block;
z-index: 4;
}
#varea {
position: absolute;
display: block;
z-index: 4;
}
#zoom {
display: block;
float: left;
height: 140px;
border: 1px solid red;
vertical-align: middle;
margin-left: auto;
margin-right: auto;
text-align: center;
position: absolute;
}
#scaletext {
display: inline;
}
#cropimage {
overflow: hidden;
display: block;
position: absolute;
top: 1px;
}
.info {
display: block;
position: relative;
border: 1px solid black;
color: black;
background-color: #A0A0A0;
margin: 20px;
padding: 10px;
}
legend {
background-color: #A0A0A0;
font-family: Verdana;
font-size: 12pt;
font-weight: bold;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-left: 1px solid black;
border-right: 1px solid black;
padding: 3px;
color: white;
}
.error {
color: red;
}
code {
color: white;
font-size: 8pt;
}

View File

@ -1,304 +0,0 @@
// File referenced in:
// templates/*/admin/media_choose.tpl
/**************************************************
* imgedit.js
* 2003-10-17
* www.sonnd.com / www.supergarv.de
*
* COPYRIGHT (C) BY sonnd / Garvin Hicking
* Published as GPL. Copyright notice has to stay in effect.
**************************************************/
// Gets a position of an element on a certain axis
function imgedit_position(element, axis) {
if (axis == 'x') {
return (element.x) ? element.x : imgedit_subposition(element, 'Left');
} else {
return (element.y) ? element.y : imgedit_subposition(element, 'Top');
}
}
// Calculate possible referenced subpositions to really get the absolute position.
function imgedit_subposition(element, axis) {
currentPos = 0;
while (element != null) {
currentPos += element['offset' + axis];
element = element.offsetParent;
}
return currentPos;
}
// Places the cropping area to a certain X/Y coordinate. Then clips the overlay picture correspondingly
function imgedit_placeArea(new_x, new_y) {
o_area.style.left = new_x + 'px';
o_area.style.top = new_y + 'px';
o_overlay.style.clip = "rect(" + (new_y+area_border) + " " + (new_x+inner_area_x) + " " + (new_y+inner_area_y) + " " + (new_x+area_border) + ")";
}
// Set correct restraints of the cropping area inside which it can move
function imgedit_setMax(new_width, new_height) {
o_area.maxX = imgedit_getMax('x', new_width, area_orientation);
o_area.maxY = imgedit_getMax('y', new_height, area_orientation);
}
// Toggle the current area orientation to the opposite one
function imgedit_areaOrientation() {
if (area_orientation == 'h') {
imgedit_toggleAreaOrientation('v');
} else {
imgedit_toggleAreaOrientation('h');
}
return false;
}
// Toggle the current area orientation
function imgedit_toggleAreaOrientation(new_orientation) {
if (new_orientation == area_orientation) {
return;
}
// Display the corresponding cropping area and hide the other one.
if (new_orientation == 'h') {
area_orientation = 'h';
o_area = o_harea;
area_x = harea_x;
area_y = harea_y;
inner_area_x = inner_harea_x;
inner_area_y = inner_harea_y;
o_varea.style.visibility = 'hidden';
o_area.style.left = o_varea.style.left;
o_area.style.top = o_varea.style.top;
o_area.style.visibility = 'visible';
} else {
area_orientation = 'v';
o_area = o_varea;
area_x = varea_x;
area_y = varea_y;
inner_area_x = inner_varea_x;
inner_area_y = inner_varea_y;
o_harea.style.visibility = 'hidden';
o_area.style.left = o_harea.style.left;
o_area.style.top = o_harea.style.top;
o_area.style.visibility = 'visible';
}
// Set the new clipping inside the cropping area
imgedit_setMax(o_backdrop.width, o_backdrop.height);
o_overlay.style.clip = "rect(" + (parseInt(o_area.style.top)+area_border) + " " + (parseInt(o_area.style.left)+inner_area_x) + " " + (parseInt(o_area.style.top)+inner_area_y) + " " + (parseInt(o_area.style.left)+area_border) + ")";
}
// Zoom the image. Takes a given stepping (can be negative)
function imgedit_zoom(step) {
pos = parseInt(o_zoombutton.style.top);
if (pos+step > slider_top && pos+step < slider_bottom) {
imgedit_zoomTo(position(o_zoombutton, 'y') + step);
o_zoombutton.style.top = pos + step + 'px';
}
return false;
}
// Automatically resize the window to fit cropping area
function imgedit_autoSize(flip) {
// First find the largest side
if (real_x > real_y) {
// The image is a horizontal one. Resize height to fit.
fitmode = 'height';
} else {
// The image is a vertical one. Resize width to fit.
fitmode = 'width';
}
// Check if the size should be flipped. If it is 'true' the image will completely fit inside the cropping area.
// If it is 'false', it will only fit one side inside the cropping area
if (flip == 'true') {
if (fitmode == 'width') {
fitmode = 'height';
} else {
fitmode = 'width';
}
}
// Get new width/height of the image
if (fitmode == 'width') {
new_width = inner_area_x - area_border;
ratio = new_width / real_x;
new_height = real_y * ratio;
} else {
new_height = inner_area_y - area_border;
ratio = new_height / real_y;
new_width = real_x * ratio;
}
// Place cropping area to (0|0), because the image has been resized?
imgedit_scaleIMG(new_width, new_height);
imgedit_placeArea(-area_border, -area_border);
// Place the slider to corresponding ratio.
o_zoombutton.style.top = slider_bottom - parseInt(ratio/2 * (slider_middle/3)) + 'px';
// Adjust some settings inside the HTML form.
document.getElementById('scaletext').style.visibility = 'visible';
document.getElementById('autoguess_clicked').value = 'true';
new_ratio = ratio;
return false;
}
// Get the maximum width/height for a certain axis the cropping area is allowed to move to
function imgedit_getMax(axis, pixels, area_orientation) {
// Which is the size we should get?
if (area_orientation == 'h') {
maxarea_x = harea_x;
maxarea_y = harea_y
} else if (area_orientation == 'v') {
maxarea_x = varea_x;
maxarea_y = varea_y
} else {
maxarea_x = area_x;
maxarea_y = area_y
}
if (axis == 'x') {
value = pixels - maxarea_x + area_border;
} else {
value = pixels - maxarea_y + area_border;
}
if (value < -area_border) {
value = -area_border;
}
return value;
}
// Scales the background image to a certain size
function imgedit_scaleIMG(new_width, new_height) {
o_backdrop.width = new_width;
o_backdrop.height = new_height;
o_overlay.width = new_width;
o_overlay.height = new_height;
imgedit_setMax(new_width, new_height);
return true;
}
// Zooms the image to a certain stepping
function imgedit_zoomTo(y) {
current = slider_bottom - y;
temp_height = current - slider_middle;
temp_ratio = temp_height / (slider_middle*3);
if (current > slider_middle) {
// make smaller than 100%
new_ratio = 1 + (temp_ratio+temp_ratio);
} else {
// make larger than 100%
new_ratio = 1 + (temp_ratio+temp_ratio);
}
new_width = parseInt(real_x * new_ratio);
new_height = parseInt(real_y * new_ratio);
imgedit_scaleIMG(new_width, new_height);
return true;
}
// OnSubmit catch. Parses current JS values into the form
function imgedit_getCoordinates() {
document.getElementById('zoombox_x').value = parseInt(o_area.style.left);
document.getElementById('zoombox_y').value = parseInt(o_area.style.top);
document.getElementById('zoombox_factor').value = new_ratio;
document.getElementById('area_orientation').value = area_orientation;
return true;
}
// Initializes everything
function imgedit_init(zoombox_width, init_area_border, pad_left, pad_top, init_area_orientation) {
// Store objects
o_backdrop = document.getElementById("backdrop");
o_overlay = document.getElementById("overlay");
o_harea = document.getElementById("harea");
o_varea = document.getElementById("varea");
o_zoombutton = document.getElementById("zoombutton");
// Object sizes
full_x = parseInt(o_backdrop.width);
full_y = parseInt(o_backdrop.height);
real_x = document.getElementById('real_img_width').value;
real_y = document.getElementById('real_img_height').value;
area_border = init_area_border;
harea_x = parseInt(o_harea.width);
harea_y = parseInt(o_harea.height);
varea_x = parseInt(o_varea.width);
varea_y = parseInt(o_varea.height);
inner_harea_x = harea_x - area_border;
inner_harea_y = harea_y - area_border;
inner_varea_x = varea_x - area_border;
inner_varea_y = varea_y - area_border;
new_ratio = document.getElementById('zoombox_factor').value;
slider_width = 10;
slider_top = 0;
slider_bottom = 95;
slider_space = slider_bottom - slider_top;
slider_middle = slider_space / 2;
zoombox_left = -(o_zoombutton.width/2) + (slider_width/2);
// Make objects dragabble
DOMDrag.init(o_harea, null, -area_border, imgedit_getMax('x', full_x, 'h'), -area_border, imgedit_getMax('y', full_y, 'h'));
DOMDrag.init(o_varea, null, -area_border, imgedit_getMax('x', full_x, 'v'), -area_border, imgedit_getMax('y', full_y, 'v'));
DOMDrag.init(o_zoombutton, null, zoombox_left, zoombox_left, slider_top, slider_bottom);
o_harea.onDrag = function (x, y) {
o_overlay.style.clip = "rect(" + (y+area_border) + " " + (x+inner_harea_x) + " " + (y+inner_harea_y) + " " + (x+area_border) + ")";
}
o_varea.onDrag = function (x, y) {
o_overlay.style.clip = "rect(" + (y+area_border) + " " + (x+inner_varea_x) + " " + (y+inner_varea_y) + " " + (x+area_border) + ")";
}
o_zoombutton.onDrag = function (x, y) {
imgedit_zoomTo(y);
}
o_zoombutton.style.left = zoombox_left + 'px';
zf = document.getElementById('zoombox_factor').value;
if (zf != 1) {
o_zoombutton.style.top = slider_bottom - parseInt(zf/2 * (slider_middle/3)) + 'px';
} else {
o_zoombutton.style.top = slider_top + slider_middle + 'px';
}
o_zoombutton.style.visibility = 'visible';
o_harea.style.cursor = 'move';
o_harea.style.left = pad_left + 'px';
o_harea.style.top = pad_top + 'px';
o_varea.style.cursor = 'move';
o_varea.style.left = pad_left + 'px';
o_varea.style.top = pad_top + 'px';
area_orientation = '';
imgedit_toggleAreaOrientation(init_area_orientation);
}

View File

@ -7,48 +7,6 @@
<meta name="viewport" content="width=device-width">
{if $media.css}<link rel="stylesheet" href="{$media.css}">{/if}
{if $media.css_tree}<link rel="stylesheet" href="{$media.css_tree}">{/if}
{if $media.css_imgedit}<link rel="stylesheet" href="{$media.css_imgedit}">{/if}
{if $media.is_imgedit}
<style>
#outer {
left: {$imgedit.zoombox_padding}px;
}
#overlay {
clip: rect({$imgedit.overlay_clip_top} {$imgedit.overlay_clip_right} {$imgedit.overlay_clip_bottom} {$imgedit.overlay_clip_left});
}
#harea {
left: {$imgedit.zoombox_x}px;
top: {$imgedit.zoombox_y}px;
visibility: {$imgedit.harea_visibility};
}
#varea {
left: {$imgedit.zoombox_x}px;
top: {$imgedit.zoombox_y}px;
visibility: {$imgedit.varea_visibility};
}
#zoom {
width: {$imgedit.zoombox_width}px;
}
#scaletext {
visibility: {$imgedit.scale_visibility};
}
#outer {
width: {$imgedit.img_width}px;
height: {$imgedit.img_height}px;
border: 1px solid red;
position: relative;
display: block;
}
</style>
<script src="{serendipity_getFile file="admin/js/dragdrop.js"}"></script>
<script src="{serendipity_getFile file='admin/imgedit.js'}" ></script>
{/if}
<script src="{serendipity_getFile file='admin/js/modernizr-2.6.2.min.js'}"></script>
<script src="{serendipity_getFile file='YahooUI/treeview/YAHOO.js'}"></script>
<script src="{serendipity_getFile file='YahooUI/treeview/treeview.js'}"></script>
@ -86,10 +44,6 @@ if (parent.frames && parent.frames['tree']) {
</script>
{/if}
{$media.external}
{if $media.is_imgedit}
{$IMGEDIT}
{/if}
<!-- EXTERNAL MEDIA END -->
{elseif $media.case == 'default'}
<!-- MEDIA MANAGER START -->

View File

@ -1,62 +0,0 @@
{* Why isn't this localized at all? http://board.s9y.org/viewtopic.php?f=10&t=18967&p=10432556#p10432556*}
<div id="imgedit" class="clearfix">
<form method="post" action="{$imgedit.my_url}">
<input id="area_orientation" name="area_orientation" type="hidden" value="{$imgedit.area_orientation}">
<input id="zoombox_factor" name="zoombox_factor" type="hidden" value="{$imgedit.zoombox_factor}">
<input id="zoombox_x" name="zoombox_x" type="hidden" value="{$imgedit.zoombox_x}">
<input id="zoombox_y" name="zoombox_y" type="hidden" value="{$imgedit.zoombox_y}">
<input id="real_img_width" name="real_img_width" type="hidden" value="{$imgedit.real_img_width}">
<input id="real_img_height" name="real_img_height" type="hidden" value="{$imgedit.real_img_height}">
<input id="autoguess_clicked" name="autoguess_clicked" type="hidden" value="{$imgedit.autoguess_clicked}">
<div id="cropbuttons" class="clearfix">
<input name="crop" type="submit" value="Crop this image! I'm serious!">
<div id="scaletext">
<span>OR</span> <input name="scale" type="submit" onclick="return imgedit_autoSize('true');" value="Just get that crap somehow inside, will ya? (Equals to: Fit image to largest side)">
</div>
</div>
{* There might be better (HTML5/jQuery) widgets for this, but let's keep it for now. *}
<div id="zoom" class="clearfix">
<input id="action_enlarge" name="action[enlarge]" type="submit" onclick="return imgedit_zoom(-2); this.blur();" value="Enlarge">
<div id="zoomslider"></div>
<script>
{* document.write('<div id="zoomslider"><img id="zoombutton" src="{serendipity_getFile file="admin/img/imgedit_slider.gif"}" width="25" height="5" alt="[Slider]"></div>'); *}
jQuery('<img/>', {
id: 'zoombutton',
src: '{serendipity_getFile file="admin/img/imgedit_slider.gif"}',
width: '25',
height: '5',
alt: '[Slider]'
}).appendTo('#zoomslider');
</script>
<noscript>
<div class="zoomfactor">Zoom: {$imgedit.zoombox_factor}x</div>
</noscript>
<input id="action_reduce" name="action[reduce]" type="submit" onclick="return imgedit_zoom(2); this.blur();" value="Reduce">
<input id="action_autoscale" name="autoscale" type="submit" onclick="return imgedit_autoSize('false');" value="Best Guess">
<!-- BEGIN ORIENTATION_AVAILABLE -->
<input id="action_orientation" name="toggle_area_orientation" type="image" onclick="return imgedit_areaOrientation();" title="Toggle Orientation" alt="Toggle Orientation" src="{serendipity_getFile file="admin/img/imgedit_orientation.gif"}">
<!-- END ORIENTATION_AVAILABLE -->
<noscript>
<input id="action_move_up" class="action_move" name="action[moveup]" type="submit" onclick="this.blur();" value="&uarr;">
<input id="action_move_left" class="action_move" name="action[moveleft]" type="submit" onclick="this.blur();" value="&larr;">
<input id="action_move_right" class="action_move" name="action[moveright]" type="submit" onclick="this.blur();" value="&rarr;">
<input id="action_move_down" class="action_move" name="action[movedown]" type="submit" onclick="this.blur();" value="&darr;">
<span id="action_moveby">Move by <input name="move_increase" type="text" value="{$imgedit.move_increase}">px</span>
</noscript>
</div>
<div id="outer" class="clearfix">
<img id="backdrop" src="{$imgedit.http_img_name}" alt="Backdrop" width="{$imgedit.img_width}" height="{$imgedit.img_height}">
<img id="overlay" src="{$imgedit.http_img_name}" alt="Overlay" width="{$imgedit.img_width}" height="{$imgedit.img_height}">
<img id="harea" src="{$imgedit.harea_img_name}" alt="[Crop area]" width="{$imgedit.harea_width}" height="{$imgedit.harea_height}">
<img id="varea" src="{$imgedit.varea_img_name}" alt="[Crop area]" width="{$imgedit.varea_width}" height="{$imgedit.varea_height}">
</div>
</form>
</div>
<script> imgedit_init({$imgedit.zoombox_width}, {$imgedit.area_border}, {$imgedit.zoombox_x}, {$imgedit.zoombox_y}, '{$imgedit.area_orientation}'); </script>

View File

@ -1,38 +0,0 @@
{* Erm, why isn't this localized at all? o_O *}
<div id="fs_info" class="info">
{* Check if h3 is the proper level. *}
<h3>Output Information</h3>
<p>Your image was {$imgedit.real_img_width} x {$imgedit.real_img_height} pixels (Orientation: {$imgedit.area_orientation}).</p>
<p>Depending on your zoom of {$imgedit.zoombox_factor}x, it was {$imgedit.zoom_img_width} x {$imgedit.zoom_img_height} pixels.</p>
<p>It got scaled to {$imgedit.img_width} x {$imgedit.img_height} pixels.</p>
<p>Then a rectangle starting from ({$imgedit.slice_from_x}|{$imgedit.slice_from_y}) to ({$imgedit.slice_to_x}|{$imgedit.slice_to_y}) has been sliced from it.</p>
{if $imgedit.image_cut}
<p>The image has been correctly cropped and only the part inside of the rectangle is going to be shown.</p>
{/if}
{if $imgedit.image_no_cut}
<p>Because the source dimensions were smaller than the destination dimensions, the image does not fill up the complete space.</p>
{/if}
{if $imgedit.image_error}
<span class="msg_error"><span class="icon-attention-circled"></span> However, there were errors processing your image.</span>
{/if}
</div>
<div id="fs_crop" class="info">
<h3>Image Result</h3>
<h4>Cropped Image:<h4>
<div id="outer">
<img id="cropimage" class="crop" src="{$imgedit.http_img_name}?{$imgedit.refresh_line}" width="{$imgedit.img_width}" height="{$imgedit.img_height}" alt="Cropped image">
</div>
</div>
<div class="info">
<h3>Play it again, Sam</h3>
<p>That was great! So, please once more, with feeling!</p>
</div>

View File

@ -163,9 +163,6 @@
</select>
</div>
{/if}
{if $file.is_image}
<a id="media_crop" class="button_link icon_link state_submit" href="serendipity_admin_image_selector.php?serendipity[adminModule]=images&amp;serendipity[adminAction]=imgedit&amp;serendipity[fid]={$file.id}">{$CONST.EDIT}</a>
{/if}
</section>
<section class="media_file_keywords">

View File

@ -672,10 +672,6 @@ window.log = function f(){ log.history = log.history || []; log.history.push(arg
serendipity.serendipity_imageSelector_done();
});
$('#imgedit > form').submit(function() {
serendipity.imgedit_getCoordinates();
});
// Click events
//
// Make the timestamp readable in browser not supporting datetime-local.

View File

@ -1687,8 +1687,6 @@ form > .button_link:first-of-type,
/* MEDIA DB
(These might go into imgedit.css or be merged with it.)
----------------------------------------------------------------- */
#fs_crop {
min-height: 200px;