+
+ private static synchronized List<String> getThemeFiles(Env env, String theme) {
+ if(themes==null) {
+ themes = new TreeMap<>();
+ File themeD = new File("theme");
+ if(themeD.exists() && themeD.isDirectory()) {
+ for (File t : themeD.listFiles()) {
+ if(t.isDirectory()) {
+ List<String> la = new ArrayList<>();
+ for(File f : t.listFiles()) {
+ if(f.isFile()) {
+ if(f.getName().endsWith(".props")) {
+ Properties props;
+ if(themeProps == null) {
+ themeProps = new TreeMap<>();
+ props = null;
+ } else {
+ props = themeProps.get(t.getName());
+ }
+ if(props==null) {
+ props = new Properties();
+ themeProps.put(t.getName(), props);
+ }
+
+ try {
+ FileInputStream fis = new FileInputStream(f);
+ try {
+ props.load(fis);
+ } finally {
+ fis.close();
+ }
+ } catch (IOException e) {
+ env.error().log(e);
+ }
+ } else {
+ la.add(f.getName());
+ }
+ }
+ }
+ themes.put(t.getName(),la);
+ }
+ }
+ }
+ }
+ return themes.get(theme);
+ }
+
+ protected Imports getImports(Env env, String theme, int backdots, BROWSER browser) {
+ List<String> ls = getThemeFiles(env,theme);
+ Imports imp = new Imports(backdots);
+ String prefix = "theme/" + theme + '/';
+ for(String f : ls) {
+ if(f.endsWith(".js")) {
+ imp.js(prefix + f);
+ } else if(f.endsWith(".css")) {
+ if(f.endsWith("iPhone.css")) {
+ if(BROWSER.IPHONE.equals(browser)) {
+ imp.css(prefix + f);
+ }
+ } else if (f.endsWith("Desktop.css")){
+ if(!BROWSER.IPHONE.equals(browser)) {
+ imp.css(prefix + f);
+ }
+ // Make Console specific to Console page
+ } else if (!"console.js".equals(f)) {
+ imp.css(prefix + f);
+ }
+ }
+ }
+ return imp;
+ }
+