Skip to content
Snippets Groups Projects
Commit f45f6b0c authored by gnaegi's avatar gnaegi
Browse files

OO-1068 more link list bootstrapify

parent 9c794685
No related branches found
No related tags found
No related merge requests found
Showing
with 117 additions and 68 deletions
...@@ -33,10 +33,11 @@ import org.olat.core.gui.components.form.ValidationError; ...@@ -33,10 +33,11 @@ import org.olat.core.gui.components.form.ValidationError;
import org.olat.core.gui.components.form.flexible.FormItem; import org.olat.core.gui.components.form.flexible.FormItem;
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.FormLink; import org.olat.core.gui.components.form.flexible.elements.FormLink;
import org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement; import org.olat.core.gui.components.form.flexible.elements.SingleSelection;
import org.olat.core.gui.components.form.flexible.elements.TextElement; import org.olat.core.gui.components.form.flexible.elements.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.FormEvent; import org.olat.core.gui.components.form.flexible.impl.FormEvent;
import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer;
import org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl; import org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl;
import org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit; import org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit;
import org.olat.core.gui.components.form.flexible.impl.elements.ItemValidatorProvider; import org.olat.core.gui.components.form.flexible.impl.elements.ItemValidatorProvider;
...@@ -66,11 +67,12 @@ import de.bps.course.nodes.LLCourseNode; ...@@ -66,11 +67,12 @@ import de.bps.course.nodes.LLCourseNode;
public class LLEditForm extends FormBasicController { public class LLEditForm extends FormBasicController {
private static final String BLANK_KEY = "_blank"; private static final String BLANK_KEY = "_blank";
private static final String SELF_KEY = "_self";
private ModuleConfiguration moduleConfig; private ModuleConfiguration moduleConfig;
private FormSubmit subm; private FormSubmit subm;
private List<TextElement> lTargetInputList; private List<TextElement> lTargetInputList;
private List<MultipleSelectionElement> lHtmlTargetInputList; private List<SingleSelection> lHtmlTargetInputList;
private List<TextElement> lDescriptionInputList; private List<TextElement> lDescriptionInputList;
private List<TextElement> lCommentInputList; private List<TextElement> lCommentInputList;
private List<FormLink> lDelButtonList; private List<FormLink> lDelButtonList;
...@@ -91,7 +93,7 @@ public class LLEditForm extends FormBasicController { ...@@ -91,7 +93,7 @@ public class LLEditForm extends FormBasicController {
// list of all link target text fields // list of all link target text fields
lTargetInputList = new ArrayList<TextElement>(linkList.size()); lTargetInputList = new ArrayList<TextElement>(linkList.size());
// list of all link html target text fields // list of all link html target text fields
lHtmlTargetInputList = new ArrayList<MultipleSelectionElement>(linkList.size()); lHtmlTargetInputList = new ArrayList<SingleSelection>(linkList.size());
// list of all link description text fields // list of all link description text fields
lDescriptionInputList = new ArrayList<TextElement>(linkList.size()); lDescriptionInputList = new ArrayList<TextElement>(linkList.size());
// list of all link comment text fields // list of all link comment text fields
...@@ -135,12 +137,13 @@ public class LLEditForm extends FormBasicController { ...@@ -135,12 +137,13 @@ public class LLEditForm extends FormBasicController {
lTargetInputList.get(i).setValue(linkValue); lTargetInputList.get(i).setValue(linkValue);
} }
link.setTarget(linkValue); link.setTarget(linkValue);
boolean selected = lHtmlTargetInputList.get(i).isSelected(0); boolean blank = lHtmlTargetInputList.get(i).isSelected(0);
if(linkValue.startsWith(Settings.getServerContextPathURI())) { if(linkValue.startsWith(Settings.getServerContextPathURI())) {
selected = false; // links to OO pages open in same window
lHtmlTargetInputList.get(i).select(BLANK_KEY, selected); blank = false;
lHtmlTargetInputList.get(i).select(SELF_KEY, true);
} }
link.setHtmlTarget(selected ? "_blank" : "_self"); link.setHtmlTarget(blank ? BLANK_KEY : SELF_KEY);
link.setDescription(lDescriptionInputList.get(i).getValue()); link.setDescription(lDescriptionInputList.get(i).getValue());
link.setComment(lCommentInputList.get(i).getValue()); link.setComment(lCommentInputList.get(i).getValue());
} }
...@@ -227,7 +230,7 @@ public class LLEditForm extends FormBasicController { ...@@ -227,7 +230,7 @@ public class LLEditForm extends FormBasicController {
} }
currentLink.setTarget(url); currentLink.setTarget(url);
currentLink.setIntern(true); currentLink.setIntern(true);
currentLink.setHtmlTarget("_blank"); currentLink.setHtmlTarget(SELF_KEY);
if(StringHelper.containsNonWhitespace(choosenEvent.getDisplayName())) { if(StringHelper.containsNonWhitespace(choosenEvent.getDisplayName())) {
currentLink.setDescription(choosenEvent.getDisplayName()); currentLink.setDescription(choosenEvent.getDisplayName());
} }
...@@ -238,7 +241,7 @@ public class LLEditForm extends FormBasicController { ...@@ -238,7 +241,7 @@ public class LLEditForm extends FormBasicController {
targetEl.setValue(url); targetEl.setValue(url);
targetEl.setEnabled(false); targetEl.setEnabled(false);
lDescriptionInputList.get(index).setValue(currentLink.getDescription()); lDescriptionInputList.get(index).setValue(currentLink.getDescription());
lHtmlTargetInputList.get(index).select(BLANK_KEY, true); lHtmlTargetInputList.get(index).select(SELF_KEY, true);
break; break;
} }
index++; index++;
...@@ -300,6 +303,7 @@ public class LLEditForm extends FormBasicController { ...@@ -300,6 +303,7 @@ public class LLEditForm extends FormBasicController {
lTarget.setEnabled(!link.isIntern()); lTarget.setEnabled(!link.isIntern());
lTarget.setDisplaySize(40); lTarget.setDisplaySize(40);
lTarget.setMandatory(true); lTarget.setMandatory(true);
lTarget.setExampleKey("target.example", null);
lTarget.setNotEmptyCheck("ll.table.target.error"); lTarget.setNotEmptyCheck("ll.table.target.error");
lTarget.setItemValidatorProvider(new ItemValidatorProvider() { lTarget.setItemValidatorProvider(new ItemValidatorProvider() {
public boolean isValidValue(String value, ValidationError validationError, Locale locale) { public boolean isValidValue(String value, ValidationError validationError, Locale locale) {
...@@ -319,9 +323,9 @@ public class LLEditForm extends FormBasicController { ...@@ -319,9 +323,9 @@ public class LLEditForm extends FormBasicController {
lTarget.setUserObject(link); lTarget.setUserObject(link);
lTargetInputList.add(index, lTarget); lTargetInputList.add(index, lTarget);
//add html target //add html target
MultipleSelectionElement htmlTargetSelection = uifactory.addCheckboxesHorizontal("html_target" + counter, flc, new String[]{BLANK_KEY}, new String[]{""}); SingleSelection htmlTargetSelection = uifactory.addDropdownSingleselect("html_target" + counter, flc, new String[]{BLANK_KEY, SELF_KEY}, new String[]{translate("ll.table.html_target"), translate("ll.table.html_target.self")}, null);
htmlTargetSelection.setUserObject(link); htmlTargetSelection.setUserObject(link);
htmlTargetSelection.select(BLANK_KEY, "_blank".equals(link.getHtmlTarget())); htmlTargetSelection.select((SELF_KEY.equals(link.getHtmlTarget()) ? SELF_KEY : BLANK_KEY), true);
lHtmlTargetInputList.add(index, htmlTargetSelection); lHtmlTargetInputList.add(index, htmlTargetSelection);
// add link description // add link description
...@@ -330,23 +334,27 @@ public class LLEditForm extends FormBasicController { ...@@ -330,23 +334,27 @@ public class LLEditForm extends FormBasicController {
lDescription.setDisplaySize(20); lDescription.setDisplaySize(20);
lDescription.setNotEmptyCheck("ll.table.description.error"); lDescription.setNotEmptyCheck("ll.table.description.error");
lDescription.setMandatory(true); lDescription.setMandatory(true);
lDescription.setExampleKey("ll.table.description", null);
lDescription.setUserObject(link); lDescription.setUserObject(link);
lDescriptionInputList.add(index, lDescription); lDescriptionInputList.add(index, lDescription);
// add link comment // add link comment
TextElement lComment =uifactory.addTextElement("comment" + counter, null, -1, link.getComment(), flc); TextElement lComment =uifactory.addTextAreaElement("comment" + counter, null, -1, 2, 50, true, link.getComment(), flc);
lComment.setDisplaySize(20); lComment.setDisplaySize(20);
lComment.setExampleKey("ll.table.comment", null);
lComment.setUserObject(link); lComment.setUserObject(link);
lCommentInputList.add(index, lComment); lCommentInputList.add(index, lComment);
// add link add action button // add link add action button
FormLink addButton = new FormLinkImpl("add" + counter, "add" + counter, "ll.table.add", Link.BUTTON_SMALL); FormLink addButton = new FormLinkImpl("add" + counter, "add" + counter, "", Link.BUTTON_SMALL + Link.NONTRANSLATED);
addButton.setUserObject(link); addButton.setUserObject(link);
addButton.setIconLeftCSS("o_icon o_icon-lg o_icon-fw o_icon_add");
flc.add(addButton); flc.add(addButton);
lAddButtonList.add(index, addButton); lAddButtonList.add(index, addButton);
// add link deletion action button // add link deletion action button
FormLink delButton = new FormLinkImpl("delete" + counter, "delete" + counter, "ll.table.delete", Link.BUTTON_SMALL); FormLink delButton = new FormLinkImpl("delete" + counter, "delete" + counter, "", Link.BUTTON_SMALL + Link.NONTRANSLATED);
delButton.setUserObject(link); delButton.setUserObject(link);
delButton.setIconLeftCSS("o_icon o_icon-lg o_icon-fw o_icon_delete_item");
flc.add(delButton); flc.add(delButton);
lDelButtonList.add(index, delButton); lDelButtonList.add(index, delButton);
// custom media action button // custom media action button
......
<table class="o_table table"> <div class="o_form form">
<thead> #foreach($link in $linkList)
<tr> #set( $iter = $velocityCount - 1)
<th>$r.translate("ll.table.target")</th> #set( $target = $lTargetInputList.get($iter).getName() )
#if($lCustomMediaButtonList) <th></th> #end #set( $targetErr = $target + "_ERROR" )
<th>$r.translate("ll.table.html_target")</th> #set( $descr = $lDescriptionInputList.get($iter).getName() )
<th>$r.translate("ll.table.description")</th> #set( $descrErr = $descr + "_ERROR" )
<th>$r.translate("ll.table.comment")</th> #set( $hasError = "false" )
<th></th>
</tr>
</thead> <div class="o_block_large_bottom row">
#foreach($link in $linkList) <div class="col-xs-12 col-md-10">
#set( $iter = $velocityCount - 1) #if ($f.hasError($target))
#set( $target = $lTargetInputList.get($iter).getName() ) $r.render($targetErr)
#set( $targetErr = $target + "_ERROR" ) #end
#set( $descr = $lDescriptionInputList.get($iter).getName() ) #if ($f.hasError($descr))
#set( $descrErr = $descr + "_ERROR" ) $r.render($descrErr)
<tr> #end
<td>$r.render($lTargetInputList.get($iter).getName())</td>
#if($lCustomMediaButtonList) <td>$r.render($lCustomMediaButtonList.get($iter).getName())</td> #end <div class="form-group">
<td>$r.render($lHtmlTargetInputList.get($iter).getName())</td> <label class="sr-only" for="$f.getItemId($lTargetInputList.get($iter).getName())">$r.translate("ll.table.target")</label>
<td>$r.render($lDescriptionInputList.get($iter).getName())</td> #if($lCustomMediaButtonList)
<td>$r.render($lCommentInputList.get($iter).getName())</td> <div class="input-group">
<td style="white-space: nowrap; text-align: right;"> $r.render($lTargetInputList.get($iter).getName())
$r.render($lAddButtonList.get($iter).getName()) <div class='input-group-addon'>
$r.render($lDelButtonList.get($iter).getName()) $r.render($lCustomMediaButtonList.get($iter).getName())
</td> </div>
</tr> </div>
#if($f.hasError($target) || $f.hasError($descr)) #else
<tr> $r.render($lTargetInputList.get($iter).getName())
<td>$r.render($targetErr)</td> #end
#if($lCustomMediaButtonList) <td></td> #end </div>
<td></td> <div class="form-group">
<td>$r.render($descrErr)</td> <label class="sr-only" for="$f.getItemId($lHtmlTargetInputList.get($iter).getName())">$r.translate("ll.table.html_target")</label>
<td></td> $r.render($lHtmlTargetInputList.get($iter).getName())
<td></td> </div>
</tr> <div class="form-group">
#end <label class="sr-only" for="$f.getItemId($lDescriptionInputList.get($iter).getName())">$r.translate("ll.table.description")</label>
#end $r.render($lDescriptionInputList.get($iter).getName())
</table> </div>
<div class="o_button_group">$r.render("submit")</div> <div class="form-group">
<label class="sr-only" for="$f.getItemId($lCommentInputList.get($iter).getName())">$r.translate("ll.table.comment")</label>
$r.render($lCommentInputList.get($iter).getName())
</div>
</div>
<div class="col-xs-12 col-md-2">
<div class="o_button_group o_button_group_top">
<div class="btn-group">
$r.render($lDelButtonList.get($iter).getName())
$r.render($lAddButtonList.get($iter).getName())
</div>
</div>
</div>
</div>
#end
<div class="o_block_large_bottom row">
<div class="col-xs-12 col-md-10">
<div class="o_button_group">
$r.render("submit")
</div>
</div>
</div>
</div>
\ No newline at end of file
<div class="o_ll_container"> <div class="o_ll_container">
<ul> <ul class="list-unstyled">
#foreach($link in $linkList) #foreach($link in $linkList)
<li> <li class="o_block">
<a href="#if($link.intern) $mapperBaseUrl$link.getTarget() #else $link.getTarget() #end" target="$link.getHtmlTarget()" class="b_link_extern">$link.getDescription()</a> <a href="#if($link.intern) $mapperBaseUrl$link.getTarget() #else $link.getTarget() #end" target="$link.getHtmlTarget()">
$link.getDescription()
#if($link.getHtmlTarget() == "_blank")
<i class="o_icon o_icon_external_link"> </i>
#end
</a>
#if($showLinkComments) #if($showLinkComments)
<div> <div class="text-muted">
$link.getComment() $link.getComment()
</div> </div>
#end #end
......
...@@ -8,6 +8,7 @@ config.nolinks.long = Sie haben noch keine Links in dieser Liste erstellt. ...@@ -8,6 +8,7 @@ config.nolinks.long = Sie haben noch keine Links in dieser Liste erstellt.
ll.table.target = Linkziel ll.table.target = Linkziel
ll.table.html_target = Neues Fenster ll.table.html_target = Neues Fenster
ll.table.html_target.self = Gleiches Fenster
ll.table.description = Beschreibung ll.table.description = Beschreibung
ll.table.comment = Kommentar ll.table.comment = Kommentar
ll.table.delete = - ll.table.delete = -
...@@ -16,5 +17,7 @@ ll.table.media = Media ...@@ -16,5 +17,7 @@ ll.table.media = Media
ll.table.target.error = Bitte URL eintragen ll.table.target.error = Bitte URL eintragen
ll.table.target.error.format = Ungltiges URL Format ll.table.target.error.format = Ungltiges URL Format
ll.table.description.error = Bitte ausfllen ll.table.description.error = Bitte Beschreibung ausfllen
ll.table.mandatory = * ... Pflichtfeld ll.table.mandatory = * ... Pflichtfeld
target.example=http://www.openolat.org
...@@ -7,8 +7,9 @@ ll.table.add=+ ...@@ -7,8 +7,9 @@ ll.table.add=+
ll.table.comment=Comment ll.table.comment=Comment
ll.table.delete=- ll.table.delete=-
ll.table.description=Description ll.table.description=Description
ll.table.description.error=Please fill in ll.table.description.error=Please fill in description
ll.table.html_target=New window ll.table.html_target=New window
ll.table.html_target.self=Same window
ll.table.mandatory=* ... Mandatory field ll.table.mandatory=* ... Mandatory field
ll.table.media=Media ll.table.media=Media
ll.table.target=Link target ll.table.target=Link target
...@@ -16,3 +17,4 @@ ll.table.target.error=Please insert URL ...@@ -16,3 +17,4 @@ ll.table.target.error=Please insert URL
ll.table.target.error.format=Invalid URL format ll.table.target.error.format=Invalid URL format
pane.tab.accessibility=Access pane.tab.accessibility=Access
pane.tab.llconfig=Configuration pane.tab.llconfig=Configuration
target.example=http://www.openolat.org
...@@ -34,6 +34,7 @@ import org.olat.core.gui.render.Renderer; ...@@ -34,6 +34,7 @@ import org.olat.core.gui.render.Renderer;
import org.olat.core.gui.render.StringOutput; import org.olat.core.gui.render.StringOutput;
import org.olat.core.gui.render.URLBuilder; import org.olat.core.gui.render.URLBuilder;
import org.olat.core.gui.translator.Translator; import org.olat.core.gui.translator.Translator;
import org.olat.core.util.StringHelper;
/** /**
* Description:<br> * Description:<br>
...@@ -77,8 +78,12 @@ class TextElementRenderer extends DefaultComponentRenderer { ...@@ -77,8 +78,12 @@ class TextElementRenderer extends DefaultComponentRenderer {
sb.append(te.maxlength); sb.append(te.maxlength);
} }
sb.append("\" value=\"").append(htmlVal).append("\" ") sb.append("\" value=\"").append(htmlVal).append("\" ")
.append(FormJSHelper.getRawJSFor(te.getRootForm(), id, te.getAction())) .append(FormJSHelper.getRawJSFor(te.getRootForm(), id, te.getAction()));
.append(" />");
if (te.hasExample()) {
sb.append(" placeholder=\"").append(StringEscapeUtils.escapeHtml(te.getExampleText())).append("\"");
}
sb.append(" />");
//add set dirty form only if enabled //add set dirty form only if enabled
sb.append(FormJSHelper.getJSStartWithVarDeclaration(teC.getFormDispatchId())) sb.append(FormJSHelper.getJSStartWithVarDeclaration(teC.getFormDispatchId()))
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
position: absolute; bottom: 0; position: absolute; bottom: 0;
} }
width: 100%; width: 100%;
z-index: 2; z-index: 3;
height: $o-footer-height; height: $o-footer-height;
overflow: hidden; overflow: hidden;
background-color: $o-footer-outer-bg; background-color: $o-footer-outer-bg;
......
...@@ -62,6 +62,9 @@ ...@@ -62,6 +62,9 @@
.o_button_group_right { .o_button_group_right {
text-align: right; text-align: right;
} }
.o_button_group_top {
margin-top: 0;
}
/* use as wrapper when buttons should be right aligned next to a title */ /* use as wrapper when buttons should be right aligned next to a title */
.o_header_with_buttons { .o_header_with_buttons {
@include clearfix(); @include clearfix();
......
...@@ -37,7 +37,7 @@ $fa-css-prefix: "o_icon" !default; ...@@ -37,7 +37,7 @@ $fa-css-prefix: "o_icon" !default;
.o_icon_bookmark:before { content: $fa-var-bookmark; color: #996633; } .o_icon_bookmark:before { content: $fa-var-bookmark; color: #996633; }
.o_icon_bookmark_add:before { content: $fa-var-bookmark-o; } .o_icon_bookmark_add:before { content: $fa-var-bookmark-o; }
.o_icon_bookmark_header:before { content: $fa-var-bookmark; } .o_icon_bookmark_header:before { content: $fa-var-bookmark; }
.o_icon_browse:before { content: $fa-var-bank; } .o_icon_browse:before { content: $fa-var-search-plus; }
.o_icon_browsercheck:before { content: $fa-var-thumbs-up; } .o_icon_browsercheck:before { content: $fa-var-thumbs-up; }
.o_icon_busy:before { content: $fa-var-spinner; } .o_icon_busy:before { content: $fa-var-spinner; }
.o_icon_calendar:before { content: $fa-var-calendar;} .o_icon_calendar:before { content: $fa-var-calendar;}
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment