2011-01-18 11:54:30 +00:00
|
|
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
|
|
|
|
2011-01-24 18:24:24 +00:00
|
|
|
<#-- Browse class groups on the home page. Could potentially become a widget -->
|
2011-01-18 11:54:30 +00:00
|
|
|
|
2011-03-08 15:44:05 +00:00
|
|
|
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/browseClassGroups.css" />')}
|
2011-01-18 11:54:30 +00:00
|
|
|
|
2011-01-24 18:24:24 +00:00
|
|
|
<#macro allClassGroups classGroups>
|
|
|
|
<#-- Loop through classGroups first so we can account for situations when all class groups are empty -->
|
|
|
|
<#assign selected = 'class="selected" ' />
|
|
|
|
<#assign classGroupList>
|
|
|
|
<#list classGroups as group>
|
2011-01-18 11:54:30 +00:00
|
|
|
<#-- Only display populated class groups -->
|
|
|
|
<#if (group.individualCount > 0)>
|
|
|
|
<#-- Catch the first populated class group. Will be used later as the default selected class group -->
|
|
|
|
<#if !firstPopulatedClassGroup??>
|
|
|
|
<#assign firstPopulatedClassGroup = group />
|
|
|
|
</#if>
|
|
|
|
<#-- Determine the active (selected) group -->
|
|
|
|
<#assign activeGroup = "" />
|
|
|
|
<#if !classGroup??>
|
|
|
|
<#if group_index == 0>
|
|
|
|
<#assign activeGroup = selected />
|
|
|
|
</#if>
|
|
|
|
<#elseif classGroup.uri == group.uri>
|
|
|
|
<#assign activeGroup = selected />
|
|
|
|
</#if>
|
2011-04-19 16:33:21 +00:00
|
|
|
<li role="listitem"><a ${activeGroup}href="${urls.currentPage}?classgroupUri=${group.uri?url}#browse" title="Browse ${group.displayName?capitalize}" data-uri="${group.uri}" data-count="${group.individualCount}">${group.displayName?capitalize} <span class="count-classes">(${group.individualCount})</span></a></li>
|
2011-01-18 11:54:30 +00:00
|
|
|
</#if>
|
|
|
|
</#list>
|
2011-01-24 18:24:24 +00:00
|
|
|
</#assign>
|
|
|
|
|
|
|
|
<#-- Display the class group browse only if we have at least one populated class group -->
|
|
|
|
<#if firstPopulatedClassGroup??>
|
|
|
|
<section id="browse" role="region">
|
|
|
|
<h4>Browse by</h4>
|
|
|
|
|
|
|
|
<ul id="browse-classgroups" role="list">
|
|
|
|
${classGroupList}
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<#-- If requesting the home page without any additional URL parameters, select the first populated class group-->
|
2011-01-28 18:21:17 +00:00
|
|
|
<#assign defaultSelectedClassGroup = firstPopulatedClassGroup />
|
2011-01-24 18:24:24 +00:00
|
|
|
|
|
|
|
<section id="browse-classes" role="navigation">
|
|
|
|
<nav>
|
2011-01-28 18:21:17 +00:00
|
|
|
<ul id="classes-in-classgroup" class="vis" role="list">
|
2011-01-24 18:24:24 +00:00
|
|
|
<#if classes??>
|
|
|
|
<#-- We don't need to send parameters because the data we need is delivered as template variables -->
|
|
|
|
<@classesInClassgroup />
|
|
|
|
<#else>
|
|
|
|
<#-- We need to pass the data to the macro because the only template variable provided by default is classGroups -->
|
|
|
|
<@classesInClassgroup classes=defaultSelectedClassGroup.classes classGroup=defaultSelectedClassGroup />
|
|
|
|
</#if>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
<#if classes??>
|
|
|
|
<#-- We don't need to send parameters because the data we need is delivered as template variables -->
|
|
|
|
<@visualGraph />
|
|
|
|
<#else>
|
|
|
|
<#-- We need to pass the data to the macro because the only template variable provided by default is classGroups -->
|
|
|
|
<@visualGraph classes=defaultSelectedClassGroup.classes classGroup=defaultSelectedClassGroup />
|
|
|
|
</#if>
|
|
|
|
</section> <!-- #browse-classes -->
|
|
|
|
</section> <!-- #browse -->
|
2011-01-28 18:21:17 +00:00
|
|
|
|
2011-02-21 18:13:26 +00:00
|
|
|
<#-- For v1.3: The controller should pass in the dataservice url. -->
|
2011-01-28 18:21:17 +00:00
|
|
|
<script type="text/javascript">
|
|
|
|
var browseData = {
|
2011-02-21 18:13:26 +00:00
|
|
|
baseUrl: '${urls.base}',
|
|
|
|
dataServiceUrl: '${urls.base}/dataservice?getVClassesForVClassGroup=1&classgroupUri=',
|
2011-02-02 16:10:58 +00:00
|
|
|
defaultBrowseClassGroupUri: '${firstPopulatedClassGroup.uri!}',
|
|
|
|
defaultBrowseClassGroupCount: '${firstPopulatedClassGroup.individualCount!}'
|
2011-01-28 18:21:17 +00:00
|
|
|
};
|
|
|
|
</script>
|
2011-03-08 15:44:05 +00:00
|
|
|
${scripts.add('<script type="text/javascript" src="${urls.base}/js/browseClassGroups.js"></script>')}
|
2011-01-28 18:21:17 +00:00
|
|
|
|
2011-01-24 18:24:24 +00:00
|
|
|
<#else>
|
|
|
|
<#-- Would be nice to update classgroups-checkForData.ftl with macro so it could be used here as well -->
|
|
|
|
<#-- <#include "classgroups-checkForData.ftl"> -->
|
|
|
|
<h3>There is currently no content in the system</h3>
|
2011-01-18 11:54:30 +00:00
|
|
|
|
2011-02-05 17:24:40 +00:00
|
|
|
<#if user.loggedIn>
|
|
|
|
<#if user.hasSiteAdminAccess>
|
|
|
|
<p>You can <a href="${urls.siteAdmin}" title="Manage content">add content and manage this site</a> from the Site Administration page.</p>
|
|
|
|
</#if>
|
|
|
|
<#else>
|
2011-01-24 18:24:24 +00:00
|
|
|
<p>Please <a href="${urls.login}" title="log in to manage this site">log in</a> to manage content.</p>
|
2011-02-05 17:24:40 +00:00
|
|
|
</#if>
|
2011-01-24 18:24:24 +00:00
|
|
|
</#if>
|
2011-01-18 11:54:30 +00:00
|
|
|
</#macro>
|
|
|
|
|
2011-01-28 18:21:17 +00:00
|
|
|
|
2011-01-18 11:54:30 +00:00
|
|
|
<#macro classesInClassgroup classes=classes classGroup=classGroup>
|
|
|
|
<#list classes as class>
|
|
|
|
<#if (class.individualCount > 0)>
|
2011-02-08 13:09:01 +00:00
|
|
|
<li role="listitem"><a href="${urls.base}/individuallist?vclassId=${class.uri?url}" title="Browse all ${class.name} content">${class.name}</a></li>
|
2011-01-18 11:54:30 +00:00
|
|
|
</#if>
|
|
|
|
</#list>
|
2011-01-24 18:24:24 +00:00
|
|
|
</#macro>
|
|
|
|
|
2011-01-28 18:21:17 +00:00
|
|
|
|
2011-01-24 18:24:24 +00:00
|
|
|
<#macro visualGraph classes=classes classGroup=classGroup>
|
|
|
|
<section id="visual-graph" class="barchart" role="region">
|
2011-01-28 18:21:17 +00:00
|
|
|
<#-- Will be populated dynamically via AJAX request -->
|
2011-01-24 18:24:24 +00:00
|
|
|
</section>
|
|
|
|
|
2011-03-08 15:44:05 +00:00
|
|
|
${scripts.add('<script type="text/javascript" src="${urls.base}/js/raphael/raphael.js"></script>',
|
|
|
|
'<script type="text/javascript" src="${urls.base}/js/raphael/g.raphael.js"></script>',
|
|
|
|
'<script type="text/javascript" src="${urls.base}/js/raphael/g.bar.js"></script>')}
|
2011-01-18 11:54:30 +00:00
|
|
|
</#macro>
|