Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
skin in DATA/HTDOCS (works after upgrade, works when only DATA is writable). preference of skinfiles: -style.css will be overwritten on every new SVN, if "DATA/SKINS/"+currentSkin+".css" exists. -DATA/SKINS will be overwritten with defaultskins from /skins so develop your skins in DATA/SKINS, and put them into skins for distribution.
allod2f34a2e9453
diff --git a/htroot/ConfigSkins_p.java b/htroot/ConfigSkins_p.javaindex 0cfdfdbf5..7d15c8e4f 100644--- a/htroot/ConfigSkins_p.java+++ b/htroot/ConfigSkins_p.java@@ -76,22 +76,23 @@ public class ConfigSkins_p {}}- private static boolean changeSkin(serverSwitch env, String skinPath, String skin){- File styleFile = new File(env.getRootPath(), "htroot/env/style.css");+ private static boolean changeSkin(plasmaSwitchboard sb, String skinPath, String skin){+ File htdocsDir = new File(sb.getRootPath(), sb.getConfig("htDocsPath", "DATA/HTDOCS")+"/env");+ File styleFile = new File(htdocsDir, "style.css");File skinFile = new File(skinPath, skin);+ styleFile.getParentFile().mkdirs();if(copyFile(skinFile, styleFile)){- env.setConfig("currentSkin", skin.substring(0,skin.length()-4));+ sb.setConfig("currentSkin", skin.substring(0,skin.length()-4));return true;}return false;}public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {- //listManager.switchboard = (plasmaSwitchboard) env;serverObjects prop = new serverObjects();plasmaSwitchboard switchboard = (plasmaSwitchboard) env;- String skinPath = new File(env.getRootPath(), env.getConfig("skinPath", "DATA/SKINS")).toString();+ String skinPath = new File(env.getRootPath(), env.getConfig("skinsPath", "DATA/SKINS")).toString();//Fallbackprop.put("currentskin", "");@@ -112,7 +113,7 @@ public class ConfigSkins_p {if (post != null){//change skinif(post.containsKey("use_button")){- changeSkin(env, skinPath, (String)post.get("skin"));+ changeSkin(switchboard, skinPath, (String)post.get("skin"));//delete skin}else if(post.containsKey("delete")){@@ -144,7 +145,7 @@ public class ConfigSkins_p {return prop;}if(post.containsKey("use_skin") && ((String)post.get("use_skin")).equals("on")){- changeSkin(env, skinPath, url.substring(url.lastIndexOf("/"), url.length()));+ changeSkin(switchboard, skinPath, url.substring(url.lastIndexOf("/"), url.length()));}}}diff --git a/htroot/env/style.css b/skins/default.csssimilarity index 100%rename from htroot/env/style.cssrename to skins/default.cssdiff --git a/source/migration.java b/source/migration.javaindex 0ce4c98ae..11bf707d6 100644--- a/source/migration.java+++ b/source/migration.java@@ -65,9 +65,35 @@ public class migration {migrateBookmarkTagsDB(sb);}serverLog.logInfo("MIGRATION", "Migrating from "+String.valueOf(fromRev)+ " to "+String.valueOf(toRev));+ installSkin(sb);migrate(sb);}}+ public static void installSkin(plasmaSwitchboard sb){+ String skin=sb.getConfig("currentSkin", "default");+ if(skin.equals("")){+ skin="default";+ }+ File skinsDir=new File(sb.getRootPath(), sb.getConfig("skinsPath", "DATA/SKINS"));+ File skinFile=new File(skinsDir, skin+".css");+ File htdocsPath=new File(sb.getRootPath(), sb.getConfig("htdocsPath", "DATA/HTDOCS")+"/env");+ File styleFile=new File(htdocsPath, "style.css");+ if(!skinFile.exists()){+ if(styleFile.exists()){+ serverLog.logInfo("MIGRATION", "Skin "+skin+" not found. Keeping old skin.");+ }else{+ serverLog.logSevere("MIGRATION", "Skin "+skin+" and no existing Skin found.");+ }+ }else{+ try {+ styleFile.getParentFile().mkdirs();+ serverFileUtils.copy(skinFile, styleFile);+ serverLog.logInfo("MIGRATION", "copied new Skinfile");+ } catch (IOException e) {+ serverLog.logSevere("MIGRATION", "Cannot copy skinfile.");+ }+ }+ }public static void migrateBookmarkTagsDB(plasmaSwitchboard sb){sb.bookmarksDB.close();File tagsDBFile=new File(sb.workPath, "bookmarkTags.db");