issue 2889 arrange script for template parse

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12679 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2013-02-04 07:14:19 +00:00
parent a25dab60cb
commit 507cf2ecbf

View file

@ -121,97 +121,93 @@ xe.lang.fri = '{$lang->fri}';
xe.lang.sat = '{$lang->sat}';
xe.lang.sun = '{$lang->sun}';
jQuery(function($){
// Dashboard portlet UI
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();
}
});
.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){
function obj2Array(htObj)
{
var aRes = [];
for(var x in htObj){
for(var x in htObj)
{
if(!htObj.hasOwnProperty(x)) continue;
aRes.push(htObj[x]);
}
return aRes;
}
jQuery(function ($) {
$.exec_json("counter.getWeeklyUniqueVisitor", {}, function(htRes){
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){
$.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) {
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], {
// The "seriesDefaults" option is an options object that will
// be applied to all series in the chart.
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
rendererOptions: {fillToZero: true}
},
// Custom labels for the series are specified with the "label"
// option on the series option. Here a series option object
// is specified for each series.
series:[
{label: xe.lang.last_week},
{label: xe.lang.this_week}
],
// Show the legend and put it outside the grid, but inside the
// plot container, shrinking the grid to accomodate the legend.
// A value of "outside" would not shrink the grid and allow
// the legend to overflow the container.
legend: {
show: true,
placement: 'outsideGrid'
},
axes: {
// Use a category axis on the x axis and use our custom ticks.
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
ticks: ticks
},
// Pad the y axis just a little so bars can get close to, but
// not touch, the grid boundaries. 1.2 is the default padding.
yaxis: {
min: 0,
ticks: 1,
//tickOptions: {formatString: '%d'},
pad: 1.05
}
}
});
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
}
}
});
// jpplot resize
jQuery(function($){
$(window).resize(function(){
jQuery(function($)
{
$(window).resize(function()
{
var targetWidth = $('.jqplot-target').width();
$('.jqplot-base-canvas, .jqplot-grid-canvas').width(targetWidth).height(142);
$('.jqplot-series-shadowCanvas, .jqplot-series-canvas, .jqplot-barRenderer-highlight-canvas, .jqplot-event-canvas,').width(targetWidth/10 * 8).height(109);