sejin7940_copy 모듈인데 19년도 3월에 1.4버전 이후로 업데이트가 없더군요.
최근 해당 기능을 사용하기 위해서 조금 손 봤습니다.
라이믹스 최신 버전에서 동작합니다.
그리고 모듈 선택기에서도 전체 선택하는 기능을 추가했습니다.
(1) 게시판 복사 모듈에서 오류를 수정하고
<script>
function receiveSelectedModules(data) {
const selectElement = document.getElementById('_target_module2');
data.forEach(module => {
const option = document.createElement('option');
option.value = module.moduleSrl;
option.text = `${module.moduleName} (${module.moduleTitle})`;
selectElement.appendChild(option);
});
}
</script>
(2) 모듈 선택기
modules/module/tpl/module_selector.html
<load target="./js/module_admin.js" />
<div class="x_modal-header">
<h1>{$lang->module_selector}</h1>
</div>
<form id="moduleForm" action="./" method="get" class="rx_ajax x_modal-body x_form-horizontal" no-error-return-url="true" style="max-height:none">
<input type="hidden" name="module" value="module" />
<input type="hidden" name="act" value="dispModuleSelectList" />
<input type="hidden" name="id" value="{$id}" />
<input type="hidden" name="type" value="{$type}" />
<div class="x_control-group">
<div class="x_controls">
<button type="button" onclick="insertSelectedModules()">선택된 항목 추가</button>
<select name="selected_module" id="selected_module">
<option loop="$mid_list => $key,$val" value="{$key}" selected="selected"|cond="$key == $selected_module">{$val->title}</option>
</select>
<input type="submit" value="{$lang->cmd_search}" class="x_btn" />
</div>
</div>
<!--@foreach($selected_mids as $category_name => $list)-->
<h2 cond="$category_name" style="margin-top:40px;">{$category_name}</h2>
<table class="x_table x_table-striped x_table-hover" style="border-top:1px dotted #ddd">
<thead>
<tr>
<th><input type="checkbox" id="selectAll" /></th>
<th>{$lang->mid}</th>
<th>{$lang->browser_title}</th>
<th>{$type=='single'?$lang->cmd_select:$lang->cmd_insert}</th>
<tr>
</thead>
<tbody>
<tr loop="$list => $mid_name,$module_info">
<td><input type="checkbox" name="selected_modules[]" value="{$module_info->module_srl}" /></td>
<td>{$mid_name}</td>
<td>{$module_info->browser_title}</td>
<td><a href="#" onclick="insertModule('{$id|escapejs}', {$module_info->module_srl}, '{$mid_name|escapejs}', '{$module_info->browser_title|escapejs}', {$type=='single'?'false':'true'}); return false;" class="button green"><span>{$type=='single'?$lang->cmd_select:$lang->cmd_insert}</span></a></td>
</tr>
</tbody>
</table>
<!--@end-->
</form>
<script>
document.getElementById('selectAll').addEventListener('click', function(event) {
const checkboxes = document.querySelectorAll('input[name="selected_modules[]"]');
checkboxes.forEach(checkbox => checkbox.checked = event.target.checked);
});
function insertSelectedModules() {
const selectedModules = document.querySelectorAll('input[name="selected_modules[]"]:checked');
const selectedData = [];
selectedModules.forEach(module => {
const moduleSrl = module.value;
const moduleName = module.closest('tr').querySelector('td:nth-child(2)').innerText;
const moduleTitle = module.closest('tr').querySelector('td:nth-child(3)').innerText;
selectedData.push({ moduleSrl, moduleName, moduleTitle });
});
if (window.opener && typeof window.opener.receiveSelectedModules === 'function') {
window.opener.receiveSelectedModules(selectedData);
window.close();
} else {
alert('부모 창이 없거나 receiveSelectedModules 함수가 정의되지 않았습니다.');
}
}
</script>
전체 선택하는 기능은 만들었는데 테스트하고보니,
게시판 복사 모듈 자체에서 복사가 안되는 항목이 있네요. -_-;
모바일 설정이나 표시값 같은게 누락되서 복사되네요 이킁;;;;
https://eond.com/tv