git-svn-id: http://xe-core.googlecode.com/svn/trunk@1279 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-04-23 05:38:32 +00:00
parent 3fb2e6fba2
commit ad2754314c
8 changed files with 101 additions and 46 deletions

View file

@ -13,7 +13,8 @@
**/ **/
// called_position가 before_module_init 이고 module이 admin이 아닐 경우 // called_position가 before_module_init 이고 module이 admin이 아닐 경우
if($called_position == 'before_module_init' && $this->module != 'admin') { if($called_position == 'before_module_init' && !$GLOBALS['__counter_addon_called__']) {
Context::addJsFile('./modules/counter/tpl/js/counter.js'); if($this->module != 'admin') Context::addJsFile('./modules/counter/tpl/js/counter.js');
$GLOBALS['__counter_addon_called__'] = true;
} }
?> ?>

View file

@ -26,6 +26,7 @@ String.prototype.getQuery = function(key) {
String.prototype.setQuery = function(key, val) { String.prototype.setQuery = function(key, val) {
var idx = this.indexOf('?'); var idx = this.indexOf('?');
var uri = this; var uri = this;
uri = uri.replace(/#$/,'');
if(idx != -1) { if(idx != -1) {
uri = this.substr(0, idx); uri = this.substr(0, idx);
var query_string = this.substr(idx+1, this.length); var query_string = this.substr(idx+1, this.length);
@ -499,8 +500,13 @@ function setMemberMenuObjCursor() {
} }
// 날자 선택 (달력 열기) // 날자 선택 (달력 열기)
function open_calendar(fo_id, day_str) { function open_calendar(fo_id, day_str, callback_func) {
if(typeof(day_str)=="undefined") day_str = ""; if(typeof(day_str)=="undefined") day_str = "";
var url = "./common/tpl/calendar.php?fo_id="+fo_id+"&day_str="+day_str;
var url = "./common/tpl/calendar.php?";
if(fo_id) url+="fo_id="+fo_id;
if(day_str) url+="&day_str="+day_str;
if(callback_func) url+="&callback_func="+callback_func;
popopen(url, 'Calendar'); popopen(url, 'Calendar');
} }

View file

@ -4,6 +4,7 @@
$method = $_REQUEST['method']; $method = $_REQUEST['method'];
$fo_id = $_REQUEST['fo_id']; $fo_id = $_REQUEST['fo_id'];
$callback_func = $_REQUEST['callback_func'];
$day_str = $_REQUEST['day_str']; $day_str = $_REQUEST['day_str'];
if($day_str && strlen($day_str)) { if($day_str && strlen($day_str)) {
@ -59,7 +60,7 @@
<link rel="stylesheet" href="./css/calendar.css" type="text/css" /> <link rel="stylesheet" href="./css/calendar.css" type="text/css" />
<script type="text/javascript"> <script type="text/javascript">
function selectDate(date_str, date_val) { function selectDate(date_str, date_val, callback_func) {
if(!opener) { if(!opener) {
window.close(); window.close();
return; return;
@ -68,13 +69,11 @@
var date_obj = opener.xGetElementById("date_<?=$fo_id?>"); var date_obj = opener.xGetElementById("date_<?=$fo_id?>");
var str_obj = opener.xGetElementById("str_<?=$fo_id?>"); var str_obj = opener.xGetElementById("str_<?=$fo_id?>");
if(!date_obj || !str_obj) { if(date_obj) date_obj.value = date_val;
window.close();
return;
}
date_obj.value = date_val; if(str_obj) xInnerHtml(str_obj, date_str);
xInnerHtml(str_obj, date_str);
if(callback_func) eval('opener.'+callback_func+'('+date_val+')');
window.close(); window.close();
@ -87,12 +86,13 @@
<div class="calendar_title"> <div class="calendar_title">
<form action="./calendar.php" method="get"> <form action="./calendar.php" method="get">
<input type="hidden" name="fo_id" value="<?=$fo_id?>"/> <input type="hidden" name="fo_id" value="<?=$fo_id?>"/>
<input type="hidden" name="callback_func" value="<?=$callback_func?>"/>
<table width="100%" border="0" cellspacing="0" cellpadding="2" align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr> <tr>
<td width="40"> <td width="40">
<a href="#" onclick="location.href='./calendar.php?fo_id=<?=$fo_id?>&amp;year=<?=$year?>&amp;month=<?=$month?>&amp;method=prev_year';return false;"><img src="./images/icon_pprev.gif" border="0" alt="prev year" /></a> <a href="#" onclick="location.href='./calendar.php?fo_id=<?=$fo_id?>&amp;year=<?=$year?>&amp;month=<?=$month?>&amp;method=prev_year&amp;callback_func=<?=$callback_func?>';return false;"><img src="./images/icon_pprev.gif" border="0" alt="prev year" /></a>
<a href="#" onclick="location.href='./calendar.php?fo_id=<?=$fo_id?>&amp;year=<?=$year?>&amp;month=<?=$month?>&amp;method=prev_month';return false;"><img src="./images/icon_prev.gif" border="0" alt="prev month" /></a> <a href="#" onclick="location.href='./calendar.php?fo_id=<?=$fo_id?>&amp;year=<?=$year?>&amp;month=<?=$month?>&amp;method=prev_month&amp;callback_func=<?=$callback_func?>';return false;"><img src="./images/icon_prev.gif" border="0" alt="prev month" /></a>
</td> </td>
<td align="center"> <td align="center">
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
@ -103,8 +103,8 @@
</table> </table>
</td> </td>
<td width="40"> <td width="40">
<a href="#" onclick="location.href='./calendar.php?fo_id=<?=$fo_id?>&amp;year=<?=$year?>&amp;month=<?=$month?>&amp;method=next_month';return false;"><img src="./images/icon_nnext.gif" border="0" alt="next month" /></a> <a href="#" onclick="location.href='./calendar.php?fo_id=<?=$fo_id?>&amp;year=<?=$year?>&amp;month=<?=$month?>&amp;method=next_month&amp;callback_func=<?=$callback_func?>';return false;"><img src="./images/icon_nnext.gif" border="0" alt="next month" /></a>
<a href="#" onclick="location.href='./calendar.php?fo_id=<?=$fo_id?>&amp;year=<?=$year?>&amp;month=<?=$month?>&amp;method=next_year';return false;"><img src="./images/icon_next.gif" border="0" alt="next year" /></a> <a href="#" onclick="location.href='./calendar.php?fo_id=<?=$fo_id?>&amp;year=<?=$year?>&amp;month=<?=$month?>&amp;method=next_year&amp;callback_func=<?=$callback_func?>';return false;"><img src="./images/icon_next.gif" border="0" alt="next year" /></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -154,7 +154,7 @@
if(date("Ymd")==$date_str) $sel_class = "today"; if(date("Ymd")==$date_str) $sel_class = "today";
else $sel_class = ""; else $sel_class = "";
?> ?>
<div class="calendar_cell <?=$sel_class?> <?=$class_name?>" onclick="selectDate('<?=$date?>','<?=$date_str?>');return false;"><div><?=$day?></div></div> <div class="calendar_cell <?=$sel_class?> <?=$class_name?>" onclick="selectDate('<?=$date?>','<?=$date_str?>','<?=$callback_func?>');return false;"><div><?=$day?></div></div>
<? <?
} }
} }

View file

@ -19,6 +19,25 @@
* @brief 관리자 페이지 초기화면 * @brief 관리자 페이지 초기화면
**/ **/
function dispCounterAdminIndex() { function dispCounterAdminIndex() {
// 정해진 일자가 없으면 오늘자로 설정
$selected_date = Context::get('selected_date');
if(!$selected_date) $selected_date = date("Ymd");
Context::set('selected_date', $selected_date);
// counter model 객체 생성
$oCounterModel = &getModel('counter');
// 전체 카운터 현황 가져오기
$status = $oCounterModel->getStatus(array(0,$selected_date));
Context::set('total_counter', $status[0]);
Context::set('selected_day_counter', $status[$selected_date]);
// 정해진 일자 현황 가져오기
// 시간, 일, 월, 년도별로 데이터 가져오기
// 표시
$this->setTemplateFile('index'); $this->setTemplateFile('index');
} }

View file

@ -5,4 +5,16 @@
* @brief 한국어 언어팩 (기본적인 내용만 수록) * @brief 한국어 언어팩 (기본적인 내용만 수록)
**/ **/
$lang->cmd_select_date = '날자 선택';
$lang->total_counter = '전체현황';
$lang->selected_day_counter = '선택일 현황';
$lang->unique_visitor = '방문자';
$lang->pageview = '페이지뷰';
$lang->unit_time = '시간별';
$lang->unit_day = '시간별';
$lang->unit_month = '시간별';
$lang->unit_year = '시간별';
?> ?>

View file

@ -1,31 +1,28 @@
<form action="./" method="get" onsubmit="return procFilter(this, insert_config)"> <!--%import("js/counter_admin.js")-->
<table border="1">
<tr> <!-- 일자를 옮기는 form -->
<th rowspan="2">{$lang->interval}</th> <form action="./" method="get" id="fo_counter">
<td><input type="text" name="interval" value="{$config->interval?$config->interval:60}" /> {$lang->unit_sec}</td> <input type="hidden" name="module" value="{$module}" />
</tr> <input type="hidden" name="act" value="{$act}" />
<tr> <input type="hidden" name="selected_date" value="{$selected_date}" />
<td>{$lang->about_interval}</td>
</tr>
<tr>
<th rowspan="2">{$lang->limit_count}</th>
<td><input type="text" name="limit_count" value="{$config->limit_count?$config->limit_count:5}" /></td>
</tr>
<tr>
<td>{$lang->about_limit_count}</td>
</tr>
<tr>
<th rowspan="2">{$lang->check_trackback}</th>
<td><input type="checkbox" name="check_trackback" value="Y" <!--@if($config->check_trackback=='Y')-->checked="true"<!--@end--> /></td>
</tr>
<tr>
<td>{$lang->about_check_trackback}</td>
</tr>
<tr>
<td colspan="2">
<input type="button" value="{$lang->cmd_cancel}" onclick="location.href='{getUrl('act','')}'" />
<input type="submit" value="{$lang->cmd_registration}" accesskey="s" />
</td>
</tr>
</table>
</form> </form>
<!-- 전체현황 -->
<div>
<h3>{$lang->total_counter}</h3>
<ul>
<li>{$lang->unique_visitor} : {number_format($total_counter->unique_visitor)}</li>
<li>{$lang->pageview} : {number_format($total_counter->pageview)}</li>
</ul>
</div>
<!-- 선택된 일자 현황 -->
<div>
<h3><span id='str_selected_date'>{zdate($selected_date, "Y-m-d")}</span> <a href="#" onclick="open_calendar(null, '{$selected_date}', 'changeSelectedDate');return false;">{$lang->cmd_select_date}</a></h3>
<ul>
<li>{$lang->unique_visitor} : {number_format($selected_day_counter->unique_visitor)}</li>
<li>{$lang->pageview} : {number_format($selected_day_counter->pageview)}</li>
</ul>
</div>

View file

@ -0,0 +1,14 @@
/**
* @brief 카운터 정보 수집 javascript
* window.onload 이벤트 후에 counter 모듈을 호출한다.
**/
// 이벤트 등록
xAddEventListener(window,'load',doCallCounter);
// counter 모듈을 호출하는 함수
function doCallCounter() {
show_waiting_message = false;
exec_xml('counter','procCounterExecute');
show_waiting_message = true;
}

View file

@ -0,0 +1,6 @@
// 관리자 페이지에서 날자 이동
function changeSelectedDate(selected_date) {
var fo_obj = xGetElementById('fo_counter');
fo_obj.selected_date.value = selected_date;
fo_obj.submit();
}