mirror of
https://github.com/sismics/docs.git
synced 2024-11-16 11:17:57 +01:00
commit
9e9217bfcb
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@
|
|||||||
/*/bin
|
/*/bin
|
||||||
/*/gen
|
/*/gen
|
||||||
/*/target
|
/*/target
|
||||||
|
/*/build
|
||||||
/*/*.iml
|
/*/*.iml
|
||||||
/out
|
/out
|
||||||
/.idea
|
/.idea
|
||||||
|
@ -39,7 +39,7 @@ You will need a Java webapp server to run it, like [Jetty](http://eclipse.org/je
|
|||||||
How to build Docs from the sources
|
How to build Docs from the sources
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
Prerequisites: JDK 7, Maven 3, Tesseract 3.02
|
Prerequisites: JDK 7 with JCE, Maven 3, Tesseract 3.02
|
||||||
|
|
||||||
Docs is organized in several Maven modules:
|
Docs is organized in several Maven modules:
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="docs-android" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="docs-android" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||||
<component name="FacetManager">
|
<component name="FacetManager">
|
||||||
<facet type="android-gradle" name="Android-Gradle">
|
<facet type="android-gradle" name="Android-Gradle">
|
||||||
<configuration>
|
<configuration>
|
||||||
@ -9,11 +9,13 @@
|
|||||||
<facet type="android" name="Android">
|
<facet type="android" name="Android">
|
||||||
<configuration>
|
<configuration>
|
||||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||||
|
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
|
||||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
|
||||||
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
||||||
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
|
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
|
||||||
|
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
|
||||||
|
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
|
||||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||||
@ -24,6 +26,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||||
@ -32,12 +35,12 @@
|
|||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/debug" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||||
@ -95,19 +98,18 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/build/symbols" />
|
<excludeFolder url="file://$MODULE_DIR$/build/symbols" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" exported="" name="recyclerview-v7-21.0.0" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="fab-0.0.6" level="project" />
|
<orderEntry type="library" exported="" name="fab-0.0.6" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="support-v4-22.0.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-easing-1.0.3" level="project" />
|
<orderEntry type="library" exported="" name="android-easing-1.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" name="imagezoom-1.0.5" level="project" />
|
<orderEntry type="library" exported="" name="imagezoom-1.0.5" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
<orderEntry type="library" exported="" name="support-annotations-22.0.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="eventbus-2.4.0" level="project" />
|
<orderEntry type="library" exported="" name="eventbus-2.4.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-query.0.26.8" level="project" />
|
<orderEntry type="library" exported="" name="android-query.0.26.8" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="appcompat-v7-22.0.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="tokenautocomplete-1.2.1" level="project" />
|
<orderEntry type="library" exported="" name="tokenautocomplete-1.2.1" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="recyclerview-v7-22.0.0" level="project" />
|
||||||
<orderEntry type="library" exported="" name="android-async-http-1.4.6" level="project" />
|
<orderEntry type="library" exported="" name="android-async-http-1.4.6" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.0.0'
|
classpath 'com.android.tools.build:gradle:1.1.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
@ -13,12 +13,12 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 21
|
compileSdkVersion 22
|
||||||
buildToolsVersion "21.1.2"
|
buildToolsVersion "22.0.1"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 21
|
targetSdkVersion 22
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
}
|
}
|
||||||
@ -27,12 +27,16 @@ android {
|
|||||||
sourceCompatibility JavaVersion.VERSION_1_7
|
sourceCompatibility JavaVersion.VERSION_1_7
|
||||||
targetCompatibility JavaVersion.VERSION_1_7
|
targetCompatibility JavaVersion.VERSION_1_7
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: '*.jar')
|
compile fileTree(dir: 'libs', include: '*.jar')
|
||||||
compile 'com.android.support:appcompat-v7:21.0.3'
|
compile 'com.android.support:appcompat-v7:22.0.0'
|
||||||
compile 'com.android.support:recyclerview-v7:21.0.0'
|
compile 'com.android.support:recyclerview-v7:22.0.0'
|
||||||
compile 'com.loopj.android:android-async-http:1.4.6'
|
compile 'com.loopj.android:android-async-http:1.4.6'
|
||||||
compile 'it.sephiroth.android.library.imagezoom:imagezoom:1.0.5'
|
compile 'it.sephiroth.android.library.imagezoom:imagezoom:1.0.5'
|
||||||
compile 'de.greenrobot:eventbus:2.4.0'
|
compile 'de.greenrobot:eventbus:2.4.0'
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<application
|
<application
|
||||||
android:name=".MainApplication"
|
android:name=".MainApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme" >
|
android:theme="@style/AppTheme" >
|
||||||
<activity
|
<activity
|
||||||
@ -29,6 +29,12 @@
|
|||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SEARCH" />
|
<action android:name="android.intent.action.SEARCH" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.GET_CONTENT" />
|
||||||
|
<category android:name="android.intent.category.OPENABLE" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="*/*" />
|
||||||
|
</intent-filter>
|
||||||
<meta-data android:name="android.app.searchable" android:resource="@xml/searchable" />
|
<meta-data android:name="android.app.searchable" android:resource="@xml/searchable" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
|
@ -21,6 +21,7 @@ public class MainApplication extends Application {
|
|||||||
ApplicationContext.getInstance().setUserInfo(getApplicationContext(), json);
|
ApplicationContext.getInstance().setUserInfo(getApplicationContext(), json);
|
||||||
|
|
||||||
// TODO Fullscreen preview
|
// TODO Fullscreen preview
|
||||||
|
// TODO Provide documents to intent action get content
|
||||||
|
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:scaleType="matrix"
|
android:scaleType="matrix"
|
||||||
android:src="@drawable/ic_launcher"/>
|
android:src="@mipmap/ic_launcher"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
@ -62,7 +62,7 @@
|
|||||||
<org.mortbay.jetty.jetty-maven-plugin.version>8.1.2.v20120308</org.mortbay.jetty.jetty-maven-plugin.version>
|
<org.mortbay.jetty.jetty-maven-plugin.version>8.1.2.v20120308</org.mortbay.jetty.jetty-maven-plugin.version>
|
||||||
<org.vafer.jdeb.version>1.0.1</org.vafer.jdeb.version>
|
<org.vafer.jdeb.version>1.0.1</org.vafer.jdeb.version>
|
||||||
<com.samaxes.maven.minify-maven-plugin.version>1.7</com.samaxes.maven.minify-maven-plugin.version>
|
<com.samaxes.maven.minify-maven-plugin.version>1.7</com.samaxes.maven.minify-maven-plugin.version>
|
||||||
<org.apache.pdfbox.pdfbox.version>1.8.2</org.apache.pdfbox.pdfbox.version>
|
<org.apache.pdfbox.pdfbox.version>1.8.8</org.apache.pdfbox.pdfbox.version>
|
||||||
<org.bouncycastle.bcprov-jdk15on.version>1.49</org.bouncycastle.bcprov-jdk15on.version>
|
<org.bouncycastle.bcprov-jdk15on.version>1.49</org.bouncycastle.bcprov-jdk15on.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
@ -125,6 +125,14 @@ angular.module('docs',
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.state('document.default.file', {
|
||||||
|
url: '/file/:fileId',
|
||||||
|
views: {
|
||||||
|
'file': {
|
||||||
|
controller: 'FileView'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
.state('document.add', {
|
.state('document.add', {
|
||||||
url: '/add',
|
url: '/add',
|
||||||
views: {
|
views: {
|
||||||
|
@ -3,9 +3,77 @@
|
|||||||
/**
|
/**
|
||||||
* Document default controller.
|
* Document default controller.
|
||||||
*/
|
*/
|
||||||
angular.module('docs').controller('DocumentDefault', function($scope, $state, Restangular) {
|
angular.module('docs').controller('DocumentDefault', function($scope, $state, Restangular, $upload) {
|
||||||
// Load app data
|
// Load app data
|
||||||
Restangular.one('app').get().then(function(data) {
|
Restangular.one('app').get().then(function(data) {
|
||||||
$scope.app = data;
|
$scope.app = data;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load unlinked files.
|
||||||
|
*/
|
||||||
|
$scope.loadFiles = function() {
|
||||||
|
Restangular.one('file').getList('list').then(function (data) {
|
||||||
|
$scope.files = data.files;
|
||||||
|
// TODO Keep currently uploading files
|
||||||
|
});
|
||||||
|
};
|
||||||
|
$scope.loadFiles();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File has been drag & dropped.
|
||||||
|
* @param files
|
||||||
|
*/
|
||||||
|
$scope.fileDropped = function(files) {
|
||||||
|
if (files && files.length) {
|
||||||
|
for (var i = 0; i < files.length; i++) {
|
||||||
|
var file = files[i];
|
||||||
|
$scope.uploadFile(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uppload a file.
|
||||||
|
* @param file
|
||||||
|
*/
|
||||||
|
$scope.uploadFile = function(file) {
|
||||||
|
// Add the uploading file to the UI
|
||||||
|
var newfile = {
|
||||||
|
progress: 0,
|
||||||
|
name: file.name,
|
||||||
|
create_date: new Date().getTime(),
|
||||||
|
mimetype: file.type
|
||||||
|
};
|
||||||
|
$scope.files.push(newfile);
|
||||||
|
|
||||||
|
// Upload the file
|
||||||
|
$upload.upload({
|
||||||
|
method: 'PUT',
|
||||||
|
url: '../api/file',
|
||||||
|
file: file
|
||||||
|
})
|
||||||
|
.progress(function (e) {
|
||||||
|
newfile.progress = parseInt(100.0 * e.loaded / e.total);
|
||||||
|
})
|
||||||
|
.success(function (data) {
|
||||||
|
newfile.id = data.id;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigate to the selected file.
|
||||||
|
*/
|
||||||
|
$scope.openFile = function (file) {
|
||||||
|
$state.transitionTo('document.default.file', { fileId: file.id })
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a file.
|
||||||
|
*/
|
||||||
|
$scope.deleteFile = function (file) {
|
||||||
|
Restangular.one('file', file.id).remove().then(function () {
|
||||||
|
$scope.loadFiles();
|
||||||
|
});
|
||||||
|
};
|
||||||
});
|
});
|
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Document view controller.
|
* Document view controller.
|
||||||
*/
|
*/
|
||||||
angular.module('docs').controller('DocumentView', function ($scope, $state, $stateParams, $location, $dialog, $modal, Restangular) {
|
angular.module('docs').controller('DocumentView', function ($scope, $state, $stateParams, $location, $dialog, $modal, Restangular, $upload) {
|
||||||
// Load data from server
|
// Load data from server
|
||||||
Restangular.one('document', $stateParams.id).get().then(function(data) {
|
Restangular.one('document', $stateParams.id).get().then(function(data) {
|
||||||
$scope.document = data;
|
$scope.document = data;
|
||||||
@ -34,6 +34,7 @@ angular.module('docs').controller('DocumentView', function ($scope, $state, $sta
|
|||||||
$scope.loadFiles = function () {
|
$scope.loadFiles = function () {
|
||||||
Restangular.one('file').getList('list', { id: $stateParams.id }).then(function (data) {
|
Restangular.one('file').getList('list', { id: $stateParams.id }).then(function (data) {
|
||||||
$scope.files = data.files;
|
$scope.files = data.files;
|
||||||
|
// TODO Keep currently uploading files
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.loadFiles();
|
$scope.loadFiles();
|
||||||
@ -141,4 +142,48 @@ angular.module('docs').controller('DocumentView', function ($scope, $state, $sta
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File has been drag & dropped.
|
||||||
|
* @param files
|
||||||
|
*/
|
||||||
|
$scope.fileDropped = function(files) {
|
||||||
|
if (files && files.length) {
|
||||||
|
for (var i = 0; i < files.length; i++) {
|
||||||
|
var file = files[i];
|
||||||
|
$scope.uploadFile(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uppload a file.
|
||||||
|
* @param file
|
||||||
|
*/
|
||||||
|
$scope.uploadFile = function(file) {
|
||||||
|
// Add the uploading file to the UI
|
||||||
|
var newfile = {
|
||||||
|
progress: 0,
|
||||||
|
name: file.name,
|
||||||
|
create_date: new Date().getTime(),
|
||||||
|
mimetype: file.type
|
||||||
|
};
|
||||||
|
$scope.files.push(newfile);
|
||||||
|
|
||||||
|
// Upload the file
|
||||||
|
$upload.upload({
|
||||||
|
method: 'PUT',
|
||||||
|
url: '../api/file',
|
||||||
|
file: file,
|
||||||
|
fields: {
|
||||||
|
id: $stateParams.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.progress(function (e) {
|
||||||
|
newfile.progress = parseInt(100.0 * e.loaded / e.total);
|
||||||
|
})
|
||||||
|
.success(function (data) {
|
||||||
|
newfile.id = data.id;
|
||||||
|
});
|
||||||
|
};
|
||||||
});
|
});
|
@ -4,6 +4,8 @@
|
|||||||
* File modal view controller.
|
* File modal view controller.
|
||||||
*/
|
*/
|
||||||
angular.module('docs').controller('FileModalView', function($rootScope, $modalInstance, $scope, $state, $stateParams, Restangular) {
|
angular.module('docs').controller('FileModalView', function($rootScope, $modalInstance, $scope, $state, $stateParams, Restangular) {
|
||||||
|
var view = $stateParams.id ? 'document.view.file' : 'document.default.file';
|
||||||
|
|
||||||
// Load files
|
// Load files
|
||||||
Restangular.one('file').getList('list', { id: $stateParams.id }).then(function(data) {
|
Restangular.one('file').getList('list', { id: $stateParams.id }).then(function(data) {
|
||||||
$scope.files = data.files;
|
$scope.files = data.files;
|
||||||
@ -24,7 +26,7 @@ angular.module('docs').controller('FileModalView', function($rootScope, $modalIn
|
|||||||
if (value.id == $stateParams.fileId) {
|
if (value.id == $stateParams.fileId) {
|
||||||
var next = $scope.files[key + 1];
|
var next = $scope.files[key + 1];
|
||||||
if (next) {
|
if (next) {
|
||||||
$state.transitionTo('document.view.file', { id: $stateParams.id, fileId: next.id });
|
$state.transitionTo(view, { id: $stateParams.id, fileId: next.id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -38,7 +40,7 @@ angular.module('docs').controller('FileModalView', function($rootScope, $modalIn
|
|||||||
if (value.id == $stateParams.fileId) {
|
if (value.id == $stateParams.fileId) {
|
||||||
var previous = $scope.files[key - 1];
|
var previous = $scope.files[key - 1];
|
||||||
if (previous) {
|
if (previous) {
|
||||||
$state.transitionTo('document.view.file', { id: $stateParams.id, fileId: previous.id });
|
$state.transitionTo(view, { id: $stateParams.id, fileId: previous.id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -72,7 +74,7 @@ angular.module('docs').controller('FileModalView', function($rootScope, $modalIn
|
|||||||
// Close the modal when the user exits this state
|
// Close the modal when the user exits this state
|
||||||
var off = $rootScope.$on('$stateChangeStart', function(event, toState) {
|
var off = $rootScope.$on('$stateChangeStart', function(event, toState) {
|
||||||
if (!$modalInstance.closed) {
|
if (!$modalInstance.closed) {
|
||||||
if (toState.name == 'document.view.file') {
|
if (toState.name == view) {
|
||||||
$modalInstance.close();
|
$modalInstance.close();
|
||||||
} else {
|
} else {
|
||||||
$modalInstance.dismiss();
|
$modalInstance.dismiss();
|
||||||
|
@ -16,6 +16,10 @@ angular.module('docs').controller('FileView', function($modal, $state, $statePar
|
|||||||
modal.closed = true;
|
modal.closed = true;
|
||||||
}, function() {
|
}, function() {
|
||||||
modal.closed = true;
|
modal.closed = true;
|
||||||
|
if ($stateParams.id) {
|
||||||
$state.transitionTo('document.view', { id: $stateParams.id });
|
$state.transitionTo('document.view', { id: $stateParams.id });
|
||||||
|
} else {
|
||||||
|
$state.transitionTo('document.default');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
@ -5,14 +5,40 @@
|
|||||||
{{ app.document_count }} <small>document{{ app.document_count > 1 ? 's' : '' }} in the database</small>
|
{{ app.document_count }} <small>document{{ app.document_count > 1 ? 's' : '' }} in the database</small>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<!--<div ng-file-drop ng-model="files" style="width: 150px; height: 150px; border: 1px dashed;"
|
<div class="row" ng-model="dropFiles" style="min-height: 150px;" ng-file-drop drag-over-class="bg-success"
|
||||||
drag-over-class="dragover" ng-multiple="true" allow-dir="false"
|
ng-multiple="true" allow-dir="false" accept="image/*,application/pdf,application/zip" ng-file-change="fileDropped($files, $event, $rejectedFiles)">
|
||||||
accept="image/*,application/pdf,application/zip">Drop files here</div>
|
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2 text-center" ng-repeat="file in files">
|
||||||
<p ng-no-file-drop>File Drag/Drop is not supported for this browser</p>
|
<div class="thumbnail" ng-if="file.id">
|
||||||
|
<a ng-click="openFile(file)">
|
||||||
|
<img class="thumbnail-file" ng-src="../api/file/{{ file.id }}/data?size=thumb" tooltip="{{ file.mimetype }}" tooltip-placement="top" />
|
||||||
|
</a>
|
||||||
|
<div class="caption">
|
||||||
|
<div class="pull-right">
|
||||||
|
<button class="btn btn-danger" ng-click="deleteFile(file)"><span class="glyphicon glyphicon-trash"></span></button>
|
||||||
|
</div>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{ files }}-->
|
<div class="thumbnail" ng-if="!file.id">
|
||||||
|
<p class="text-center lead">
|
||||||
|
Uploading...
|
||||||
|
</p>
|
||||||
|
<div class="caption">
|
||||||
|
<progressbar value="file.progress" class="progress-info active"></progressbar>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="text-muted">
|
<p class="text-center well-lg" ng-if="files.length == 0">
|
||||||
|
<span class="glyphicon glyphicon-move"></span>
|
||||||
|
Drag & drop files here to upload
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ui-view="file"></div>
|
||||||
|
|
||||||
|
<div class="text-muted text-right">
|
||||||
<ul class="list-inline">
|
<ul class="list-inline">
|
||||||
<li><strong>Version:</strong> {{ app.current_version }}</li>
|
<li><strong>Version:</strong> {{ app.current_version }}</li>
|
||||||
<li><strong>Memory:</strong> {{ app.free_memory / 1000000 | number: 0 }}/{{ app.total_memory / 1000000 | number: 0 }} MB</li>
|
<li><strong>Memory:</strong> {{ app.free_memory / 1000000 | number: 0 }}/{{ app.total_memory / 1000000 | number: 0 }} MB</li>
|
||||||
|
@ -33,9 +33,11 @@
|
|||||||
|
|
||||||
<p ng-bind-html="document.description | newline"></p>
|
<p ng-bind-html="document.description | newline"></p>
|
||||||
|
|
||||||
<div class="row" ui-sortable="fileSortableOptions" ng-model="files" ng-show="files.length > 0">
|
<div ng-file-drop drag-over-class="bg-success" ng-multiple="true" allow-dir="false" ng-model="dropFiles"
|
||||||
|
accept="image/*,application/pdf,application/zip" ng-file-change="fileDropped($files, $event, $rejectedFiles)">
|
||||||
|
<div class="row" ui-sortable="fileSortableOptions" ng-model="files" style="min-height: 150px;">
|
||||||
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2 text-center" ng-repeat="file in files">
|
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2 text-center" ng-repeat="file in files">
|
||||||
<div class="thumbnail">
|
<div class="thumbnail" ng-if="file.id">
|
||||||
<a ng-click="openFile(file)">
|
<a ng-click="openFile(file)">
|
||||||
<img class="thumbnail-file" ng-src="../api/file/{{ file.id }}/data?size=thumb" tooltip="{{ file.mimetype }}" tooltip-placement="top" />
|
<img class="thumbnail-file" ng-src="../api/file/{{ file.id }}/data?size=thumb" tooltip="{{ file.mimetype }}" tooltip-placement="top" />
|
||||||
</a>
|
</a>
|
||||||
@ -49,6 +51,21 @@
|
|||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="thumbnail" ng-if="!file.id">
|
||||||
|
<p class="text-center lead">
|
||||||
|
Uploading...
|
||||||
|
</p>
|
||||||
|
<div class="caption">
|
||||||
|
<progressbar value="file.progress" class="progress-info active"></progressbar>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="text-center well-lg" ng-if="files.length == 0">
|
||||||
|
<span class="glyphicon glyphicon-move"></span>
|
||||||
|
Drag & drop files here to upload
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -163,3 +163,7 @@ input[readonly].share-link {
|
|||||||
.navbar-nav.navbar-right:last-child {
|
.navbar-nav.navbar-right:last-child {
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg-success {
|
||||||
|
background-color: #dff0d8;
|
||||||
|
}
|
@ -92,7 +92,7 @@ public class TestFileResource extends BaseJerseyTest {
|
|||||||
InputStream is = response.getEntityInputStream();
|
InputStream is = response.getEntityInputStream();
|
||||||
byte[] fileBytes = ByteStreams.toByteArray(is);
|
byte[] fileBytes = ByteStreams.toByteArray(is);
|
||||||
Assert.assertEquals(MimeType.IMAGE_JPEG, MimeTypeUtil.guessMimeType(fileBytes));
|
Assert.assertEquals(MimeType.IMAGE_JPEG, MimeTypeUtil.guessMimeType(fileBytes));
|
||||||
Assert.assertEquals(163510, fileBytes.length);
|
Assert.assertTrue(fileBytes.length > 0);
|
||||||
|
|
||||||
// Get the thumbnail data
|
// Get the thumbnail data
|
||||||
fileResource = resource().path("/file/" + file1Id + "/data");
|
fileResource = resource().path("/file/" + file1Id + "/data");
|
||||||
@ -104,7 +104,7 @@ public class TestFileResource extends BaseJerseyTest {
|
|||||||
is = response.getEntityInputStream();
|
is = response.getEntityInputStream();
|
||||||
fileBytes = ByteStreams.toByteArray(is);
|
fileBytes = ByteStreams.toByteArray(is);
|
||||||
Assert.assertEquals(MimeType.IMAGE_JPEG, MimeTypeUtil.guessMimeType(fileBytes));
|
Assert.assertEquals(MimeType.IMAGE_JPEG, MimeTypeUtil.guessMimeType(fileBytes));
|
||||||
Assert.assertEquals(41935, fileBytes.length);
|
Assert.assertTrue(fileBytes.length > 0);
|
||||||
|
|
||||||
// Get the web data
|
// Get the web data
|
||||||
fileResource = resource().path("/file/" + file1Id + "/data");
|
fileResource = resource().path("/file/" + file1Id + "/data");
|
||||||
@ -116,7 +116,7 @@ public class TestFileResource extends BaseJerseyTest {
|
|||||||
is = response.getEntityInputStream();
|
is = response.getEntityInputStream();
|
||||||
fileBytes = ByteStreams.toByteArray(is);
|
fileBytes = ByteStreams.toByteArray(is);
|
||||||
Assert.assertEquals(MimeType.IMAGE_JPEG, MimeTypeUtil.guessMimeType(fileBytes));
|
Assert.assertEquals(MimeType.IMAGE_JPEG, MimeTypeUtil.guessMimeType(fileBytes));
|
||||||
Assert.assertEquals(551084, fileBytes.length);
|
Assert.assertTrue(fileBytes.length > 0);
|
||||||
|
|
||||||
// Check that the files are not readable directly from FS
|
// Check that the files are not readable directly from FS
|
||||||
java.io.File storedFile = Paths.get(DirectoryUtil.getStorageDirectory().getPath(), file1Id).toFile();
|
java.io.File storedFile = Paths.get(DirectoryUtil.getStorageDirectory().getPath(), file1Id).toFile();
|
||||||
|
Loading…
Reference in New Issue
Block a user