org.apache.wicket.markup.head.StringHeaderItem Java Examples

The following examples show how to use org.apache.wicket.markup.head.StringHeaderItem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {
	super.renderHead(response);
	
	// get the Sakai skin header fragment from the request attribute
	final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

	response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
	response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));

	// Tool additions (at end so we can override if required)
	response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));

	// render jQuery and the Wicket event library
	// Both must be priority so they are emitted into the head
	final String cdnQuery = PortalUtils.getCDNQuery();
	response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format(PortalUtils.getLatestJQueryPath()+ "?version=%s", cdnQuery))));
	response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/my-calendar/scripts/wicket/wicket-event-jquery.min.js?version=%s", cdnQuery))));

	// NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.
}
 
Example #2
Source File: AbstractMobilePage.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response)
{
  super.renderHead(response);
  response.render(JavaScriptReferenceHeaderItem.forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference()));
  response.render(StringHeaderItem.forString(WicketUtils.getCssForFavicon(getUrl("/favicon.ico"))));
  if (WebConfiguration.isDevelopmentMode() == true) {
    response.render(CssReferenceHeaderItem.forUrl("mobile/jquery.mobile-" + JQUERY_MOBILE_VERSION + "/jquery.mobile-" + JQUERY_MOBILE_VERSION + ".css"));
  } else {
    response.render(CssReferenceHeaderItem.forUrl("mobile/jquery.mobile-" + JQUERY_MOBILE_VERSION + "/jquery.mobile-" + JQUERY_MOBILE_VERSION + ".min.css"));
  }
  response.render(CssReferenceHeaderItem.forUrl("mobile/projectforge.css"));
  response.render(JavaScriptReferenceHeaderItem.forUrl("mobile/jquery.mobile-" + JQUERY_MOBILE_VERSION + "/myconfig.js"));
  if (WebConfiguration.isDevelopmentMode() == true) {
    // response.renderJavaScriptReference("mobile/jquery.mobile/myconfig.js");
    response.render(JavaScriptReferenceHeaderItem.forUrl("mobile/jquery.mobile-" + JQUERY_MOBILE_VERSION + "/jquery.mobile-" + JQUERY_MOBILE_VERSION + ".js"));
  } else {
    // response.renderJavaScriptReference("mobile/jquery.mobile/myconfig.js");
    response.render(JavaScriptReferenceHeaderItem.forUrl("mobile/jquery.mobile-" + JQUERY_MOBILE_VERSION + "/jquery.mobile-" + JQUERY_MOBILE_VERSION + ".min.js"));
  }
}
 
Example #3
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {
    super.renderHead(response);

    final String version = this.serverConfigurationService.getString("portal.cdn.version", "");

    // get the Sakai skin header fragment from the request attribute
    final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

    response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
    response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));

    // Tool additions (at end so we can override if required)
    response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));

    // render jQuery and the Wicket event library
    // Both must be priority so they are emitted into the head
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/library/webjars/jquery/1.12.4/jquery.min.js?version=%s", version))));
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/mycalendar/scripts/wicket/wicket-event-jquery.min.js?version=%s", version))));

    // additional styles (datepicker, this widget etc)
    response.render(CssHeaderItem.forUrl(String.format("/library/webjars/jquery-ui/1.12.1/jquery-ui.min.css?version=%s", version)));

    // NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.

}
 
Example #4
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {

    super.renderHead(response);

    final String version = this.serverConfigurationService.getString("portal.cdn.version", "");

    // get the Sakai skin header fragment from the request attribute
    final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

    response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
    response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));

    // Tool additions (at end so we can override if required)
    response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));

    // render jQuery and the Wicket event library
    // Both must be priority so they are emitted into the head
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/library/webjars/jquery/1.12.4/jquery.min.js?version=%s", version))));
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/site-description/scripts/wicket/wicket-event-jquery.min.js?version=%s", version))));

    // NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.
}
 
Example #5
Source File: BasePage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {

	// get the Sakai skin header fragment from the request attribute
	final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

	final String sakaiHtmlHead = (String) request.getAttribute("sakai.html.head");
	if (StringUtils.isNotBlank(sakaiHtmlHead)) {
		response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
	}
	response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));

	String version = PortalUtils.getCDNQuery();

	// Tool additions (at end so we can override if required)
	response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));
	response.render(CssHeaderItem.forUrl(String.format("/profile2-tool/css/profile2.css%s", version)));
	response.render(JavaScriptHeaderItem.forUrl(String.format("/profile2-tool/javascript/profile2.js%s", version)));

}
 
