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
d61dff1e
Commit
d61dff1e
authored
8 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-2596: remove participants can send emails (patch S. Clemenz)
parent
e8c47027
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/bps/course/nodes/den/DENManageParticipantsController.java
+31
-54
31 additions, 54 deletions
...bps/course/nodes/den/DENManageParticipantsController.java
with
31 additions
and
54 deletions
src/main/java/de/bps/course/nodes/den/DENManageParticipantsController.java
+
31
−
54
View file @
d61dff1e
...
@@ -63,6 +63,9 @@ import de.bps.course.nodes.DENCourseNode;
...
@@ -63,6 +63,9 @@ import de.bps.course.nodes.DENCourseNode;
public
class
DENManageParticipantsController
extends
BasicController
{
public
class
DENManageParticipantsController
extends
BasicController
{
public
static
final
String
ADD_ACTION
=
"denAddParticipants"
;
public
static
final
String
REMOVE_ACTION
=
"denRemoveParticipants"
;
private
DENCourseNode
courseNode
;
private
DENCourseNode
courseNode
;
private
OLATResourceable
ores
;
private
OLATResourceable
ores
;
private
DENStatus
status
;
private
DENStatus
status
;
...
@@ -82,11 +85,10 @@ public class DENManageParticipantsController extends BasicController {
...
@@ -82,11 +85,10 @@ public class DENManageParticipantsController extends BasicController {
private
KalendarEvent
selectedEvent
;
private
KalendarEvent
selectedEvent
;
//mail notification
//mail notification
private
MailNotificationEditController
addedNotificationCtr
,
removedN
otificationCtr
;
private
MailNotificationEditController
n
otificationCtr
;
private
ContactFormController
contactCtr
;
private
ContactFormController
contactCtr
;
private
CloseableModalController
notificationCmc
;
private
CloseableModalController
notificationCmc
;
private
List
<
Identity
>
added
=
new
ArrayList
<
Identity
>();
private
List
<
Identity
>
selectedIds
=
new
ArrayList
<
Identity
>();
private
List
<
Identity
>
removed
=
new
ArrayList
<
Identity
>();
private
CloseableModalController
manageParticipantsModalCntrl
;
private
CloseableModalController
manageParticipantsModalCntrl
;
...
@@ -157,11 +159,11 @@ public class DENManageParticipantsController extends BasicController {
...
@@ -157,11 +159,11 @@ public class DENManageParticipantsController extends BasicController {
BitSet
selection
=
tmse
.
getSelection
();
BitSet
selection
=
tmse
.
getSelection
();
//delete all users from the selected dates
//delete all users from the selected dates
if
(
tmse
.
getAction
().
equals
(
DENListTableDataModel
.
DELETE_ACTION
)
&&
selection
.
cardinality
()
>
0
)
{
if
(
tmse
.
getAction
().
equals
(
DENListTableDataModel
.
DELETE_ACTION
)
&&
selection
.
cardinality
()
>
0
)
{
removed
=
denManager
.
getSelectedEventParticipants
(
dateList
,
selection
);
selectedIds
=
denManager
.
getSelectedEventParticipants
(
dateList
,
selection
);
dateList
=
denManager
.
deleteParticipants
(
ores
,
courseNode
,
denManager
.
getSelectedEventIDs
(
dateList
,
selection
));
dateList
=
denManager
.
deleteParticipants
(
ores
,
courseNode
,
denManager
.
getSelectedEventIDs
(
dateList
,
selection
));
listTableData
.
setObjects
(
dateList
);
listTableData
.
setObjects
(
dateList
);
//send notification mail
//send notification mail
create
Removed
NotificationMail
(
ureq
,
dateList
.
get
(
0
).
getSubject
()
);
createNotificationMail
(
ureq
,
courseNode
.
getShortTitle
(),
REMOVE_ACTION
);
}
else
if
(
tmse
.
getAction
().
equals
(
DENListTableDataModel
.
MAIL_ACTION
)
&&
selection
.
cardinality
()
>
0
)
{
}
else
if
(
tmse
.
getAction
().
equals
(
DENListTableDataModel
.
MAIL_ACTION
)
&&
selection
.
cardinality
()
>
0
)
{
//send email to all users from the selected dates
//send email to all users from the selected dates
List
<
Identity
>
participants
=
denManager
.
getSelectedEventParticipants
(
dateList
,
selection
);
List
<
Identity
>
participants
=
denManager
.
getSelectedEventParticipants
(
dateList
,
selection
);
...
@@ -175,7 +177,7 @@ public class DENManageParticipantsController extends BasicController {
...
@@ -175,7 +177,7 @@ public class DENManageParticipantsController extends BasicController {
userSearchCMC
.
deactivate
();
userSearchCMC
.
deactivate
();
}
else
{
}
else
{
List
<
Identity
>
toAdd
=
null
;
List
<
Identity
>
toAdd
=
null
;
added
=
new
ArrayList
<
Identity
>();
selectedIds
=
new
ArrayList
<
Identity
>();
if
(
event
instanceof
SingleIdentityChosenEvent
)
{
if
(
event
instanceof
SingleIdentityChosenEvent
)
{
SingleIdentityChosenEvent
singleEvent
=
(
SingleIdentityChosenEvent
)
event
;
SingleIdentityChosenEvent
singleEvent
=
(
SingleIdentityChosenEvent
)
event
;
Identity
choosenIdentity
=
singleEvent
.
getChosenIdentity
();
Identity
choosenIdentity
=
singleEvent
.
getChosenIdentity
();
...
@@ -192,16 +194,16 @@ public class DENManageParticipantsController extends BasicController {
...
@@ -192,16 +194,16 @@ public class DENManageParticipantsController extends BasicController {
if
(!
status
.
isEnrolled
()
&&
status
.
getErrorMessage
().
equals
(
DENStatus
.
ERROR_ALREADY_ENROLLED
))
if
(!
status
.
isEnrolled
()
&&
status
.
getErrorMessage
().
equals
(
DENStatus
.
ERROR_ALREADY_ENROLLED
))
showMessage
=
true
;
showMessage
=
true
;
else
else
added
.
add
(
identity
);
selectedIds
.
add
(
identity
);
}
}
if
(
showMessage
)
if
(
showMessage
)
showWarning
(
"enrollment.warning.manual"
);
showWarning
(
"enrollment.warning.manual"
);
refreshTables
();
refreshTables
();
}
}
userSearchCMC
.
deactivate
();
userSearchCMC
.
deactivate
();
if
(
added
.
size
()
>
0
)
{
if
(
selectedIds
.
size
()
>
0
)
{
//write notification mail
//write notification mail
create
Added
NotificationMail
(
ureq
,
dateList
.
get
(
0
)
.
getSubject
());
createNotificationMail
(
ureq
,
selectedEvent
.
getSubject
()
,
ADD_ACTION
);
}
}
}
}
...
@@ -215,9 +217,9 @@ public class DENManageParticipantsController extends BasicController {
...
@@ -215,9 +217,9 @@ public class DENManageParticipantsController extends BasicController {
if
(!
status
.
isCancelled
())
showError
();
if
(!
status
.
isCancelled
())
showError
();
//send notification mail
//send notification mail
else
{
else
{
removed
.
clear
();
selectedIds
.
clear
();
removed
.
add
(
identity
);
selectedIds
.
add
(
identity
);
create
Removed
NotificationMail
(
ureq
,
dateList
.
get
(
0
).
getSubject
()
);
createNotificationMail
(
ureq
,
selectedEvent
.
getSubject
(),
REMOVE_ACTION
);
}
}
refreshTables
();
refreshTables
();
//write email to single user
//write email to single user
...
@@ -227,40 +229,22 @@ public class DENManageParticipantsController extends BasicController {
...
@@ -227,40 +229,22 @@ public class DENManageParticipantsController extends BasicController {
createParticipantsMail
(
ureq
,
participants
);
createParticipantsMail
(
ureq
,
participants
);
}
}
}
}
}
else
if
(
source
==
addedN
otificationCtr
&&
event
==
Event
.
DONE_EVENT
)
{
}
else
if
(
source
==
n
otificationCtr
&&
event
==
Event
.
DONE_EVENT
)
{
if
(
addedN
otificationCtr
.
getMailTemplate
()
!=
null
)
{
if
(
n
otificationCtr
.
getMailTemplate
()
!=
null
)
{
Identity
sender
=
ureq
.
getIdentity
();
Identity
sender
=
ureq
.
getIdentity
();
MailerResult
result
=
new
MailerResult
();
MailerResult
result
=
new
MailerResult
();
String
metaId
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
String
metaId
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
MailContext
context
=
new
MailContextImpl
(
getWindowControl
().
getBusinessControl
().
getAsString
());
MailContext
context
=
new
MailContextImpl
(
getWindowControl
().
getBusinessControl
().
getAsString
());
MailBundle
[]
bundles
=
mailManager
.
makeMailBundles
(
context
,
added
,
addedN
otificationCtr
.
getMailTemplate
(),
sender
,
metaId
,
result
);
MailBundle
[]
bundles
=
mailManager
.
makeMailBundles
(
context
,
selectedIds
,
n
otificationCtr
.
getMailTemplate
(),
sender
,
metaId
,
result
);
result
.
append
(
mailManager
.
sendMessage
(
bundles
));
result
.
append
(
mailManager
.
sendMessage
(
bundles
));
if
(
addedN
otificationCtr
.
getMailTemplate
().
getCpfrom
())
{
if
(
n
otificationCtr
.
getMailTemplate
().
getCpfrom
())
{
MailBundle
ccBundles
=
mailManager
.
makeMailBundle
(
context
,
sender
,
addedN
otificationCtr
.
getMailTemplate
(),
sender
,
metaId
,
result
);
MailBundle
ccBundles
=
mailManager
.
makeMailBundle
(
context
,
sender
,
n
otificationCtr
.
getMailTemplate
(),
sender
,
metaId
,
result
);
result
.
append
(
mailManager
.
sendMessage
(
ccBundles
));
result
.
append
(
mailManager
.
sendMessage
(
ccBundles
));
}
}
MailHelper
.
printErrorsAndWarnings
(
result
,
getWindowControl
(),
ureq
.
getLocale
());
MailHelper
.
printErrorsAndWarnings
(
result
,
getWindowControl
(),
ureq
.
getLocale
());
}
}
notificationCmc
.
deactivate
();
notificationCmc
.
deactivate
();
added
.
clear
();
selectedIds
.
clear
();
}
else
if
(
source
==
removedNotificationCtr
&&
event
==
Event
.
DONE_EVENT
)
{
if
(
removedNotificationCtr
.
getMailTemplate
()
!=
null
)
{
//fxdiff VCRP-16: intern mail system
Identity
sender
=
ureq
.
getIdentity
();
MailerResult
result
=
new
MailerResult
();
String
metaId
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
MailContext
context
=
new
MailContextImpl
(
getWindowControl
().
getBusinessControl
().
getAsString
());
MailBundle
[]
bundles
=
mailManager
.
makeMailBundles
(
context
,
added
,
addedNotificationCtr
.
getMailTemplate
(),
sender
,
metaId
,
result
);
result
.
append
(
mailManager
.
sendMessage
(
bundles
));
if
(
addedNotificationCtr
.
getMailTemplate
().
getCpfrom
())
{
MailBundle
ccBundle
=
mailManager
.
makeMailBundle
(
context
,
sender
,
addedNotificationCtr
.
getMailTemplate
(),
sender
,
metaId
,
result
);
result
.
append
(
mailManager
.
sendMessage
(
ccBundle
));
}
MailHelper
.
printErrorsAndWarnings
(
result
,
getWindowControl
(),
ureq
.
getLocale
());
}
notificationCmc
.
deactivate
();
removed
.
clear
();
}
else
if
(
source
==
contactCtr
)
{
}
else
if
(
source
==
contactCtr
)
{
notificationCmc
.
deactivate
();
notificationCmc
.
deactivate
();
}
}
...
@@ -304,28 +288,21 @@ public class DENManageParticipantsController extends BasicController {
...
@@ -304,28 +288,21 @@ public class DENManageParticipantsController extends BasicController {
tableListParticipants
.
setTableDataModel
(
listTableData
);
tableListParticipants
.
setTableDataModel
(
listTableData
);
}
}
private
void
createAddedNotificationMail
(
UserRequest
ureq
,
String
subjectStr
)
{
private
void
createNotificationMail
(
UserRequest
ureq
,
String
subjectStr
,
String
action
)
{
MailTemplate
mailTempl
=
denManager
.
getAddedMailTemplate
(
ureq
,
subjectStr
,
getTranslator
());
MailTemplate
mailTempl
;
removeAsListenerAndDispose
(
addedNotificationCtr
);
if
(
action
.
equals
(
REMOVE_ACTION
))
{
mailTempl
=
denManager
.
getRemovedMailTemplate
(
ureq
,
subjectStr
,
getTranslator
());
addedNotificationCtr
=
new
MailNotificationEditController
(
getWindowControl
(),
ureq
,
mailTempl
,
false
,
false
,
true
);
}
else
{
listenTo
(
addedNotificationCtr
);
mailTempl
=
denManager
.
getAddedMailTemplate
(
ureq
,
subjectStr
,
getTranslator
());
}
removeAsListenerAndDispose
(
notificationCmc
);
notificationCmc
=
new
CloseableModalController
(
getWindowControl
(),
"close"
,
addedNotificationCtr
.
getInitialComponent
());
listenTo
(
notificationCmc
);
notificationCmc
.
activate
();
removeAsListenerAndDispose
(
notificationCtr
);
}
private
void
createRemovedNotificationMail
(
UserRequest
ureq
,
String
subjectStr
)
{
notificationCtr
=
new
MailNotificationEditController
(
getWindowControl
(),
ureq
,
mailTempl
,
false
,
false
,
true
);
MailTemplate
mailTempl
=
denManager
.
getRemovedMailTemplate
(
ureq
,
subjectStr
,
getTranslator
());
listenTo
(
notificationCtr
);
removeAsListenerAndDispose
(
addedNotificationCtr
);
addedNotificationCtr
=
new
MailNotificationEditController
(
getWindowControl
(),
ureq
,
mailTempl
,
false
,
false
,
true
);
listenTo
(
addedNotificationCtr
);
removeAsListenerAndDispose
(
notificationCmc
);
removeAsListenerAndDispose
(
notificationCmc
);
notificationCmc
=
new
CloseableModalController
(
getWindowControl
(),
"close"
,
addedN
otificationCtr
.
getInitialComponent
());
notificationCmc
=
new
CloseableModalController
(
getWindowControl
(),
"close"
,
n
otificationCtr
.
getInitialComponent
());
listenTo
(
notificationCmc
);
listenTo
(
notificationCmc
);
notificationCmc
.
activate
();
notificationCmc
.
activate
();
...
...
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