} else {
template = "-" + template;
}
final ISolutionRepository repository = PentahoSystem.get(ISolutionRepository.class, userSession);
final ActionResource resource;
String fullTemplatePath = null;
if (templateName != null) {
if (templateName.startsWith("/") || templateName.startsWith("\\")) { //$NON-NLS-1$ //$NON-NLS-2$
fullTemplatePath = templateName;
} else {
fullTemplatePath = ActionInfo.buildSolutionPath(solution, path, templateName);
}
}
if (fullTemplatePath != null && repository.resourceExists(fullTemplatePath)) {
resource = new ActionResource("", IActionSequenceResource.SOLUTION_FILE_RESOURCE, "text/xml", //$NON-NLS-1$ //$NON-NLS-2$
fullTemplatePath);
} else {
resource = new ActionResource("", IActionSequenceResource.SOLUTION_FILE_RESOURCE, "text/xml", //$NON-NLS-1$ //$NON-NLS-2$
"system/" + PLUGIN_NAME + "/default-dashboard-template.html"); //$NON-NLS-1$ //$NON-NLS-2$
}
// Check for access permissions
if (repository.getSolutionFile(resource, ISolutionRepository.ACTION_EXECUTE) == null) {
out.write("Access Denied".getBytes(ENCODING));
return;
}
String intro = ""; //$NON-NLS-1$
String footer = ""; //$NON-NLS-1$
final String dashboardTemplate = "template-dashboard" + template + ".html"; //$NON-NLS-1$
final IUITemplater templater = PentahoSystem.get(IUITemplater.class, userSession);
ArrayList<String> i18nTagsList = new ArrayList<String>();
if (templater != null) {
String solutionPath = "system/" + PLUGIN_NAME + "/" + dashboardTemplate;
if(!repository.resourceExists(solutionPath))
{//then try in solution
solutionPath = SOLUTION_DIR + "/templates/" + dashboardTemplate;
}
final ActionResource templateResource = new ActionResource("", IActionSequenceResource.SOLUTION_FILE_RESOURCE, "text/xml", solutionPath); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String templateContent = repository.getResourceAsString(templateResource, ISolutionRepository.ACTION_EXECUTE);
// Process i18n on dashboard outer template
templateContent = updateUserLanguageKey(templateContent);
templateContent = processi18nTags(templateContent, i18nTagsList);
// Process i18n on dashboard outer template - end