function printOwnerEditorScript($entryId = false) { global $pluginURL, $pluginName, $configMappings; $contentWidth = 500; $context = Model_Context::getInstance(); $browser = Utils_Browser::getInstance(); if ($browser->isMobile()) { $contentWidth = 270; } else { $contentWidth = Utils_Misc::getContentWidth(); /* if($skin = $context->getProperty('skin.skin')) { if($xml = @file_get_contents(ROOT."/skin/blog/$skin/index.xml")) { $xmls = new XMLStruct(); $xmls->open($xml, $context->getProperty('service.encoding')); if($xmls->getValue('/skin/default/contentWidth')) { $contentWidth = $xmls->getValue('/skin/default/contentWidth'); } } }*/ } ?> <script type="text/javascript"> //<![CDATA[ var entryId = <?php echo $entryId ? $entryId : 0; ?> ; var skinContentWidth = <?php echo $contentWidth; ?> ; function savePosition(oTextarea) { if (oTextarea.createTextRange) oTextarea.currentPos = document.selection.createRange().duplicate(); } function insertTag(oTextarea, prefix, postfix) { if (isSafari && !isMinSafari3) var selection = window.getSelection; else var selection = document.selection; if (selection) { if (oTextarea.createTextRange && oTextarea.currentPos) { oTextarea.currentPos.text = prefix + oTextarea.currentPos.text + postfix; oTextarea.focus(); savePosition(oTextarea); } else oTextarea.value = oTextarea.value + prefix + postfix; } else if (oTextarea.selectionStart != null && oTextarea.selectionEnd != null) { var s1 = oTextarea.value.substring(0, oTextarea.selectionStart); var s2 = oTextarea.value.substring(oTextarea.selectionStart, oTextarea.selectionEnd); var s3 = oTextarea.value.substring(oTextarea.selectionEnd); oTextarea.value = s1 + prefix + s2 + postfix + s3; } else oTextarea.value += prefix + postfix; return true; } function editorChanged() { if ((entryManager != undefined) && (entryManager.stateChanged != undefined)) entryManager.stateChanged(); } function getEditor() { <?php $setEditor = $context->getProperty('editor.key'); /// CHANGED FROM 1.8 : Editor only loads what user is using. foreach (getAllEditors() as $id => $editor) { if ($id == $setEditor) { getEditorInfo($id); // explicitly loads plugin code ($pluginURL, $pluginName returned as global) if (isset($editor['initfunc']) && function_exists($editor['initfunc'])) { echo "\t\t\n" . call_user_func_array($editor['initfunc'], array(&$editor)) . "\t\t\n"; $pluginURL = $pluginName = ""; $context->unsetProperty('plugin.url'); $context->unsetProperty('plugin.name'); } } } ?> return new TTDefaultEditor(); } var editor = null; function setCurrentEditor(key, formatter) { var neweditor = getEditor(); if (neweditor == null) { if (editor == null) { // this indicates currently selected editor is unavailable; // we fallback into the default editor. neweditor = new TTDefaultEditor(); } else { return false; } } // if (editor != null) { // try { editor.syncTextarea(); } catch(e) {} // editor.finalize(); // } editor = neweditor; editor.formatter = formatter; editor.initialize(document.getElementById("editWindow")); return true; } function changeEditor(key, formatter) { if (entryManager.nowsaving == true) { alert("<?php echo _t('현재 자동 저장 중입니다. 저장이 완료된 후 다시 시도해 주세요.'); ?> "); return false; } if (!confirm("<?php echo _t('정말로 에디터를 변경하시겠습니까?'); ?> ")) { return false; } if (editor != null) { try { editor.syncTextarea(); } catch (e) { } editor.finalize(); } entryManager.changeEditor = true; entryManager.currentEditor = key; entryManager.saveDraft(); } function reloadEditor() { var url = '<?php echo $context->getProperty('uri.blog') . "/owner/entry/edit/"; ?> ' + entryManager.entryId + '?editor=' + entryManager.currentEditor; if (entryManager.draftSaved == true) { url = url + '&draft=true'; } if (entryManager.returnURL != null) { url = url + '&returnURL=' + encodeURIComponent(entryManager.returnURL); } window.location = url; } //]]> </script> <?php printFormatterSelectScript(); }
<?php /// Copyright (c) 2004-2016, Needlworks / Tatter Network Foundation /// All rights reserved. Licensed under the GPL. /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) require ROOT . '/library/preprocessor.php'; require ROOT . '/interface/common/owner/header.php'; printFormatterSelectScript(); ?> <script type="text/javascript"> //<![CDATA[ var title = "<?php echo escapeJSInCData($context->getProperty('blog.title')); ?> "; var description = "<?php echo escapeJSInCData(trim($context->getProperty('blog.description'))); ?> "; function setResample() { document.getElementById("resample-form").submit(); } function setEditorConfig() { var request = new HTTPRequest("GET", "<?php echo $context->getProperty('uri.blog'); ?> /owner/setting/entry/editor/?defaultEditor=" + document.getElementById('editor-form').defaultEditor.value + "&defaultFormatter=" + document.getElementById('editor-form').defaultFormatter.value + "&useBlogAPI=" + document.getElementById('editor-form').useBlogAPI.checked + "&blogApiPassword=" + document.getElementById('editor-form').blogApiPassword.value );