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
cdbaab8c
Commit
cdbaab8c
authored
7 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-3285: push the max. number of characters of info messages
parent
78b8ffba
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/org/olat/commons/info/ui/InfoEditFormController.java
+11
-9
11 additions, 9 deletions
...java/org/olat/commons/info/ui/InfoEditFormController.java
with
11 additions
and
9 deletions
src/main/java/org/olat/commons/info/ui/InfoEditFormController.java
+
11
−
9
View file @
cdbaab8c
...
@@ -55,6 +55,8 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -55,6 +55,8 @@ import org.springframework.beans.factory.annotation.Autowired;
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*/
*/
public
class
InfoEditFormController
extends
FormBasicController
{
public
class
InfoEditFormController
extends
FormBasicController
{
private
static
final
int
MESSAGE_MAX_LENGTH
=
32000
;
private
TextElement
titleEl
;
private
TextElement
titleEl
;
private
FileElement
attachmentEl
;
private
FileElement
attachmentEl
;
...
@@ -96,7 +98,7 @@ public class InfoEditFormController extends FormBasicController {
...
@@ -96,7 +98,7 @@ public class InfoEditFormController extends FormBasicController {
messageEl
.
getEditorConfiguration
().
enableCharCount
();
messageEl
.
getEditorConfiguration
().
enableCharCount
();
messageEl
.
getEditorConfiguration
().
setPathInStatusBar
(
true
);
messageEl
.
getEditorConfiguration
().
setPathInStatusBar
(
true
);
messageEl
.
setMandatory
(
true
);
messageEl
.
setMandatory
(
true
);
messageEl
.
setMaxLength
(
2000
);
messageEl
.
setMaxLength
(
MESSAGE_MAX_LENGTH
);
attachmentEl
=
uifactory
.
addFileElement
(
getWindowControl
(),
"attachment"
,
formLayout
);
attachmentEl
=
uifactory
.
addFileElement
(
getWindowControl
(),
"attachment"
,
formLayout
);
attachmentEl
.
setDeleteEnabled
(
true
);
attachmentEl
.
setDeleteEnabled
(
true
);
...
@@ -140,24 +142,24 @@ public class InfoEditFormController extends FormBasicController {
...
@@ -140,24 +142,24 @@ public class InfoEditFormController extends FormBasicController {
protected
boolean
validateFormLogic
(
UserRequest
ureq
)
{
protected
boolean
validateFormLogic
(
UserRequest
ureq
)
{
titleEl
.
clearError
();
titleEl
.
clearError
();
messageEl
.
clearError
();
messageEl
.
clearError
();
boolean
allOk
=
true
;
boolean
allOk
=
super
.
validateFormLogic
(
ureq
)
;
String
t
=
titleEl
.
getValue
();
String
t
=
titleEl
.
getValue
();
if
(!
StringHelper
.
containsNonWhitespace
(
t
))
{
if
(!
StringHelper
.
containsNonWhitespace
(
t
))
{
titleEl
.
setErrorKey
(
"form.legende.mandatory"
,
new
String
[]
{});
titleEl
.
setErrorKey
(
"form.legende.mandatory"
,
new
String
[]
{});
allOk
=
false
;
allOk
&
=
false
;
}
else
if
(
t
.
length
()
>
500
)
{
}
else
if
(
t
.
length
()
>
500
)
{
titleEl
.
setErrorKey
(
"input.toolong"
,
new
String
[]
{
"500"
,
Integer
.
toString
(
t
.
length
())});
titleEl
.
setErrorKey
(
"input.toolong"
,
new
String
[]
{
"500"
,
Integer
.
toString
(
t
.
length
())});
allOk
=
false
;
allOk
&
=
false
;
}
}
String
m
=
messageEl
.
getValue
();
String
m
=
messageEl
.
getValue
();
if
(!
StringHelper
.
containsNonWhitespace
(
m
))
{
if
(!
StringHelper
.
containsNonWhitespace
(
m
))
{
messageEl
.
setErrorKey
(
"form.legende.mandatory"
,
new
String
[]
{});
messageEl
.
setErrorKey
(
"form.legende.mandatory"
,
new
String
[]
{});
allOk
=
false
;
allOk
&
=
false
;
}
else
if
(
m
.
length
()
>
2000
)
{
}
else
if
(
m
.
length
()
>
MESSAGE_MAX_LENGTH
)
{
messageEl
.
setErrorKey
(
"input.toolong"
,
new
String
[]
{
"2000"
,
Integer
.
toString
(
m
.
length
())});
messageEl
.
setErrorKey
(
"input.toolong"
,
new
String
[]
{
Integer
.
toString
(
MESSAGE_MAX_LENGTH
)
,
Integer
.
toString
(
m
.
length
())
});
allOk
=
false
;
allOk
&
=
false
;
}
}
List
<
ValidationStatus
>
validation
=
new
ArrayList
<>();
List
<
ValidationStatus
>
validation
=
new
ArrayList
<>();
...
@@ -165,7 +167,7 @@ public class InfoEditFormController extends FormBasicController {
...
@@ -165,7 +167,7 @@ public class InfoEditFormController extends FormBasicController {
if
(
validation
.
size
()
>
0
)
{
if
(
validation
.
size
()
>
0
)
{
allOk
&=
false
;
allOk
&=
false
;
}
}
return
allOk
&
super
.
validateFormLogic
(
ureq
)
;
return
allOk
;
}
}
public
InfoMessage
getInfoMessage
()
{
public
InfoMessage
getInfoMessage
()
{
...
...
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