#13: Display the document's creator

This commit is contained in:
jendib 2015-05-09 16:21:59 +02:00
parent fc1bb22d8d
commit 82ba0b5761
5 changed files with 12 additions and 6 deletions

View File

@ -26,9 +26,10 @@ Features
- Full text search in image and PDF - Full text search in image and PDF
- SHA-256 encryption - SHA-256 encryption
- Tag system - Tag system
- Multi-users - Multi-users ACL system
- Document sharing - Document sharing by URL
- RESTful Web API - RESTful Web API
- Modern Android client
Download Download
-------- --------

View File

@ -38,6 +38,7 @@ import com.sismics.docs.core.dao.jpa.AclDao;
import com.sismics.docs.core.dao.jpa.DocumentDao; import com.sismics.docs.core.dao.jpa.DocumentDao;
import com.sismics.docs.core.dao.jpa.FileDao; import com.sismics.docs.core.dao.jpa.FileDao;
import com.sismics.docs.core.dao.jpa.TagDao; import com.sismics.docs.core.dao.jpa.TagDao;
import com.sismics.docs.core.dao.jpa.UserDao;
import com.sismics.docs.core.dao.jpa.criteria.DocumentCriteria; import com.sismics.docs.core.dao.jpa.criteria.DocumentCriteria;
import com.sismics.docs.core.dao.jpa.dto.AclDto; import com.sismics.docs.core.dao.jpa.dto.AclDto;
import com.sismics.docs.core.dao.jpa.dto.DocumentDto; import com.sismics.docs.core.dao.jpa.dto.DocumentDto;
@ -83,6 +84,7 @@ public class DocumentResource extends BaseResource {
DocumentDao documentDao = new DocumentDao(); DocumentDao documentDao = new DocumentDao();
AclDao aclDao = new AclDao(); AclDao aclDao = new AclDao();
UserDao userDao = new UserDao();
Document documentDb; Document documentDb;
try { try {
documentDb = documentDao.getDocument(documentId); documentDb = documentDao.getDocument(documentId);
@ -101,7 +103,7 @@ public class DocumentResource extends BaseResource {
document.put("description", documentDb.getDescription()); document.put("description", documentDb.getDescription());
document.put("create_date", documentDb.getCreateDate().getTime()); document.put("create_date", documentDb.getCreateDate().getTime());
document.put("language", documentDb.getLanguage()); document.put("language", documentDb.getLanguage());
document.put("creator", documentDb.getUserId()); document.put("creator", userDao.getById(documentDb.getUserId()).getUsername());
// Add tags // Add tags
TagDao tagDao = new TagDao(); TagDao tagDao = new TagDao();

View File

@ -117,6 +117,7 @@ angular.module('docs').controller('DocumentView', function ($scope, $state, $sta
// Display the new share ACL and add it to the local ACLs // Display the new share ACL and add it to the local ACLs
$scope.showShare(acl); $scope.showShare(acl);
$scope.document.acls.push(acl); $scope.document.acls.push(acl);
$scope.document.acls = angular.copy($scope.document.acls);
}) })
}); });
}; };

View File

@ -6,7 +6,9 @@
angular.module('docs').controller('Login', function($scope, $rootScope, $state, $dialog, User) { angular.module('docs').controller('Login', function($scope, $rootScope, $state, $dialog, User) {
$scope.login = function() { $scope.login = function() {
User.login($scope.user).then(function() { User.login($scope.user).then(function() {
$rootScope.userInfo = User.userInfo(true); User.userInfo(true).then(function(data) {
$rootScope.userInfo = data;
});
$state.transitionTo('document.default'); $state.transitionTo('document.default');
}, function() { }, function() {
var title = 'Login failed'; var title = 'Login failed';

View File

@ -10,7 +10,7 @@
<div class="page-header"> <div class="page-header">
<h1> <h1>
{{ document.title }} <small>{{ document.create_date | date: 'yyyy-MM-dd' }}</small> {{ document.title }} <small>{{ document.create_date | date: 'yyyy-MM-dd' }} by {{ document.creator }}</small>
<img ng-if="document" ng-src="img/flag/{{ document.language }}.png" title="{{ document.language }}" /> <img ng-if="document" ng-src="img/flag/{{ document.language }}.png" title="{{ document.language }}" />
<a ng-href="../api/file/zip?id={{ document.id }}" class="btn btn-default" title="Download all files"> <a ng-href="../api/file/zip?id={{ document.id }}" class="btn btn-default" title="Download all files">
<span class="glyphicon glyphicon-download-alt"></span> <span class="glyphicon glyphicon-download-alt"></span>
@ -92,7 +92,7 @@
<td> <td>
<span class="label label-default" style="margin-right: 6px;" ng-repeat="a in acl | orderBy: 'perm'"> <span class="label label-default" style="margin-right: 6px;" ng-repeat="a in acl | orderBy: 'perm'">
{{ a.perm }} {{ a.perm }}
<span ng-show="document.creator != a.id && document.writable" <span ng-show="document.creator != a.name && a.type == 'USER' && document.writable"
class="glyphicon glyphicon-remove pointer" class="glyphicon glyphicon-remove pointer"
ng-click="deleteAcl(a)"></span> ng-click="deleteAcl(a)"></span>
</span> </span>