Example #6
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {
    super.renderHead(response);

    // get the Sakai skin header fragment from the request attribute
    final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

    response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
    response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));

    // Tool additions (at end so we can override if required)
    response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));

    // render jQuery and the Wicket event library
    // Both must be priority so they are emitted into the head
    final String cdnQuery = PortalUtils.getCDNQuery();
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format(PortalUtils.getLatestJQueryPath()+ "?version=%s", cdnQuery))));
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/my-calendar/scripts/wicket/wicket-event-jquery.min.js?version=%s", cdnQuery))));

    // NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.
}
 
Example #7
Source File: BasePage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * This block adds the required wrapper markup to style it like a Sakai tool. 
 * Add to this any additional CSS or JS references that you need.
 * 
 */
public void renderHead(IHeaderResponse response) {
	
	
	//get Sakai skin
	String skinRepo = sakaiProxy.getSkinRepoProperty();
	String toolCSS = sakaiProxy.getToolSkinCSS(skinRepo);
	String toolBaseCSS = skinRepo + "/tool_base.css";
	
	//Sakai additions				
	response.render(JavaScriptReferenceHeaderItem.forUrl("/library/js/headscripts.js"));
	response.render(CssReferenceHeaderItem.forUrl(toolBaseCSS));
	response.render(CssReferenceHeaderItem.forUrl(toolCSS));
	response.render (OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));
	response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));					
	
}
 
Example #8
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {
	super.renderHead(response);
	
	// get the Sakai skin header fragment from the request attribute
	final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

	response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
	response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));

	// Tool additions (at end so we can override if required)
	response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));

	// render jQuery and the Wicket event library
	// Both must be priority so they are emitted into the head
	final String cdnQuery = PortalUtils.getCDNQuery();
	response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format(PortalUtils.getLatestJQueryPath()+ "?version=%s", cdnQuery))));
	response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/my-calendar/scripts/wicket/wicket-event-jquery.min.js?version=%s", cdnQuery))));

	// NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.
}
 
Example #9
Source File: AbstractBasePage.java    From AppStash with Apache License 2.0 6 votes vote down vote up
@Override
public void renderHead(IHeaderResponse response) {
    super.renderHead(response);

    String contextPath = RequestCycle.get().getRequest().getContextPath();

    Map<String, String> replacements = Collections.singletonMap("contextPath", getContextPath());
    MapVariableInterpolator variableInterpolator = new MapVariableInterpolator(FAVICON_HEADER, replacements);
    response.render(StringHeaderItem.forString(variableInterpolator.toString()));

    String designUrl = String.format("/assets/css/bootstrap-%s.min.css", designSelector.getDesignType());
    response.render(CssHeaderItem.forUrl(contextPath + designUrl));
    response.render(CssHeaderItem.forUrl(contextPath + "/assets/css/bootstrap-theme-shop.css"));

    response.render(JavaScriptHeaderItem.forUrl(contextPath + "/assets/js/bootstrap.min.js"));
    response.render(CssHeaderItem.forUrl(contextPath + "/assets/css/bootstrap-addon.css"));
}
 
Example #10
Source File: AbstractBasePage.java    From the-app with Apache License 2.0 6 votes vote down vote up
@Override
public void renderHead(IHeaderResponse response) {
    super.renderHead(response);

    String contextPath = RequestCycle.get().getRequest().getContextPath();

    Map<String, String> replacements = Collections.singletonMap("contextPath", getContextPath());
    MapVariableInterpolator variableInterpolator = new MapVariableInterpolator(FAVICON_HEADER, replacements);
    response.render(StringHeaderItem.forString(variableInterpolator.toString()));

    String designUrl = String.format("/assets/css/bootstrap-%s.min.css", designSelector.getDesignType());
    response.render(CssHeaderItem.forUrl(contextPath + designUrl));
    response.render(CssHeaderItem.forUrl(contextPath + "/assets/css/bootstrap-theme-shop.css"));

    response.render(JavaScriptHeaderItem.forUrl(contextPath + "/assets/js/bootstrap.min.js"));
    response.render(CssHeaderItem.forUrl(contextPath + "/assets/css/bootstrap-addon.css"));
}
 
