From 7291ca3bf95f943bd4ac4a3f217405ebf0db099d Mon Sep 17 00:00:00 2001 From: bnu Date: Fri, 13 May 2016 17:34:21 +0900 Subject: [PATCH] =?UTF-8?q?fix=20#1884=20=EB=8C=80=EC=8B=9C=EB=B3=B4?= =?UTF-8?q?=EB=93=9C=20=EC=B9=B4=EC=9A=B4=ED=84=B0=EC=9A=A9=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A6=BD=ED=8A=B8=EB=A5=BC=20=EB=B3=84=EB=8F=84=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/admin/tpl/_dashboard_counter.html | 87 +---------------------- modules/admin/tpl/js/dashboard_counter.js | 80 +++++++++++++++++++++ 2 files changed, 83 insertions(+), 84 deletions(-) create mode 100644 modules/admin/tpl/js/dashboard_counter.js diff --git a/modules/admin/tpl/_dashboard_counter.html b/modules/admin/tpl/_dashboard_counter.html index db8112a0b..7234b4f08 100644 --- a/modules/admin/tpl/_dashboard_counter.html +++ b/modules/admin/tpl/_dashboard_counter.html @@ -1,3 +1,5 @@ + +

{$lang->uv}

@@ -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 - } - } - }); -}; - + \ No newline at end of file diff --git a/modules/admin/tpl/js/dashboard_counter.js b/modules/admin/tpl/js/dashboard_counter.js new file mode 100644 index 000000000..60eab1aa0 --- /dev/null +++ b/modules/admin/tpl/js/dashboard_counter.js @@ -0,0 +1,80 @@ +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; + 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 + } + } + }); +}; \ No newline at end of file