first
This commit is contained in:
4
modules/widget/README.md
Normal file
4
modules/widget/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
## Copyright and license
|
||||
Copyright 2020 Redblock, Inc.
|
||||
|
||||
Licensed under the [RBL](https://kimsq.com/p/rbl) License
|
||||
8
modules/widget/action/a.widget_update.php
Normal file
8
modules/widget/action/a.widget_update.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
|
||||
checkAdmin(0);
|
||||
|
||||
|
||||
getLink($g['s'].'/?r='.$r.'&m=admin&module='.$m.'&layout='.$_layout.'&sublayout='.$_sublayout,'parent.',sprintf('[%s] 파일이 수정되었습니다.',$codeFile),'');
|
||||
?>
|
||||
4
modules/widget/admin.php
Normal file
4
modules/widget/admin.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
include $g['path_module'].$module.'/admin/'.$front.'.php';
|
||||
?>
|
||||
27
modules/widget/admin/_info.php
Normal file
27
modules/widget/admin/_info.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
$license_local = $g['path_module'].$module.'/LICENSE';
|
||||
$license_global = $g['path_root'].'LICENSE';
|
||||
|
||||
if (file_exists($license_local)) $license = $license_local;
|
||||
else $license = $license_global;
|
||||
?>
|
||||
|
||||
<link href="<?php echo $g['s']?>/_core/css/github-markdown.css" rel="stylesheet">
|
||||
<?php getImport('jquery-markdown','jquery.markdown','0.0.10','js')?>
|
||||
|
||||
<?php @include $g['path_module'].$module.'/var/var.moduleinfo.php' ?>
|
||||
|
||||
<article class="rb-docs markdown-body px-5 pt-3">
|
||||
<h1><?php echo sprintf('%s 모듈정보',ucfirst($MD['name']))?></h1>
|
||||
|
||||
<div class="pb-5 readme"><?php readfile($g['path_module'].$module.'/README.md')?></div>
|
||||
|
||||
<div class="pb-5">
|
||||
<h2>라이센스</h2>
|
||||
<textarea class="form-control" rows="10"><?php readfile($license)?></textarea>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(".markdown-body .readme").markdown();
|
||||
</script>
|
||||
121
modules/widget/admin/main.css
Normal file
121
modules/widget/admin/main.css
Normal file
@@ -0,0 +1,121 @@
|
||||
#widgetbox {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#widgetbox .category {
|
||||
position: absolute;
|
||||
left:0;
|
||||
top: 0;
|
||||
bottom:0;
|
||||
width: 305px;
|
||||
height: 100%;
|
||||
margin-right: -200px;
|
||||
padding: 0;
|
||||
border-right: #dfdfdf solid 1px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
#widgetbox .category .list-group-item:first-child {
|
||||
border-top: 0;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
#widgetbox .category .list-group-item:last-child {
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
#widgetbox .category .list-group-item {
|
||||
padding: .55rem .75rem;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
font-size: 13px
|
||||
}
|
||||
|
||||
|
||||
#widgetbox .content {
|
||||
margin-left: 305px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
#widgetbox .content .none {
|
||||
color: #c0c0c0;
|
||||
text-align: center;
|
||||
padding-top: 70px;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
#widgetbox {
|
||||
overflow: auto;
|
||||
}
|
||||
#widgetbox .category {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border: 0;
|
||||
}
|
||||
#widgetbox .category span {
|
||||
width: 100%;
|
||||
}
|
||||
#widgetbox .content {
|
||||
float: left;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
margin-left: 0;
|
||||
padding: 10px 10px 120px 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-tabs {
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
.nav-tabs .nav-item:first-child .nav-link {
|
||||
border-left: 0
|
||||
}
|
||||
.nav-tabs .nav-link {
|
||||
text-align: center;
|
||||
padding: .5rem 2rem;
|
||||
border-right: 1px solid #ccc;
|
||||
border-bottom: 0;
|
||||
color: #999;
|
||||
background-color: rgba(0, 0, 0, 0.03);
|
||||
border-radius: 0;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
.nav-tabs .nav-link.active {
|
||||
color: #333;
|
||||
background-color: inherit;
|
||||
border: 1px solid #ccc;
|
||||
border-top: 0;
|
||||
border-bottom-color: #fff;
|
||||
border-top: 1px solid #007bff;
|
||||
}
|
||||
|
||||
.position-relative .js-del {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 5px
|
||||
}
|
||||
|
||||
#mjointbox h5 {
|
||||
border-bottom:#dfdfdf dashed 1px;
|
||||
padding:5px 0 15px 0;
|
||||
margin:0 0 30px 0
|
||||
}
|
||||
#mjointbox .rb-label {
|
||||
font-weight:normal;
|
||||
cursor:pointer
|
||||
}
|
||||
|
||||
.pl-6 {
|
||||
padding-left: 4rem!important;
|
||||
}
|
||||
.pl-7 {
|
||||
padding-left: 5rem!important;
|
||||
}
|
||||
.pl-8 {
|
||||
padding-left: 6rem!important;
|
||||
}
|
||||
251
modules/widget/admin/main.php
Normal file
251
modules/widget/admin/main.php
Normal file
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
$step_start = 1;
|
||||
$pwd_start = $g['path_widget'];
|
||||
$g['adm_href'] = $g['s']."/?r=".$r."&m=admin&module=widget".($dropfield?"&dropfield=".$dropfield:'').($option?"&option=".$option:'').($isWcode?"&isWcode=".$isWcode:'').($isEdit?"&isEdit=".$isEdit:'');
|
||||
|
||||
|
||||
if ($option) {
|
||||
$wdgvar=array();
|
||||
// $swval=explode(',',getKRtoUTF(urldecode(str_replace('[!]','&',$option))));
|
||||
$swval=explode(',',urldecode(str_replace('[!]','&',$option)));
|
||||
$swidget=$swval[0];
|
||||
$pwd = $pwd_start.$swidget.'/';
|
||||
|
||||
foreach($swval as $_cval)
|
||||
{
|
||||
$_xval=explode('^',$_cval);
|
||||
$wdgvar[$_xval[0]]=$_xval[1];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$pwd = $pwd ? urldecode($pwd) : $pwd_start;
|
||||
$swidget = is_file($pwd.'main.php') ? str_replace($g['path_widget'],'',$pwd) : '';
|
||||
if ($swidget) $swidget = substr($swidget,0,strlen($swidget)-1);
|
||||
}
|
||||
|
||||
|
||||
if (strstr($pwd,'..')) {
|
||||
getLink('','','정상적인 접근이 아닙니다.','close');
|
||||
}
|
||||
|
||||
if(!is_dir($pwd)) {
|
||||
getLink('','','존재하지 않는 폴더입니다.','close');
|
||||
}
|
||||
|
||||
function getDirexists($dir) {
|
||||
$opendir = opendir($dir);
|
||||
while(false !== ($file = readdir($opendir))) {
|
||||
if(is_dir($dir.'/'.$file) && !strstr('[.][..][images][data]',$file)){$fex = 1; break;}
|
||||
}
|
||||
closedir($opendir);
|
||||
return $fex;
|
||||
}
|
||||
|
||||
function getPrintdir( $nTab, $filepath, $files, $state ,$dir_ex) {
|
||||
global $g,$pwd,$file,$step_start;
|
||||
|
||||
if($step_start) { $nTab = $nTab - $step_start; }
|
||||
$css = strstr($pwd,$filepath) ? ' active' : '';
|
||||
$fname1 = getKRtoUTF($files);
|
||||
$fname2 = getFolderName($filepath);
|
||||
|
||||
$filepath_arr = explode ('/', $filepath);
|
||||
$depth = count($filepath_arr)-1;
|
||||
|
||||
echo '<a href="'.$g['adm_href'].'&pwd='.$filepath.'" class="list-group-item list-group-item-action d-flex justify-content-between align-items-center';
|
||||
if($state && $dir_ex) {
|
||||
echo ' pl-'.$depth.'"><span><i class="fa fa-folder-o"></i> ';
|
||||
}
|
||||
else if (!$state && $dir_ex) {
|
||||
echo ' text-primary font-weight-bold pl-'.$depth.'"><span><i class="fa fa-folder-open-o"></i> ';
|
||||
}
|
||||
else {
|
||||
echo $css.'" style="color:#'.($css?'fff':'999').'"><span class="pl-6"><i class="fa fa-puzzle-piece"></i> ';
|
||||
}
|
||||
echo $fname2.'</span></a>';
|
||||
}
|
||||
function getDirlist($dirpath,$nStep)
|
||||
{
|
||||
global $pwd;
|
||||
$arrPath = explode('/', $pwd );
|
||||
|
||||
if( $dir_handle = opendir($dirpath) )
|
||||
{
|
||||
while( false !== ($files = readdir($dir_handle)) )
|
||||
{
|
||||
$subDir = $dirpath.$files.'/';
|
||||
if(is_dir($subDir) && !strstr('[.][..][images][data]',$files))
|
||||
{
|
||||
getPrintdir( $nStep, $subDir, $files, !strstr($pwd,$subDir) , getDirexists($subDir) );
|
||||
if( $arrPath[$nStep+1] == $files ) {
|
||||
getDirlist( $subDir, $nStep+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir( $dir_handle );
|
||||
}
|
||||
function getWidgetPreviewImg($path)
|
||||
{
|
||||
if (is_file($path.'.jpg')) return $path.'.jpg';
|
||||
if (is_file($path.'.gif')) return $path.'.gif';
|
||||
if (is_file($path.'.png')) return $path.'.png';
|
||||
return false;
|
||||
}
|
||||
?>
|
||||
|
||||
<link href="<?php echo $g['s']?>/_core/css/github-markdown.css" rel="stylesheet">
|
||||
|
||||
<div id="widgetbox" class="position-relative" style="height:100vh">
|
||||
<div class="category">
|
||||
<?php getDirlist($pwd_start,$step_start)?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php if($swidget):?>
|
||||
<?php if($option):?>
|
||||
<input type="hidden" id="s_w" value="">
|
||||
<input type="hidden" id="s_h" value="">
|
||||
<input type="hidden" id="s_t" value="">
|
||||
<input type="hidden" id="s_l" value="">
|
||||
<?php endif?>
|
||||
|
||||
<div class="position-relative">
|
||||
<ul class="nav nav-tabs f14" role="tablist">
|
||||
<li class="nav-item"><a class="nav-link active" href="#readme" role="tab" data-toggle="tab">사용안내</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#preview" role="tab" data-toggle="tab">미리보기</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#code" role="tab" data-toggle="tab">설정하기</a></li>
|
||||
</ul>
|
||||
<?php if($isWcode=='Y'):?>
|
||||
<div class="js-del">
|
||||
<a class="btn btn-link muted-link btn-sm" href="<?php echo $g['s']?>/?r=<?php echo $r?>&m=<?php echo $m?>&a=deletewidget&pwd=<?php echo $pwd?>" title="삭제" data-tooltip="tooltip" data-placement="left" onclick="return hrefCheck(this,true,'정말로 삭제하시겠습니까?');">
|
||||
<i class="fa fa-trash-o fa-fw"></i>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif?>
|
||||
</div><!-- /.position-relative -->
|
||||
|
||||
<div class="tab-content p-3">
|
||||
<div class="tab-pane f14" id="code">
|
||||
<?php include $g['path_widget'].$swidget.'/admin.php' ?>
|
||||
</div>
|
||||
<div class="tab-pane" id="preview">
|
||||
<?php $_widgetPreview=getWidgetPreviewImg($g['path_widget'].$swidget.'/thumb')?>
|
||||
<?php if($_widgetPreview):?>
|
||||
<div class="text-center mt-4">
|
||||
<a href="<?php echo $_widgetPreview?>" target="_blank">
|
||||
<img src="<?php echo $_widgetPreview?>" class="img-fluid" alt="">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php else:?>
|
||||
<div class="none">
|
||||
<i class="fa fa-puzzle-piece fa-5x"></i><br><br>
|
||||
미리보기가 없습니다.
|
||||
</div>
|
||||
<?php endif?>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane active" id="readme">
|
||||
<div class="bg-light text-center text-muted f12 rounded border p-2">
|
||||
위젯파일 경로: <span class="ml-2"><?php echo $g['path_widget'].$swidget ?>/main.php</span>
|
||||
</div>
|
||||
<?php $markdown_readme = $g['path_widget'].$swidget.'/readme.txt';?>
|
||||
<?php if (file_exists($markdown_readme)): ?>
|
||||
<div class="p-3 readme">
|
||||
<?php readfile($g['path_widget'].$swidget.'/readme.txt')?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="d-flex align-items-center justify-content-center" style="height: calc(100vh - 5.53rem);">
|
||||
<div class="text-muted text-center">
|
||||
<h1><i class="fa fa-file-text-o" aria-hidden="true"></i></h1>
|
||||
<small>안내문서가 없습니다.</small>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php else:?>
|
||||
<div class="d-flex align-items-center justify-content-center" style="height: calc(100vh - 5.53rem);">
|
||||
<div class="text-muted text-center">
|
||||
<h1><i class="fa fa-mouse-pointer" aria-hidden="true"></i></h1>
|
||||
<small>추가할 위젯을 선택하세요.</small>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif?>
|
||||
<textarea id="rb-widget-code-result" class="hidden"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- @부모레이어를 제어할 수 있도록 모달의 헤더와 풋터를 부모레이어에 출력시킴 -->
|
||||
|
||||
<div id="_modal_header" hidden>
|
||||
<h5 class="modal-title">
|
||||
<i class="kf-widget kf-lg"></i>
|
||||
위젯 선택하기
|
||||
</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="_modal_footer" hidden>
|
||||
<button type="button" class="btn btn-light pull-left" data-dismiss="modal" aria-hidden="true" id="_modalclosebtn_">닫기</button>
|
||||
<?php if(!$isWcode||$isEdit):?>
|
||||
<?php if($isCodeOnly):?>
|
||||
<button type="button" class="btn btn-primary" onclick="frames._modal_iframe_modal_window._widgetCode();modalSetting('.rb-modal-x','<?php echo getModalLink('site/pages/popup.widget.code')?>');" data-toggle="modal" data-target=".rb-modal-x"<?php if(!$swidget):?> disabled<?php endif?>>
|
||||
<i class="fa fa-code fa-lg"></i> 코드보기
|
||||
</a>
|
||||
<button type="button" class="btn btn-light" disabled>위젯코드만 지원</button>
|
||||
<?php else:?>
|
||||
<button type="button" class="btn btn-light" onclick="frames._modal_iframe_modal_window._widgetCode();modalSetting('.rb-modal-x','<?php echo getModalLink('site/pages/popup.widget.code')?>');" data-toggle="modal" data-target=".rb-modal-x"<?php if(!$swidget):?> disabled<?php endif?>>
|
||||
<i class="fa fa-code fa-lg"></i> 코드보기
|
||||
</a>
|
||||
<button type="button" class="btn btn-primary" onclick="frames._modal_iframe_modal_window._saveCheck(<?php echo $isEdit?1:0?>);"<?php if(!$swidget):?> disabled<?php endif?>>삽입하기</button>
|
||||
<?php endif?>
|
||||
<?php else:?>
|
||||
<button type="button" class="btn btn-primary" onclick="frames._modal_iframe_modal_window._widgetCode();modalSetting('.rb-modal-x','<?php echo getModalLink('site/pages/popup.widget.code')?>');" data-toggle="modal" data-target=".rb-modal-x"<?php if(!$swidget):?> disabled<?php endif?>>
|
||||
<i class="fa fa-code fa-lg"></i> 코드보기
|
||||
</a>
|
||||
<?php endif?>
|
||||
</div>
|
||||
|
||||
|
||||
<?php getImport('jquery-markdown','jquery.markdown','0.0.10','js')?>
|
||||
|
||||
<script>
|
||||
|
||||
$("#readme .readme").markdown();
|
||||
|
||||
function _widgetCode()
|
||||
{
|
||||
getId('rb-widget-code-result').innerHTML = widgetCode(0);
|
||||
}
|
||||
function _saveCheck(n)
|
||||
{
|
||||
saveCheck(n);
|
||||
parent.$('#modal_window').modal('hide');
|
||||
}
|
||||
function dropJoint(m)
|
||||
{
|
||||
var f = opener.getId('<?php echo $dropfield?>');
|
||||
f.value = m;
|
||||
f.focus();
|
||||
top.close();
|
||||
}
|
||||
|
||||
<?php if($swidget && $option):?>
|
||||
var dp = <?php echo $dropfield?>;
|
||||
var sz = parent.moveObject[dp];
|
||||
getId('s_w').value = parseInt(sz.style.width);
|
||||
getId('s_h').value = parseInt(sz.style.height);
|
||||
getId('s_t').value = parseInt(sz.style.top);
|
||||
getId('s_l').value = parseInt(sz.style.left);
|
||||
<?php endif?>
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
3
modules/widget/admin/var/var.menu.php
Normal file
3
modules/widget/admin/var/var.menu.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$d['amenu']['main'] = '목록';
|
||||
?>
|
||||
3
modules/widget/main.php
Normal file
3
modules/widget/main.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
if(!defined('__KIMS__')) exit;
|
||||
?>
|
||||
1
modules/widget/name.txt
Normal file
1
modules/widget/name.txt
Normal file
@@ -0,0 +1 @@
|
||||
위젯
|
||||
0
modules/widget/var/var.moduleinfo.php
Normal file
0
modules/widget/var/var.moduleinfo.php
Normal file
Reference in New Issue
Block a user