mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-25 14:19:58 +09:00
fix #1884 대시보드 카운터용 스크립트를 별도 파일로 분리
This commit is contained in:
parent
f8b76b5571
commit
7291ca3bf9
2 changed files with 83 additions and 84 deletions
|
|
@ -1,3 +1,5 @@
|
|||
<load target="js/dashboard_counter.js" />
|
||||
|
||||
<div>
|
||||
<section class="status">
|
||||
<h2>{$lang->uv}</h2>
|
||||
|
|
@ -75,87 +77,4 @@ xe.lang.thu = '{$lang->thu}';
|
|||
xe.lang.fri = '{$lang->fri}';
|
||||
xe.lang.sat = '{$lang->sat}';
|
||||
xe.lang.sun = '{$lang->sun}';
|
||||
|
||||
jQuery(function($)
|
||||
{
|
||||
// Dashboard portlet UI
|
||||
$('.dashboard>div>section>ul>li')
|
||||
.bind('mouseenter focusin', function(){
|
||||
$(this).addClass('hover').find('>.action').show();
|
||||
})
|
||||
.bind('mouseleave focusout', function()
|
||||
{
|
||||
if(!$(this).find(':focus').length)
|
||||
{
|
||||
$(this).removeClass('hover').find('>.action').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function obj2Array(htObj)
|
||||
{
|
||||
var aRes = [];
|
||||
|
||||
for(var x in htObj)
|
||||
{
|
||||
if(!htObj.hasOwnProperty(x)) continue;
|
||||
aRes.push(htObj[x]);
|
||||
}
|
||||
|
||||
return aRes;
|
||||
}
|
||||
|
||||
jQuery(function ($)
|
||||
{
|
||||
$.exec_json("counter.getWeeklyUniqueVisitor", {}, function(htRes)
|
||||
{
|
||||
var aLastWeek = obj2Array(htRes.last_week.list);
|
||||
var aThisWeek = obj2Array(htRes.this_week.list);
|
||||
|
||||
drawChart("visitors", "Weekly Visitors", aLastWeek, aThisWeek);
|
||||
});
|
||||
|
||||
$.exec_json("counter.getWeeklyPageView", {}, function(htRes)
|
||||
{
|
||||
var aLastWeek = obj2Array(htRes.last_week.list);
|
||||
var aThisWeek = obj2Array(htRes.this_week.list);
|
||||
|
||||
drawChart("page_views", "Weekly Page Views", aLastWeek, aThisWeek);
|
||||
});
|
||||
});
|
||||
|
||||
function drawChart(sContainerId, sTitle, aLastWeek, aThisWeek)
|
||||
{
|
||||
$ = jQuery;
|
||||
|
||||
var s1 = aLastWeek;
|
||||
var s2 = aThisWeek;
|
||||
// Can specify a custom tick Array.
|
||||
// Ticks should match up one for each y value (category) in the series.
|
||||
var ticks = [xe.lang.sun,xe.lang.mon,xe.lang.tue,xe.lang.wed,xe.lang.thu,xe.lang.fri,xe.lang.sat];
|
||||
|
||||
var plot1 = $.jqplot(sContainerId, [s1, s2], {
|
||||
seriesDefaults:{
|
||||
renderer:$.jqplot.BarRenderer,
|
||||
rendererOptions: {fillToZero: true}
|
||||
},
|
||||
series:[
|
||||
{label: xe.lang.last_week},
|
||||
{label: xe.lang.this_week}
|
||||
],
|
||||
legend:
|
||||
{
|
||||
show: true,
|
||||
placement: 'outsideGrid'
|
||||
},
|
||||
axes: {
|
||||
xaxis: {
|
||||
renderer: $.jqplot.CategoryAxisRenderer, ticks: ticks
|
||||
},
|
||||
yaxis: {
|
||||
min: 0, ticks: 1, pad: 1.05
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue