mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-22 20:59:55 +09:00
이미지링크 컴포넌트에 링크를 추가할 수 있도록 기능 추가 및 크기 조절시 비율을 이용하도록 변경
git-svn-id: http://xe-core.googlecode.com/svn/trunk@2231 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
6d0eca6965
commit
dce40a2fac
7 changed files with 89 additions and 17 deletions
|
|
@ -41,28 +41,42 @@
|
|||
**/
|
||||
function transHTML($xml_obj) {
|
||||
$src = $xml_obj->attrs->src;
|
||||
$style = $xml_obj->attrs->style;
|
||||
$width = $xml_obj->attrs->width;
|
||||
$height = $xml_obj->attrs->height;
|
||||
$align = $xml_obj->attrs->align;
|
||||
$alt = $xml_obj->attrs->alt;
|
||||
$border = $xml_obj->attrs->border;
|
||||
$link_url = $xml_obj->attrs->link_url;
|
||||
$open_window = $xml_obj->attrs->open_window;
|
||||
|
||||
$tmp_arr = explode('/',$src);
|
||||
$alt = array_pop($tmp_arr);
|
||||
if(!$alt) {
|
||||
$tmp_arr = explode('/',$src);
|
||||
$alt = array_pop($tmp_arr);
|
||||
}
|
||||
|
||||
$src = str_replace(array('&','"'), array('&','&qout;'), $src);
|
||||
if(!$alt) $alt = $src;
|
||||
|
||||
$output = array();
|
||||
$output = array("src=\"".$src."\"");
|
||||
if($alt) $output[] = "alt=\"".$alt."\"";
|
||||
if($alt) $output[] = "title=\"".$alt."\"";
|
||||
if($width) $output[] = "width=\"".$width."\"";
|
||||
if($height) $output[] = "height=\"".$height."\"";
|
||||
if($align) $output[] = "align=\"".$align."\"";
|
||||
if($border) $output[] = "border=\"".$border."\"";
|
||||
if($style) $output[] = "style=\"".$style."\"";
|
||||
return "<img ".implode(" ", $output)." />";
|
||||
$attr_output = array();
|
||||
$style_output = array();
|
||||
$attr_output = array("src=\"".$src."\"");
|
||||
if($alt) {
|
||||
$attr_output[] = "alt=\"".$alt."\"";
|
||||
$attr_output[] = "title=\"".$alt."\"";
|
||||
}
|
||||
if($align) $attr_output[] = "align=\"".$align."\"";
|
||||
|
||||
if($width) $style_output[] = "width:".$width."px";
|
||||
if($height) $style_output[] = "height:".$height."px";
|
||||
if(!$align) $style_output[] = "display:block";
|
||||
if($border) $style_output[] = "border:".$border."px";
|
||||
$code = sprintf("<img %s style=\"%s\" />", implode(" ",$attr_output), implode(";",$style_output));
|
||||
|
||||
if($link_url) {
|
||||
if($open_window =='Y') $code = sprintf('<a href="%s" onclick="window.open(this.href);return false;">%s</a>', $link_url, $code);
|
||||
else $code = sprintf('<a href="%s" >%s</a>', $link_url, $code);
|
||||
}
|
||||
return $code;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
$lang->image_align_middle = "Center";
|
||||
$lang->image_align_right = "Right of Article";
|
||||
$lang->image_border = "Border Thickness";
|
||||
$lang->urllink_url = "URL";
|
||||
|
||||
$lang->about_url_link_open_window = "Make the link to open as a new window";
|
||||
$lang->cmd_get_scale = "Get Image Size";
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
$lang->image_align_middle = "中央揃え";
|
||||
$lang->image_align_right = "右揃え";
|
||||
$lang->image_border = "ボーダー";
|
||||
$lang->urllink_url = "URL";
|
||||
|
||||
$lang->about_url_link_open_window = "チェックするとリンクをクリックした時に、新しいウィンドウで開きます。";
|
||||
$lang->cmd_get_scale = "サイズ表示";
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -15,5 +15,8 @@
|
|||
$lang->image_align_right = "글의 우측으로";
|
||||
$lang->image_border = "경계선 두께";
|
||||
|
||||
$lang->urllink_open_window = "새창열기";
|
||||
$lang->about_url_link_open_window = "선택하시면 링크 선택시 새창으로 열립니다";
|
||||
|
||||
$lang->cmd_get_scale = "크기 구하기";
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
$lang->image_align_middle = "居中";
|
||||
$lang->image_align_right = "内容右侧";
|
||||
$lang->image_border = "边框粗细";
|
||||
$lang->urllink_url = "URL";
|
||||
|
||||
$lang->about_url_link_open_window = "将在新窗口中打开链接。";
|
||||
$lang->cmd_get_scale = "获得图片大小";
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -21,12 +21,20 @@
|
|||
<th scope="row">{$lang->image_scale}</th>
|
||||
<td>
|
||||
<ul>
|
||||
<li><input type="text" id="width" value="0" size="4" class="inputTypeText" />px </li>
|
||||
<li><input type="text" id="height" value="0" size="4" class="inputTypeText" />px </li>
|
||||
<li><input type="text" id="width" value="0" size="4" class="inputTypeText" onblur="setScale('width');return false;" />px </li>
|
||||
<li><input type="text" id="height" value="0" size="4" class="inputTypeText" onblur="setScale('height');return false;" />px </li>
|
||||
<li><a href="#" onclick="getImageScale(); return false;" class="button"><span>{$lang->cmd_get_scale}</span></a></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">URL</th>
|
||||
<td><input type="text" id="link_url" value="" class="inputTypeText w100"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{$lang->urllink_open_window}</th>
|
||||
<td><input type="checkbox" id="open_window" value="Y" /> {$lang->about_url_link_open_window}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{$lang->image_alt}</th>
|
||||
<td><input type="text" id="image_alt" value="" class="inputTypeText w100"/></td>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
* popup으로 열렸을 경우 부모창의 위지윅에디터에 select된 이미지가 있는지 체크하여
|
||||
* 있으면 가져와서 원하는 곳에 삽입
|
||||
**/
|
||||
|
||||
var orig_width = 0;
|
||||
var orig_height = 0;
|
||||
function getImage() {
|
||||
// 부모 위지윅 에디터에서 선택된 영역이 있는지 확인
|
||||
if(typeof(opener)=="undefined") return;
|
||||
|
|
@ -23,10 +26,20 @@ function getImage() {
|
|||
var alt = node.getAttribute("alt");
|
||||
var width = node.getAttribute("width");
|
||||
var height = node.getAttribute("height");
|
||||
orig_width = width;
|
||||
orig_height = height;
|
||||
var link_url = node.getAttribute("link_url");
|
||||
var open_window = node.getAttribute("open_window");
|
||||
|
||||
xGetElementById("image_url").value = src;
|
||||
xGetElementById("image_alt").value = alt;
|
||||
|
||||
if(link_url) {
|
||||
link_url = link_url.replace(/<([^>]*)>/ig,'').replace(/</ig,'<').replace(/>/ig,'>').replace(/&/ig,'&');
|
||||
xGetElementById('link_url').value = link_url;
|
||||
}
|
||||
if(open_window == 'Y') xGetElementById('open_window').checked = "true";
|
||||
|
||||
switch(align) {
|
||||
case 'left' : xGetElementById("align_left").checked = true; break;
|
||||
case 'middle' : xGetElementById("align_middle").checked = true; break;
|
||||
|
|
@ -50,11 +63,18 @@ function getImageScale() {
|
|||
|
||||
xGetElementById("width").value = img.width;
|
||||
xGetElementById("height").value = img.height;
|
||||
|
||||
|
||||
orig_width = img.width;
|
||||
orig_height = img.height;
|
||||
}
|
||||
function insertImage(obj) {
|
||||
if(typeof(opener)=="undefined") return;
|
||||
|
||||
var link_url = xGetElementById('link_url').value;
|
||||
if(link_url) link_url = link_url.replace(/&/ig,'&').replace(/</ig,'<').replace(/>/ig,'>');
|
||||
var open_window = 'N';
|
||||
if(xGetElementById('open_window').checked) open_window = 'Y';
|
||||
|
||||
var url = xGetElementById("image_url").value;
|
||||
var alt = xGetElementById("image_alt").value;
|
||||
var align = "";
|
||||
|
|
@ -75,9 +95,10 @@ function insertImage(obj) {
|
|||
url = url.replace(request_uri,'');
|
||||
var text = "<img editor_component=\"image_link\" src=\""+url+"\" border=\""+border+"\" ";
|
||||
if(alt) text+= " alt=\""+alt+"\"";
|
||||
if(align) text+= " align=\""+align+"\" ";
|
||||
if(width) text+= " width=\""+width+"\" ";
|
||||
if(height) text+= " height=\""+height+"\" ";
|
||||
if(link_url) text+= " link_url=\""+link_url+"\" ";
|
||||
if(open_window=='Y') text+= " open_window=\"Y\" ";
|
||||
text+= " />";
|
||||
|
||||
opener.editorFocus(opener.editorPrevSrl);
|
||||
|
|
@ -91,3 +112,23 @@ function insertImage(obj) {
|
|||
}
|
||||
|
||||
xAddEventListener(window, "load", getImage);
|
||||
|
||||
function setScale(type) {
|
||||
switch(type) {
|
||||
case 'width' :
|
||||
if(!orig_height) return;
|
||||
var n_width = xGetElementById('width').value;
|
||||
var p = n_width/orig_width;
|
||||
var n_height = parseInt(orig_height * p,10);
|
||||
xGetElementById('height').value = n_height;
|
||||
break;
|
||||
case 'height' :
|
||||
if(!orig_width) return;
|
||||
var n_height = xGetElementById('height').value;
|
||||
var p = n_height/orig_height;
|
||||
var n_width = parseInt(orig_width * p,10);
|
||||
xGetElementById('width').value = n_width;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue