diff --git a/pom.xml b/pom.xml
index ab3e9243a..479cae69f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
redcomet
knowledge
war
- 0.2.1
+ 0.2.2
webapp for knowledge
https://support-project.org/
diff --git a/src/main/java/redcomet/knowledge/deploy/InitializationListener.java b/src/main/java/redcomet/knowledge/deploy/InitializationListener.java
index 4fa171d18..2bab3b2f8 100644
--- a/src/main/java/redcomet/knowledge/deploy/InitializationListener.java
+++ b/src/main/java/redcomet/knowledge/deploy/InitializationListener.java
@@ -1,13 +1,16 @@
package redcomet.knowledge.deploy;
+import java.io.File;
import java.util.TimeZone;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
+import redcomet.common.config.ConfigLoader;
import redcomet.common.exception.SystemException;
import redcomet.common.log.Log;
import redcomet.common.log.LogFactory;
+import redcomet.knowledge.config.AppConfig;
import redcomet.ormapping.connection.ConnectionManager;
public class InitializationListener implements ServletContextListener {
@@ -35,7 +38,20 @@ public void contextInitialized(ServletContextEvent contextEvent) {
TimeZone zone = TimeZone.getTimeZone("GMT");
TimeZone.setDefault(zone);
-
+ // 添付ファイル格納ディレクトリ(テンポラリディレクトリ)が存在しなければ生成
+ AppConfig appConfig = ConfigLoader.load(AppConfig.APP_CONFIG, AppConfig.class);
+ String tmpDir = appConfig.getTmpPath();
+ File tmp = new File(tmpDir);
+ if (!tmp.exists()) {
+ tmp.mkdirs();
+ LOG.info("tmp directory created." + tmpDir);
+ }
+ String idxDir = appConfig.getIndexPath();
+ File idx = new File(idxDir);
+ if (!idx.exists()) {
+ idx.mkdirs();
+ LOG.info("idx directory created." + idxDir);
+ }
}
}
diff --git a/src/main/webapp/js/knowledge-edit.js b/src/main/webapp/js/knowledge-edit.js
index e48bd327f..db02b5436 100644
--- a/src/main/webapp/js/knowledge-edit.js
+++ b/src/main/webapp/js/knowledge-edit.js
@@ -47,19 +47,24 @@ $(document).ready(function() {
$('.progress .progress-bar').text(progress + '%');
}).on('fileuploadfail', function (e, data) {
- var msg = data.jqXHR.responseJSON.msg;
- $.each(data.files, function (index) {
- var filediv = '
';
- filediv += '';
- filediv += '';
- filediv += ' ';
- filediv += data.files[index].name;
- filediv += ' ';
- filediv += msg;
- filediv += '
';
- $('#files').append(filediv);
- $.notify('アップロードに失敗したファイルがあります', 'warn');
- });
+ if (data && data.jqXHR && data.jqXHR.responseJSON && data.jqXHR.responseJSON.msg) {
+ var msg = data.jqXHR.responseJSON.msg;
+ $.each(data.files, function (index) {
+ var filediv = '';
+ filediv += '';
+ filediv += '';
+ filediv += ' ';
+ filediv += data.files[index].name;
+ filediv += ' ';
+ filediv += msg;
+ filediv += '
';
+ $('#files').append(filediv);
+ $.notify('アップロードに失敗したファイルがあります', 'warn');
+ });
+ } else {
+ console.log(e);
+ console.log(data);
+ }
}).prop('disabled', !$.support.fileInput).parent().addClass($.support.fileInput ? undefined : 'disabled');
});