Index: tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ShowPageProducer.java =================================================================== --- tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ShowPageProducer.java (révision 74891) +++ tool/src/java/org/sakaiproject/lessonbuildertool/tool/producers/ShowPageProducer.java (révision 74950) @@ -45,10 +45,15 @@ import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.File; +import java.io.IOException; import java.net.URL; import java.net.URLEncoder; +import java.net.HttpURLConnection; +import java.net.ProtocolException; import javax.servlet.http.HttpServletRequest; import org.apache.commons.logging.Log; @@ -73,6 +78,8 @@ import org.sakaiproject.event.api.UsageSession; import org.sakaiproject.event.cover.UsageSessionService; +import org.sakaiproject.util.ResourceLoader; + import uk.org.ponder.localeutil.LocaleGetter; import uk.org.ponder.messageutil.MessageLocator; import uk.org.ponder.rsf.components.UIBoundBoolean; @@ -988,7 +995,7 @@ if (itemList.size() == 0) { if (canEditPage) { UIOutput.make(tofill, "startupHelp"). - decorate(new UIFreeAttributeDecorator("src", "/sakai-lessonbuildertool-tool/" + messageLocator.getMessage("simplepage.startup_help"))). + decorate(new UIFreeAttributeDecorator("src", "/sakai-lessonbuildertool-tool/" + getLocalizedURL("templates/instructions/general.html"))). decorate(new UIFreeAttributeDecorator("id","iframe")); UIOutput.make(tofill, "iframeJavascript"); @@ -1591,4 +1598,59 @@ UIOutput.make(container, "status-td"); UIOutput.make(container, imageId).decorate(new UIFreeAttributeDecorator("src", imagePath)).decorate(new UIFreeAttributeDecorator("alt", imageAlt)).decorate(new UITooltipDecorator(imageAlt)); } + +private String getLocalizedURL(String defaultPath) { + + if ( defaultPath == null || defaultPath.trim().length()==0 ) + return defaultPath; + else + defaultPath = defaultPath.trim(); + + Locale locale = new ResourceLoader().getLocale(); + + int suffixIndex = defaultPath.lastIndexOf(".") >= 0 ? defaultPath.lastIndexOf(".") : defaultPath.length()-1; + String suffix = defaultPath.substring(suffixIndex); + String prefix = defaultPath.substring(0,suffixIndex); + + String [] localeDetails = locale.toString().split("_"); + int localeSize = localeDetails.length; + String filePath = null; + String localizedPath = null; + + if (localeSize > 2) { + localizedPath = prefix + "_" + locale.toString() + suffix; + filePath = myUrl()+"/sakai-lessonbuildertool-tool/"+localizedPath; + if ( UrlOk(filePath) ) return localizedPath; + } + + if (localeSize > 1) { + localizedPath = prefix + "_" + locale.getLanguage() + "_" + locale.getCountry() + suffix; + filePath = myUrl()+"/sakai-lessonbuildertool-tool/"+localizedPath; + if ( UrlOk(filePath) ) return localizedPath; + } + + if (localeSize > 0) { + localizedPath = prefix + "_" + locale.getLanguage() + suffix; + filePath = myUrl()+"/sakai-lessonbuildertool-tool/"+localizedPath; + if ( UrlOk(filePath) ) return localizedPath; + } + + return defaultPath; + } + +private boolean UrlOk(String url) { + try { + HttpURLConnection.setFollowRedirects(false); + HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection(); + con.setRequestMethod("HEAD"); + return (con.getResponseCode() == HttpURLConnection.HTTP_OK); + } catch (ProtocolException e) { + return false; + } catch (IOException e) { + return false; + } +} + + +} Index: tool/src/webapp/templates/instructions/general_en_US_DEBUG.html =================================================================== --- tool/src/webapp/templates/instructions/general_en_US_DEBUG.html (révision 0) +++ tool/src/webapp/templates/instructions/general_en_US_DEBUG.html (révision 74950) @@ -0,0 +1,24 @@ + + + + + + + + +

You are using the en_US_DEBUG locale. This file is 'lessonbuilder/tool/src/webapp/templates/instructions/general_en_US_DEBUG.html'. The File you have to translate is 'lessonbuilder/tool/src/webapp/templates/instructions/general.html'. You have to add your locale to the file name for your translation. If your locale was 'es_ES', the translated file name would be 'lessonbuilder/tool/src/webapp/templates/instructions/general_es_ES.html'.

+ +

Adding Multimedia Content

+

accessibility introduction

+

sequencing introduction

Index: tool/src/webapp/templates/instructions/sequencing_en_US_DEBUG.html =================================================================== --- tool/src/webapp/templates/instructions/sequencing_en_US_DEBUG.html (révision 0) +++ tool/src/webapp/templates/instructions/sequencing_en_US_DEBUG.html (révision 74950) @@ -0,0 +1,29 @@ + + + + + + + + + + +

+[ Back to main help screen] +

+ +

You are using the en_US_DEBUG locale. This file is 'lessonbuilder/tool/src/webapp/templates/instructions/accessibility_en_US_DEBUG.html'. The File you have to translate is 'lessonbuilder/tool/src/webapp/templates/instructions/accessibility.html'. You have to add your locale to the file name for your translation. If your locale was 'ca', the translated file name would be 'lessonbuilder/tool/src/webapp/templates/instructions/accessibility_ca.html'.

+ + + Index: tool/src/webapp/templates/instructions/accessibility_en_US_DEBUG.html =================================================================== --- tool/src/webapp/templates/instructions/accessibility_en_US_DEBUG.html (révision 0) +++ tool/src/webapp/templates/instructions/accessibility_en_US_DEBUG.html (révision 74950) @@ -0,0 +1,29 @@ + + + + + + + + + + +

+[ Back to main help screen]

+ +

You are using the en_US_DEBUG locale. This file is 'lessonbuilder/tool/src/webapp/templates/instructions/accessibility_en_US_DEBUG.html'. The File you have to translate is 'lessonbuilder/tool/src/webapp/templates/instructions/accessibility.html'. You have to add your locale to the file name for your translation. If your locale was 'ja_JP', the translated file name would be 'lessonbuilder/tool/src/webapp/templates/instructions/accessibility_ja_JP.html'.

+ + + Index: tool/src/webapp/templates/instructions/multimedia_en_US_DEBUG.html =================================================================== --- tool/src/webapp/templates/instructions/multimedia_en_US_DEBUG.html (révision 0) +++ tool/src/webapp/templates/instructions/multimedia_en_US_DEBUG.html (révision 74950) @@ -0,0 +1,28 @@ + + + + + + + + + + +

+[ Back to main help screen]

+ +

You are using the en_US_DEBUG locale. This file is 'lessonbuilder/tool/src/webapp/templates/instructions/multimedia_en_US_DEBUG.html'. The File you have to translate is 'lessonbuilder/tool/src/webapp/templates/instructions/multimedia.html'. You have to add your locale to the file name for your translation. If your locale was 'fr_FR', the translated file name would be 'lessonbuilder/tool/src/webapp/templates/instructions/multimedia_fr_FR.html'.

+ +