Skip to content
Snippets Groups Projects
Commit b8f46bcf authored by srosse's avatar srosse
Browse files

OO-1068: bootstrapify user profile in edit course access and user admin

parent d374f92a
No related branches found
No related tags found
No related merge requests found
Showing
with 203 additions and 38 deletions
......@@ -2,8 +2,10 @@
$r.render("backLink")
#end
<h4>$r.translate("content.usermgmt.userfound")</h4>
<div class="clearfix">
<div class="pull-left">$r.render("portrait")</div>
<div class="o_user_infos row">
<div class="o_user_portrait">$r.render("portrait")</div>
<div class="o_user_infos_inner">
$r.render("userShortDescription")
</div>
</div>
$r.render("userTabP")
\ No newline at end of file
<table class="table table-bordered">
<table class="table table-bordered">
#if($username)
<tr>
<th>$usernameLabel</th>
<td>$username</td>
</tr>
#end
#foreach( $propertyHandler in $userPropertyHandlers )
#if ($propertyHandler.getUserPropertyAsHTML($user, $locale) && $propertyHandler.getUserPropertyAsHTML($user, $locale) != "")
#foreach( $propertyHandler in $userPropertyHandlers )
#if ($propertyHandler.getUserPropertyAsHTML($user, $locale) && $propertyHandler.getUserPropertyAsHTML($user, $locale) != "")
<tr>
<th>$r.translate($propertyHandler.i18nFormElementLabelKey())</th>
<td>$propertyHandler.getUserPropertyAsHTML($user, $locale)</td>
</tr>
</tr>
#end
#end
</table>
#end
</table>
\ No newline at end of file
......@@ -62,6 +62,8 @@ public class FormLayoutContainer extends FormItemImpl implements FormItemContain
private static final String VELOCITY_ROOT = Util.getPackageVelocityRoot(FormLayoutContainer.class);
private static final String LAYOUT_DEFAULT = VELOCITY_ROOT + "/form_default.html";
private static final String LAYOUT_DEFAULT_6_6 = VELOCITY_ROOT + "/form_default_6_6.html";
private static final String LAYOUT_DEFAULT_9_3 = VELOCITY_ROOT + "/form_default_9_3.html";
private static final String LAYOUT_HORIZONTAL = VELOCITY_ROOT + "/form_horizontal.html";
private static final String LAYOUT_VERTICAL = VELOCITY_ROOT + "/form_vertical.html";
private static final String LAYOUT_BAREBONE = VELOCITY_ROOT + "/form_barebone.html";
......@@ -512,6 +514,30 @@ public class FormLayoutContainer extends FormItemImpl implements FormItemContain
return tmp;
}
/**
* This a variant of the default form layout but with a ration 6 to 6 for label and field.
* @param name
* @param formTranslator
* @return
*/
public static FormLayoutContainer createDefaultFormLayout_6_6(String name, Translator formTranslator){
FormLayoutContainer tmp = new FormLayoutContainer(name, formTranslator, LAYOUT_DEFAULT_6_6);
return tmp;
}
/**
* This a variant of the default form layout but with a ration 9 to 3 for label and field.
* @param name
* @param formTranslator
* @return
*/
public static FormLayoutContainer createDefaultFormLayout_9_3(String name, Translator formTranslator){
FormLayoutContainer tmp = new FormLayoutContainer(name, formTranslator, LAYOUT_DEFAULT_9_3);
return tmp;
}
/**
* Create a layout container that renders the form elements and its labels vertically.
*
......
## for odd reason bootstrap calls vertial horizontal
<fieldset #if(!$!f.domReplacementWrapperRequired) id="$r.getCId()" #end class="o_form form-horizontal #if ($off_css_class) $off_css_class #end $f.getContainerCssClass()" role="form">
#if ($off_title && $off_chelp_package)
<legend>
#if ($off_chelp_package)
$r.contextHelpWithWrapper("$off_chelp_package","$off_chelp_page","$off_chelp_hover")
#end
#if ($off_icon)
<i class="$off_icon"> </i>
#end
$!off_title
</legend>
#elseif ($off_title)
<legend>
#if ($off_icon)
<i class="$off_icon"> </i>
#end
$!off_title
</legend>
#elseif ($off_chelp_package)
<div class="clearfix">$r.contextHelpWithWrapper("$off_chelp_package","$off_chelp_page","$off_chelp_hover")</div>
#end
#if ($off_desc || $off_warn || $off_info)
<div class="row"><div class="col-sm-offset-6 col-sm-6">
#if ($off_desc) <div class="o_desc">$off_desc</div> #end
#if ($off_warn) <div class="o_warning">$off_warn</div> #end
#if ($off_info) <div class="o_info">$off_info</div> #end
</div></div>
#end
#foreach ($item in $formitemnames)
#if ($f.isVisible($item))
<div class="form-group $f.getElementCssClass($item) #if($f.hasError($item)) has-feedback has-error #end clearfix">
#if ($f.hasLabel($item))
$r.render("${item}_LABEL", "$f.getItemId($item)", "col-sm-6")
#end
<div class="col-sm-6 #if (!$f.hasLabel($item)) col-sm-offset-6 #end">
$r.render(${item}, "form")
#if($f.hasError($item))
<span class="o_icon o_icon_error form-control-feedback"></span>
#end
</div>
#if($f.hasExample($item))
<div class="help-block col-sm-offset-6 col-sm-6">
$r.render("${item}_EXAMPLE")
</div>
#end
#if($f.hasError($item))
<div class="col-sm-offset-6 col-sm-6">
$r.render("${item}_ERROR")
</div>
#end
</div>
#end
#end
</fieldset>
\ No newline at end of file
## for odd reason bootstrap calls vertial horizontal
<fieldset #if(!$!f.domReplacementWrapperRequired) id="$r.getCId()" #end class="o_form form-horizontal #if ($off_css_class) $off_css_class #end $f.getContainerCssClass()" role="form">
#if ($off_title && $off_chelp_package)
<legend>
#if ($off_chelp_package)
$r.contextHelpWithWrapper("$off_chelp_package","$off_chelp_page","$off_chelp_hover")
#end
#if ($off_icon)
<i class="$off_icon"> </i>
#end
$!off_title
</legend>
#elseif ($off_title)
<legend>
#if ($off_icon)
<i class="$off_icon"> </i>
#end
$!off_title
</legend>
#elseif ($off_chelp_package)
<div class="clearfix">$r.contextHelpWithWrapper("$off_chelp_package","$off_chelp_page","$off_chelp_hover")</div>
#end
#if ($off_desc || $off_warn || $off_info)
<div class="row"><div class="col-sm-offset-9 col-sm-3">
#if ($off_desc) <div class="o_desc">$off_desc</div> #end
#if ($off_warn) <div class="o_warning">$off_warn</div> #end
#if ($off_info) <div class="o_info">$off_info</div> #end
</div></div>
#end
#foreach ($item in $formitemnames)
#if ($f.isVisible($item))
<div class="form-group $f.getElementCssClass($item) #if($f.hasError($item)) has-feedback has-error #end clearfix">
#if ($f.hasLabel($item))
$r.render("${item}_LABEL", "$f.getItemId($item)", "col-sm-9")
#end
<div class="col-sm-3 #if (!$f.hasLabel($item)) col-sm-offset-9 #end">
$r.render(${item}, "form")
#if($f.hasError($item))
<span class="o_icon o_icon_error form-control-feedback"></span>
#end
</div>
#if($f.hasExample($item))
<div class="help-block col-sm-offset-9 col-sm-3">
$r.render("${item}_EXAMPLE")
</div>
#end
#if($f.hasError($item))
<div class="col-sm-offset-9 col-sm-3">
$r.render("${item}_ERROR")
</div>
#end
</div>
#end
#end
</fieldset>
\ No newline at end of file
......@@ -24,7 +24,6 @@ import java.util.List;
import org.olat.NewControllerFactory;
import org.olat.basesecurity.BaseSecurityModule;
import org.olat.core.CoreSpringFactory;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.form.flexible.FormItem;
import org.olat.core.gui.components.form.flexible.FormItemContainer;
......@@ -46,6 +45,7 @@ import org.olat.repository.RepositoryEntry;
import org.olat.user.DisplayPortraitController;
import org.olat.user.UserManager;
import org.olat.user.propertyhandlers.UserPropertyHandler;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
......@@ -60,24 +60,23 @@ public class MemberInfoController extends FormBasicController {
private Long repoEntryKey;
private UserCourseInformations courseInfos;
private final UserManager userManager;
private final BaseSecurityModule securityModule;
private final UserCourseInformationsManager efficiencyStatementManager;
@Autowired
private UserManager userManager;
@Autowired
private BaseSecurityModule securityModule;
@Autowired
private UserCourseInformationsManager userCourseInfosMgr;
public MemberInfoController(UserRequest ureq, WindowControl wControl, Identity identity,
RepositoryEntry repoEntry) {
super(ureq, wControl, "info_member");
setTranslator(Util.createPackageTranslator(UserPropertyHandler.class, ureq.getLocale(), getTranslator()));
userManager = CoreSpringFactory.getImpl(UserManager.class);
securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
efficiencyStatementManager = CoreSpringFactory.getImpl(UserCourseInformationsManager.class);
this.identity = identity;
if(repoEntry != null){
repoEntryKey = repoEntry.getKey();
courseInfos = efficiencyStatementManager.getUserCourseInformations(repoEntry.getOlatResource().getResourceableId(), identity);
courseInfos = userCourseInfosMgr.getUserCourseInformations(repoEntry.getOlatResource().getResourceableId(), identity);
}
initForm(ureq);
}
......@@ -94,7 +93,7 @@ public class MemberInfoController extends FormBasicController {
}
//user properties
FormLayoutContainer userPropertiesContainer = FormLayoutContainer.createDefaultFormLayout("userProperties", getTranslator());
FormLayoutContainer userPropertiesContainer = FormLayoutContainer.createDefaultFormLayout_6_6("userProperties", getTranslator());
formLayout.add("userProperties", userPropertiesContainer);
List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(getClass().getCanonicalName(), false);
......@@ -111,7 +110,7 @@ public class MemberInfoController extends FormBasicController {
}
//course informations
FormLayoutContainer courseInfosContainer = FormLayoutContainer.createDefaultFormLayout("courseInfos", getTranslator());
FormLayoutContainer courseInfosContainer = FormLayoutContainer.createDefaultFormLayout_9_3("courseInfos", getTranslator());
formLayout.add("courseInfos", courseInfosContainer);
membershipCreationEl = uifactory.addStaticTextElement("firstTime", "course.membership.creation", "", courseInfosContainer);
......@@ -141,7 +140,8 @@ public class MemberInfoController extends FormBasicController {
formLayout.add("contact", contactLink);
if(repoEntryKey != null) {
assessmentLink = uifactory.addFormLink("assessment", formLayout, "o_icon o_icon_assessment");
assessmentLink = uifactory.addFormLink("assessment", formLayout, Link.BUTTON);
assessmentLink.setIconLeftCSS("o_icon o_icon_certificate");
formLayout.add("assessment", assessmentLink);
}
}
......
<div class="pull-right">
$r.render("home")
$r.render("contact")
#if($r.available("assessment"))
$r.render("assessment")
#end
</div>
<h3>$fullname</h3>
<div class="container-fluid"><div class="row">
<div class="col-sm-2">
$r.render("image")
</div>
<div class="col-sm-5">
$r.render("userProperties")
<div class="o_header_with_buttons">
<h3>$fullname</h3>
<div class="o_button_group o_button_group_right">
$r.render("home")
$r.render("contact")
#if($r.available("assessment"))
$r.render("assessment")
#end
</div>
<div class="col-sm-5">
$r.render("courseInfos")
</div>
<div class="o_user_infos">
<div class="o_user_portrait">$r.render("image")</div>
<div class="o_user_infos_inner">
<div class="container-fluid">
<div class="col-sm-8">
$r.render("userProperties")
</div>
<div class="col-sm-4">
$r.render("courseInfos")
</div>
</div>
</div>
</div></div>
\ No newline at end of file
</div>
\ No newline at end of file
......@@ -58,6 +58,7 @@
@import "modules/portal";
@import "modules/library";
@import "modules/translationtool";
@import "modules/user";
@import "modules/thirdparty";
......
.o_user_infos {
position:relative;
.o_user_portrait {
position:absolute;
top:0;
left:15px;
width:100px;
height:100px;
}
.o_user_infos_inner {
margin:0 30px 0 100px;
}
.o_user_infos_inner table {
margin:0 30px 15px 30px;
}
}
\ No newline at end of file
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