NIHVIVO-2006 Realized that I had introduced a bug in r7283 and was missing the closing </a> for #classes-in-classgroup list items. IE was not a fan. Also removed labels since Raphael uses VML for graphing in IE and I wasn't reliably able to target and hide rvml:textpath.

This commit is contained in:
nac26 2011-02-08 13:29:09 +00:00
parent 1fafef06ba
commit a8d353dab1
2 changed files with 15 additions and 28 deletions

View file

@ -58,11 +58,10 @@ public class FreemarkerConfigurationLoader {
String themeDir = getThemeDir(vreq.getPortal()); String themeDir = getThemeDir(vreq.getPortal());
return getConfigForTheme(themeDir); return getConfigForTheme(themeDir);
} }
protected String getThemeDir(Portal portal) { protected String getThemeDir(Portal portal) {
return portal.getThemeDir().replaceAll("/$", ""); return portal.getThemeDir().replaceAll("/$", "");
} }
protected Configuration getConfigForTheme(String themeDir) { protected Configuration getConfigForTheme(String themeDir) {
@ -96,10 +95,10 @@ public class FreemarkerConfigurationLoader {
config.setTemplateUpdateDelay(0); // no template caching in development config.setTemplateUpdateDelay(0); // no template caching in development
} else { } else {
int delay = 60; int delay = 60;
log.debug("Setting Freemarker template cache update delay to " + delay + "."); log.debug("Setting Freemarker template cache update delay to " + delay + ".");
config.setTemplateUpdateDelay(delay); // in seconds; Freemarker default is 5 config.setTemplateUpdateDelay(delay); // in seconds; Freemarker default is 5
} }
// Specify how templates will see the data model. // Specify how templates will see the data model.
// The default wrapper exposes set methods unless exposure level is set. // The default wrapper exposes set methods unless exposure level is set.
// By default we want to block exposure of set methods. // By default we want to block exposure of set methods.
@ -126,15 +125,19 @@ public class FreemarkerConfigurationLoader {
log.error("Error setting value for url_escaping_charset."); log.error("Error setting value for url_escaping_charset.");
} }
config.setTemplateLoader(getTemplateLoader(config, themeDir)); // auto include setup.ftl which allows for globals to be easily defined in a template that's always included
// used primarily to setup ${bodyClasses} for now
config.addAutoInclude("pageSetup.ftl");
config.setTemplateLoader(getTemplateLoader(config, themeDir));
return config; return config;
} }
// Define template locations. Template loader will look first in the theme-specific // Define template locations. Template loader will look first in the theme-specific
// location, then in the vitro location. // location, then in the vitro location.
protected final TemplateLoader getTemplateLoader(Configuration config, String themeDir) { protected final TemplateLoader getTemplateLoader(Configuration config, String themeDir) {
List<TemplateLoader> loaders = new ArrayList<TemplateLoader>(); List<TemplateLoader> loaders = new ArrayList<TemplateLoader>();
MultiTemplateLoader mtl = null; MultiTemplateLoader mtl = null;
try { try {
@ -145,7 +148,7 @@ public class FreemarkerConfigurationLoader {
if (themeTemplateDir.exists()) { if (themeTemplateDir.exists()) {
FileTemplateLoader themeFtl = new FileTemplateLoader(themeTemplateDir); FileTemplateLoader themeFtl = new FileTemplateLoader(themeTemplateDir);
loaders.add(themeFtl); loaders.add(themeFtl);
} }
// Vitro template loader // Vitro template loader
String vitroTemplatePath = context.getRealPath("/templates/freemarker"); String vitroTemplatePath = context.getRealPath("/templates/freemarker");
@ -159,8 +162,6 @@ public class FreemarkerConfigurationLoader {
} catch (IOException e) { } catch (IOException e) {
log.error("Error creating template loaders"); log.error("Error creating template loaders");
} }
return mtl; return mtl;
} }
}
}

View file

@ -41,12 +41,10 @@ var browseClassGroups = {
$('ul#classes-in-classgroup li a').hover(function() { $('ul#classes-in-classgroup li a').hover(function() {
var classIndex = $('ul#classes-in-classgroup li a').index(this); var classIndex = $('ul#classes-in-classgroup li a').index(this);
$('#visual-graph svg path').eq(classIndex).attr('fill', '#ccc'); $('#visual-graph svg path').eq(classIndex).attr('fill', '#ccc');
$('#visual-graph svg text').eq(classIndex).toggle();
return false; return false;
}, function() { }, function() {
var classIndex = $('ul#classes-in-classgroup li a').index(this); var classIndex = $('ul#classes-in-classgroup li a').index(this);
$('#visual-graph svg path').eq(classIndex).attr('fill', '#999'); $('#visual-graph svg path').eq(classIndex).attr('fill', '#999');
$('#visual-graph svg text').eq(classIndex).toggle();
}) })
}, },
@ -93,8 +91,7 @@ var browseClassGroups = {
// Build the content of each list item, piecing together each component // Build the content of each list item, piecing together each component
listItem = '<li role="listitem">'; listItem = '<li role="listitem">';
listItem += '<a href="'+ indexUrl +'" title="Browse all '+ name +' content">'+ name; listItem += '<a href="'+ indexUrl +'" title="Browse all '+ name +' content">'+ name +'</a>';
listItem += ' <span>('+ indivCount +')</span>';
listItem += '</li>'; listItem += '</li>';
// Add the list item to the array of classes // Add the list item to the array of classes
@ -156,14 +153,6 @@ var graphClassGroups = {
var chart = r.g.hbarchart(0, 16, 300, height, [values], {type:"soft", singleColor:"#999"}); var chart = r.g.hbarchart(0, 16, 300, height, [values], {type:"soft", singleColor:"#999"});
// Add the class names as labels and then hide them
chart.label(labels, true);
// Getting a JS error in the console when trying to add the class
// "setting a property that has only a getter"
// $('svg text').addClass('hidden');
// so using .hide() instead
$('svg text').hide();
// Was unable to append <a> within <svg> -- was always hidden and couldn't get it to display // Was unable to append <a> within <svg> -- was always hidden and couldn't get it to display
// so using jQuery click to add links // so using jQuery click to add links
$('rect').click(function() { $('rect').click(function() {
@ -185,20 +174,17 @@ var graphClassGroups = {
// On hover // On hover
// 1. Change bar color // 1. Change bar color
// 2. Reveal label // 2. Highlight class name in main list
// 3. Highlight class name in main list
chart.hover(function() { chart.hover(function() {
this.bar.attr({fill: "#ccc"}); this.bar.attr({fill: "#ccc"});
$('rect').hover(function() { $('rect').hover(function() {
var index = $('rect').index(this); var index = $('rect').index(this);
$('svg text').eq(index).show();
$('#classes-in-classgroup li a').eq(index).addClass('selected'); $('#classes-in-classgroup li a').eq(index).addClass('selected');
}) })
}, function() { }, function() {
this.bar.attr({fill: "#999"}); this.bar.attr({fill: "#999"});
$('rect').hover(function() { $('rect').hover(function() {
var index = $('rect').index(this); var index = $('rect').index(this);
$('svg text').eq(index).hide();
$('#classes-in-classgroup li a').eq(index).removeClass('selected'); $('#classes-in-classgroup li a').eq(index).removeClass('selected');
}) })
}); });