Example #11
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {
    super.renderHead(response);

    final String version = this.serverConfigurationService.getString("portal.cdn.version", "");

    // get the Sakai skin header fragment from the request attribute
    final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

    response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
    response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));

    // Tool additions (at end so we can override if required)
    response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));

    // render jQuery and the Wicket event library
    // Both must be priority so they are emitted into the head
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/library/webjars/jquery/1.12.4/jquery.min.js?version=%s", version))));
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/mycalendar/scripts/wicket/wicket-event-jquery.min.js?version=%s", version))));

    // additional styles (datepicker, this widget etc)
    response.render(CssHeaderItem.forUrl(String.format("/library/webjars/jquery-ui/1.12.1/jquery-ui.min.css?version=%s", version)));

    // NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.

}
 
Example #12
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {

    super.renderHead(response);

    final String version = this.serverConfigurationService.getString("portal.cdn.version", "");

    // get the Sakai skin header fragment from the request attribute
    final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

    response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
    response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));

    // Tool additions (at end so we can override if required)
    response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));

    // render jQuery and the Wicket event library
    // Both must be priority so they are emitted into the head
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/library/webjars/jquery/1.12.4/jquery.min.js?version=%s", version))));
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/site-description/scripts/wicket/wicket-event-jquery.min.js?version=%s", version))));

    // NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.
}
 
Example #13
Source File: BasePage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {

	// get the Sakai skin header fragment from the request attribute
	final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

	final String sakaiHtmlHead = (String) request.getAttribute("sakai.html.head");
	if (StringUtils.isNotBlank(sakaiHtmlHead)) {
		response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
	}
	response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));

	String version = PortalUtils.getCDNQuery();

	// Tool additions (at end so we can override if required)
	response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));
	response.render(CssHeaderItem.forUrl(String.format("/profile2-tool/css/profile2.css%s", version)));
	response.render(JavaScriptHeaderItem.forUrl(String.format("/profile2-tool/javascript/profile2.js%s", version)));

}
 
Example #14
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response) {
    super.renderHead(response);

    // get the Sakai skin header fragment from the request attribute
    final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

    response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
    response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));

    // Tool additions (at end so we can override if required)
    response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));

    // render jQuery and the Wicket event library
    // Both must be priority so they are emitted into the head
    final String cdnQuery = PortalUtils.getCDNQuery();
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format(PortalUtils.getLatestJQueryPath()+ "?version=%s", cdnQuery))));
    response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forUrl(String.format("/my-calendar/scripts/wicket/wicket-event-jquery.min.js?version=%s", cdnQuery))));

    // NOTE: All libraries apart from jQuery and Wicket Event must be rendered inline with the application. See WidgetPage.html.
}
 
Example #15
Source File: BasePage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * This block adds the required wrapper markup to style it like a Sakai tool. 
 * Add to this any additional CSS or JS references that you need.
 * 
 */
public void renderHead(IHeaderResponse response) {
	
	
	//get Sakai skin
	String skinRepo = sakaiProxy.getSkinRepoProperty();
	String toolCSS = sakaiProxy.getToolSkinCSS(skinRepo);
	String toolBaseCSS = skinRepo + "/tool_base.css";
	
	//Sakai additions				
	response.render(JavaScriptReferenceHeaderItem.forUrl("/library/js/headscripts.js"));
	response.render(CssReferenceHeaderItem.forUrl(toolBaseCSS));
	response.render(CssReferenceHeaderItem.forUrl(toolCSS));
	response.render (OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));
	response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));					
	
}
 
Example #16
Source File: MyStatusPanel.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void renderHead(Component component, IHeaderResponse response) {
 	response.render(StringHeaderItem.forString("<script type=\"text/javascript\">" +
	"$(document).ready( function(){" +
	"autoFill('#" + component.getMarkupId() + "', '" + defaultStatus + "');" +
	"countChars('#" + component.getMarkupId() + "');" +
	"});" +
"</script>"));
 }
 
