</div> <div id="textarea-section" class="section"> <h3><?php echo _t('본문'); ?> </h3> <dl class="editoroption"> <dt><label for="contentformatter"><?php echo _t('포매터'); ?> </label></dt> <dd><select id="contentformatter" name="contentformatter" onchange="return setFormatter(this.value, document.getElementById('contenteditor'), setCurrentEditor);"> <?php foreach (getAllFormatters() as $key => $formatter) { ?> <option value="<?php echo htmlspecialchars($key); ?> "<?php echo $entry['contentformatter'] == $key ? ' selected="selected"' : ''; ?> ><?php echo htmlspecialchars($formatter['name']); ?> </option> <?php } ?> </select></dd>
function printFormatterSelectScript() { ?> <script type="text/javascript"> //<![CDATA[ function getEditorsForFormatter(key) { switch (key) { <?php foreach (getAllFormatters() as $id => $formatter) { echo "\t\tcase '" . addslashes($id) . "': return ["; $delim = ''; foreach ($formatter['editors'] as $key => $value) { echo $delim . "'" . addslashes($key) . "'"; $delim = ', '; } echo "];\n"; } ?> } return []; } function setFormatter(key, editorselect, correct) { var editoroptions = editorselect.options; var editorsusedfor = getEditorsForFormatter(key); var editormap = {}; for (var i = 0; i < editorsusedfor.length; ++i) { editormap[editorsusedfor[i]] = true; } var firsteditor = -1; for (var i = 0; i < editoroptions.length; ++i) { if (editormap[editoroptions[i].value]) { editoroptions[i].disabled = false; editoroptions[i].style.color = ''; if (firsteditor < 0) firsteditor = i; } else { editoroptions[i].disabled = true; editoroptions[i].style.color = 'GrayText'; } } //if (correct && !editormap[editorselect.value] && firsteditor >= 0) { if (correct && firsteditor >= 0) { editorselect.selectedIndex = firsteditor; if (typeof correct == 'function') correct(editorselect.value, key); } return true; } function saveEditor(select) { select.prevSelectedIndex = select.selectedIndex; return true; } function setEditor(select) { if (select.options[select.selectedIndex].disabled) { select.selectedIndex = select.prevSelectedIndex; return false; } select.prevSelectedIndex = select.selectedIndex; return true; } //]]> </script> <?php }
<fieldset class="container"> <legend><?php echo _t('글 작성 환경을 설정합니다'); ?> </legend> <dl id="formatter-line" class="line"> <dt><span class="label"><?php echo _t('기본 포매터'); ?> </span></dt> <dd> <select id="defaultFormatter" name="defaultFormatter" onchange="return setFormatter(this.value, document.getElementById('defaultEditor'), true);"> <?php $defaultFormatter = getDefaultFormatter(); foreach (getAllFormatters() as $key => $value) { ?> <option value="<?php echo htmlspecialchars($key); ?> "<?php echo $key == $defaultFormatter ? ' selected="selected"' : ''; ?> ><?php echo htmlspecialchars($value['name']); ?> </option> <?php } ?> </select>