Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

OWF-5553: Calendar icon in Widget Views widget moves one pixel to lef…

…t on mouse over and two pixels left on select while using Large Text theme.
  • Loading branch information...
commit 8dbe39c4cd9d251c0560b7cf4ba4a8e72e489a70 1 parent 9c7e757
Greg Traub authored

Showing 1 changed file with 97 additions and 90 deletions. Show diff stats Hide diff stats

  1. +97 90 web-app/js/components/admin/TagCloud.js
187 web-app/js/components/admin/TagCloud.js
... ... @@ -1,105 +1,112 @@
1 1 Ext.define('Ozone.components.admin.TagCloud', {
2   - extend: 'Ext.panel.Panel',
3   - alias: ['widget.tagcloud', 'widget.Ozone.components.admin.TagCloud'],
  2 + extend: 'Ext.panel.Panel',
  3 + alias: ['widget.tagcloud', 'widget.Ozone.components.admin.TagCloud'],
4 4
5   - generateTagCloud: function(params) {
6   - params = params || {};
7   - var fromDate = params.fromDate;
8   - var toDate = params.toDate;
9   - scope = this;
  5 + generateTagCloud: function(params) {
  6 + params = params || {};
  7 + var fromDate = params.fromDate;
  8 + var toDate = params.toDate;
  9 + scope = this;
10 10
11   - var dateObj = new Date();
  11 + var dateObj = new Date();
12 12 if (toDate == null) {
13   - toDate = new Date();
  13 + toDate = new Date();
14 14 } else {
15   - toDate = new Date(toDate);
  15 + toDate = new Date(toDate);
16 16 }
17 17
18   - // Change toDate to last millisecond of selected date because date picker will
19   - // not consider time so the full day won't be included in the totals.
20   - var year = toDate.getFullYear();
21   - var month = toDate.getMonth();
22   - var day = toDate.getDate();
23   - toDate = new Date(year, month, day, 23, 59, 59, 999);
  18 + // Change toDate to last millisecond of selected date because date picker will
  19 + // not consider time so the full day won't be included in the totals.
  20 + var year = toDate.getFullYear();
  21 + var month = toDate.getMonth();
  22 + var day = toDate.getDate();
  23 + toDate = new Date(year, month, day, 23, 59, 59, 999);
24 24
25   - if (fromDate == null) {
26   - // fromDate defaults to one year from toDate
27   - fromDate = new Date(year - 1, month, day);
28   - } else {
29   - fromDate = new Date(fromDate);
30   - }
  25 + if (fromDate == null) {
  26 + // fromDate defaults to one year from toDate
  27 + fromDate = new Date(year - 1, month, day);
  28 + } else {
  29 + fromDate = new Date(fromDate);
  30 + }
31 31
32   - Ext.Ajax.request({
33   - url: Ozone.metrics.util.contextPath() + '/tagCloudMetric',
34   - params: {
35   - fromDate: fromDate.getTime(),
36   - toDate: toDate.getTime()
37   - },
38   - success: function(response){
39   - var data = Ext.decode(response.responseText).results;
  32 + Ext.Ajax.request({
  33 + url: Ozone.metrics.util.contextPath() + '/tagCloudMetric',
  34 + params: {
  35 + fromDate: fromDate.getTime(),
  36 + toDate: toDate.getTime()
  37 + },
  38 + success: function(response){
  39 + var data = Ext.decode(response.responseText).results;
  40 + scope.update(data);
  41 + }
  42 + });
  43 + },
40 44
41   - var instance;
42   - var max = -1;
43   - var min = -1;
  45 + initComponent: function() {
  46 + var me = this;
  47 + me.tpl = new Ext.XTemplate(
  48 + '<ul class="cloud">{[this.initialize(values)]}' +
  49 + '<tpl for=".">' +
  50 + '<li>' +
  51 + '<span ' +
  52 + 'id={componentId} ' +
  53 + 'title="{total}" ' +
  54 + 'class="tag" ' +
  55 + 'style="font-size:{[this.fontSize(values)]}em" ' +
  56 + 'onmouseover="document.getElementById(\'{componentId}\').className=\'tag-active\'" ' +
  57 + 'onmouseout="document.getElementById(\'{componentId}\').className=\'tag\'" ' +
  58 + 'onclick = "graph(\'{componentId}\')" ' +
  59 + '>' +
  60 + '{[this.nameNoSpace(values)]} ' +
  61 + '</span>' +
  62 + '</li>' +
  63 + '</tpl>' +
  64 + '</ul>',
  65 + {
  66 + min: -1,
  67 + minSize: 0,
  68 + constant: 0,
  69 + initialize: function(values) {
  70 + var instance;
  71 + var max = -1;
  72 + var min = -1;
44 73
45   - //find max and min number of views
46   - for(var i = 0; i < data.length; i++){
47   - instance = data[i];
48   - var views = instance.total;
  74 + //find max and min number of views
  75 + for (var i = 0; i < values.length; i++) {
  76 + instance = values[i];
  77 + var views = instance.total;
49 78
50   - if(max == -1){
51   - max = views;
52   - }else if(max < views){
53   - max = views;
54   - }
  79 + if (max == -1) {
  80 + max = views;
  81 + } else if (max < views) {
  82 + max = views;
  83 + }
55 84
56   - if(min == -1){
57   - min = views;
58   - }else if (min > views){
59   - min = views;
60   - }
61   - }
  85 + if (min == -1) {
  86 + min = views;
  87 + } else if (min > views) {
  88 + min = views;
  89 + }
  90 + }
62 91
63   - var numFonts = 8;
64   - var delta = (max - min)/ numFonts;
65   - var intervals = [];
66   -
67   - for(var k = 1; k <= numFonts; k++){
68   - intervals[k - 1] = min + (k * delta);
69   - }
70   -
71   - var html = '<ul class ="cloud">';
72   - var tag = 'tag';
73   - var views;
74   - var maxSize = 2.5;
75   - var minSize = 1.0;
76   - var constant = Math.log(max - (min - 1)) / (maxSize - minSize)
77   -
78   - for(var j = 0; j < data.length; j++){
79   - instance = data[j];
80   - views = instance.total;
81   -
82   - var fontSize = Math.log(views - (min - 1)) / constant + minSize;
83   - var name = instance.component.toLowerCase();
84   - var nameNoSpace = Ozone.util.HTMLEncode(name.replace(/ /g, '_'));
85   - var nameSafe = nameNoSpace.replace(/\\/g, '__');
86   - var componentId = instance.componentId;
87   - var component = instance.component;
88   -
89   - // adds the widget name to the list with the views as a tooltip
90   - html += '<li><span id =' + nameSafe + ' title="' + instance.total + '" class="' + tag + '" style="font-size:' + fontSize + 'em" ' +
91   - 'onmouseover = "document.getElementById(\'' + nameSafe + '\').className=\'' + tag + '-active\'" ' + '" onmouseout = "document.getElementById(\'' + nameSafe + '\').className=\'' + tag + '\'"' +
92   - ' onclick = "graph(\'' + componentId +'\',\'' + component + '\')" >' + nameNoSpace + ' ' + '</span></li>'
93   - }
94   -
95   - html += '</ul>'
96   - scope.update(html)
97   - }
98   - });
99   - },
100   -
101   - initComponent: function() {
102   - this.generateTagCloud();
103   - this.callParent();
104   - }
  92 + var maxSize = 2.5;
  93 + var minSize = 1.0;
  94 + var constant = Math.log(max - (min - 1)) / (maxSize - minSize)
  95 +
  96 + this.min = min;
  97 + this.minSize = minSize;
  98 + this.constant = constant;
  99 + },
  100 + nameNoSpace: function(values) {
  101 + var name = values.component.toLowerCase();
  102 + return Ozone.util.HTMLEncode(name.replace(/ /g, '_'));
  103 + },
  104 + fontSize: function(values) {
  105 + return Math.log(values.total - (this.min - 1)) / this.constant + this.minSize;
  106 + }
  107 + }
  108 + );
  109 + this.generateTagCloud();
  110 + this.callParent();
  111 + }
105 112 });

0 comments on commit 8dbe39c

Please sign in to comment.
Something went wrong with that request. Please try again.