forked from Needlworks/Textcube
/
index.php
548 lines (490 loc) · 25.6 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
<?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';
$tabsClass['cover'] = true;
importlib('blogskin');
importlib("model.blog.sidebar");
importlib("model.blog.coverpage");
importlib("model.blog.entry");
importlib("model.blog.archive");
importlib("model.blog.tag");
importlib("model.blog.notice");
importlib("model.blog.comment");
importlib("model.blog.remoteresponse");
importlib("model.blog.link");
require ROOT . '/interface/common/owner/header.php';
$service['pagecache'] = false; // For plugin setting update.
$stats = Statistics::getStatistics($blogid);
function correctCoverpageImage( $subject ) {
$pattern_with_src = '/(?:\ssrc\s*=\s*["\']?)([^\s^"^>^\']+)(?:[\s">\'])/i';
$pattern_with_background = '/(?:\sbackground\s*=\s*["\']??)([^\s^"^>^\']+)(?:[\s">\'])/i';
$pattern_with_url_func = '/(?:url\s*\(\s*\'?)([^)]+)(?:\'?\s*\))/i';
$return_val = preg_replace_callback($pattern_with_src , 'correctImagePath', $subject);
$return_val = preg_replace_callback($pattern_with_background , 'correctImagePath', $return_val);
$return_val = preg_replace_callback($pattern_with_url_func , 'correctImagePath', $return_val );
return $return_val;
}
function correctImagePath($match ) {
$context = Model_Context::getInstance();
$pathArr = explode( "/" , $match[1]);
if( false === $pathArr )
return $match[0];
$c = count( $pathArr);
if( $c <= 1 )
return $match[0];
if( $pathArr[$c-1] == "" )
return $match[0];// ./s/b/c/ 이런식으로 경로만 들어있는 경우 스킵
if( false !== array_search( "http:" , $pathArr) )
return $match[0] ; // full url의 경우 스킵
if( $pathArr[0] != '.' && $pathArr[0] != '..' )
return $match[0] ; //첫 디렉토리가 현재 디렉토리가 아닌경우 스킵
return str_replace( $match[1], $context->getProperty('uri.service') . "/skin/".$context->getProperty('skin.skin')."/" . $match[1], $match[0]);
}
function getBlogContentForCoverPage()
{
global $blogid, $blog, $service, $stats, $skinSetting;
global $pd_category, $pd_categoryXhtml, $pd_archive, $pd_calendar, $pd_tags, $pd_notices, $pd_recentEntry;
global $pd_recentComment, $pd_recentTrackback, $pd_link, $pd_authorList;
$categories = getCategories($blogid);
$totalPosts = getEntriesTotalCount($blogid);
$pd_category = getCategoriesView($totalPosts, $categories, isset($category) ? $category : true);
$pd_categoryXhtml = getCategoriesView($totalPosts, $categories, isset($category) ? $category : true, true);
$pd_archive = getArchives($blogid);
$pd_calendar = getCalendarView(getCalendar($blogid, true));
$pd_tags = getRandomTags($blogid);
$pd_notices = getNotices($blogid);
$pd_recentEntry = getRecentEntries($blogid);
$pd_recentComment = getRecentComments($blogid);
$pd_recentTrackback = getRecentTrackbacks($blogid);
$pd_link = getLinks($blogid);
$pd_authorList = User::getUserNamesOfBlog($blogid);
}
function pretty_dress($view)
{
global $blogid, $blog, $database, $service, $stats, $skinSetting;
$context = Model_Context::getInstance();
/* local static */
global $pd_category, $pd_categoryXhtml, $pd_archive, $pd_calendar, $pd_tags, $pd_notices, $pd_recentEntry;
global $pd_recentComment, $pd_recentTrackback, $pd_link, $pd_authorList;
if (isset($_REQUEST['safe'])) {
// safe mode
return '<div class="coverpage-element-safebox">…</div>';
}
if (isset($_REQUEST['tag'])) {
// safe mode
return '<div class="coverpage-element-safebox"><p>' . nl2br(htmlspecialchars($view, ENT_QUOTES)) . '</p></div>';
}
$writer = User::getBlogOwnerName($blogid);
$pageTitle = _t('페이지 제목');
dress('page_title', htmlspecialchars($pageTitle), $view);
dress('blogger', htmlspecialchars($writer), $view);
dress('title', htmlspecialchars($context->getProperty('blog.title')), $view);
dress('desc', htmlspecialchars($context->getProperty('blog.description')), $view);
if ($context->getProperty('blog.logo') != null)
dress('image', $context->getProperty('service.path')."/attach/$blogid/".$context->getProperty('blog.logo'), $view);
else
dress('image', $context->getProperty('service.path')."/resources/image/spacer.gif", $view);
dress('blog_link', $context->getProperty('uri.blog')."/", $view);
dress('keylog_link', $context->getProperty('uri.blog')."/keylog", $view);
dress('localog_link', $context->getProperty('uri.blog')."/location", $view);
dress('taglog_link', $context->getProperty('uri.blog')."/tag", $view);
dress('guestbook_link', $context->getProperty('uri.blog')."/guestbook", $view);
list($view, $searchView) = Skin::cutSkinTag($view, 'search');
dress('search_name', 'search', $searchView);
dress('search_text', isset($search) ? htmlspecialchars($search) : '', $searchView);
dress('search_onclick_submit', 'searchBlog()', $searchView);
dress('search', '<form id="TTSearchForm" action="'.parseURL($context->getProperty('uri.blog').'/search/').'" method="get" onsubmit="return searchBlog()">'.$searchView.'</form>', $view);
dress('category', $pd_category, $view);
dress('category_list', $pd_categoryXhtml, $view);
dress('count_total', $stats['total'], $view);
dress('count_today', $stats['today'], $view);
dress('count_yesterday', $stats['yesterday'], $view);
list($view, $archiveView) = Skin::cutSkinTag($view, 'archive_rep');
dress('archive_rep', getArchivesView($pd_archive, $archiveView), $view);
dress('calendar', $pd_calendar, $view);
list($view, $randomView) = Skin::cutSkinTag($view, 'random_tags');
dress('random_tags', getRandomTagsView($pd_tags, $randomView), $view);
list($view, $recentNoticeItem) = Skin::cutSkinTag($view, 'rct_notice_rep');
list($view, $noticeView) = Skin::cutSkinTag($view, 'rct_notice');
$notices = $pd_notices;
if (sizeof($notices) == 0) {
$notices = array( array('title' => _t('공지 제목'), 'id' => -1));
}
if (sizeof($notices) > 0) {
$itemsView = '';
foreach ($notices as $notice) {
$itemView = $recentNoticeItem;
dress('notice_rep_title', htmlspecialchars(fireEvent('ViewNoticeTitle', Utils_Unicode::lessenAsEm($notice['title'], $skinSetting['recentNoticeLength']), $notice['id'])), $itemView);
dress('notice_rep_link', "$context->getProperty('uri.blog')/notice/{$notice['id']}", $itemView);
$itemsView .= $itemView;
}
dress('rct_notice_rep', $itemsView, $noticeView);
dress('rct_notice', $noticeView, $view);
}
list($view, $authorList) = Skin::cutSkinTag($view, 'author_rep');
dress('author_rep', getAuthorListView($pd_authorList, $authorList), $view);
list($view, $recentEntry) = Skin::cutSkinTag($view, 'rctps_rep');
dress('rctps_rep', getRecentEntriesView($pd_recentEntry, null, $recentEntry), $view);
list($view, $recentComments) = Skin::cutSkinTag($view, 'rctrp_rep');
dress('rctrp_rep', getRecentCommentsView($pd_recentComment, null, $recentComments), $view);
list($view, $recentTrackback) = Skin::cutSkinTag($view, 'rcttb_rep');
dress('rcttb_rep', getRecentTrackbacksView($pd_recentTrackback, null, $recentTrackback), $view);
list($view, $s_link_rep) = Skin::cutSkinTag($view, 'link_rep');
dress('link_rep', getLinksView($pd_link, $s_link_rep), $view);
dress('rss_url', "$context->getProperty('uri.blog')/rss", $view);
dress('owner_url', "$context->getProperty('uri.blog')/owner", $view);
dress('textcube_name', TEXTCUBE_NAME, $view);
dress('textcube_version', TEXTCUBE_VERSION, $view);
$tagSearches = array ( '@<a @i' , '@</a *>@i', '@ id *= *".*"@isU', '@ onkey(down|up|press) *="@i', '@ on(click|load|unload) *="@i', '@<input +@i' , '@<script.*</script *>@siU', '@<form @siU', '@</form>@siU' );
$tagReplaces = array ( '<span ' , '</span>' , '' , ' onnothing="' , ' onnothing="' , '<input disabled="disabled" ' , '' , '<div ' , '</div>');
$view = preg_replace($tagSearches, $tagReplaces, $view);
return correctCoverpageImage($view);
}
$defaultModeSelected = false;
$safeModeSelected = false;
$tagModeSelected = false;
$initModeSelected = false;
$viewMode = '';
$viewMode2 = '';
$viewMode3 = '';
$previewMode = '';
if ((!isset($_REQUEST['safe'])) && (!isset($_REQUEST['tag']))) {
// $defaultModeSelected = true;
$safeModeSelected = true;
$viewMode = '&viewMode=safe';
$viewMode2 = '?viewMode=safe';
$viewMode3 = '&viewMode=safe';
$previewMode = '&safe';
$_REQUEST['safe'] = true;
} else if ((isset($_REQUEST['safe'])) && (!isset($_REQUEST['tag']))) {
$safeModeSelected = true;
$viewMode = '&viewMode=safe';
$viewMode2 = '?viewMode=safe';
$viewMode3 = '&viewMode=safe';
$previewMode = '&safe';
} else if ((!isset($_REQUEST['safe'])) && (isset($_REQUEST['tag']))) {
$tagModeSelected = true;
$viewMode = '&viewMode=tag';
$viewMode2 = '?viewMode=tag';
$viewMode3 = '&viewMode=tag';
$previewMode = '&tag';
} else if ((isset($_REQUEST['safe'])) && (isset($_REQUEST['tag']))) {
$initModeSelected = true;
}
$coverpagePluginArray = array();
for ($i=0; $i<count($coverpageMappings); $i++) {
$coverpagePluginArray[$coverpageMappings[$i]['plugin'] . '/' . $coverpageMappings[$i]['handler']]=
array(
'type' => 3, 'id' => $coverpageMappings[$i]['handler'],
'plugin' => $coverpageMappings[$i]['plugin'], 'title' =>$coverpageMappings[$i]['title'],
'display' => $coverpageMappings[$i]['display'],
'identifier' => implode(':', array(3,$coverpageMappings[$i]['plugin'],$coverpageMappings[$i]['handler'])),
'parameters' => $coverpageMappings[$i]['parameters']
);
}
$skin = new Skin($skinSetting['skin']);
$usedCoverpageBasicModule = array();
$coverpageCount = count($skin->coverpageBasicModules);
getBlogContentForCoverPage();
?>
<form id="part-coverpage-order" class="part" method="post" action="<?php echo parseURL($context->getProperty('uri.blog').'/owner/skin/coverpage');?>">
<h2 class="caption"><span class="main-text"><?php echo _t('블로그 표지를 관리합니다');?></span></h2>
<?php
require ROOT . '/interface/common/owner/skinTab.php';
?>
<div class="main-explain-box">
<p class="explain"><?php echo _t('블로그의 표지 구성을 변경할 수 있습니다.');?> <?php echo _f('표지는 블로그 첫 화면 또는 %1/cover 에 표시되는 부분입니다.',$context->getProperty('uri.default'));?> <?php echo _t('표지에 새로운 요소를 추가/삭제할 수 있으며 패널들을 자유롭게 배치 할 수 있습니다.');?>
<?php echo ($service['type'] == 'path' || $service['type'] == 'domain') ? _t('다중 사용자 모드로 설치된 경우 블로그 관리자는 표지 기능을 이용하여 대표 블로그를 다른 블로그들에 대한 센터 기능을 하도록 구성할 수 있습니다.') : '';?></p>
<p class="explain"><?php echo _t('블로그-설정 메뉴에서 블로그 첫 화면을 표지로 사용하도록 변경할 수 있습니다.');?></p>
</div>
<dl id="direct-link-line" class="line">
<dt><?php echo _t('플러그인 설정');?></dt>
<dd><a class="button" href="<?php echo $context->getProperty('uri.blog');?>/owner/plugin?visibility=coverpage"><?php echo _t('위젯 켜고 끄기');?></a></dd>
</dl>
<?php
if (is_null($skin->cover) || count($coverpageMappings) == 0) {
if (is_null($skin->cover))
$errmsg = _t('사용중인 스킨이 블로그 표지를 지원하지 않습니다.');
else
$errmsg = _t('사용중인 표지 플러그인이 없습니다.');
?>
<ul id="coverpage-tabs-box" class="tabs-box">
<li class="selected"><a id="default-mode-button" class="button" href="<?php echo $context->getProperty('uri.blog');?>/owner/skin/coverpage" title="<?php echo _t('실제 출력되는 내용을 직접 볼 수 있는 기본 모드입니다.');?>"><?php echo _t('기본모드');?></a></li>
</ul>
<div id="coverpage-box-disabled" class="data-inbox">
<p><?php echo $errmsg;?></p>
</div>
</form>
<?php
require ROOT . '/interface/common/owner/footer.php';
exit;
}
// 사용중인 표지 모듈 리스트 출력.
$bFirstRadio = true;
$coverpageConfig = getCoverpageModuleOrderData();
if (is_null($coverpageConfig)) {
for ($i=0; $i<$coverpageCount; $i++) {
$coverpageConfig[$i] = array();
}
}
?>
<ul id="coverpage-tabs-box" class="tabs-box second-tab">
<li class="default-mode-button<?php echo $defaultModeSelected ? ' selected' : NULL;?>"><a href="<?php echo $context->getProperty('uri.blog');?>/owner/skin/coverpage" title="<?php echo _t('실제 출력되는 내용을 직접 볼 수 있는 기본 모드입니다.');?>"><?php echo _t('기본모드');?></a></li>
<li class="safe-mode-button<?php echo $safeModeSelected ? ' selected' : NULL;?>"><a href="<?php echo $context->getProperty('uri.blog');?>/owner/skin/coverpage?safe" title="<?php echo _t('태그를 사용하지 않아 레이아웃이 깨질 위험이 없는 모드입니다.');?>"><?php echo _t('안전모드');?></a></li>
<li class="tag-mode-button<?php echo $tagModeSelected ? ' selected' : NULL;?>"><a href="<?php echo $context->getProperty('uri.blog');?>/owner/skin/coverpage?tag" title="<?php echo _t('실제 블로그 표지에 사용되는 태그를 직접사용하는 모드입니다.');?>"><?php echo _t('태그모드');?></a></li>
<li class="init-button<?php echo $initModeSelected ? ' selected' : NULL;?>"><a href="coverpage/initialize<?php echo $viewMode2;?>" onclick="if (!confirm('<?php echo _t('정말 표지의 기능을 초기화하시겠습니까?');?>')) return false;" title="<?php echo _t('표지의 기능을 스킨 설정 상태로 초기화합니다.');?>"><span class="text"><?php echo _t('초기화');?></span></a></li>
</ul>
<div id="coverpage-box" class="data-inbox">
<table border="0">
<tr>
<?php
for ($i=0; $i<$coverpageCount; $i++) {
if (array_key_exists($i, $coverpageConfig))
$orderConfig = $coverpageConfig[$i];
else
$orderConfig = array();
?>
<td class="section">
<h3><input type="radio" id="coverpage-<?php echo $i + 1;?>" class="radio" name="coverpageNumber" value="<?php echo $i;?>"<?php echo $bFirstRadio ? ' checked="checked"' : NULL;?> /><label for="coverpage-<?php echo $i + 1;?>"><?php echo $skin->coverpageName[$i];?></label></h3>
<ul id="coverpage-ul-<?php echo $i;?>" class="coverpage">
<?php
for ($j=0; $j<count($orderConfig); $j++) {
if ($orderConfig[$j]['type'] == 3) { // plugin
$plugin = $orderConfig[$j]['id']['plugin'];
$handler = $orderConfig[$j]['id']['handler'];
$sidbarPluginIndex = $plugin . '/' . $handler;
$invalidPlugin = false;
if (!array_key_exists($sidbarPluginIndex, $coverpagePluginArray)) {
// invalid or missed plug-in
$coverpagePluginArray[$sidbarPluginIndex] = array();
$coverpagePluginArray[$sidbarPluginIndex]['title'] = $plugin;
$coverpagePluginArray[$sidbarPluginIndex]['handler'] = $handler;
$coverpagePluginArray[$sidbarPluginIndex]['display'] = $plugin;
$coverpagePluginArray[$sidbarPluginIndex]['parameters'] = array();
$invalidPlugin = true;
} else {
include_once (ROOT . "/plugins/{$plugin}/index.php");
}
if (function_exists($handler))
{
if( !empty( $configMappings[$plugin]['config'] ) ) {
$configVal = getCurrentSetting($plugin);
$context->setProperty('plugin.config',Setting::fetchConfigVal($configVal));
} else {
$configVal ='';
$context->setProperty('plugin.config',array());
}
?>
<li class="coverpage-module coverpage-plugin-module" id="coverpage-element-<?php echo "{$i}-{$j}";?>">
<h4 class="module-title"><?php echo $coverpagePluginArray[$sidbarPluginIndex]['display'], '::', $coverpagePluginArray[$sidbarPluginIndex]['title'];?></h4>
<div class="button-box">
<?php
if ($j == 0) {
?>
<img src="<?php echo $context->getProperty('service.path').$context->getProperty('panel.skin');?>/image/img_moveup_module_disabled.jpg" border="0" alt="<?php echo _t('위로');?>" />
<?php
} else {
?>
<a href="<?php echo parseURL($context->getProperty('uri.blog').'/owner/skin/coverpage/order/?coverpageNumber='.$i.'&targetcoverpageNumber='.$i.'&modulePos='.$j.'&targetPos='.($j - 1).$viewMode);?>" title="<?php echo _t('이 표지 모듈을 위로 이동합니다.');?>"><img src="<?php echo $context->getProperty('service.path').$context->getProperty('panel.skin');?>/image/img_moveup_module.jpg" border="0" alt="<?php echo _t('위로');?>" /></a>
<?php
}
if ($j == count($orderConfig) - 1) {
?>
<img src="<?php echo $context->getProperty('service.path').$context->getProperty('panel.skin');?>/image/img_movedown_module_disabled.jpg" border="0" alt="<?php echo _t('아래로');?>" />
<?php
} else {
?>
<a href="<?php echo parseURL($context->getProperty('uri.blog').'/owner/skin/coverpage/order/?coverpageNumber='.$i.'&targetcoverpageNumber='.$i.'&modulePos='.$j.'&targetPos='.($j + 2).$viewMode);?>" title="<?php echo _t('이 표지 모듈을 아래로 이동합니다.');?>"><img src="<?php echo $context->getProperty('service.path').$context->getProperty('panel.skin');?>/image/img_movedown_module.jpg" border="0" alt="<?php echo _t('아래로');?>" /></a>
<?php
}
?>
<a href="<?php echo parseURL($context->getProperty('uri.blog').'/owner/skin/coverpage/delete/?coverpageNumber='.$i.'&modulePos='.$j.$viewMode);?>" title="<?php echo _t('이 표지 모듈을 삭제합니다.');?>"><img src="<?php echo $context->getProperty('service.path').$context->getProperty('panel.skin');?>/image/img_delete_module.gif" border="0" alt="<?php echo _t('삭제');?>" /></a>
<!-- TODO : coverpage plugin settting -->
</div>
<?php
$pluginparameters = $coverpagePluginArray[$sidbarPluginIndex]['parameters'];
if (count($pluginparameters) > 0) {
?>
<div class="edit-button-box">
<a href="<?php echo parseURL($context->getProperty('uri.blog').'/owner/skin/coverpage/edit?coverpageNumber='.$i.'&modulePos='.$j.$viewMode);?>"><?php echo _t('편집');?></a>
</div>
<?php
}
?>
<div class="module-content">
<?php
if (($invalidPlugin == false) && function_exists($handler)) {
$pluginURL = "{$context->getProperty('service.path')}/plugins/{$orderConfig[$j]['id']['plugin']}";
echo pretty_dress(call_user_func($handler, $orderConfig[$j]['parameters']));
}
?>
</div>
</li>
<?php
}
if ($invalidPlugin == true)
unset($coverpagePluginArray[$sidbarPluginIndex]);
} else {
// other type
}
}
?>
</ul>
</td>
<?php
$bFirstRadio = false;
}
?>
</tr>
</table>
</div>
<div id="coverpage-element-box" class="data-inbox">
<h3><?php echo _t('추가 가능한 모듈');?></h3>
<fieldset id="coverpage-plugin-module-box" class="section">
<legend><?php echo _t('추가 가능한 플러그인');?></legend>
<ul class="module-list">
<?php
// 표지 플러그인 모듈을 리스트에 포함시킨다.
foreach ($coverpagePluginArray as $nowKey) {
?>
<li class="coverpage-module" id="<?php echo "add-coverpage-module-{$nowKey['identifier']}";?>">
<h4 class="module-title"><input type="radio" id="module<?php echo $nowKey['identifier'];?>" class="radio" name="moduleId" value="<?php echo $nowKey['identifier'];?>" /><label for="module<?php echo $nowKey['identifier'];?>"><?php echo $nowKey['display'], '::' , $nowKey['title'];?></label></h4>
<div class="edit-button-box">
</div>
<div class="module-content">
<?php
$pluginURL = "{$context->getProperty('service.path')}/plugins/{$nowKey['plugin']}";
include_once (ROOT . "/plugins/{$nowKey['plugin']}/index.php");
echo pretty_dress(call_user_func($nowKey['id'], array('preview' => '')));
?>
</div>
</li>
<?php
}
?>
</ul>
</fieldset>
<div class="button-box">
<input type="submit" class="input-button" value="<?php echo _t('모듈 추가');?>" title="<?php echo _t('선택된 모듈을 표지에 추가합니다.');?>"/>
</div>
</div>
<p id="coverpage-description" class="pseudo-clear">
<em>* <?php echo _t('표지의 위치는 스킨의 구조에 따라 달라집니다.');?></em>
</p>
</form>
<script src="<?php echo $context->getProperty('service.path');?>/resources/script/dojo/dojo.js" type="text/javascript"></script>
<script src="<?php echo $context->getProperty('service.path');?>/resources/script/coverpage.min.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var decorateDragPanelString_deleteTitle = "<?php echo _t('이 표지 모듈을 삭제합니다.');?>";
var commonString_delete = "<?php echo _t('삭제');?>";
var commonString_cancel = "<?php echo _t('취소');?>";
var commonString_close = "<?php echo _t('닫기');?>";
var commonString_saving = "<?php echo _t('저장하고 있습니다.');?>";
var commonString_error = "<?php echo _t('저장하지 못했습니다');?>";
var viewMode = "<?php echo $viewMode3;?>";
var previewMode = "<?php echo $previewMode;?>";
function reordering() {
var pos = 0;
var pNode = null;
<?php
for ($i=0; $i<$coverpageCount; $i++) {
echo "pNode = document.getElementById('coverpage-ul-{$i}').firstChild;";
?>
pos = 0;
while (pNode != null) {
if ((pNode.nodeType != 3/* TEXT_NODE */) && (pNode.className.indexOf("coverpage-module") != -1)) {
pNode.modulePos = pos++;
var p2Node = pNode.firstChild;
while (p2Node != null) {
if ((p2Node.tagName != null) && (p2Node.tagName.toLowerCase() == 'a')) break;
p2Node = p2Node.nextSibling;
}
if (p2Node != null) {
p2Node.href = blogURL + "/owner/skin/coverpage/delete/?coverpageNumber=" + pNode.coverpageNumber + "&modulePos=" + pNode.modulePos + viewMode;
}
if ((pNode.moduleCategory == 'plugin') && (pNode.hasPropertyEdit == true)) {
p2Node = pNode.firstChild;
while (p2Node != null) {
if ((p2Node.tagName != null) && (p2Node.tagName.toLowerCase() == 'div')) {
break;
}
p2Node = p2Node.nextSibling;
}
if (p2Node != null) {
p2Node.innerHTML = '<a onclick="editCoverpagePlugin('+ pNode.coverpageNumber + ',' + pNode.modulePos + '); return false" ><?php echo _t('편집');?><\/a>';
}
}
}
pNode = pNode.nextSibling;
}
<?php
}
?>
}
function initPages()
{
dlg = dojo.widget.createWidget("popupWindow", {}, document.getElementById('body-skin').firstChild, 'after');
dlg.domNode.className = 'ajax-popup-window';
var inputs = document.getElementsByTagName("input");
for (i=0; i < inputs.length;) {
if (inputs[i].className == 'radio') {
inputs[i].parentNode.removeChild(inputs[i]);
} else {
i++
}
}
inputs = document.getElementsByTagName("div");
for (i=0; i < inputs.length;) {
if (inputs[i].className == 'button-box') {
inputs[i].parentNode.removeChild(inputs[i]);
} else {
i++
}
}
<?php
for ($i=0; $i<$coverpageCount; $i++) {
echo "document.getElementById('coverpage-ul-{$i}').coverpage = {$i};";
echo "new DropPanel(document.getElementById('coverpage-ul-{$i}'), [\"coverpage\"]);";
$orderConfig = array_key_exists($i, $coverpageConfig) ? $coverpageConfig[$i] : array();
for ($j=0; $j<count($orderConfig); $j++) {
echo "document.getElementById('coverpage-element-{$i}-{$j}').coverpageNumber = {$i};";
echo "document.getElementById('coverpage-element-{$i}-{$j}').modulePos = {$j};";
echo "document.getElementById('coverpage-element-{$i}-{$j}').ajaxtype = 'reorder';";
echo "document.getElementById('coverpage-element-{$i}-{$j}').hasPropertyEdit = false;";
if ($orderConfig[$j]['type'] == 3) {
echo "document.getElementById('coverpage-element-{$i}-{$j}').moduleCategory = 'plugin';";
echo "document.getElementById('coverpage-element-{$i}-{$j}').hasPropertyEdit = ";
$plugin = $orderConfig[$j]['id']['plugin'];
$handler = $orderConfig[$j]['id']['handler'];
$sidbarPluginIndex = $plugin . '/' . $handler;
echo (array_key_exists($sidbarPluginIndex, $coverpagePluginArray)
&& (count($coverpagePluginArray[$sidbarPluginIndex]['parameters']) > 0)) ? 'true' : 'false';
echo ";";
}
echo "new DragPanel(document.getElementById('coverpage-element-{$i}-{$j}'), [\"coverpage\"]);";
}
}
foreach ($coverpagePluginArray as $nowKey) {
echo "document.getElementById('add-coverpage-module-{$nowKey['identifier']}').identifier = '{$nowKey['identifier']}';";
echo "document.getElementById('add-coverpage-module-{$nowKey['identifier']}').ajaxtype = 'register';";
echo "document.getElementById('add-coverpage-module-{$nowKey['identifier']}').moduleCategory = 'plugin';";
echo "document.getElementById('add-coverpage-module-{$nowKey['identifier']}').hasPropertyEdit = ";
echo count($nowKey['parameters']) > 0 ? 'true' : 'false';
echo ";";
echo "new DragPanelAdd(document.getElementById('add-coverpage-module-{$nowKey['identifier']}'), [\"coverpage\"]);";
}
?>
reordering();
}
dojo.addOnLoad(initPages);
function changeList() {
document.getElementById("part-coverpage-order").submit();
}
//]]>
</script>
<?php
require ROOT . '/interface/common/owner/footer.php';
?>