Merge r7497 from nihvivo-rel-1.2-maint

This commit is contained in:
rjy7 2011-02-21 18:13:26 +00:00
parent 198c8293ce
commit fe3bd563bc
3 changed files with 7 additions and 22 deletions

View file

@ -408,9 +408,6 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
// Let the page template know which page it's processing. // Let the page template know which page it's processing.
map.put("currentServlet", normalizeServletName(vreq.getServletPath().replaceFirst("/", ""))); map.put("currentServlet", normalizeServletName(vreq.getServletPath().replaceFirst("/", "")));
// Allow template to send domain name to JavaScript (needed for AJAX calls)
map.put("requestedPage", vreq.getRequestURL().toString());
// In template: ${now?date}, ${now?datetime}, ${now?time} // In template: ${now?date}, ${now?datetime}, ${now?time}
map.put("now", new Date()); map.put("now", new Date());

View file

@ -63,18 +63,11 @@ ${stylesheets.add("/css/browseClassGroups.css")}
</section> <!-- #browse-classes --> </section> <!-- #browse-classes -->
</section> <!-- #browse --> </section> <!-- #browse -->
<#---------------------------------------------------------------------------------- <#-- For v1.3: The controller should pass in the dataservice url. -->
requestedPage is currently provided by FreemarkerHttpServlet. Should this be moved
to PageController? Maybe we should have Java provide the domain name directly
instead of the full URL of the requested page? Chintan was also asking for a
template variable with the domain name for an AJAX request with visualizations.
------------------------------------------------------------------------------------>
<#assign domainName = requestedPage?substring(0, requestedPage?index_of("/", 7)) />
<script type="text/javascript"> <script type="text/javascript">
var browseData = { var browseData = {
baseUrl: '${domainName + urls.base}', baseUrl: '${urls.base}',
dataServiceUrl: '${domainName + urls.base}/dataservice?getVClassesForVClassGroup=1&classgroupUri=', dataServiceUrl: '${urls.base}/dataservice?getVClassesForVClassGroup=1&classgroupUri=',
defaultBrowseClassGroupUri: '${firstPopulatedClassGroup.uri!}', defaultBrowseClassGroupUri: '${firstPopulatedClassGroup.uri!}',
defaultBrowseClassGroupCount: '${firstPopulatedClassGroup.individualCount!}' defaultBrowseClassGroupCount: '${firstPopulatedClassGroup.individualCount!}'
}; };

View file

@ -2,13 +2,7 @@
<#-- Template to setup and call scripts for menupages --> <#-- Template to setup and call scripts for menupages -->
<#----------------------------------------------------------------------------------
requestedPage is currently provided by FreemarkerHttpServlet. Should this be moved
to PageController? Maybe we should have Java provide the domain name directly
instead of the full URL of the requested page? Chintan was also asking for a
template variable with the domain name for an AJAX request with visualizations.
------------------------------------------------------------------------------------>
<#assign domainName = requestedPage?substring(0, requestedPage?index_of("/", 7)) />
<#list vClassGroup as vClass> <#list vClassGroup as vClass>
<#if (vClass.entityCount > 0)> <#if (vClass.entityCount > 0)>
@ -21,10 +15,11 @@ template variable with the domain name for an AJAX request with visualizations.
</#if> </#if>
</#list> </#list>
<#-- For v1.3: The controller should pass in the dataservice url. -->
<script type="text/javascript"> <script type="text/javascript">
var menupageData = { var menupageData = {
baseUrl: '${domainName + urls.base}', baseUrl: '${urls.base}',
dataServiceUrl: '${domainName + urls.base}/dataservice?getLuceneIndividualsByVClass=1&vclassId=', dataServiceUrl: '${urls.base}/dataservice?getLuceneIndividualsByVClass=1&vclassId=',
defaultBrowseVClassUri: '${firstNonEmptyVClass}' defaultBrowseVClassUri: '${firstNonEmptyVClass}'
}; };
</script> </script>