Add summary and activity screens, remove private datasets from counts
[ckanext-dga-stats.git] / ckanext / dga_stats / templates_legacy / ckanext / stats / index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<html xmlns:py="http://genshi.edgewall.org/"
  xmlns:i18n="http://genshi.edgewall.org/i18n"
  xmlns:xi="http://www.w3.org/2001/XInclude"
  py:strip="">
 
  <py:def i18n:msg="" function="page_title">Statistics</py:def>
 
  <py:def function="page_heading">
    Statistics
  </py:def>
 
  <py:def function="optional_feed">
    <!--!
    Hellish hack to get excanvas to work in IE8. We disable html5shiv from
    overriding the createElement() method on this page.
    See: http://stackoverflow.com/questions/10208062/using-flot-with-bootstrap-ie8-incompatibility
    -->
    <!--[if lte IE 8 ]><script>var html5 = {shivMethods: false};</script><![endif]-->
  </py:def>
 
  <py:def function="optional_head">
    <style type="text/css">
      body #sidebar {
        display: none;
      }
 
      body #content {
        width: 950px;
      }
 
      h3 {
        margin-top: 20px;
      }
 
      .graph {
        width: 950px;
        height: 300px;
        margin-bottom: 20px;
      }
 
      .metric {
          width: 30%;
      }
 
    </style>
  </py:def>
 
  <py:match path="minornavigation">
    <ul class="tabbed">
      <li class="current-tab">
        <a href="">Home</a>
      </li>
    </ul>
  </py:match>
 
  <div py:match="content">
    <h3>Total number of Datasets</h3>
    <div id="new_packages_graph" class="graph"></div>
 
    <h3>Revisions to Datasets per week</h3>
    <div id="package_revisions_graph" class="graph"></div>
 
    <h3>Top Rated Datasets</h3>
    <table py:if="c.top_rated_packages" class="table table-bordered table-striped">
      <tr><th>Dataset</th><th>Average rating</th><th class="metric">Number of ratings</th></tr>
      <tr py:for="package, rating, num_ratings in c.top_rated_packages">
        <td>${h.link_to(package.title or package.name, h.url_for(controller='package', action='read', id=package.name))}</td><td>${rating}</td><td>${num_ratings}</td>
      </tr>
    </table>
    <p py:if="not c.top_rated_packages">No ratings</p>
 
    <h3>Most Edited Datasets</h3>
    <table class="table table-bordered table-striped">
      <tr><th>Dataset</th><th class="metric">Number of edits</th></tr>
      <tr py:for="package, edits in c.most_edited_packages">
        <td>${h.link_to(package.title or package.name, h.url_for(controller='package', action='read', id=package.name))}</td><td>${edits}</td>
      </tr>
    </table>
 
    <h3>Largest Groups</h3>
    <table class="table table-bordered table-striped">
      <tr><th>Group</th><th class="metric">Number of datasets</th></tr>
      <tr py:for="group, num_packages in c.largest_groups">
        <td>${h.link_to(group.title or group.name, h.url_for(controller='group', action='read', id=group.name))}</td><td>${num_packages}</td>
      </tr>
    </table>
 
    <h3>Top Tags</h3>
    <table class="table table-bordered table-striped">
      <tr py:for="tag, num_packages in c.top_tags">
        <td>${h.link_to(tag.name, h.url_for(controller='tag', action='read', id=tag.name))}</td><td class="metric">${num_packages}</td>
      </tr>
    </table>
  
    <h3>Users owning most datasets</h3>
    <table class="table table-bordered table-striped">
      <tr py:for="user, num_packages in c.top_package_owners">
        <td>${h.linked_user(user)}</td><td class="metric">${num_packages}</td>
      </tr>
    </table>
 
    <p>
      Page last updated:
       <?python 
          import datetime
       ?>
      ${datetime.datetime.now().strftime('%c')}
    </p>
  </div>
 
  <py:def function="optional_footer">
    <script type="text/javascript">
      // HACKy
      $('body').addClass('no-sidebar');
    </script>
 
    ${jsConditionalForIe(8, '&lt;script language="javascript" type="text/javascript" src="' + h.url_for_static('/scripts/vendor/flot/0.7/excanvas.js') + '"&gt;&lt;/script&gt;', 'lte')}
    <script type="text/javascript" src="${ h.url_for_static('/scripts/vendor/flot/0.7/jquery.flot.js') }">//pointless jscript comment</script>
    <script type="text/javascript">
      var options = {
          xaxis: {
            mode: "time",
            timeformat: "%y-%b"
          },
          yaxis: {
            min: 0
          },
          legend: {
            position: "nw"
          }
      };
      var data = [
        [ 
          ${",".join(c.packages_by_week)}
        ]
      ];
      $.plot($("#new_packages_graph"), data, options);
    </script>
    
    <script type="text/javascript">
      var options = {
          xaxis: {
            mode: "time",
            timeformat: "%y-%b"
          },
          legend: {
            position: "nw"
          },
          colors: ["#ffcc33", "#ff8844"]
      };
      var data = [
        {label: "All package revisions",
         lines: {fill: 1 },
         data: [${",".join(c.all_package_revisions)}]},
        {label: "New datasets",
         lines: {fill: 1},
         data: [${",".join(c.new_datasets)}]}
      ];
      $.plot($("#package_revisions_graph"), data, options);
    </script>
  </py:def>
  <xi:include href="../../layout.html" />
</html>