Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
7528a9a4
Commit
7528a9a4
authored
7 years ago
by
hg
Browse files
Options
Downloads
Patches
Plain Diff
OO-3272: Portrait and logo should only be deleted if save button is clicked
parent
7d8f7cba
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/olat/user/ProfileFormController.java
+22
-18
22 additions, 18 deletions
src/main/java/org/olat/user/ProfileFormController.java
with
22 additions
and
18 deletions
src/main/java/org/olat/user/ProfileFormController.java
+
22
−
18
View file @
7528a9a4
...
...
@@ -98,6 +98,8 @@ public class ProfileFormController extends FormBasicController {
private
final
boolean
isAdministrativeUser
;
private
final
List
<
UserPropertyHandler
>
userPropertyHandlers
;
private
boolean
portraitDeleted
=
false
;
private
boolean
logoDeleted
=
false
;
private
boolean
emailChanged
=
false
;
private
String
changedEmail
;
private
String
currentEmail
;
...
...
@@ -386,19 +388,12 @@ public class ProfileFormController extends FormBasicController {
if
(
source
==
portraitUpload
)
{
if
(
event
instanceof
FileElementEvent
)
{
if
(
FileElementEvent
.
DELETE
.
equals
(
event
.
getCommand
()))
{
File
img
=
dps
.
getLargestPortrait
(
identityToModify
.
getName
());
portraitDeleted
=
true
;
portraitUpload
.
setInitialFile
(
null
);
if
(
portraitUpload
.
getUploadFile
()
!=
null
)
{
portraitUpload
.
reset
();
if
(
img
!=
null
)
{
portraitUpload
.
setInitialFile
(
img
);
}
}
else
if
(
img
!=
null
)
{
dps
.
deletePortrait
(
identityToModify
);
portraitUpload
.
setInitialFile
(
null
);
notifyPortraitChanged
();
}
flc
.
setDirty
(
true
);
}
}
else
if
(
portraitUpload
.
isUploadSuccess
())
{
flc
.
setDirty
(
true
);
...
...
@@ -406,19 +401,12 @@ public class ProfileFormController extends FormBasicController {
}
else
if
(
source
==
logoUpload
)
{
if
(
event
instanceof
FileElementEvent
)
{
if
(
FileElementEvent
.
DELETE
.
equals
(
event
.
getCommand
()))
{
File
img
=
dps
.
getLargestLogo
(
identityToModify
.
getName
());
logoDeleted
=
true
;
logoUpload
.
setInitialFile
(
null
);
if
(
logoUpload
.
getUploadFile
()
!=
null
)
{
logoUpload
.
reset
();
if
(
img
!=
null
)
{
logoUpload
.
setInitialFile
(
img
);
}
}
else
if
(
img
!=
null
)
{
dps
.
deleteLogo
(
identityToModify
);
logoUpload
.
setInitialFile
(
null
);
notifyPortraitChanged
();
}
flc
.
setDirty
(
true
);
}
}
else
if
(
logoUpload
.
isUploadSuccess
())
{
flc
.
setDirty
(
true
);
...
...
@@ -445,6 +433,14 @@ public class ProfileFormController extends FormBasicController {
}
}
if
(
portraitDeleted
)
{
File
img
=
dps
.
getLargestPortrait
(
identityToModify
.
getName
());
if
(
img
!=
null
)
{
dps
.
deletePortrait
(
identityToModify
);
notifyPortraitChanged
();
}
}
File
uploadedImage
=
portraitUpload
.
getUploadFile
();
String
uploadedFilename
=
portraitUpload
.
getUploadFileName
();
if
(
uploadedImage
!=
null
)
{
...
...
@@ -452,6 +448,14 @@ public class ProfileFormController extends FormBasicController {
notifyPortraitChanged
();
}
if
(
logoDeleted
)
{
File
img
=
dps
.
getLargestLogo
(
identityToModify
.
getName
());
if
(
img
!=
null
)
{
dps
.
deleteLogo
(
identityToModify
);
notifyPortraitChanged
();
}
}
if
(
logoUpload
!=
null
)
{
File
uploadedLogo
=
logoUpload
.
getUploadFile
();
String
uploadedLogoname
=
logoUpload
.
getUploadFileName
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment