Skip to content
Snippets Groups Projects
Commit 0c56bab2 authored by srosse's avatar srosse
Browse files

OO-3508: export file dialog uploaded by user

parent 934dab69
No related branches found
No related tags found
No related merge requests found
Showing
with 136 additions and 4 deletions
......@@ -99,7 +99,7 @@ public class DeletedUsersController extends FormBasicController {
tableEl.setCustomizeColumns(true);
tableEl.setEmtpyTableMessageKey("error.no.user.found");
tableEl.setExportEnabled(false);
tableEl.setAndLoadPersistedPreferences(ureq, "deleted-user-list");
tableEl.setAndLoadPersistedPreferences(ureq, "deleted-user-list-v2");
}
@Override
......
......@@ -66,7 +66,7 @@ public class DeletedUsersTableModel extends DefaultFlexiTableDataSourceModel<Del
}
public enum DeletedCols implements FlexiSortableColumnDef {
username("table.identity.name"),
username("table.identity.deleted.name"),
firstName("table.name.firstName"),
lastName("table.name.lastName"),
deletedDate("table.identity.deleteddate"),
......
......@@ -81,6 +81,7 @@ new.user.cancel=Die Aktion wurde abgebrochen. Es wurde keine neues Benutzerkonto
new.user.successful=Das neue Benutzerkonto wurde angelegt.
notification.noNews=Seit diesem Datum haben sich keine neue Benutzer angemeldet
notification.noSubscription=Sie haben Benachrichtigung \u00FCber neue Benutzer nicht abonniert
owner=Kursbesitzer
poolsmanager=Poolverwalter
repocoach=Kursbetreuer
rightForm.error.anonymous.no.roles=Anonyme G\u00E4ste k\u00F6nnen keine Systemrollen wahrnehmen
......@@ -143,7 +144,8 @@ table.header.vcard=Visitenkarte
table.identity.action=Aktion
table.identity.deletedby=Gel\u00F6scht von
table.identity.deleteddate=Gel\u00F6scht am
table.identity.deletedroles=Rolen
table.identity.deletedroles=Rollen
table.identity.deleted.name=Del_Benutzername
table.identity.vcard=<i class\='o_icon o_icon-lg o_icon_home'> </i>
table.identity.creationdate=Erstellt
table.identity.lastlogin=letzter Login
......
......@@ -81,6 +81,7 @@ new.user.cancel=Action cancelled. No new user account created.
new.user.successful=The new user account has been created successfully.
notification.noNews=No new users have logged on since that date.
notification.noSubscription=You have not subscribed to get news about new users.
owner=Course owner
poolsmanager=Question bank manager
repocoach=Course coach
rightForm.error.anonymous.no.roles=Anonymous guests cannot exercise system roles
......@@ -144,6 +145,7 @@ table.identity.creationdate=Created
table.identity.deletedby=Deleted by
table.identity.deleteddate=Deleted
table.identity.deletedroles=Roles
table.identity.deleted.name=Del_User name
table.identity.lastlogin=Last login
table.identity.name=User name
table.identity.vcard=<i class\='o_icon o_icon-lg o_icon_home'> </i>
......
......@@ -265,7 +265,7 @@ public class UserDeletionManager extends BasicManager {
// Delete data of modules that implement the user data deletable
String anonymisedIdentityName = identity.getKey().toString();
String anonymisedIdentityName = "del_" + identity.getKey().toString();
Map<String,UserDataDeletable> userDataDeletableResourcesMap = CoreSpringFactory.getBeansOfType(UserDataDeletable.class);
List<UserDataDeletable> userDataDeletableResources = new ArrayList<>(userDataDeletableResourcesMap.values());
// Start with high priorities (900: user manager), then continue with
......
......@@ -21,6 +21,7 @@ package org.olat.course.nodes.dialog;
import java.util.List;
import org.olat.basesecurity.IdentityRef;
import org.olat.core.id.Identity;
import org.olat.core.util.vfs.VFSContainer;
import org.olat.core.util.vfs.VFSLeaf;
......@@ -40,6 +41,13 @@ public interface DialogElementsManager {
public List<DialogElement> getDialogElements(RepositoryEntryRef entry, String subIdent);
/**
*
* @param author The author of the elements
* @return A list of dialog elements
*/
public List<DialogElement> getDialogElements(IdentityRef author);
public DialogElement getDialogElementByForum(Long forumKey);
public DialogElement getDialogElementByKey(Long elementKey);
......
......@@ -22,6 +22,7 @@ package org.olat.course.nodes.dialog.manager;
import java.util.Date;
import java.util.List;
import org.olat.basesecurity.IdentityRef;
import org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl;
import org.olat.core.commons.persistence.DB;
import org.olat.core.id.Identity;
......@@ -87,6 +88,20 @@ public class DialogElementsManagerImpl implements DialogElementsManager {
.getResultList();
}
@Override
public List<DialogElement> getDialogElements(IdentityRef author) {
StringBuilder sb = new StringBuilder();
sb.append("select element from dialogelement as element")
.append(" inner join fetch element.entry entry")
.append(" inner join element.author author")
.append(" where author.key=:identityKey");
return dbInstance.getCurrentEntityManager()
.createQuery(sb.toString(), DialogElement.class)
.setParameter("identityKey", author.getKey())
.getResultList();
}
@Override
public DialogElement getDialogElementByForum(Long forumKey) {
StringBuilder sb = new StringBuilder();
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.dialog.manager;
import java.io.File;
import java.util.List;
import java.util.Locale;
import org.olat.core.id.Identity;
import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing;
import org.olat.core.util.FileUtils;
import org.olat.core.util.StringHelper;
import org.olat.core.util.vfs.VFSLeaf;
import org.olat.course.CourseFactory;
import org.olat.course.ICourse;
import org.olat.course.nodes.CourseNode;
import org.olat.course.nodes.dialog.DialogElement;
import org.olat.course.nodes.dialog.DialogElementsManager;
import org.olat.repository.RepositoryEntry;
import org.olat.user.UserDataExportable;
import org.olat.user.manager.ManifestBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
* Initial date: 29 mai 2018<br>
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*
*/
@Service
public class DialogElementsUserDataManager implements UserDataExportable {
private static final OLog log = Tracing.createLoggerFor(DialogElementsUserDataManager.class);
@Autowired
private DialogElementsManager dialogElementsManager;
@Override
public String getExporterID() {
return "dialog";
}
@Override
public void export(Identity identity, ManifestBuilder manifest, File archiveDirectory, Locale locale) {
List<DialogElement> elements = dialogElementsManager.getDialogElements(identity);
File elementsArchiveDirectory = new File(archiveDirectory, "FileDialogs");
for(DialogElement element:elements) {
exportElement(element, elementsArchiveDirectory);
}
}
private void exportElement(DialogElement element, File elementsArchiveDirectory) {
VFSLeaf file = dialogElementsManager.getDialogLeaf(element);
if(file != null && file.exists()) {
RepositoryEntry entry = element.getEntry();
String name = StringHelper.transformDisplayNameToFileSystemName(entry.getDisplayname()) +
"_" + getNodeName(element);
File elementDir = new File(elementsArchiveDirectory, name);
elementDir.mkdirs();
FileUtils.copyItemToDir(file, elementDir, "Copy file dialog");
}
}
private String getNodeName(DialogElement element) {
try {
RepositoryEntry entry = element.getEntry();
ICourse course = CourseFactory.loadCourse(entry.getOlatResource().getResourceableId());
CourseNode node = course.getRunStructure().getNode(element.getSubIdent());
if(node == null) {
return element.getSubIdent();
}
if(StringHelper.containsNonWhitespace(node.getShortTitle())) {
return node.getShortTitle();
}
if(StringHelper.containsNonWhitespace(node.getLongTitle())) {
return node.getLongTitle();
}
return element.getSubIdent();
} catch (Exception e) {
log.error("", e);
return element.getSubIdent();
}
}
}
......@@ -5,6 +5,7 @@ calendars=Kalendareintr\u00E4ge
certificates=Certifikaten
chat=Chat
comments.ratings=Kommentaren und Bewertungen
dialog=Dateidiscussion
disclaimer=Nutzungsbedigung
display.portrait=Profilbild
download.data=Dateien herunterladen
......
......@@ -5,6 +5,7 @@ calendars=Calendars
certificates=Certificates
chat=Chat messages
comments.ratings=Comments and ratings
dialog=File dialog
disclaimer=Disclaimer
display.portrait=Published image
download.data=Download the data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment