diff --git a/common/js/common.js b/common/js/common.js index daa37c2d0..b390faa80 100644 --- a/common/js/common.js +++ b/common/js/common.js @@ -36,8 +36,8 @@ function displayMultimedia(src, width, height, auto_start) { var ext = src.split("."); var type = ext[ext.length-1]; - if(auto_start) auto_start = 1; - else auto_start = 0; + if(auto_start) auto_start = "true"; + else auto_start = "false"; var clsid = ""; var codebase = ""; diff --git a/modules/document/document.model.php b/modules/document/document.model.php index e472892bd..1dc18cde6 100644 --- a/modules/document/document.model.php +++ b/modules/document/document.model.php @@ -319,7 +319,7 @@ **/ function transContent($content) { // 에디터 컴포넌트를 찾아서 결과 코드로 변환 - $content = preg_replace_callback('!<(div|img) editor_component="([a-zA-Z\_^\"]+)"([^\>]*?)>!is', array($this,'_transMultimedia'), $content); + $content = preg_replace_callback('!<(div|img)([^\>]*?)>(<\/div>)?!is', array($this,'_transMultimedia'), $content); //
코드 변환 $content = str_replace(array("
","
","
"),"
", $content); @@ -335,9 +335,13 @@ * 로 되어 있는 코드를 변경 **/ function _transMultimedia($matches) { + // IE에서는 태그의 특성중에서 " 를 빼어 버리는 경우가 있기에 정규표현식으로 추가해줌 + $buff = $matches[0]; + $buff = preg_replace('/([^=^"^ ]*)=([^"])([^=^ ]*)/i', '$1="$2$3"', $buff); + // 플러그인에서 생성된 코드 (img, div태그내에 plugin코드 존재)의 parameter를 추출 $oXmlParser = new XmlParser(); - $xml_doc = $oXmlParser->parse($matches[0]); + $xml_doc = $oXmlParser->parse($buff); // plugin attribute가 없으면 return $editor_component = $xml_doc->attrs->editor_component; diff --git a/modules/editor/components/multimedia_link/multimedia_link.class.php b/modules/editor/components/multimedia_link/multimedia_link.class.php index c67239d25..0f0f4ff56 100644 --- a/modules/editor/components/multimedia_link/multimedia_link.class.php +++ b/modules/editor/components/multimedia_link/multimedia_link.class.php @@ -69,7 +69,7 @@ if(!$height) $height = 480; $auto_start = $xml_obj->attrs->auto_start; - if(!$auto_start) $auto_start = "false"; + if($auto_start!="true") $auto_start = "false"; else $auto_start = "true"; $caption = $xml_obj->body; diff --git a/modules/editor/components/multimedia_link/tpl/popup.js b/modules/editor/components/multimedia_link/tpl/popup.js index 7ff2bd820..56f315a2c 100644 --- a/modules/editor/components/multimedia_link/tpl/popup.js +++ b/modules/editor/components/multimedia_link/tpl/popup.js @@ -1,3 +1,28 @@ +/** + * popup으로 열렸을 경우 부모창의 위지윅에디터에 select된 멀티미디어 컴포넌트 코드를 체크하여 + * 있으면 가져와서 원하는 곳에 삽입 + **/ +function getMultimedia() { + // 부모 위지윅 에디터에서 선택된 영역이 있는지 확인 + if(typeof(opener)=="undefined") return; + + var node = opener.editorPrevNode; + if(!node || node.nodeName != "DIV") return; + + var url = node.getAttribute("src"); + var caption = xInnerHtml(node); + var width = node.getAttribute("width"); + var height = node.getAttribute("height"); + var auto_start = node.getAttribute("auto_start"); + + xGetElementById("multimedia_url").value = url; + xGetElementById("multimedia_caption").value = caption; + xGetElementById("multimedia_width").value = width; + xGetElementById("multimedia_height").value = height; + if(auto_start=="true") xGetElementById("multimedia_auto_start").checked = true; + +} + function insertMultimedia(obj) { if(typeof(opener)=="undefined") return; @@ -30,3 +55,5 @@ function insertMultimedia(obj) { window.close(); } + +xAddEventListener(window, "load", getMultimedia);