Example #17
Source File: AbstractUnsecureBasePage.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void renderHead(final IHeaderResponse response)
{
  super.renderHead(response);
  response.render(StringHeaderItem.forString(WicketUtils.getCssForFavicon(getUrl("/favicon.ico"))));
  WicketRenderHeadUtils.renderMainCSSIncludes(response);
  WicketRenderHeadUtils.renderMainJavaScriptIncludes(response);
  initializeContextMenu(response);
}
 
Example #18
Source File: GradeSummaryTablePanel.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void renderHead(final IHeaderResponse response) {

		final String version = PortalUtils.getCDNQuery();
		response.render(StringHeaderItem.forString(
			"<script src=\"/webcomponents/rubrics/sakai-rubrics-utils.js" + version + "\"></script>"));
		response.render(StringHeaderItem.forString(
			"<script type=\"module\" src=\"/webcomponents/rubrics/rubric-association-requirements.js" + version + "\"></script>"));
	}
 
Example #19
Source File: RubricGradePanel.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void renderHead(final IHeaderResponse response) {

		final String version = PortalUtils.getCDNQuery();
		response.render(StringHeaderItem.forString(
			"<script src=\"/webcomponents/rubrics/sakai-rubrics-utils.js" + version + "\"></script>"));
		response.render(StringHeaderItem.forString(
			"<script type=\"module\" src=\"/webcomponents/rubrics/rubric-association-requirements.js" + version + "\"></script>"));
    }
 
Example #20
Source File: AddOrEditGradeItemPanelContent.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void renderHead(final IHeaderResponse response) {

		final String version = PortalUtils.getCDNQuery();
		response.render(StringHeaderItem.forString(
			"<script src=\"/webcomponents/rubrics/sakai-rubrics-utils.js" + version + "\"></script>"));
		response.render(StringHeaderItem.forString(
			"<script type=\"module\" src=\"/webcomponents/rubrics/rubric-association-requirements.js" + version + "\"></script>"));
	}
 
Example #21
Source File: BasePage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * This block adds the required wrapper markup to style it like a Sakai tool. Add to this any additional CSS or JS references that you
 * need.
 *
 */
@Override
public void renderHead(final IHeaderResponse response) {
	super.renderHead(response);

	final String version = PortalUtils.getCDNQuery();

	// get the Sakai skin header fragment from the request attribute
	final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

	response.render(new PriorityHeaderItem(JavaScriptHeaderItem
			.forReference(getApplication().getJavaScriptLibrarySettings().getJQueryReference())));

	response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
	response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));

	// Tool additions (at end so we can override if required)
	response.render(StringHeaderItem
			.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));

	// Shared JavaScript and stylesheets
	// Force Wicket to use Sakai's version of jQuery
	response.render(
			new PriorityHeaderItem(
					JavaScriptHeaderItem
							.forUrl(String.format("/library/webjars/jquery/1.12.4/jquery.min.js%s", version))));
	// And pair this instance of jQuery with a Bootstrap version we've tested with
	response.render(
			new PriorityHeaderItem(
					JavaScriptHeaderItem
							.forUrl(String.format("/library/webjars/bootstrap/3.3.7/js/bootstrap.min.js%s", version))));
	// Some global gradebookng styles
	response.render(CssHeaderItem
			.forUrl(String.format("/gradebookng-tool/styles/gradebook-shared.css%s", version)));

}
 
Example #22
Source File: BasePage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void renderHead(IHeaderResponse response) {
	
	//get the Sakai skin header fragment from the request attribute
	HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();
	response.render(StringHeaderItem.forString(request.getAttribute("sakai.html.head").toString()));
	response.render(JavaScriptHeaderItem.forUrl(COMMONSCRIPT));

}
 
Example #23
Source File: BasePage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * This block adds the required wrapper markup to style it like a Sakai tool. 
 * Add to this any additional CSS or JS references that you need.
 * 
 */
