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
e7079596
Commit
e7079596
authored
13 years ago
by
gnaegi
Browse files
Options
Downloads
Patches
Plain Diff
OO-65 add raw html and script tag support in info message
parent
86b150ef
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/org/olat/admin/sysinfo/InfoMsgForm.java
+21
-5
21 additions, 5 deletions
src/main/java/org/olat/admin/sysinfo/InfoMsgForm.java
src/main/java/org/olat/admin/sysinfo/_content/infomsg.html
+4
-2
4 additions, 2 deletions
src/main/java/org/olat/admin/sysinfo/_content/infomsg.html
with
25 additions
and
7 deletions
src/main/java/org/olat/admin/sysinfo/InfoMsgForm.java
+
21
−
5
View file @
e7079596
...
@@ -21,15 +21,20 @@
...
@@ -21,15 +21,20 @@
* OpenOLAT - Online Learning and Training</a><br>
* OpenOLAT - Online Learning and Training</a><br>
* This file has been modified by the OpenOLAT community. Changes are licensed
* This file has been modified by the OpenOLAT community. Changes are licensed
* under the Apache 2.0 license as the original file.
* under the Apache 2.0 license as the original file.
* <p>
* Initial code contributed and copyrighted by<br>
* 2012 by frentix GmbH, http://www.frentix.com
* <p>
*/
*/
package
org.olat.admin.sysinfo
;
package
org.olat.admin.sysinfo
;
import
org.olat.core.gui.UserRequest
;
import
org.olat.core.gui.UserRequest
;
import
org.olat.core.gui.components.form.flexible.FormItemContainer
;
import
org.olat.core.gui.components.form.flexible.FormItemContainer
;
import
org.olat.core.gui.components.form.flexible.elements.TextElement
;
import
org.olat.core.gui.components.form.flexible.elements.
Rich
TextElement
;
import
org.olat.core.gui.components.form.flexible.impl.FormBasicController
;
import
org.olat.core.gui.components.form.flexible.impl.FormBasicController
;
import
org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer
;
import
org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer
;
import
org.olat.core.gui.components.form.flexible.impl.elements.richText.RichTextConfiguration
;
import
org.olat.core.gui.control.Controller
;
import
org.olat.core.gui.control.Controller
;
import
org.olat.core.gui.control.Event
;
import
org.olat.core.gui.control.Event
;
import
org.olat.core.gui.control.WindowControl
;
import
org.olat.core.gui.control.WindowControl
;
...
@@ -38,10 +43,12 @@ import org.olat.core.gui.control.WindowControl;
...
@@ -38,10 +43,12 @@ import org.olat.core.gui.control.WindowControl;
* Initial Date: Apr 30, 2004
* Initial Date: Apr 30, 2004
*
*
* @author Mike Stock
* @author Mike Stock
* @author Sergio Trentini
* @author Florian Gnägi
*/
*/
public
class
InfoMsgForm
extends
FormBasicController
{
public
class
InfoMsgForm
extends
FormBasicController
{
private
TextElement
msg
;
private
Rich
TextElement
msg
;
private
String
infomsg
;
private
String
infomsg
;
/**
/**
...
@@ -49,7 +56,7 @@ public class InfoMsgForm extends FormBasicController {
...
@@ -49,7 +56,7 @@ public class InfoMsgForm extends FormBasicController {
* @param infomsg
* @param infomsg
*/
*/
public
InfoMsgForm
(
UserRequest
ureq
,
WindowControl
wControl
,
String
infomsg
)
{
public
InfoMsgForm
(
UserRequest
ureq
,
WindowControl
wControl
,
String
infomsg
)
{
super
(
ureq
,
wControl
);
super
(
ureq
,
wControl
,
LAYOUT_VERTICAL
);
this
.
infomsg
=
infomsg
;
this
.
infomsg
=
infomsg
;
initForm
(
ureq
);
initForm
(
ureq
);
}
}
...
@@ -58,7 +65,8 @@ public class InfoMsgForm extends FormBasicController {
...
@@ -58,7 +65,8 @@ public class InfoMsgForm extends FormBasicController {
* @return the info message
* @return the info message
*/
*/
public
String
getInfoMsg
()
{
public
String
getInfoMsg
()
{
return
msg
.
getValue
();
// use raw value to circumvent XSS filtering of script tags
return
msg
.
getRawValue
();
}
}
public
void
reset
()
{
public
void
reset
()
{
...
@@ -78,9 +86,17 @@ public class InfoMsgForm extends FormBasicController {
...
@@ -78,9 +86,17 @@ public class InfoMsgForm extends FormBasicController {
@Override
@Override
protected
void
initForm
(
FormItemContainer
formLayout
,
Controller
listener
,
UserRequest
ureq
)
{
protected
void
initForm
(
FormItemContainer
formLayout
,
Controller
listener
,
UserRequest
ureq
)
{
msg
=
uifactory
.
addRichTextElementForStringData
Minimalistic
(
"msg"
,
"infomsg"
,
infomsg
,
20
,
6
0
,
false
,
formLayout
,
ureq
.
getUserSession
(),
getWindowControl
());
msg
=
uifactory
.
addRichTextElementForStringData
(
"msg"
,
"infomsg"
,
infomsg
,
20
,
7
0
,
false
,
true
,
null
,
null
,
formLayout
,
ureq
.
getUserSession
(),
getWindowControl
());
msg
.
setMaxLength
(
1024
);
msg
.
setMaxLength
(
1024
);
RichTextConfiguration
richTextConfig
=
msg
.
getEditorConfiguration
();
// manually enable the source edit button
richTextConfig
.
setQuotedConfigValue
(
RichTextConfiguration
.
THEME_ADVANCED_BUTTONS3_ADD
,
RichTextConfiguration
.
SEPARATOR_BUTTON
+
","
+
RichTextConfiguration
.
CODE_BUTTON
);
//allow script tags...
richTextConfig
.
setQuotedConfigValue
(
RichTextConfiguration
.
INVALID_ELEMENTS
,
RichTextConfiguration
.
INVALID_ELEMENTS_FORM_FULL_VALUE_UNSAVE_WITH_SCRIPT
);
richTextConfig
.
setQuotedConfigValue
(
RichTextConfiguration
.
EXTENDED_VALID_ELEMENTS
,
"script[src,type,defer]"
);
FormLayoutContainer
buttonGroupLayout
=
FormLayoutContainer
.
createButtonLayout
(
"buttonGroupLayout"
,
getTranslator
());
FormLayoutContainer
buttonGroupLayout
=
FormLayoutContainer
.
createButtonLayout
(
"buttonGroupLayout"
,
getTranslator
());
formLayout
.
add
(
buttonGroupLayout
);
formLayout
.
add
(
buttonGroupLayout
);
uifactory
.
addFormSubmitButton
(
"submit"
,
"submit"
,
buttonGroupLayout
);
uifactory
.
addFormSubmitButton
(
"submit"
,
"submit"
,
buttonGroupLayout
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/org/olat/admin/sysinfo/_content/infomsg.html
+
4
−
2
View file @
e7079596
<i>
Message Admin-Token: $!admintoken
</i><br/>
<p>
<i>
Message Admin-Token: $!admintoken
</i>
</p>
<fieldset>
<fieldset>
<legend>
$r.translate("infomsg.title")
</legend>
<legend>
$r.translate("infomsg.title")
</legend>
#if ($infomsg)
#if ($infomsg)
...
@@ -28,7 +31,6 @@ $r.render("infomsgEdit") $r.render("infomsgClear")
...
@@ -28,7 +31,6 @@ $r.render("infomsgEdit") $r.render("infomsgClear")
</fieldset>
</fieldset>
#end
#end
<hr
class=
"o_separator"
>
<fieldset>
<fieldset>
<legend>
$r.translate("maintenancemsg.title")
</legend>
<legend>
$r.translate("maintenancemsg.title")
</legend>
...
...
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