Horribly hacky links to publishers and datasets, nobody tell Tom
Horribly hacky links to publishers and datasets, nobody tell Tom

--- a/ckanext/ga_report/controller.py
+++ b/ckanext/ga_report/controller.py
@@ -531,7 +531,7 @@
     '''
     publishers = []
     for pub in model.Session.query(model.Group).\
-               filter(model.Group.type=='publisher').\
+               filter(model.Group.type=='organization').\
                filter(model.Group.state=='active').\
                order_by(model.Group.name):
         publishers.append((pub.name, pub.title))

--- a/ckanext/ga_report/ga_model.py
+++ b/ckanext/ga_report/ga_model.py
@@ -125,7 +125,7 @@
         dataset_ref = dataset_match.groups()[0]
         dataset = model.Package.get(dataset_ref)
         if dataset:
-            publisher_groups = dataset.get_groups('publisher')
+            publisher_groups = dataset.get_groups('organization')
             if publisher_groups:
                 return dataset_ref,publisher_groups[0].name
         return dataset_ref, None
@@ -323,11 +323,11 @@
     """
     toplevel = get_top_level()
     publishers = model.Session.query(model.Group).\
-        filter(model.Group.type=='publisher').\
+        filter(model.Group.type=='organization').\
         filter(model.Group.state=='active').all()
     for publisher in publishers:
         views, visits, subpub = update_publisher(period_name, publisher, publisher.name)
-        parent, parents = '', publisher.get_groups('publisher')
+        parent, parents = '', publisher.get_groups('organization')
         if parents:
             parent = parents[0].name
         item = model.Session.query(GA_Publisher).\
@@ -377,7 +377,7 @@
                      model.Member.table_name == 'group' and \
                      model.Member.state == 'active').\
            filter(model.Member.id==None).\
-           filter(model.Group.type=='publisher').\
+           filter(model.Group.type=='organization').\
            order_by(model.Group.name).all()
 
 def get_children(publisher):

--- a/ckanext/ga_report/helpers.py
+++ b/ckanext/ga_report/helpers.py
@@ -71,7 +71,7 @@
 def single_popular_dataset_html(top=20):
     dataset_dict = single_popular_dataset(top)
     groups = package.get('groups', [])
-    publishers = [ g for g in groups if g.get('type') == 'publisher' ]
+    publishers = [ g for g in groups if g.get('type') == 'organization' ]
     publisher = publishers[0] if publishers else {'name':'', 'title': ''}
     context = {
         'dataset': dataset_dict,
@@ -118,7 +118,7 @@
 
             if not p in datasets:
                 datasets[p] = {'views':0, 'visits': 0}
-                
+
             datasets[p]['views'] = datasets[p]['views'] + int(entry.pageviews)
             datasets[p]['visits'] = datasets[p]['visits'] + int(entry.visits)
 

--- a/ckanext/ga_report/templates/ga_report/ga_util.html
+++ b/ckanext/ga_report/templates/ga_report/ga_util.html
@@ -70,7 +70,6 @@
 </div>
 
 <div py:def="ga_sidebar(download_link)">
-  <div class="boxed">
     <div class="widget-container widget_text">
       <h4>Download</h4>
       <p><center>
@@ -92,7 +91,7 @@
           <li>The results are not shown when the number of views/visits is tiny. Where these relate to site pages, results are available in full in the CSV download. Where these relate to users' web browser information, results are not disclosed, for privacy reasons.</li>
       </ul>
     </div>
-  </div>
+
 </div>
 
 

--- a/ckanext/ga_report/templates/ga_report/publisher/index.html
+++ b/ckanext/ga_report/templates/ga_report/publisher/index.html
@@ -6,7 +6,6 @@
   <xi:include href="../ga_util.html" />
 
   <py:def function="page_title">Usage by Publisher</py:def>
-
 
 
   <py:def function="sidebar">
@@ -25,9 +24,23 @@
     <script type="text/javascript" src="/scripts/vendor/d3.layout.min.js"></script>
     <script type="text/javascript" src="/scripts/vendor/rickshaw.min.js"></script>
   </py:def>
-  <py:def function="page_heading">Site Usage ${usage_nav('Publishers')}</py:def>
+
+ <py:match path="breadcrumbs">
+    <li><a href="/data/site-usage">Site Analytics</a></li>
+    <li><a href="/data/site-usage/publisher">Publishers</a></li>
+  </py:match>
+
+
 
   <div py:match="content">
+
+    <h3 style='text-align:center;'>
+      <a href="/data/site-usage">Site-wide</a>
+      <span style="color: #bbb;margin:10px;">|</span>
+      Publishers
+      <span style="color: #bbb;margin:10px;">|</span>
+      <a href="/data/site-usage/dataset">Datasets</a>
+    </h3>
 
 
     <div class="boxed">

--- a/ckanext/ga_report/templates/ga_report/publisher/read.html
+++ b/ckanext/ga_report/templates/ga_report/publisher/read.html
@@ -22,9 +22,24 @@
   <py:def function="sidebar">
     ${ga_sidebar(download_link=h.url_for(controller='ckanext.ga_report.controller:GaDatasetReport',action='dataset_csv',id=c.publisher_name or 'all',month=c.month or 'all'))}
   </py:def>
-  <py:def function="page_heading">Site Usage ${usage_nav('Datasets')}</py:def>
+
+ <py:match path="breadcrumbs">
+    <li><a href="/data/site-usage">Site Analytics</a></li>
+    <li><a href="/data/site-usage/publisher">Datasets</a></li>
+    <li py:if="c.publisher"><a href="/data/site-usage/publisher/${c.publisher.name}">${c.publisher.title}</a></li>
+  </py:match>
+
+
 
   <div py:match="content">
+    <h3 style='text-align:center;'>
+      <a href="/data/site-usage">Site-wide</a>
+      <span style="color: #bbb;margin:10px;">|</span>
+      <a href="/data/site-usage/publisher">Publishers</a>
+      <span style="color: #bbb;margin:10px;">|</span>
+      Datasets
+    </h3>
+
 
     <div class="boxed">
      <h3 py:if="c.publisher"><a href="${h.url_for(controller='ckanext.dgu.controllers.publisher:PublisherController',action='read',id=c.publisher.name)}">${c.publisher.title}</a></h3>

--- a/ckanext/ga_report/templates/ga_report/site/index.html
+++ b/ckanext/ga_report/templates/ga_report/site/index.html
@@ -23,9 +23,22 @@
     ${ga_sidebar(download_link=h.url_for(controller='ckanext.ga_report.controller:GaReport',action='csv',month=c.month or 'all'))}
   </py:def>
 
-  <py:def function="page_heading">Site Usage ${usage_nav('Site-wide')}</py:def>
+
+ <py:match path="breadcrumbs">
+    <li><a href="/data/site-usage">Site Analytics</a></li>
+    <li><a href="/data/site-usage">Site-wide</a></li>
+  </py:match>
+
 
   <div py:match="content">
+
+    <h3 style='text-align:center;'>
+      Site-wide
+      <span style="color: #bbb;margin:10px;">|</span>
+      <a href="/data/site-usage/publisher">Publishers</a>
+      <span style="color: #bbb;margin:10px;">|</span>
+      <a href="/data/site-usage/dataset">Datasets</a>
+    </h3>
 
     <div class="boxed">
     <div class="tabbable">
@@ -168,7 +181,7 @@
         CKAN.GA_Reports.bind_sparklines();
         CKAN.GA_Reports.bind_sidebar();
         CKAN.GA_Reports.bind_month_selector();
-      });  
+      });
     </script>
   </py:def>