public void renderHead(IHeaderResponse response) {


	//get Sakai skin
	String skinRepo = sakaiProxy.getSkinRepoProperty();
	String toolCSS = sakaiProxy.getToolSkinCSS(skinRepo);
	String toolBaseCSS = skinRepo + "/tool_base.css";

	//Sakai additions
	response.render(JavaScriptHeaderItem.forUrl("/library/js/headscripts.js"));
	response.render(CssHeaderItem.forUrl(toolBaseCSS));
	response.render(CssHeaderItem.forUrl(toolCSS));
	response.render(OnDomReadyHeaderItem.forScript("setMainFrameHeight( window.name )"));

	StringBuilder headJs = new StringBuilder();
	headJs.append("var sakai = sakai || {}; sakai.editor = sakai.editor || {}; " +
	"sakai.editor.editors = sakai.editor.editors || {}; " +
	"sakai.editor.editors.ckeditor = sakai.editor.editors.ckeditor || {}; " +
	"sakai.locale = sakai.locale || {};\n");
	headJs.append("sakai.locale.userCountry = '" + rloader.getLocale().getCountry() + "';\n");
	headJs.append("sakai.locale.userLanguage = '" + rloader.getLocale().getLanguage() + "';\n");
	headJs.append("sakai.locale.userLocale = '" + rloader.getLocale().toString() + "';\n");
	response.render(JavaScriptHeaderItem.forScript(headJs, null));

	//Tool additions (at end so we can override if required)
	response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));
	//response.renderCSSReference("css/my_tool_styles.css");
	//response.renderJavascriptReference("js/my_tool_javascript.js");

	//for jQuery
	response.render(JavaScriptHeaderItem.forUrl("/library/webjars/jquery/1.12.4/jquery.min.js"));
	response.render(JavaScriptHeaderItem.forUrl("/library/webjars/jquery-ui/1.12.1/jquery-ui.min.js"));

	//for datepicker
	response.render(CssHeaderItem.forUrl("/library/webjars/jquery-ui/1.12.1/jquery-ui.css"));
	response.render(JavaScriptHeaderItem.forUrl("javascript/jquery.asmselect.js"));
	response.render(CssHeaderItem.forUrl("css/jquery.asmselect.css"));
	response.render(JavaScriptHeaderItem.forUrl("/library/js/lang-datepicker/lang-datepicker.js"));
}
 
Example #24
Source File: BasePage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void renderHead(IHeaderResponse response) {
	
	//get the Sakai skin header fragment from the request attribute
	HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();
	response.render(StringHeaderItem.forString(request.getAttribute("sakai.html.head").toString()));
	response.render(JavaScriptHeaderItem.forUrl(COMMONSCRIPT));

}
 
Example #25
Source File: MyStatusPanel.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void renderHead(Component component, IHeaderResponse response) {
 	response.render(StringHeaderItem.forString("<script type=\"text/javascript\">" +
	"$(document).ready( function(){" +
	"autoFill('#" + component.getMarkupId() + "', '" + defaultStatus + "');" +
	"countChars('#" + component.getMarkupId() + "');" +
	"});" +
"</script>"));
 }
 
Example #26
Source File: BasePage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * This block adds the required wrapper markup to style it like a Sakai tool. 
 * Add to this any additional CSS or JS references that you need.
 * 
 */
public void renderHead(IHeaderResponse response) {


	//get Sakai skin
	String skinRepo = sakaiProxy.getSkinRepoProperty();
	String toolCSS = sakaiProxy.getToolSkinCSS(skinRepo);
	String toolBaseCSS = skinRepo + "/tool_base.css";

	//Sakai additions
	response.render(JavaScriptHeaderItem.forUrl("/library/js/headscripts.js"));
	response.render(CssHeaderItem.forUrl(toolBaseCSS));
	response.render(CssHeaderItem.forUrl(toolCSS));
	response.render(OnDomReadyHeaderItem.forScript("setMainFrameHeight( window.name )"));

	StringBuilder headJs = new StringBuilder();
	headJs.append("var sakai = sakai || {}; sakai.editor = sakai.editor || {}; " +
	"sakai.editor.editors = sakai.editor.editors || {}; " +
	"sakai.editor.editors.ckeditor = sakai.editor.editors.ckeditor || {}; " +
	"sakai.locale = sakai.locale || {};\n");
	headJs.append("sakai.locale.userCountry = '" + rloader.getLocale().getCountry() + "';\n");
	headJs.append("sakai.locale.userLanguage = '" + rloader.getLocale().getLanguage() + "';\n");
	headJs.append("sakai.locale.userLocale = '" + rloader.getLocale().toString() + "';\n");
	response.render(JavaScriptHeaderItem.forScript(headJs, null));

	//Tool additions (at end so we can override if required)
	response.render(StringHeaderItem.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));
	//response.renderCSSReference("css/my_tool_styles.css");
	//response.renderJavascriptReference("js/my_tool_javascript.js");

	//for jQuery
	response.render(JavaScriptHeaderItem.forUrl("/library/webjars/jquery/1.12.4/jquery.min.js"));
	response.render(JavaScriptHeaderItem.forUrl("/library/webjars/jquery-ui/1.12.1/jquery-ui.min.js"));

	//for datepicker
	response.render(CssHeaderItem.forUrl("/library/webjars/jquery-ui/1.12.1/jquery-ui.css"));
	response.render(JavaScriptHeaderItem.forUrl("javascript/jquery.asmselect.js"));
	response.render(CssHeaderItem.forUrl("css/jquery.asmselect.css"));
	response.render(JavaScriptHeaderItem.forUrl("/library/js/lang-datepicker/lang-datepicker.js"));
}
 
