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
7dd93588
Commit
7dd93588
authored
4 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-5279: check the provider to remove them all
parent
13c0018c
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/commons/calendar/ui/ExternalLinksController.java
+11
-12
11 additions, 12 deletions
...org/olat/commons/calendar/ui/ExternalLinksController.java
with
11 additions
and
12 deletions
src/main/java/org/olat/commons/calendar/ui/ExternalLinksController.java
+
11
−
12
View file @
7dd93588
...
@@ -124,36 +124,36 @@ public class ExternalLinksController extends FormBasicController {
...
@@ -124,36 +124,36 @@ public class ExternalLinksController extends FormBasicController {
String
id
=
link
.
getId
();
String
id
=
link
.
getId
();
String
uri
=
link
.
getLink
().
getURI
();
String
uri
=
link
.
getLink
().
getURI
();
if
(!
StringHelper
.
containsNonWhitespace
(
uri
))
{
if
(!
StringHelper
.
containsNonWhitespace
(
uri
))
{
uri
=
"http://"
;
uri
=
"http
s
://"
;
}
}
TextElement
url
=
uifactory
.
addTextElement
(
"url_"
+
id
,
null
,
-
1
,
uri
,
layoutContainer
);
TextElement
url
=
uifactory
.
addTextElement
(
"url_"
.
concat
(
id
)
,
null
,
-
1
,
uri
,
layoutContainer
);
url
.
clearError
();
url
.
clearError
();
url
.
setDisplaySize
(
60
);
url
.
setDisplaySize
(
60
);
url
.
setMandatory
(
true
);
url
.
setMandatory
(
true
);
link
.
setUrl
(
url
);
link
.
setUrl
(
url
);
// add link description
// add link description
TextElement
name
=
uifactory
.
addTextElement
(
"displayName_"
+
id
,
null
,
-
1
,
link
.
getLink
().
getDisplayName
(),
layoutContainer
);
TextElement
name
=
uifactory
.
addTextElement
(
"displayName_"
.
concat
(
id
)
,
null
,
-
1
,
link
.
getLink
().
getDisplayName
(),
layoutContainer
);
name
.
clearError
();
name
.
clearError
();
name
.
setDisplaySize
(
40
);
name
.
setDisplaySize
(
40
);
name
.
setMandatory
(
true
);
name
.
setMandatory
(
true
);
link
.
setName
(
name
);
link
.
setName
(
name
);
// add link add action button
// add link add action button
FormLink
addButton
=
uifactory
.
addFormLink
(
"add_"
+
id
,
"table.add"
,
"table.add"
,
layoutContainer
,
Link
.
BUTTON
);
FormLink
addButton
=
uifactory
.
addFormLink
(
"add_"
.
concat
(
id
)
,
"table.add"
,
"table.add"
,
layoutContainer
,
Link
.
BUTTON
);
addButton
.
setUserObject
(
link
);
addButton
.
setUserObject
(
link
);
link
.
setAddButton
(
addButton
);
link
.
setAddButton
(
addButton
);
// add link deletion action button
// add link deletion action button
FormLink
delButton
=
uifactory
.
addFormLink
(
"del_"
+
id
,
"table.delete"
,
"table.delete"
,
layoutContainer
,
Link
.
BUTTON
);
FormLink
delButton
=
uifactory
.
addFormLink
(
"del_"
.
concat
(
id
)
,
"table.delete"
,
"table.delete"
,
layoutContainer
,
Link
.
BUTTON
);
delButton
.
setUserObject
(
link
);
delButton
.
setUserObject
(
link
);
link
.
setDelButton
(
delButton
);
link
.
setDelButton
(
delButton
);
}
}
@Override
@Override
protected
boolean
validateFormLogic
(
UserRequest
ureq
)
{
protected
boolean
validateFormLogic
(
UserRequest
ureq
)
{
boolean
allOk
=
super
.
validateFormLogic
(
ureq
);
boolean
allOk
=
true
;
for
(
LinkWrapper
link:
externalLinks
)
{
for
(
LinkWrapper
link:
externalLinks
)
{
link
.
getUrl
().
clearError
();
link
.
getUrl
().
clearError
();
link
.
getName
().
clearError
();
link
.
getName
().
clearError
();
...
@@ -182,13 +182,13 @@ public class ExternalLinksController extends FormBasicController {
...
@@ -182,13 +182,13 @@ public class ExternalLinksController extends FormBasicController {
}
}
}
}
return
allOk
&&
super
.
validateFormLogic
(
ureq
)
;
return
allOk
;
}
}
@Override
@Override
protected
void
formInnerEvent
(
UserRequest
ureq
,
FormItem
source
,
FormEvent
event
)
{
protected
void
formInnerEvent
(
UserRequest
ureq
,
FormItem
source
,
FormEvent
event
)
{
if
(
source
==
newButton
)
{
if
(
source
==
newButton
)
{
String
id
=
UUID
.
randomUUID
().
toString
().
replace
All
(
"-"
,
""
);
String
id
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
KalendarEventLink
link
=
new
KalendarEventLink
(
EXTERNAL_LINKS_PROVIDER
,
id
,
""
,
""
,
""
);
KalendarEventLink
link
=
new
KalendarEventLink
(
EXTERNAL_LINKS_PROVIDER
,
id
,
""
,
""
,
""
);
LinkWrapper
linkWrapper
=
new
LinkWrapper
(
link
);
LinkWrapper
linkWrapper
=
new
LinkWrapper
(
link
);
externalLinks
.
add
(
linkWrapper
);
externalLinks
.
add
(
linkWrapper
);
...
@@ -246,7 +246,7 @@ public class ExternalLinksController extends FormBasicController {
...
@@ -246,7 +246,7 @@ public class ExternalLinksController extends FormBasicController {
//remove deleted links
//remove deleted links
for
(
Iterator
<
KalendarEventLink
>
it
=
links
.
iterator
();
it
.
hasNext
();
)
{
for
(
Iterator
<
KalendarEventLink
>
it
=
links
.
iterator
();
it
.
hasNext
();
)
{
KalendarEventLink
link
=
it
.
next
();
KalendarEventLink
link
=
it
.
next
();
if
(
EXTERNAL_LINKS_PROVIDER
.
equals
(
link
.
get
Id
())
&&
!
usedUuids
.
contains
(
link
.
getId
()))
{
if
(
EXTERNAL_LINKS_PROVIDER
.
equals
(
link
.
get
Provider
())
&&
!
usedUuids
.
contains
(
link
.
getId
()))
{
it
.
remove
();
it
.
remove
();
}
}
}
}
...
@@ -261,10 +261,9 @@ public class ExternalLinksController extends FormBasicController {
...
@@ -261,10 +261,9 @@ public class ExternalLinksController extends FormBasicController {
private
LinkWrapper
createLinkWrapper
()
{
private
LinkWrapper
createLinkWrapper
()
{
String
id
=
UUID
.
randomUUID
().
toString
().
replace
All
(
"-"
,
""
);
String
id
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
KalendarEventLink
newLink
=
new
KalendarEventLink
(
EXTERNAL_LINKS_PROVIDER
,
id
,
""
,
""
,
""
);
KalendarEventLink
newLink
=
new
KalendarEventLink
(
EXTERNAL_LINKS_PROVIDER
,
id
,
""
,
""
,
""
);
LinkWrapper
newLinkWrapper
=
new
LinkWrapper
(
newLink
);
return
new
LinkWrapper
(
newLink
);
return
newLinkWrapper
;
}
}
public
class
LinkWrapper
{
public
class
LinkWrapper
{
...
...
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