Skip to content
Snippets Groups Projects
Commit 335b7b5f authored by Florian Gnaegi - frentix GmbH's avatar Florian Gnaegi - frentix GmbH
Browse files

OO-1068 add missing technical info to repo details page

parent 5de3369b
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,7 @@ import java.util.Date; ...@@ -24,6 +24,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import org.olat.NewControllerFactory; import org.olat.NewControllerFactory;
import org.olat.basesecurity.GroupRoles;
import org.olat.catalog.CatalogEntry; import org.olat.catalog.CatalogEntry;
import org.olat.catalog.CatalogManager; import org.olat.catalog.CatalogManager;
import org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback; import org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback;
...@@ -47,10 +48,12 @@ import org.olat.core.gui.control.Controller; ...@@ -47,10 +48,12 @@ 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;
import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController; import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController;
import org.olat.core.helpers.Settings;
import org.olat.core.id.OLATResourceable; import org.olat.core.id.OLATResourceable;
import org.olat.core.util.Formatter; import org.olat.core.util.Formatter;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.core.util.coordinate.CoordinatorManager;
import org.olat.core.util.filter.FilterFactory; import org.olat.core.util.filter.FilterFactory;
import org.olat.core.util.resource.OresHelper; import org.olat.core.util.resource.OresHelper;
import org.olat.core.util.vfs.VFSContainer; import org.olat.core.util.vfs.VFSContainer;
...@@ -61,6 +64,7 @@ import org.olat.course.assessment.EfficiencyStatementManager; ...@@ -61,6 +64,7 @@ import org.olat.course.assessment.EfficiencyStatementManager;
import org.olat.course.assessment.UserCourseInformations; import org.olat.course.assessment.UserCourseInformations;
import org.olat.course.assessment.UserEfficiencyStatement; import org.olat.course.assessment.UserEfficiencyStatement;
import org.olat.course.assessment.manager.UserCourseInformationsManager; import org.olat.course.assessment.manager.UserCourseInformationsManager;
import org.olat.course.run.RunMainController;
import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroup;
import org.olat.group.BusinessGroupService; import org.olat.group.BusinessGroupService;
import org.olat.group.model.SearchBusinessGroupParams; import org.olat.group.model.SearchBusinessGroupParams;
...@@ -78,6 +82,7 @@ import org.olat.resource.accesscontrol.model.AccessMethod; ...@@ -78,6 +82,7 @@ import org.olat.resource.accesscontrol.model.AccessMethod;
import org.olat.resource.accesscontrol.model.OfferAccess; import org.olat.resource.accesscontrol.model.OfferAccess;
import org.olat.resource.accesscontrol.model.Price; import org.olat.resource.accesscontrol.model.Price;
import org.olat.resource.accesscontrol.ui.PriceFormat; import org.olat.resource.accesscontrol.ui.PriceFormat;
import org.olat.resource.references.ReferenceManager;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
/** /**
...@@ -115,6 +120,10 @@ public class RepositoryEntryDetailsController extends FormBasicController { ...@@ -115,6 +120,10 @@ public class RepositoryEntryDetailsController extends FormBasicController {
private EfficiencyStatementManager effManager; private EfficiencyStatementManager effManager;
@Autowired @Autowired
private UserCourseInformationsManager userCourseInfosManager; private UserCourseInformationsManager userCourseInfosManager;
@Autowired
private CoordinatorManager coordinatorManager;
@Autowired
private ReferenceManager referenceManager;
private String baseUrl; private String baseUrl;
...@@ -216,8 +225,17 @@ public class RepositoryEntryDetailsController extends FormBasicController { ...@@ -216,8 +225,17 @@ public class RepositoryEntryDetailsController extends FormBasicController {
//load memberships //load memberships
boolean isMember = repositoryService.isMember(getIdentity(), entry); boolean isMember = repositoryService.isMember(getIdentity(), entry);
if (isMember) {
Boolean isAuthor = Boolean.valueOf(repositoryService.hasRole(getIdentity(), entry, GroupRoles.owner.name()));
layoutCont.contextPut("isEntryAuthor", isAuthor);
}
// push roles to velocity as well
layoutCont.contextPut("roles", ureq.getUserSession().getRoles());
//access control //access control
String accessI18n;
List<PriceMethod> types = new ArrayList<PriceMethod>(); List<PriceMethod> types = new ArrayList<PriceMethod>();
if (entry.isMembersOnly()) { if (entry.isMembersOnly()) {
// members only always show lock icon // members only always show lock icon
...@@ -227,6 +245,7 @@ public class RepositoryEntryDetailsController extends FormBasicController { ...@@ -227,6 +245,7 @@ public class RepositoryEntryDetailsController extends FormBasicController {
startLink = uifactory.addFormLink("start", "start", linkText, null, layoutCont, Link.BUTTON + Link.NONTRANSLATED); startLink = uifactory.addFormLink("start", "start", linkText, null, layoutCont, Link.BUTTON + Link.NONTRANSLATED);
startLink.setElementCssClass("o_start"); startLink.setElementCssClass("o_start");
} }
accessI18n = "cif.access.membersonly";
} else { } else {
AccessResult acResult = acService.isAccessible(entry, getIdentity(), false); AccessResult acResult = acService.isAccessible(entry, getIdentity(), false);
if(acResult.isAccessible()) { if(acResult.isAccessible()) {
...@@ -255,7 +274,19 @@ public class RepositoryEntryDetailsController extends FormBasicController { ...@@ -255,7 +274,19 @@ public class RepositoryEntryDetailsController extends FormBasicController {
} }
startLink.setIconRightCSS("o_icon o_icon_start o_icon-lg"); startLink.setIconRightCSS("o_icon o_icon_start o_icon-lg");
startLink.setPrimary(true); startLink.setPrimary(true);
switch (entry.getAccess()) {
case 1: accessI18n = "cif.access.owners";
break;
case 2: accessI18n = "cif.access.owners_authors";
break;
case 3: accessI18n = "cif.access.owners_authors";
break;
case 4: accessI18n = "cif.access.users_guests";
break;
}
} }
layoutCont.contextPut("accessI18n", "cif.access.membersonly");
if(!types.isEmpty()) { if(!types.isEmpty()) {
layoutCont.contextPut("ac", types); layoutCont.contextPut("ac", types);
...@@ -312,6 +343,27 @@ public class RepositoryEntryDetailsController extends FormBasicController { ...@@ -312,6 +343,27 @@ public class RepositoryEntryDetailsController extends FormBasicController {
} }
} }
layoutCont.contextPut("recentLaunch", recentLaunch); layoutCont.contextPut("recentLaunch", recentLaunch);
// show how many users are currently using this resource
String numUsers;
OLATResourceable ores = entry.getOlatResource();
int cnt = 0;
OLATResourceable courseRunOres = OresHelper.createOLATResourceableInstance(RunMainController.ORES_TYPE_COURSE_RUN, entry.getOlatResource().getResourceableId());
if (ores != null) cnt = coordinatorManager.getCoordinator().getEventBus().getListeningIdentityCntFor(courseRunOres);
numUsers = String.valueOf(cnt);
layoutCont.contextPut("numUsers", numUsers);
// Where is it in use
String referenceDetails = referenceManager.getReferencesToSummary(entry.getOlatResource(), getLocale());
if (referenceDetails != null) {
layoutCont.contextPut("referenceDetails", referenceDetails);
}
// Link to bookmark entry
String url = Settings.getServerContextPathURI() + "/url/RepositoryEntry/" + entry.getKey();
layoutCont.contextPut("extlink", url);
layoutCont.contextPut("isGuestAllowed", (entry.getAccess() >= RepositoryEntry.ACC_USERS_GUESTS ? Boolean.TRUE : Boolean.FALSE));
} }
} }
......
...@@ -14,10 +14,9 @@ ...@@ -14,10 +14,9 @@
</div> </div>
</div> </div>
#set ($hasContent = ($objectives && $requirements && $credits))
<div class="row"> <div class="row">
<div class="col-xs-12 #if($hasContent) col-sm-5 col-md-4 pull-right #end"><div class="row"> <div class="col-xs-12 col-sm-5 col-md-4 pull-right"><div class="row">
<div class="col-xs-6 #if($hasContent) col-sm-12 #end o_subcolumn"> <div class="col-xs-6 col-sm-12 o_subcolumn">
<div class="o_overview"> <div class="o_overview">
<h3>$r.translate("details.overview")</h3> <h3>$r.translate("details.overview")</h3>
#if($v.lifecycle || $v.lifecycle.softKey || $row.lifecycle.start || $row.lifecycle.end) #if($v.lifecycle || $v.lifecycle.softKey || $row.lifecycle.start || $row.lifecycle.end)
...@@ -82,7 +81,7 @@ ...@@ -82,7 +81,7 @@
$r.render("start") $r.render("start")
</div> </div>
<div class="col-xs-6 #if($hasContent) col-sm-12 #end o_subcolumn"> <div class="col-xs-6 col-sm-12 o_subcolumn">
<div class="o_personal"> <div class="o_personal">
<h3>$r.translate("details.personal")</h3> <h3>$r.translate("details.personal")</h3>
<table class="table"><tbody> <table class="table"><tbody>
...@@ -140,8 +139,8 @@ ...@@ -140,8 +139,8 @@
</div> </div>
</div></div> </div></div>
#if ($hasContent) ## START LEFT COLUMN
<div class="col-xs-12 col-sm-7 col-md-8"> <div class="col-xs-12 col-sm-7 col-md-8">
#if($objectives) #if($objectives)
<div class="o_objectives"> <div class="o_objectives">
...@@ -161,10 +160,137 @@ ...@@ -161,10 +160,137 @@
$credits $credits
</div> </div>
#end #end
<div class="panel panel-default">
<div class="panel-heading" data-toggle="collapse" data-target="#collapseInfo">
<h3 class="panel-title">
#if ($isGuestAllowed)
$r.contextHelpWithWrapper("org.olat.repository","rep-meta-guest.html","help.hover.rep.detail")
#else
$r.contextHelpWithWrapper("org.olat.repository","rep-meta-learner.html","help.hover.rep.detail")
#end
$r.translate("details.entryinfoheader")
</h3>
</div>
<div id="collapseInfo" class="panel-collapse collapse in">
<table class="table table-condensed table-striped"><tbody>
<tr><th>$r.translate("cif.id")</th><td>$v.getKey()</td></tr>
#if ($roles.isOLATAdmin())
<tr><th>$r.translate("cif.ores_id")</th><td>$v.getOlatResource().getResourceableId()</td></tr>
<tr><th>$r.translate("cif.softkey")</th><td>$v.getSoftkey()</td></tr>
#end
#if($v.getExternalId())
<tr><th>$r.translate("cif.externalid")</th><td>$v.getExternalId()</td></tr>
#end
#if($v.getExternalRef())
<tr><th>$r.translate("cif.externalref")</th><td>$v.getExternalRef()</td></tr>
#end
<tr><th>$r.translate("orderby.creationDate")</th><td>$r.formatDateAndTime($v.getCreationDate())</td></tr>
<tr><th>$r.translate("orderby.lastModified")</th><td>$r.formatDateAndTime($v.getLastModified())</td></tr>
#if ($isAuthor || $roles.isOLATAdmin() || $roles.isAuthor() || $roles.isInstitutionalResourceManager())
<tr><th>$r.translate("cif.access")</th><td>$r.translate("$accessI18n")</td></tr>
<tr><th>$r.translate("cif.initialAuthor")</th><td>$v.getInitialAuthor()</td></tr>
<tr><th>$r.translate("cif.owners")</th><td>TODO</td></tr>
</tbody></table>
<div class="panel-body">
<h5>$r.translate("details.extlinkheader")</h5>
<div class="o_copy_code">$extlink</div>
#if ($isGuestAllowed)
<div class="o_copy_code">${extlink}?guest=true&amp;lang=${userlang}</div>
#end
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" data-toggle="collapse" data-target="#collapseUsage">
<h3 class="panel-title">
$r.contextHelpWithWrapper("org.olat.repository",'rep-meta-info-reference.html','help.hover.rep.detail')
$r.translate("details.referenceinfoheader")
</h3>
</div>
<div id="collapseUsage" class="panel-collapse collapse">
<table class="table table-condensed table-striped"><tbody>
#if ($referenceDetails)
<tr>
<th>$r.translate("details.referenceinfo")</th>
<td>$referenceDetails</td>
</tr>
#end
#if ($isAuthor || $roles.isOLATAdmin() || $roles.isInstitutionalResourceManager())
<tr><th>$r.translate("cif.lastusage")</th><td>$r.formatDateAndTime($v.getStatistics().getLastUsage())</td></tr>
<tr><th>$r.translate("cif.usedbycnt")</th><td>$numUsers</td></tr>
<tr><th>$r.translate("cif.launched")</th><td>#if ($v.getStatistics().getLaunchCounter()) $v.getStatistics().getLaunchCounter() #else 0 #end</td></tr>
<tr><th>$r.translate("cif.downloaded")</th><td>#if ($v.getStatistics().getDowloadCounter()) $v.getStatistics().getDowloadCounter() #else 0 #end</td></tr>
#end
#end
</tbody></table>
</div>
</div>
#if ($v.getManagedFlags().size() > 0)
<div class="panel panel-default">
<div class="panel-heading" data-toggle="collapse" data-target="#collapseManaged">
<h3 class="panel-title">
$r.contextHelpWithWrapper("org.olat.admin.restapi","managed.html","help.hover.managed")
$r.translate("cif.managedflags")
</h3>
</div>
<div id="collapseManaged" class="panel-collapse collapse">
<div class="panel-body">
$r.translate("managed.resource.intro")
</div>
<div class="panel-body">
<ul>
#foreach ($flag in $v.getManagedFlags())
<li>$r.translate("managed.flags.course.${flag}")</li>
#end
</ul>
</div>
</div>
</div>
#end
</div> </div>
#end ## END LEFT COLUMN
</div> </div>
</div> </div>
#*
#if ($isOwner || $isAuthor)
<h3>
$r.translate("addinfo.owner")
</h3>
#if($iscourse && $CourseInfoForm)
$r.render("CourseInfoForm")
#else
<fieldset>
<legend>$r.translate("details.typeinfoheader")</legend>
$r.contextHelpWithWrapper("org.olat.repository",'rep-meta-info.html','help.hover.rep.detail')
#if ($hasHandlerDetails)
$r.render("handlerDetails")
#else
<i>$r.translate("details.notypeinfo")</i>
#end
</fieldset>
#end
#if($isOwner)
#o_togglebox_start("o_repo_details" $r.translate("addinfo.owner"))
<fieldset>
<legend>$r.translate('details.owner')</legend>
$r.render('ownertable')
</fieldset>
$r.render('vc_infopanel')
#o_togglebox_end()
#end
#end
*#
\ No newline at end of file
3.1.1 3.1.1
SaSS version, get it from https://github.com/twbs/bootstrap-sass/releases SaSS version, get it from https://github.com/twbs/bootstrap-sass/releases
\ No newline at end of file
PATCHES:
- Add "panel-collapse" to about line 96 in panels.scss like this:
.panel, .panel-collapse {
> .table,
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
// Place a non-bordered `.table` within a panel (not within a `.panel-body`) and // Place a non-bordered `.table` within a panel (not within a `.panel-body`) and
// watch it go full width. // watch it go full width.
.panel { .panel, .panel-collapse {
> .table, > .table,
> .table-responsive > .table { > .table-responsive > .table {
margin-bottom: 0; margin-bottom: 0;
......
...@@ -49,6 +49,17 @@ div.o_chelp_wrapper { ...@@ -49,6 +49,17 @@ div.o_chelp_wrapper {
overflow-x: auto; overflow-x: auto;
overflow-y: hidden; overflow-y: hidden;
} }
.o_copy_code {
overflow-x: auto;
overflow-y: auto;
font-family: $font-family-monospace;
padding: 2px 4px;
font-size: 90%;
color: $code-color;
background-color: $code-bg;
white-space: nowrap;
border-radius: $border-radius-base;
}
/* multiple buttons, center aligned */ /* multiple buttons, center aligned */
.o_button_group { .o_button_group {
......
source diff could not be displayed: it is too large. Options to address this: view the blob.
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