Example #27
Source File: GradeSummaryTablePanel.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void renderHead(final IHeaderResponse response) {

		final String version = PortalUtils.getCDNQuery();
		response.render(StringHeaderItem.forString(
			"<script src=\"/webcomponents/rubrics/sakai-rubrics-utils.js" + version + "\"></script>"));
		response.render(StringHeaderItem.forString(
			"<script type=\"module\" src=\"/webcomponents/rubrics/rubric-association-requirements.js" + version + "\"></script>"));
	}
 
Example #28
Source File: RubricGradePanel.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void renderHead(final IHeaderResponse response) {

		final String version = PortalUtils.getCDNQuery();
		response.render(StringHeaderItem.forString(
			"<script src=\"/webcomponents/rubrics/sakai-rubrics-utils.js" + version + "\"></script>"));
		response.render(StringHeaderItem.forString(
			"<script type=\"module\" src=\"/webcomponents/rubrics/rubric-association-requirements.js" + version + "\"></script>"));
    }
 
Example #29
Source File: AddOrEditGradeItemPanelContent.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void renderHead(final IHeaderResponse response) {

		final String version = PortalUtils.getCDNQuery();
		response.render(StringHeaderItem.forString(
			"<script src=\"/webcomponents/rubrics/sakai-rubrics-utils.js" + version + "\"></script>"));
		response.render(StringHeaderItem.forString(
			"<script type=\"module\" src=\"/webcomponents/rubrics/rubric-association-requirements.js" + version + "\"></script>"));
	}
 
Example #30
Source File: BasePage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * This block adds the required wrapper markup to style it like a Sakai tool. Add to this any additional CSS or JS references that you
 * need.
 *
 */
@Override
public void renderHead(final IHeaderResponse response) {
	super.renderHead(response);

	final String version = PortalUtils.getCDNQuery();

	// get the Sakai skin header fragment from the request attribute
	final HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();

	response.render(new PriorityHeaderItem(JavaScriptHeaderItem
			.forReference(getApplication().getJavaScriptLibrarySettings().getJQueryReference())));

	response.render(StringHeaderItem.forString((String) request.getAttribute("sakai.html.head")));
	response.render(OnLoadHeaderItem.forScript("setMainFrameHeight( window.name )"));

	// Tool additions (at end so we can override if required)
	response.render(StringHeaderItem
			.forString("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"));

	// Shared JavaScript and stylesheets
	// Force Wicket to use Sakai's version of jQuery
	response.render(
			new PriorityHeaderItem(
					JavaScriptHeaderItem
							.forUrl(String.format("/library/webjars/jquery/1.12.4/jquery.min.js%s", version))));
	// And pair this instance of jQuery with a Bootstrap version we've tested with
	response.render(
			new PriorityHeaderItem(
					JavaScriptHeaderItem
							.forUrl(String.format("/library/webjars/bootstrap/3.3.7/js/bootstrap.min.js%s", version))));
	// Some global gradebookng styles
	response.render(CssHeaderItem
			.forUrl(String.format("/gradebookng-tool/styles/gradebook-shared.css%s", version)));

}