mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 14:07:55 +01:00
Closes #177: import document from EML file (UI done)
This commit is contained in:
parent
b95ec019de
commit
ba4470f155
@ -28,14 +28,15 @@ Features
|
|||||||
--------
|
--------
|
||||||
|
|
||||||
- Responsive user interface
|
- Responsive user interface
|
||||||
- Workflow system ![New!](https://www.sismics.com/public/img/new.png)
|
|
||||||
- Optical character recognition
|
- Optical character recognition
|
||||||
- Support image, PDF, ODT and DOCX files
|
- Support image, PDF, ODT and DOCX files
|
||||||
- Flexible search engine
|
- Flexible search engine
|
||||||
- Full text search in all supported files
|
- Full text search in all supported files
|
||||||
- All [Dublin Core](http://dublincore.org/) metadata
|
- All [Dublin Core](http://dublincore.org/) metadata
|
||||||
|
- Workflow system ![New!](https://www.sismics.com/public/img/new.png)
|
||||||
- 256-bit AES encryption of stored files
|
- 256-bit AES encryption of stored files
|
||||||
- Tag system with nesting
|
- Tag system with nesting
|
||||||
|
- Import document from email (EML format) ![New!](https://www.sismics.com/public/img/new.png)
|
||||||
- User/group permission system
|
- User/group permission system
|
||||||
- 2-factor authentication
|
- 2-factor authentication
|
||||||
- Hierarchical groups
|
- Hierarchical groups
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modal import controller.
|
||||||
|
*/
|
||||||
|
angular.module('docs').controller('ModalImport', function ($scope, $uibModalInstance, file, $q, $timeout) {
|
||||||
|
// Payload
|
||||||
|
var formData = new FormData();
|
||||||
|
formData.append('file', file, file.name);
|
||||||
|
|
||||||
|
// Send the file
|
||||||
|
var deferred = $q.defer();
|
||||||
|
var getProgressListener = function(deferred) {
|
||||||
|
return function(event) {
|
||||||
|
deferred.notify(event);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'PUT',
|
||||||
|
url: '../api/document/eml',
|
||||||
|
data: formData,
|
||||||
|
cache: false,
|
||||||
|
contentType: false,
|
||||||
|
processData: false,
|
||||||
|
success: function(response) {
|
||||||
|
deferred.resolve(response);
|
||||||
|
},
|
||||||
|
error: function(jqXHR) {
|
||||||
|
deferred.reject(jqXHR);
|
||||||
|
},
|
||||||
|
xhr: function() {
|
||||||
|
var myXhr = $.ajaxSettings.xhr();
|
||||||
|
myXhr.upload.addEventListener(
|
||||||
|
'progress', getProgressListener(deferred), false);
|
||||||
|
return myXhr;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
deferred.promise.then(function(data) {
|
||||||
|
$uibModalInstance.close(data);
|
||||||
|
}, function(data) {
|
||||||
|
$scope.errorQuota = data.responseJSON && data.responseJSON.type === 'QuotaReached';
|
||||||
|
if (!$scope.errorQuota) {
|
||||||
|
$scope.errorGeneral = true;
|
||||||
|
}
|
||||||
|
$timeout(function () {
|
||||||
|
$uibModalInstance.close(null);
|
||||||
|
}, 3000);
|
||||||
|
}, function(e) {
|
||||||
|
$scope.progress = e.loaded / e.total;
|
||||||
|
});
|
||||||
|
});
|
@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Document controller.
|
* Document controller.
|
||||||
*/
|
*/
|
||||||
angular.module('docs').controller('Document', function ($scope, $rootScope, $timeout, $state, Restangular, $q, $filter) {
|
angular.module('docs').controller('Document', function ($scope, $rootScope, $timeout, $state, Restangular, $q, $filter, $uibModal) {
|
||||||
/**
|
/**
|
||||||
* Scope variables.
|
* Scope variables.
|
||||||
*/
|
*/
|
||||||
@ -209,4 +209,24 @@ angular.module('docs').controller('Document', function ($scope, $rootScope, $tim
|
|||||||
$scope.search = '';
|
$scope.search = '';
|
||||||
$scope.searchOpened = false;
|
$scope.searchOpened = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.importEml = function (file) {
|
||||||
|
// Open the import modal
|
||||||
|
$uibModal.open({
|
||||||
|
templateUrl: 'partial/docs/import.html',
|
||||||
|
controller: 'ModalImport',
|
||||||
|
resolve: {
|
||||||
|
file: function () {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).result.then(function (data) {
|
||||||
|
if (data === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.viewDocument(data.id);
|
||||||
|
$scope.loadDocuments();
|
||||||
|
});
|
||||||
|
};
|
||||||
});
|
});
|
@ -185,7 +185,7 @@ angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $
|
|||||||
$scope.alerts.unshift({
|
$scope.alerts.unshift({
|
||||||
type: 'danger',
|
type: 'danger',
|
||||||
msg: $translate.instant('document.edit.document_' + ($scope.isEdit() ? 'edited' : 'added') + '_with_errors')
|
msg: $translate.instant('document.edit.document_' + ($scope.isEdit() ? 'edited' : 'added') + '_with_errors')
|
||||||
+ (data.responseJSON.type === 'QuotaReached' ? (' - ' + $translate.instant('document.edit.quota_reached')) : '')
|
+ (data.responseJSON && data.responseJSON.type === 'QuotaReached' ? (' - ' + $translate.instant('document.edit.quota_reached')) : '')
|
||||||
});
|
});
|
||||||
|
|
||||||
// Reset view and title
|
// Reset view and title
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
<script src="app/docs/controller/Login.js" type="text/javascript"></script>
|
<script src="app/docs/controller/Login.js" type="text/javascript"></script>
|
||||||
<script src="app/docs/controller/ModalPasswordLost.js" type="text/javascript"></script>
|
<script src="app/docs/controller/ModalPasswordLost.js" type="text/javascript"></script>
|
||||||
<script src="app/docs/controller/ModalFeedback.js" type="text/javascript"></script>
|
<script src="app/docs/controller/ModalFeedback.js" type="text/javascript"></script>
|
||||||
|
<script src="app/docs/controller/ModalImport.js" type="text/javascript"></script>
|
||||||
<script src="app/docs/controller/PasswordReset.js" type="text/javascript"></script>
|
<script src="app/docs/controller/PasswordReset.js" type="text/javascript"></script>
|
||||||
<script src="app/docs/controller/Navigation.js" type="text/javascript"></script>
|
<script src="app/docs/controller/Navigation.js" type="text/javascript"></script>
|
||||||
<script src="app/docs/controller/Footer.js" type="text/javascript"></script>
|
<script src="app/docs/controller/Footer.js" type="text/javascript"></script>
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
"search_clear": "Clear",
|
"search_clear": "Clear",
|
||||||
"any_language": "Any language",
|
"any_language": "Any language",
|
||||||
"add_document": "Add a document",
|
"add_document": "Add a document",
|
||||||
|
"import_eml": "Import from an email (EML format)",
|
||||||
"tags": "Tags",
|
"tags": "Tags",
|
||||||
"no_tags": "No tags",
|
"no_tags": "No tags",
|
||||||
"no_documents": "No document in the database",
|
"no_documents": "No document in the database",
|
||||||
@ -390,6 +391,11 @@
|
|||||||
"sent_title": "Feedback sent",
|
"sent_title": "Feedback sent",
|
||||||
"sent_message": "Thank you for your feedback! It will help us make Sismics Docs even better."
|
"sent_message": "Thank you for your feedback! It will help us make Sismics Docs even better."
|
||||||
},
|
},
|
||||||
|
"import": {
|
||||||
|
"title": "Importing",
|
||||||
|
"error_quota": "Quota limit reached, contact your administrator to increase your quota",
|
||||||
|
"error_general": "An error occurred while trying to import your file, please make sure it is a valid EML file"
|
||||||
|
},
|
||||||
"app_share": {
|
"app_share": {
|
||||||
"main": "Ask a shared document link to access it",
|
"main": "Ask a shared document link to access it",
|
||||||
"403": {
|
"403": {
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
"search_clear": "Vider",
|
"search_clear": "Vider",
|
||||||
"any_language": "Toutes les langues",
|
"any_language": "Toutes les langues",
|
||||||
"add_document": "Ajouter un document",
|
"add_document": "Ajouter un document",
|
||||||
|
"import_eml": "Importer depuis un email (format EML)",
|
||||||
"tags": "Tags",
|
"tags": "Tags",
|
||||||
"no_tags": "Aucun tag",
|
"no_tags": "Aucun tag",
|
||||||
"no_documents": "Aucun document dans la base de données",
|
"no_documents": "Aucun document dans la base de données",
|
||||||
@ -390,6 +391,11 @@
|
|||||||
"sent_title": "Avis envoyé",
|
"sent_title": "Avis envoyé",
|
||||||
"sent_message": "Merci pour votre avis ! Cela nous aidera à améliorer Sismics Docs."
|
"sent_message": "Merci pour votre avis ! Cela nous aidera à améliorer Sismics Docs."
|
||||||
},
|
},
|
||||||
|
"import": {
|
||||||
|
"title": "Import en cours",
|
||||||
|
"error_quota": "Limite de quota atteinte, contactez votre administrateur pour augmenter votre quota",
|
||||||
|
"error_general": "Une erreur est survenue lors de la tentative d'importation de votre fichier, assurez-vous qu'il s'agit bien d'un fichier EML valide"
|
||||||
|
},
|
||||||
"app_share": {
|
"app_share": {
|
||||||
"main": "Demandez un lien de partage d'un document pour y accéder",
|
"main": "Demandez un lien de partage d'un document pour y accéder",
|
||||||
"403": {
|
"403": {
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
"search_clear": "清除",
|
"search_clear": "清除",
|
||||||
"any_language": "所有语言",
|
"any_language": "所有语言",
|
||||||
"add_document": "添加一个文档",
|
"add_document": "添加一个文档",
|
||||||
|
"import_eml": "从电子邮件导入(EML格式)",
|
||||||
"tags": "标签",
|
"tags": "标签",
|
||||||
"no_tags": "无标签",
|
"no_tags": "无标签",
|
||||||
"no_documents": "数据库中无该文档",
|
"no_documents": "数据库中无该文档",
|
||||||
@ -390,6 +391,11 @@
|
|||||||
"sent_title": "反馈意见已发送",
|
"sent_title": "反馈意见已发送",
|
||||||
"sent_message": "非常感谢您的反馈意见!这将帮我们进一步改进Sismics Docs从而更好的为您提供服务。"
|
"sent_message": "非常感谢您的反馈意见!这将帮我们进一步改进Sismics Docs从而更好的为您提供服务。"
|
||||||
},
|
},
|
||||||
|
"import": {
|
||||||
|
"title": "输入",
|
||||||
|
"error_quota": "已达到配额限制,请联系您的管理员以增加配额",
|
||||||
|
"error_general": "尝试导入文件时发生错误,请确保它是有效的EML文件"
|
||||||
|
},
|
||||||
"app_share": {
|
"app_share": {
|
||||||
"main": "请求获取文档权限的链接",
|
"main": "请求获取文档权限的链接",
|
||||||
"403": {
|
"403": {
|
||||||
@ -415,7 +421,8 @@
|
|||||||
"Group": "组",
|
"Group": "组",
|
||||||
"Tag": "标签",
|
"Tag": "标签",
|
||||||
"User": "用户",
|
"User": "用户",
|
||||||
"RouteModel": "工作流程"
|
"RouteModel": "工作流程",
|
||||||
|
"Route": "工作流程"
|
||||||
},
|
},
|
||||||
"selectrelation": {
|
"selectrelation": {
|
||||||
"typeahead": "请输入一个文档名称"
|
"typeahead": "请输入一个文档名称"
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
"search_clear": "清除",
|
"search_clear": "清除",
|
||||||
"any_language": "任何語言",
|
"any_language": "任何語言",
|
||||||
"add_document": "添加一個文檔",
|
"add_document": "添加一個文檔",
|
||||||
|
"import_eml": "從電子郵件導入(EML格式)",
|
||||||
"tags": "標籤",
|
"tags": "標籤",
|
||||||
"no_tags": "無標籤",
|
"no_tags": "無標籤",
|
||||||
"no_documents": "數據庫中無該文檔",
|
"no_documents": "數據庫中無該文檔",
|
||||||
@ -390,6 +391,11 @@
|
|||||||
"sent_title": "反饋已發送",
|
"sent_title": "反饋已發送",
|
||||||
"sent_message": "感謝您的反饋意見!這將幫助我們進一步優化Sismics Docs文檔管理系統以便更好的為您提供服務。"
|
"sent_message": "感謝您的反饋意見!這將幫助我們進一步優化Sismics Docs文檔管理系統以便更好的為您提供服務。"
|
||||||
},
|
},
|
||||||
|
"import": {
|
||||||
|
"title": "輸入",
|
||||||
|
"error_quota": "已達到配額限制,請聯繫您的管理員以增加配額",
|
||||||
|
"error_general": "嘗試導入文件時發生錯誤,請確保它是有效的EML文件"
|
||||||
|
},
|
||||||
"app_share": {
|
"app_share": {
|
||||||
"main": "請求一個共享的文檔鏈接來訪問該文檔",
|
"main": "請求一個共享的文檔鏈接來訪問該文檔",
|
||||||
"403": {
|
"403": {
|
||||||
@ -415,7 +421,8 @@
|
|||||||
"Group": "組",
|
"Group": "組",
|
||||||
"Tag": "標籤",
|
"Tag": "標籤",
|
||||||
"User": "用戶",
|
"User": "用戶",
|
||||||
"RouteModel": "工作流程"
|
"RouteModel": "工作流程",
|
||||||
|
"Route": "工作流程"
|
||||||
},
|
},
|
||||||
"selectrelation": {
|
"selectrelation": {
|
||||||
"typeahead": "請輸入文檔名稱"
|
"typeahead": "請輸入文檔名稱"
|
||||||
|
@ -1,9 +1,19 @@
|
|||||||
<div class="row row-full">
|
<div class="row row-full">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="well well-full">
|
<div class="well well-full">
|
||||||
<p class="text-center">
|
<div class="text-center mb-10">
|
||||||
<a href="#/document/add" class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span> {{ 'document.add_document' | translate }}</a>
|
<div class="btn-group" uib-dropdown>
|
||||||
</p>
|
<a href="#/document/add" class="btn btn-primary">
|
||||||
|
<span class="glyphicon glyphicon-plus"></span> {{ 'document.add_document' | translate }}
|
||||||
|
</a>
|
||||||
|
<button type="button" class="btn btn-primary" uib-dropdown-toggle>
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul uib-dropdown-menu>
|
||||||
|
<li><a href ngf-select="importEml($file)">{{ 'document.import_eml' | translate }}</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row search-dropdown-anchor">
|
<div class="row search-dropdown-anchor">
|
||||||
<div class="col-xs-2 tag-tree-dropdown" uib-dropdown>
|
<div class="col-xs-2 tag-tree-dropdown" uib-dropdown>
|
||||||
|
10
docs-web/src/main/webapp/src/partial/docs/import.html
Normal file
10
docs-web/src/main/webapp/src/partial/docs/import.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<form name="form">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3>{{ 'import.title' | translate }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<uib-progressbar max="100" value="progress * 100"></uib-progressbar>
|
||||||
|
<div uib-alert class="alert-danger" ng-if="errorQuota">{{ 'import.error_quota' | translate }}</div>
|
||||||
|
<div uib-alert class="alert-danger" ng-if="errorGeneral">{{ 'import.error_general' | translate }}</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
Loading…
Reference in New Issue
Block a user