From cbbb3a1c8d9f9bfc63410ac0eadc8915839dc20e Mon Sep 17 00:00:00 2001 From: srosse <none@none> Date: Wed, 30 Mar 2016 15:21:27 +0200 Subject: [PATCH] CL-526: display user interest and user searched interests properties side by side if the two are present --- .../olat/user/HomePageDisplayController.java | 11 ++++ .../olat/user/_content/homepagedisplay.html | 55 ++++++------------- .../_i18n/LocalStrings_de.properties | 1 + .../_i18n/LocalStrings_en.properties | 1 + .../_i18n/LocalStrings_fr.properties | 1 + 5 files changed, 31 insertions(+), 38 deletions(-) diff --git a/src/main/java/org/olat/user/HomePageDisplayController.java b/src/main/java/org/olat/user/HomePageDisplayController.java index 382b29df6fb..dd60e844dea 100644 --- a/src/main/java/org/olat/user/HomePageDisplayController.java +++ b/src/main/java/org/olat/user/HomePageDisplayController.java @@ -91,13 +91,24 @@ public class HomePageDisplayController extends BasicController { // do the looping in the velocity context List<UserPropertyHandler> userPropertyHandlers = new ArrayList<UserPropertyHandler>(userManager.getUserPropertyHandlersFor(usageIdentifyer, false)); + UserPropertyHandler userSearchedInterestsHandler = null; + UserPropertyHandler userInterestsHandler = null; for(Iterator<UserPropertyHandler> propIt=userPropertyHandlers.iterator(); propIt.hasNext(); ) { UserPropertyHandler prop = propIt.next(); if(!hpc.isEnabled(prop.getName()) && !userManager.isMandatoryUserProperty(usageIdentifyer, prop)) { propIt.remove(); + } else if("userInterests".equals(prop.getName())) { + userInterestsHandler = prop; + } else if("userSearchedInterests".equals(prop.getName())) { + userSearchedInterestsHandler = prop; } } + if(userInterestsHandler != null && userSearchedInterestsHandler != null) { + userPropertyHandlers.remove(userSearchedInterestsHandler); + } + mainVC.contextPut("userPropertyHandlers", userPropertyHandlers); + mainVC.contextPut("userSearchedInterestsHandler", userSearchedInterestsHandler); mainVC.contextPut("homepageConfig", hpc); // Add external link to visiting card diff --git a/src/main/java/org/olat/user/_content/homepagedisplay.html b/src/main/java/org/olat/user/_content/homepagedisplay.html index 069e4b12a08..0299afe954c 100644 --- a/src/main/java/org/olat/user/_content/homepagedisplay.html +++ b/src/main/java/org/olat/user/_content/homepagedisplay.html @@ -1,57 +1,36 @@ <div class="o_visitingcard clearfix well"><div class="o_scrollblock"> - <h2> - <i class="o_icon o_icon_visitingcard"></i> - $r.translate("menu.homepage") $userFullname - </h2> + <h2><i class="o_icon o_icon_visitingcard"></i> $r.translate("menu.homepage") $userFullname</h2> #if ($deleted) - <p class="o_warning"> - $r.translate("user.deleted") - </p> + <p class="o_warning">$r.translate("user.deleted")</p> #end <div class="o_visitingcard_content"> - <div class="o_visitingcard_image o_block"> - $r.render("image") - </div> + <div class="o_visitingcard_image o_block">$r.render("image")</div> <table class="table table-condensed table-striped"> #if($r.available("im.link")) <tr class="o_im_status"> - <th> - <label> - $r.translate("status") - </label> - </th> - <td> - <div id="o_im_buddy"> - $r.render("im.link") - </div> - </td> + <th>$r.translate("status")</th> + <td colspan="3"><div id="o_im_buddy">$r.render("im.link")</div></td> </tr> #end - #foreach( $propertyHandler in $userPropertyHandlers ) + #foreach($propertyHandler in $userPropertyHandlers ) <tr> - <th> - <label> - $r.translate($propertyHandler.i18nFormElementLabelKey()) - </label> - </th> - <td> - $!propertyHandler.getUserPropertyAsHTML($user, $locale) - </td> + <th>$r.translate($propertyHandler.i18nFormElementLabelKey()) </th> + #if($propertyHandler.name == "userInterests" && $userSearchedInterestsHandler) + <td>$!propertyHandler.getUserPropertyAsHTML($user, $locale)</td> + <th>$r.translate($userSearchedInterestsHandler.i18nFormElementLabelKey())</th> + <td>$!userSearchedInterestsHandler.getUserPropertyAsHTML($user, $locale)</td> + #else + <td colspan="3">$!propertyHandler.getUserPropertyAsHTML($user, $locale)</td> + #end </tr> #end - #if ( $homepageConfig.getTextAboutMe() && ($homepageConfig.getTextAboutMe() != "") ) + #if( $homepageConfig.getTextAboutMe() && ($homepageConfig.getTextAboutMe() != "") ) <tr valign="top" class="o_user_aboutme"> - <th> - <label> - $r.translate("form.text") - </label> - </th> - <td> - $!r.formatLatexFormulas($homepageConfig.getTextAboutMe()) - </td> + <th>$r.translate("form.text")</th> + <td colspan="3">$!r.formatLatexFormulas($homepageConfig.getTextAboutMe())</td> </tr> #end </table> diff --git a/src/main/java/org/olat/user/propertyhandlers/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/user/propertyhandlers/_i18n/LocalStrings_de.properties index a60ecb3889d..60848f6e2bb 100644 --- a/src/main/java/org/olat/user/propertyhandlers/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/user/propertyhandlers/_i18n/LocalStrings_de.properties @@ -343,6 +343,7 @@ form.name.telPrivate.error.empty=Das Feld "Telefon Privat" darf nicht leer sein. form.name.telPrivate.error.valid=Bitte geben Sie eine g\u00FCltige Telefonnummer an. form.name.typeOfUser=Art von Benutzer form.name.userInterests=Expertise +form.name.userSearchedInterests=Gesuchte Expertise form.name.xing=Xing form.name.xing.error=Bitte geben Sie einen g\u00FCltigen Xing-Namen an (Entspricht dem in der WWW-Adresse Ihres Xing-Profiles, http\://www.xing.com/profile/<Ihr Benutzername>) form.name.zipCode=Postleitzahl diff --git a/src/main/java/org/olat/user/propertyhandlers/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/user/propertyhandlers/_i18n/LocalStrings_en.properties index 192784dc3e1..738a27a0a69 100644 --- a/src/main/java/org/olat/user/propertyhandlers/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/user/propertyhandlers/_i18n/LocalStrings_en.properties @@ -343,6 +343,7 @@ form.name.telPrivate.error.empty=The field "Phone number private" is mandatory. form.name.telPrivate.error.valid=Please enter a valid phone number form.name.typeOfUser=Type of user form.name.userInterests=Expertise +form.name.userSearchedInterests=Searched Expertise form.name.xing=Xing form.name.xing.error=Please indicate a valid Xing name (the one in the www address of your Xing profile, http\://www.xing.com/profile/<your user name>) form.name.zipCode=Zip code diff --git a/src/main/java/org/olat/user/propertyhandlers/_i18n/LocalStrings_fr.properties b/src/main/java/org/olat/user/propertyhandlers/_i18n/LocalStrings_fr.properties index 50a248f292d..be539e82af1 100644 --- a/src/main/java/org/olat/user/propertyhandlers/_i18n/LocalStrings_fr.properties +++ b/src/main/java/org/olat/user/propertyhandlers/_i18n/LocalStrings_fr.properties @@ -343,6 +343,7 @@ form.name.telPrivate.error.empty=Le champ "t\u00E9l\u00E9phone priv\u00E9" ne do form.name.telPrivate.error.valid=Veuillez indiquer un num\u00E9ro de t\u00E9l\u00E9phone valide form.name.typeOfUser=Type d'utilisateur form.name.userInterests=Comp\u00E9tences +form.name.userSearchedInterests=Comp\u00E9tences recherch\u00E9es form.name.xing=Xing form.name.xing.error=Veuillez indiquer un nom Xing valide (correspondant \u00E0 celui dans l'adresse www de votre profile Xing, http\://www.xing.com/profile/<votre nom d'utilisateur) form.name.zipCode=NPA / Code postal -- GitLab