--- a/ckanext/dga_stats/templates/ckanext/stats/index.html +++ b/ckanext/dga_stats/templates/ckanext/stats/index.html @@ -29,6 +29,7 @@ <p class="empty">{{ _('No groups') }}</p> {% endif %} </section> +{% if h.check_access('sysadmin') %} <section id="activity-counts" class="module-content tab-content"> <h2>{{ _('Site Activity Log') }}</h2> {% if c.activity_counts %} @@ -54,7 +55,57 @@ <p class="empty">{{ _('No groups') }}</p> {% endif %} </section> - + <section id="recent-datasets" class="module-content tab-content"> + <h2>{{ _('Recent Datasets') }}</h2> + {% if c.recent_datasets %} + <table class="table table-chunky table-bordered table-striped"> + <thead> + <tr> + <th>{{ _('Date') }}</th> + <th>{{ _('Dataset') }}</th> + <th>{{ _('New/Modified') }}</th> + </tr> + </thead> + <tbody> + {% for date,package,newmodified in c.recent_datasets %} + <tr> + <td>{{ date }}</td> + <td>{{ h.link_to(package.title or package.name, h.url_for(controller='package', action='read', id=package.name)) }}</td> + <td>{{ newmodified }}</td> + </tr> + {% endfor %} + </tbody> + </table> + {% else %} + <p class="empty">{{ _('No groups') }}</p> + {% endif %} + </section> + <section id="user-access-list" class="module-content tab-content"> + <h2>{{ _('User Access List') }}</h2> + {% if c.user_access_list %} + <table class="table table-chunky table-bordered table-striped"> + <thead> + <tr> + <th>{{ _('Username') }}</th> + <th>{{ _('Sysadmin') }}</th> + <th class="metric">{{ _('Organisational Role') }}</th> + </tr> + </thead> + <tbody> + {% for username,sysadmin,role in c.user_access_list %} + <tr> + <td>{{ username }}</td> + <td>{{ sysadmin }}</td> + <td>{{ role }}</td> + </tr> + {% endfor %} + </tbody> + </table> + {% else %} + <p class="empty">{{ _('No groups') }}</p> + {% endif %} + </section> +{% endif %} <section id="stats-total-datasets" class="module-content tab-content active"> <h2>{{ _('Total number of Datasets') }}</h2> @@ -176,7 +227,7 @@ <p class="empty">{{ _('No groups') }}</p> {% endif %} </section> - +{% if False %} <section id="stats-top-tags" class="module-content tab-content"> <h2>{{ _('Top Tags') }}</h2> <table class="table table-chunky table-bordered table-striped"> @@ -196,7 +247,6 @@ </tbody> </table> </section> - <section id="stats-most-owned" class="module-content tab-content"> <h2>{{ _('Users Owning Most Datasets') }}</h2> <table class="table table-chunky table-bordered table-striped"> @@ -216,6 +266,7 @@ </tbody> </table> </section> +{% endif %} <section id="stats-by-org" class="module-content tab-content"> <h2>{{ _('Datasets by Organization') }}</h2> {% if c.by_org %} @@ -229,6 +280,7 @@ </thead> <tbody> {% for group,private, num_packages in c.by_org %} + {% if private == False or h.check_access('sysadmin') %} <tr> <td>{{ h.link_to(group.title or group.name, h.url_for(controller='organization', action='read', id=group.name)) }}</td> {% if private == True %} @@ -238,14 +290,14 @@ {% endif %} <td class="metric">{{ num_packages }}</td> </tr> - {% endfor %} - </tbody> - </table> - {% else %} - <p class="empty">{{ _('No groups') }}</p> - {% endif %} - </section> - + {% endif %} + {% endfor %} + </tbody> + </table> + {% else %} + <p class="empty">{{ _('No groups') }}</p> + {% endif %} + </section> </article> {% endblock %} @@ -254,15 +306,19 @@ <h2 class="module-heading"><i class="icon-bar-chart icon-medium"></i> {{ _('Statistics Menu') }}</h2> <nav data-module="stats-nav"> <ul class="unstyled nav nav-simple"> - <li class="nav-item"><a href="#summary" data-toggle="tab">{{ _('Summary') }}</a></li> + <li class="nav-item active"><a href="#summary" data-toggle="tab">{{ _('Summary') }}</a></li> +{% if h.check_access('sysadmin') %} <li class="nav-item"><a href="#activity-counts" data-toggle="tab">{{ _('Site Activity Log') }}</a></li> - <li class="nav-item active"><a href="#stats-total-datasets" data-toggle="tab">{{ _('Total Number of Datasets') }}</a></li> + <li class="nav-item"><a href="#recent-datasets" data-toggle="tab">{{ _('Recent Datasets') }}</a></li> + <li class="nav-item"><a href="#user-access-list" data-toggle="tab">{{ _('User Access List') }}</a></li> +{% endif %} + <li class="nav-item"><a href="#stats-total-datasets" data-toggle="tab">{{ _('Total Number of Datasets') }}</a></li> <li class="nav-item"><a href="#stats-dataset-revisions" data-toggle="tab">{{ _('Dataset Revisions per Week') }}</a></li> <!-- <li class="nav-item"><a href="#stats-top-rated" data-toggle="tab">{{ _('Top Rated Datasets') }}</a></li> --> <li class="nav-item"><a href="#stats-most-edited" data-toggle="tab">{{ _('Most Edited Datasets') }}</a></li> - <li class="nav-item"><a href="#stats-top-tags" data-toggle="tab">{{ _('Top Tags') }}</a></li> - <li class="nav-item"><a href="#stats-most-owned" data-toggle="tab">{{ _('Users Owning Most Datasets') }}</a></li> - <li class="nav-item"><a href="#stats-by-org" data-toggle="tab">{{ _('Datasets by Organization') }}</a></li> +<!-- <li class="nav-item"><a href="#stats-top-tags" data-toggle="tab">{{ _('Top Tags') }}</a></li> + <li class="nav-item"><a href="#stats-most-owned" data-toggle="tab">{{ _('Users Owning Most Datasets') }}</a></li> --> + <li class="nav-item"><a href="#stats-by-org" data-toggle="tab">{{ _('Datasets by Organization') }}</a></li> </ul> </nav> </section>