<?php
if (!defined('_GNUBOARD_')) exit;
include_once("{$board_skin_path}/db_update.php");
add_stylesheet('<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">', 0);
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.write.css">', 0);
// 5. 버전 폼 기본값 설정 (이전 게시물 값 가져오기)
if (!$write['x2_ver']) {
$row_ver = sql_fetch(" select x2_ver from {$write_table} order by wr_id desc limit 1 ");
$default_ver = $row_ver['x2_ver'];
} else {
$default_ver = $write['x2_ver'];
}
// [혜정 센스] 분류 기본값 설정 로직: 현재값 없으면 오늘 날짜(YYYY-MM)
$current_ca_name = $write['ca_name'] ? $write['ca_name'] : date("Y-m");
$file_count = (isset($board['bo_upload_count']) && $board['bo_upload_count']) ? $board['bo_upload_count'] : 0;
$line_rows = array();
if (!empty($write['x2_line'])) {
$line_tokens = explode('@', $write['x2_line']);
foreach ($line_tokens as $line_token) {
if ($line_token === '') continue;
$line_parts = explode('^', $line_token, 2);
$line_content = isset($line_parts[0]) ? $line_parts[0] : '';
$line_time = isset($line_parts[1]) && trim($line_parts[1]) !== '' ? trim($line_parts[1]) : date('Y-m-d H:i:s');
$line_rows[] = array(
'content' => $line_content,
'time' => $line_time
);
}
}
if (empty($line_rows)) {
$line_rows[] = array(
'content' => '',
'time' => date('Y-m-d H:i:s')
);
}
$memo_open = !empty($write['x2_memo']);
$prev_option = sql_fetch(" select x2_way, x2_week, x2_daily, x2_key, x2_ess from {$write_table} order by wr_id desc limit 1 ");
$way_option_tokens = array();
if (!empty($board['bo_4'])) {
$raw_way_tokens = explode('|', $board['bo_4']);
foreach ($raw_way_tokens as $way_token) {
$way_token = trim($way_token);
if ($way_token === '') continue;
$way_option_tokens[] = $way_token;
}
}
$point_option_tokens = array();
if (!empty($board['bo_5'])) {
$raw_point_tokens = explode('|', $board['bo_5']);
foreach ($raw_point_tokens as $point_token) {
$point_token = trim($point_token);
if ($point_token === '') continue;
$point_option_tokens[] = $point_token;
}
}
$healing_option_tokens = array();
if (!empty($board['bo_6'])) {
$raw_healing_tokens = explode('|', $board['bo_6']);
foreach ($raw_healing_tokens as $healing_token) {
$healing_token = trim($healing_token);
if ($healing_token === '') continue;
$healing_option_tokens[] = $healing_token;
}
}
$routine_option_tokens = array();
if (!empty($board['bo_7'])) {
$raw_routine_tokens = explode('|', $board['bo_7']);
foreach ($raw_routine_tokens as $routine_token) {
$routine_token = trim($routine_token);
if ($routine_token === '') continue;
$routine_option_tokens[] = $routine_token;
}
}
$health_option_tokens = array();
if (!empty($board['bo_8'])) {
$raw_health_tokens = explode('|', $board['bo_8']);
foreach ($raw_health_tokens as $health_token) {
$health_token = trim($health_token);
if ($health_token === '') continue;
$health_option_tokens[] = $health_token;
}
}
$x2_way_raw = isset($write['x2_way']) ? trim($write['x2_way']) : '';
$x2_way_selected = array();
if ($x2_way_raw !== '') {
foreach (explode('|', $x2_way_raw) as $way_selected_token) {
$way_selected_token = trim($way_selected_token);
if ($way_selected_token === '') continue;
$x2_way_selected[] = $way_selected_token;
}
}
$way_open = ($x2_way_raw !== '');
$x2_point_raw = isset($write['x2_point']) ? trim($write['x2_point']) : '';
$x2_point_selected = array();
if ($x2_point_raw !== '') {
foreach (explode('|', $x2_point_raw) as $point_selected_token) {
$point_selected_token = trim($point_selected_token);
if ($point_selected_token === '') continue;
$x2_point_selected[] = $point_selected_token;
}
}
$point_open = ($x2_point_raw !== '');
$x2_healing_raw = isset($write['x2_healing']) ? trim($write['x2_healing']) : '';
$x2_healing_selected = array();
if ($x2_healing_raw !== '') {
foreach (explode('|', $x2_healing_raw) as $healing_selected_token) {
$healing_selected_token = trim($healing_selected_token);
if ($healing_selected_token === '') continue;
$x2_healing_selected[] = $healing_selected_token;
}
}
$healing_open = ($x2_healing_raw !== '');
$x2_routine_raw = isset($write['x2_routine']) ? trim($write['x2_routine']) : '';
$x2_routine_selected = array();
if ($x2_routine_raw !== '') {
foreach (explode('|', $x2_routine_raw) as $routine_selected_token) {
$routine_selected_token = trim($routine_selected_token);
if ($routine_selected_token === '') continue;
$x2_routine_selected[] = $routine_selected_token;
}
}
$routine_open = ($x2_routine_raw !== '');
$x2_health_raw = isset($write['x2_health']) ? trim($write['x2_health']) : '';
$x2_health_selected = array();
if ($x2_health_raw !== '') {
foreach (explode('|', $x2_health_raw) as $health_selected_token) {
$health_selected_token = trim($health_selected_token);
if ($health_selected_token === '') continue;
$x2_health_selected[] = $health_selected_token;
}
}
$health_open = ($x2_health_raw !== '');
$extra_open = (!empty($write['x2_extra1']) || !empty($write['x2_extra2']));
$week_days = array('월', '화', '수', '목', '금', '토', '일');
$write_x2_week = isset($write['x2_week']) ? trim($write['x2_week']) : '';
$default_x2_week = isset($prev_option['x2_week']) ? trim($prev_option['x2_week']) : '';
$x2_week_raw = ($write_x2_week !== '') ? $write_x2_week : $default_x2_week;
$x2_week_rows = explode('^', $x2_week_raw);
for ($week_idx = 0; $week_idx < 7; $week_idx++) {
if (!isset($x2_week_rows[$week_idx])) {
$x2_week_rows[$week_idx] = '';
}
}
$week_has_values = false;
foreach ($x2_week_rows as $week_row_value) {
if (trim($week_row_value) !== '') {
$week_has_values = true;
break;
}
}
$week_status_tokens = array();
for ($week_idx = 0; $week_idx < 7; $week_idx++) {
$week_status_tokens[] = $week_days[$week_idx] . (trim($x2_week_rows[$week_idx]) !== '' ? '●' : '○');
}
$week_status_text = implode(' ', $week_status_tokens);
$write_x2_daily = isset($write['x2_daily']) ? trim($write['x2_daily']) : '';
$x2_daily_value = ($write_x2_daily !== '') ? $write_x2_daily : (isset($prev_option['x2_daily']) ? $prev_option['x2_daily'] : '');
$daily_has_value = (trim($x2_daily_value) !== '');
$write_x2_key = isset($write['x2_key']) ? trim($write['x2_key']) : '';
$x2_key_value = ($write_x2_key !== '') ? $write_x2_key : (isset($prev_option['x2_key']) ? $prev_option['x2_key'] : '');
$key_has_value = (trim($x2_key_value) !== '');
$write_x2_ess = isset($write['x2_ess']) ? trim($write['x2_ess']) : (isset($write['x2_Ess']) ? trim($write['x2_Ess']) : '');
$prev_x2_ess = isset($prev_option['x2_ess']) ? $prev_option['x2_ess'] : (isset($prev_option['x2_Ess']) ? $prev_option['x2_Ess'] : '');
$x2_ess_value = ($write_x2_ess !== '') ? $write_x2_ess : $prev_x2_ess;
$ess_has_value = (trim($x2_ess_value) !== '');
?>
<div id="WRITE_WRAP">
<canvas id="space-canvas"></canvas>
<article id="WRITE">
<form name="fwrite" id="fwrite" action="<?php echo $action_url; ?>" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="bo_table" value="<?php echo $bo_table; ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id; ?>">
<input type="hidden" name="sca" value="<?php echo $sca; ?>">
<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
<div class="write-top-bar">
<h2 class="write-top-title"><i class="fa-solid fa-rocket"></i> DATA CONTROL</h2>
<div class="write-top-actions">
<button type="button" class="btn-action btn-cancel-top" onclick="window.history.back();">CANCEL</button>
<button type="submit" class="btn-action btn-save-top">SAVE MISSION</button>
</div>
</div>
<table class="write-table">
<tr>
<td class="td-label"><i class="fa-solid fa-satellite-dish"></i> 분류/시간</td>
<td class="td-value">
<div class="field-row-wrap">
<?php if ($is_category) { ?>
<span class="field-caption">언제</span>
<select name="ca_name" required>
<option value="">분류 선택</option>
<?php
// [수정] 따옴표 문제 해결을 위한 정밀 치환
$category_option = str_replace('value="'.$current_ca_name.'"', 'value="'.$current_ca_name.'" selected', $category_option);
$category_option = str_replace("value='".$current_ca_name."'", "value='".$current_ca_name."' selected", $category_option);
echo $category_option;
?>
</select>
<?php } ?>
<span class="field-caption">하루</span>
<select name="x2_ca2" required>
<option value=''>선택</option>
<?php
$bo_1_opts = explode("|", $board['bo_1']);
foreach($bo_1_opts as $val) {
$selected = ($write['x2_ca2'] == $val) ? "selected" : "";
echo "<option value='{$val}' {$selected}>{$val}</option>";
}
?>
</select>
<span class="field-caption">무엇</span>
<select name="x2_ca3" id="x2_ca3" required>
<option value=''>선택</option>
<?php
$bo_2_opts = explode("|", $board['bo_2']);
foreach($bo_2_opts as $val) {
if (!trim($val)) continue;
$selected = (isset($write['x2_ca3']) && $write['x2_ca3'] == $val) ? "selected" : "";
echo "<option value='{$val}' {$selected}>{$val}</option>";
}
?>
</select>
<span class="field-caption">또는</span>
<select name="x2_ca4" id="x2_ca4" required>
<option value=''>선택</option>
<?php
$bo_3_opts = explode("|", $board['bo_3']);
foreach($bo_3_opts as $val) {
if (!trim($val)) continue;
$selected = (isset($write['x2_ca4']) && $write['x2_ca4'] == $val) ? "selected" : "";
echo "<option value='{$val}' {$selected}>{$val}</option>";
}
?>
</select>
<button type="button" class="btn-action btn-memo-toggle" id="memo-toggle-btn" aria-expanded="<?php echo $memo_open ? 'true' : 'false'; ?>">메모</button>
<div class="date-time-wrap">
<span class="field-caption no-margin">버전</span>
<input type="text" name="x2_ver" value="<?php echo $default_ver; ?>" size="8" placeholder="Version">
</div>
</div>
<div id="memo-area" class="memo-area <?php echo $memo_open ? 'open' : ''; ?>">
<div class="memo-clean-wrap">
<label class="switch">
<input type="checkbox" name="x2_memo_clean" value="1" <?php echo (isset($write['x2_memo_clean']) && $write['x2_memo_clean'] == "1") ? "checked" : ""; ?>>
<span class="slider"></span>
</label>
<span class="field-caption no-margin">메모 정리</span>
</div>
<textarea name="x2_memo" rows="5" placeholder="메모를 입력하세요"><?php echo $write['x2_memo']; ?></textarea>
</div>
</td>
</tr>
<tr>
<td class="td-label"><i class="fa-solid fa-gear"></i> 옵션</td>
<td class="td-value">
<div class="field-row-wrap">
<span class="field-caption">간판</span>
<label class="switch">
<input type="checkbox" name="x2_see" value="1" <?php echo (isset($write['x2_see']) && $write['x2_see'] == "1") ? "checked" : ""; ?>>
<span class="slider"></span>
</label>
<span class="field-caption">우선</span>
<label class="switch">
<input type="checkbox" name="x2_top" value="1" <?php echo ($write['x2_top'] == "1") ? "checked" : ""; ?>>
<span class="slider"></span>
</label>
<span class="field-caption">라벨</span>
<input type="hidden" name="x2_label" value="0">
<label class="switch">
<input type="checkbox" name="x2_label" value="1" <?php echo (isset($write['x2_label']) && $write['x2_label'] == "1") ? "checked" : ""; ?>>
<span class="slider"></span>
</label>
<span class="field-caption no-margin">프로젝트</span>
<input type="text" name="x2_project" value="<?php echo $write['x2_project']; ?>" size="40" placeholder="Project">
<label class="option-toggle-switch btn-action <?php echo $extra_open ? 'is-on' : ''; ?>" id="extra-toggle-btn" aria-expanded="<?php echo $extra_open ? 'true' : 'false'; ?>">
<span class="toggle-left">추가</span>
<input type="checkbox" class="option-toggle-input extra-toggle-input" <?php echo $extra_open ? 'checked' : ''; ?>>
<span class="option-toggle-track"></span>
<span class="toggle-left">생각</span>
</label>
<div class="date-time-wrap">
<input type="date" name="wr_date_custom" id="wr_date_custom" value="<?php echo substr($write['wr_datetime'],0,10); ?>">
<input type="time" name="wr_time_custom" id="wr_time_custom" value="<?php echo substr($write['wr_datetime'],11,8); ?>" step="1">
</div>
</div>
</td>
</tr>
<tr id="extra-row">
<td colspan="2" style="padding:0; border:0;">
<div id="extra-row-inner" style="<?php echo $extra_open ? '' : 'display:none;'; ?> overflow:hidden;">
<table class="write-table" style="margin:0; padding:0; border:0;">
<tr>
<td class="td-label"><i class="fa-solid fa-plus"></i> 추가 항목</td>
<td class="td-value">
<div class="option-panel-title">내일 할일</div>
<input type="text" name="x2_extra1" value="<?php echo $write['x2_extra1']; ?>" style="width:100%" placeholder="내일 할 일">
<div class="option-panel-title" style="margin-top:15px;">한 줄 생각</div>
<input type="text" name="x2_extra2" value="<?php echo $write['x2_extra2']; ?>" style="width:100%" placeholder="한 줄 생각">
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td class="td-label"><i class="fa-solid fa-pen-fancy"></i> 일상 : 제목</td>
<td class="td-value">
<input type="text" name="wr_subject" value="<?php echo $subject; ?>" required style="width:100%" placeholder="제목을 입력하세요">
</td>
</tr>
<tr>
<td class="td-label"><i class="fa-solid fa-tags"></i> 태그</td>
<td class="td-value">
<input type="text" name="wr_1" value="<?php echo $write['wr_1']; ?>" style="width:100%" placeholder="태그를 입력하세요 (쉼표로 구분)">
</td>
</tr>
<tr>
<td class="td-label"><i class="fa-solid fa-diagram-project"></i> 추가 옵션</td>
<td class="td-value">
<div class="field-row-wrap option-toggle-wrap">
<label class="option-toggle-switch btn-action <?php echo $way_open ? 'is-on' : ''; ?>" data-target="option-way-panel" aria-expanded="<?php echo $way_open ? 'true' : 'false'; ?>">
<span class="toggle-left">길</span>
<input type="checkbox" class="option-toggle-input" <?php echo $way_open ? 'checked' : ''; ?>>
<span class="option-toggle-track"></span>
</label>
<label class="option-toggle-switch btn-action <?php echo $point_open ? 'is-on' : ''; ?>" data-target="option-point-panel" aria-expanded="<?php echo $point_open ? 'true' : 'false'; ?>">
<span class="toggle-left">포인트</span>
<input type="checkbox" class="option-toggle-input" <?php echo $point_open ? 'checked' : ''; ?>>
<span class="option-toggle-track"></span>
</label>
<label class="option-toggle-switch btn-action <?php echo $healing_open ? 'is-on' : ''; ?>" data-target="option-healing-panel" aria-expanded="<?php echo $healing_open ? 'true' : 'false'; ?>">
<span class="toggle-left">힐링</span>
<input type="checkbox" class="option-toggle-input" <?php echo $healing_open ? 'checked' : ''; ?>>
<span class="option-toggle-track"></span>
</label>
<label class="option-toggle-switch btn-action <?php echo $routine_open ? 'is-on' : ''; ?>" data-target="option-routine-panel" aria-expanded="<?php echo $routine_open ? 'true' : 'false'; ?>">
<span class="toggle-left">루틴</span>
<input type="checkbox" class="option-toggle-input" <?php echo $routine_open ? 'checked' : ''; ?>>
<span class="option-toggle-track"></span>
</label>
<label class="option-toggle-switch btn-action <?php echo $health_open ? 'is-on' : ''; ?>" data-target="option-health-panel" aria-expanded="<?php echo $health_open ? 'true' : 'false'; ?>">
<span class="toggle-left">건강</span>
<input type="checkbox" class="option-toggle-input" <?php echo $health_open ? 'checked' : ''; ?>>
<span class="option-toggle-track"></span>
</label>
<label class="option-toggle-switch btn-action" data-target="option-week-panel" aria-expanded="false">
<span class="toggle-left">요일</span>
<input type="checkbox" class="option-toggle-input">
<span class="option-toggle-track"></span>
<span class="toggle-right toggle-status <?php echo $week_has_values ? 'has-value' : ''; ?>">
<i class="fa-solid <?php echo $week_has_values ? 'fa-circle-check' : 'fa-circle-minus'; ?>"></i>
<span class="status-text"><?php echo $week_status_text; ?></span>
</span>
</label>
<label class="option-toggle-switch btn-action" data-target="option-daily-panel" aria-expanded="false">
<span class="toggle-left">일상</span>
<input type="checkbox" class="option-toggle-input">
<span class="option-toggle-track"></span>
<span class="toggle-right toggle-icon <?php echo $daily_has_value ? 'has-value' : ''; ?>">
<i class="fa-solid <?php echo $daily_has_value ? 'fa-circle-check' : 'fa-circle-minus'; ?>"></i>
</span>
</label>
<label class="option-toggle-switch btn-action" data-target="option-key-panel" aria-expanded="false">
<span class="toggle-left">중요</span>
<input type="checkbox" class="option-toggle-input">
<span class="option-toggle-track"></span>
<span class="toggle-right toggle-icon <?php echo $key_has_value ? 'has-value' : ''; ?>">
<i class="fa-solid <?php echo $key_has_value ? 'fa-circle-check' : 'fa-circle-minus'; ?>"></i>
</span>
</label>
<label class="option-toggle-switch btn-action" data-target="option-ess-panel" aria-expanded="false">
<span class="toggle-left">필수</span>
<input type="checkbox" class="option-toggle-input">
<span class="option-toggle-track"></span>
<span class="toggle-right toggle-icon <?php echo $ess_has_value ? 'has-value' : ''; ?>">
<i class="fa-solid <?php echo $ess_has_value ? 'fa-circle-check' : 'fa-circle-minus'; ?>"></i>
</span>
</label>
</div>
<div id="option-way-panel" class="option-panel <?php echo $way_open ? 'open' : ''; ?>">
<div class="option-panel-title">길 선택</div>
<div class="option-way-grid">
<?php foreach ($way_option_tokens as $way_option_token) { ?>
<label class="option-way-item">
<span class="switch">
<input type="checkbox" name="x2_way[]" value="<?php echo htmlspecialchars($way_option_token, ENT_QUOTES); ?>" <?php echo in_array($way_option_token, $x2_way_selected) ? 'checked' : ''; ?>>
<span class="slider"></span>
</span>
<span class="field-caption no-margin"><?php echo htmlspecialchars($way_option_token); ?></span>
</label>
<?php } ?>
</div>
</div>
<div id="option-point-panel" class="option-panel <?php echo $point_open ? 'open' : ''; ?>">
<div class="option-panel-title">포인트 선택</div>
<div class="option-way-grid">
<?php foreach ($point_option_tokens as $point_option_token) { ?>
<label class="option-way-item">
<span class="switch">
<input type="checkbox" name="x2_point[]" value="<?php echo htmlspecialchars($point_option_token, ENT_QUOTES); ?>" <?php echo in_array($point_option_token, $x2_point_selected) ? 'checked' : ''; ?>>
<span class="slider"></span>
</span>
<span class="field-caption no-margin"><?php echo htmlspecialchars($point_option_token); ?></span>
</label>
<?php } ?>
</div>
</div>
<div id="option-healing-panel" class="option-panel <?php echo $healing_open ? 'open' : ''; ?>">
<div class="option-panel-title">힐링 선택</div>
<div class="option-way-grid">
<?php foreach ($healing_option_tokens as $healing_option_token) { ?>
<label class="option-way-item">
<span class="switch">
<input type="checkbox" name="x2_healing[]" value="<?php echo htmlspecialchars($healing_option_token, ENT_QUOTES); ?>" <?php echo in_array($healing_option_token, $x2_healing_selected) ? 'checked' : ''; ?>>
<span class="slider"></span>
</span>
<span class="field-caption no-margin"><?php echo htmlspecialchars($healing_option_token); ?></span>
</label>
<?php } ?>
</div>
</div>
<div id="option-routine-panel" class="option-panel <?php echo $routine_open ? 'open' : ''; ?>">
<div class="option-panel-title">루틴 선택</div>
<div class="option-way-grid">
<?php foreach ($routine_option_tokens as $routine_option_token) { ?>
<label class="option-way-item">
<span class="switch">
<input type="checkbox" name="x2_routine[]" value="<?php echo htmlspecialchars($routine_option_token, ENT_QUOTES); ?>" <?php echo in_array($routine_option_token, $x2_routine_selected) ? 'checked' : ''; ?>>
<span class="slider"></span>
</span>
<span class="field-caption no-margin"><?php echo htmlspecialchars($routine_option_token); ?></span>
</label>
<?php } ?>
</div>
</div>
<div id="option-health-panel" class="option-panel <?php echo $health_open ? 'open' : ''; ?>">
<div class="option-panel-title">건강 선택</div>
<div class="option-way-grid">
<?php foreach ($health_option_tokens as $health_option_token) { ?>
<label class="option-way-item">
<span class="switch">
<input type="checkbox" name="x2_health[]" value="<?php echo htmlspecialchars($health_option_token, ENT_QUOTES); ?>" <?php echo in_array($health_option_token, $x2_health_selected) ? 'checked' : ''; ?>>
<span class="slider"></span>
</span>
<span class="field-caption no-margin"><?php echo htmlspecialchars($health_option_token); ?></span>
</label>
<?php } ?>
</div>
</div>
<div id="option-week-panel" class="option-panel">
<div class="option-panel-title">요일별 기록</div>
<div class="option-week-grid">
<?php for ($week_idx = 0; $week_idx < 7; $week_idx++) { ?>
<div class="option-week-item">
<div class="option-week-label"><?php echo $week_days[$week_idx]; ?>요일</div>
<textarea name="x2_week[]" rows="4" placeholder="<?php echo $week_days[$week_idx]; ?>요일 내용"><?php echo htmlspecialchars($x2_week_rows[$week_idx], ENT_QUOTES); ?></textarea>
</div>
<?php } ?>
</div>
</div>
<div id="option-daily-panel" class="option-panel">
<div class="option-panel-title">일상</div>
<textarea name="x2_daily" rows="5" placeholder="일상 내용을 입력하세요"><?php echo htmlspecialchars($x2_daily_value, ENT_QUOTES); ?></textarea>
</div>
<div id="option-key-panel" class="option-panel">
<div class="option-panel-title">중요</div>
<textarea name="x2_key" rows="5" placeholder="중요 내용을 입력하세요"><?php echo htmlspecialchars($x2_key_value, ENT_QUOTES); ?></textarea>
</div>
<div id="option-ess-panel" class="option-panel">
<div class="option-panel-title">필수</div>
<textarea name="x2_ess" rows="5" placeholder="필수 내용을 입력하세요"><?php echo htmlspecialchars($x2_ess_value, ENT_QUOTES); ?></textarea>
</div>
</td>
</tr>
<tr>
<td colspan="2" class="editor-toggle-row">
<button type="button" class="btn-action btn-editor-toggle" onclick="$('#Editor-Area').slideToggle();">데이터 에디터 & 첨부파일 관리</button>
</td>
</tr>
</table>
<div id="Editor-Area" style="<?php echo ($w=='u' || $write['wr_content']) ? 'display:block;' : 'display:none;'; ?>">
<div style="padding:30px; background: rgba(0, 0, 0, 0.4);">
<?php echo $editor_html; ?>
</div>
<div class="extra-code-section">
<h3 style="color:#e2e8f0; font-size:0.9rem; margin-bottom:15px;"><i class="fa-solid fa-code" style="color:#00f2ff; margin-right:10px;"></i>추가 내용</h3>
<textarea name="x2_txt" rows="8" placeholder="추가 내용을 입력하세요"><?php echo $write['x2_txt']; ?></textarea>
</div>
<div class="extra-code-section work-line-section">
<h3 class="section-title"><i class="fa-solid fa-list-check"></i> 일상 라인</h3>
<input type="hidden" name="x2_line" id="x2_line_serialized" value="<?php echo htmlspecialchars($write['x2_line'], ENT_QUOTES); ?>">
<div id="workLineRows">
<?php foreach ($line_rows as $line_idx => $line_row) { ?>
<div class="work-line-row" data-index="<?php echo $line_idx; ?>">
<div class="work-line-time-wrap">
<span class="field-caption no-margin">기록 시간</span>
<input type="text" class="work-line-time" value="<?php echo htmlspecialchars($line_row['time'], ENT_QUOTES); ?>" readonly>
</div>
<textarea class="work-line-content" rows="4" placeholder="작업 내용을 입력하세요"><?php echo htmlspecialchars($line_row['content'], ENT_QUOTES); ?></textarea>
</div>
<?php } ?>
</div>
<button type="button" class="btn-action btn-add-line" id="btn-add-work-line">+ ADD WORK LINE</button>
</div>
<table class="write-table">
<tr>
<td class="td-label" ><i class="fa-solid fa-link"></i> 링크</td>
<td class="td-value" style="padding-right:0px;">
<input type="text" name="wr_link1" value="<?php echo $write['wr_link1']; ?>" style="width:100%" placeholder="참조 링크 #1">
</td>
<td class="td-value">
<input type="text" name="wr_link2" value="<?php echo $write['wr_link2']; ?>" style="width:100%" placeholder="참조 링크 #2">
</td>
</tr>
</table>
<table class="write-table">
<tr>
<td class="td-label"><i class="fa-solid fa-paperclip"></i> 페이로드 첨부</td>
<td class="td-value">
<div id="variableFiles">
<?php for ($i=0; $is_file && $i<$file_count; $i++) {
$is_active = ($i == 0 || (isset($file[$i]['file']) && $file[$i]['file'])) ? "active" : "";
?>
<div class="file-row <?php echo $is_active; ?>" id="file_row_<?php echo $i; ?>">
<label for="bf_file_<?php echo $i; ?>" class="file-btn-custom">FILE #<?php echo $i+1; ?></label>
<input type="file" name="bf_file[<?php echo $i; ?>]" id="bf_file_<?php echo $i; ?>" style="display:none;" onchange="updateFileName(this, <?php echo $i; ?>)">
<span id="file_name_<?php echo $i; ?>" style="color:#8fa3ad; font-size:0.85rem; flex:1;">
<?php if($w == 'u' && isset($file[$i]['file']) && $file[$i]['file']) {
echo $file[$i]['source'];
echo " <label style='color:#ff4757; margin-left:10px; cursor:pointer;'><input type='checkbox' name='bf_file_del[$i]' value='1'> 삭제</label>";
} else { echo "No file selected"; } ?>
</span>
<?php if ($board['bo_use_file_content']) { ?>
<input type="text" name="bf_content[<?php echo $i; ?>]" value="<?php echo ($w == 'u') ? stripslashes($file[$i]['bf_content']) : ''; ?>" class="file-desc-input" placeholder="파일 설명 입력">
<?php } ?>
</div>
<?php } ?>
</div>
<button type="button" class="btn-action btn-add-file" onclick="file_add();">+ ADD FILE SLOT</button>
</td>
</tr>
</table>
</div>
<div class="write-submit-wrap">
<button type="submit" class="btn-action btn-save-main">MISSION COMPLETE & SAVE</button>
</div>
</form>
</article>
</div>
<?php include_once("{$board_skin_path}/write/write.script.php"); ?>