Skip to content
Snippets Groups Projects
Commit 56b8ef85 authored by srosse's avatar srosse
Browse files

OO-1516: better check if the map exists and show a warning if it doesn't

parent f45201a1
No related branches found
No related tags found
No related merge requests found
......@@ -609,19 +609,17 @@ public class EPFrontendManager implements UserDataDeletable, DeletableGroupData
* sync map with its former source (template)
*/
public boolean synchronizeStructuredMapToUserCopy(PortfolioStructureMap map) {
final EPStructuredMap userMap = (EPStructuredMap) map;
final EPStructureManager structMgr = structureManager; // only remove
// synthetic access
// warnings
if(map == null) return false;
final EPStructuredMap userMap = (EPStructuredMap)map;
Boolean synched = coordinator.getSyncer().doInSync(map.getOlatResource(), new SyncerCallback<Boolean>() {
public Boolean execute() {
if (userMap.getStructuredMapSource() == null) { return Boolean.FALSE; }
// need to reload it, I don't know why
Long templateKey = userMap.getStructuredMapSource().getKey();
userMap.setLastSynchedDate(new Date());
PortfolioStructure template = structMgr.loadPortfolioStructureByKey(templateKey);
structMgr.syncStructureRecursively(template, userMap, true);
PortfolioStructure template = structureManager.loadPortfolioStructureByKey(templateKey);
structureManager.syncStructureRecursively(template, userMap, true);
return Boolean.TRUE;
}
});
......
......@@ -107,7 +107,16 @@ public class EPMapViewController extends BasicController implements Activateable
if (map instanceof EPStructuredMap && (map.getStatus() == null || !map.getStatus().equals(StructureStatusEnum.CLOSED) )){
map = (PortfolioStructureMap) ePFMgr.loadPortfolioStructureByKey(map.getKey());
boolean syncOk = ePFMgr.synchronizeStructuredMapToUserCopy(map);
if (syncOk) showInfo("synced.map.success");
if (syncOk) {
showInfo("synced.map.success");
} else if(map == null) {
showWarning("synced.map.deleted");
putInitialPanel(createVelocityContainer("map_deleted"));
return;
} else {
showError("synced.map.error");
}
}
if(EPSecurityCallbackFactory.isLockNeeded(secCallback)) {
......
<div class="o_warning">$r.translate("synced.map.deleted")</div>
\ No newline at end of file
......@@ -97,6 +97,8 @@ map.share.invitation.mail.success=Die eingeladenen Personen wurden erfolgreich p
map.share.invitation.mail.failure=Fehler beim Versenden der E-Mail. Die eingeladenen Personen konnten nicht per E-Mail benachrichtigt werden. Versuchen Sie es später noch einmal oder kontaktieren Sie den Support.
map.is.closed.hint=Mappe geschlossen
synced.map.success=Diese Mappe wurde mit der ursprünglichen Vorlage synchronisiert.
synced.map.deleted=Diese Mappe wurde gelöscht.
synced.map.error=Diese Mappe konnte nicht mit der ursprünglichen Vorlage synchronisiert werden.
map.style.default=Schlicht
map.style.comic=Comic
map.style.leather=Leder
......
......@@ -134,6 +134,8 @@ restrict.show.limited=Show only those binders released for me
restrictions.not.conform=You haven't abided by all restrictions. Please mind the requirements.
save.and.open.map=Save and open binder
synced.map.success=This folder has been synchronized with its original template.
synced.map.deleted=This folder was deleted.
synced.map.error=This folder cannot be synchronized with its original template.
template.alreadyInUse=This template has already been copied by at least one user. When modifying your template this copy will be synchronized as well. It is possible to delete elements or expand your template; however, links to artefacts already existing may be lost\!
toc=Table of contents
view.map=Open
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