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
c160d183
Commit
c160d183
authored
4 years ago
by
uhensler
Browse files
Options
Downloads
Patches
Plain Diff
OO-5299: Hide course tools until disclaimer accepted
parent
540ea08c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/org/olat/course/run/CourseRuntimeController.java
+23
-19
23 additions, 19 deletions
...ain/java/org/olat/course/run/CourseRuntimeController.java
src/main/java/org/olat/course/run/RunMainController.java
+15
-5
15 additions, 5 deletions
src/main/java/org/olat/course/run/RunMainController.java
with
38 additions
and
24 deletions
src/main/java/org/olat/course/run/CourseRuntimeController.java
+
23
−
19
View file @
c160d183
...
...
@@ -468,11 +468,13 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
toolbarPanel
.
setBreadcrumbEnabled
(
false
);
}
RunMainController
rmc
=
getRunMainController
();
boolean
disclaimerAccepted
=
rmc
!=
null
&&
rmc
.
isDisclaimerAccepted
();
initToolsMenu
(
toolsDropdown
);
initToolsMyCourse
(
course
);
initGeneralTools
(
course
);
initGeneralTools
(
course
,
disclaimerAccepted
);
RunMainController
rmc
=
getRunMainController
();
if
(
rmc
!=
null
)
{
rmc
.
initToolbarAndProgressbar
();
}
...
...
@@ -852,7 +854,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
return
(
userCourseEnv
.
isParticipant
()
||
!
userCourseEnv
.
getParticipatingGroups
().
isEmpty
());
}
private
void
initGeneralTools
(
ICourse
course
)
{
private
void
initGeneralTools
(
ICourse
course
,
boolean
disclaimerAccepted
)
{
boolean
assessmentLock
=
isAssessmentLock
();
UserCourseEnvironment
userCourseEnv
=
getUserCourseEnvironment
();
...
...
@@ -864,7 +866,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
toolbarPanel
.
addTool
(
detailsLink
);
}
if
(!
assessmentLock
&&
!
isGuestOnly
if
(!
assessmentLock
&&
!
isGuestOnly
&&
disclaimerAccepted
&&
LearningPathNodeAccessProvider
.
TYPE
.
equals
(
cc
.
getNodeAccessType
().
getType
()))
{
learningPathLink
=
LinkFactory
.
createToolLink
(
"learningPath"
,
translate
(
"command.learning.path"
),
this
,
CourseTool
.
learningpath
.
getIconCss
());
learningPathLink
.
setUrl
(
BusinessControlFactory
.
getInstance
()
...
...
@@ -875,7 +877,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
learningPathLink
.
setVisible
(
userCourseEnv
!=
null
&&
userCourseEnv
.
isParticipant
());
}
if
(!
assessmentLock
&&
!
isGuestOnly
if
(!
assessmentLock
&&
!
isGuestOnly
&&
disclaimerAccepted
&&
LearningPathNodeAccessProvider
.
TYPE
.
equals
(
cc
.
getNodeAccessType
().
getType
()))
{
learningPathsLink
=
LinkFactory
.
createToolLink
(
"learningPaths"
,
translate
(
"command.learning.paths"
),
this
,
CourseTool
.
learningpath
.
getIconCss
());
learningPathsLink
.
setUrl
(
BusinessControlFactory
.
getInstance
()
...
...
@@ -886,7 +888,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
learningPathsLink
.
setVisible
(
userCourseEnv
!=
null
&&
(
userCourseEnv
.
isCoach
()
||
userCourseEnv
.
isAdmin
()));
}
boolean
calendarIsEnabled
=
!
assessmentLock
&&
!
isGuestOnly
&&
calendarModule
.
isEnabled
()
boolean
calendarIsEnabled
=
!
assessmentLock
&&
!
isGuestOnly
&&
disclaimerAccepted
&&
calendarModule
.
isEnabled
()
&&
calendarModule
.
isEnableCourseToolCalendar
()
&&
reSecurity
.
canLaunch
();
if
(
calendarIsEnabled
&&
userCourseEnv
!=
null
)
{
calendarLink
=
LinkFactory
.
createToolLink
(
"calendar"
,
translate
(
"command.calendar"
),
this
,
"o_icon_calendar"
);
...
...
@@ -897,14 +899,14 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
toolbarPanel
.
addTool
(
calendarLink
);
}
if
(!
assessmentLock
&&
isLecturesLinkEnabled
())
{
if
(!
assessmentLock
&&
disclaimerAccepted
&&
isLecturesLinkEnabled
())
{
lecturesLink
=
LinkFactory
.
createToolLink
(
"command.lectures"
,
translate
(
"command.lectures"
),
this
,
"o_icon_lecture"
);
lecturesLink
.
setUrl
(
BusinessControlFactory
.
getInstance
()
.
getAuthenticatedURLFromBusinessPathStrings
(
businessPathEntry
,
"[Lectures:0]"
));
toolbarPanel
.
addTool
(
lecturesLink
);
}
if
(!
assessmentLock
&&
!
isGuestOnly
&&
userCourseEnv
!=
null
)
{
if
(!
assessmentLock
&&
!
isGuestOnly
&&
disclaimerAccepted
&&
userCourseEnv
!=
null
)
{
participantListLink
=
LinkFactory
.
createToolLink
(
"participantlist"
,
translate
(
CourseTool
.
participantlist
.
getI18nKey
()),
this
,
CourseTool
.
participantlist
.
getIconCss
());
...
...
@@ -914,7 +916,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
toolbarPanel
.
addTool
(
participantListLink
);
}
if
(!
assessmentLock
&&
userCourseEnv
!=
null
)
{
if
(!
assessmentLock
&&
disclaimerAccepted
&&
userCourseEnv
!=
null
)
{
participantInfoLink
=
LinkFactory
.
createToolLink
(
"participantinfo"
,
translate
(
CourseTool
.
participantinfos
.
getI18nKey
()),
this
,
CourseTool
.
participantinfos
.
getIconCss
());
...
...
@@ -924,7 +926,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
toolbarPanel
.
addTool
(
participantInfoLink
);
}
if
(!
assessmentLock
&&
!
isGuestOnly
&&
userCourseEnv
!=
null
&&
!
userCourseEnv
.
isCourseReadOnly
())
{
if
(!
assessmentLock
&&
!
isGuestOnly
&&
disclaimerAccepted
&&
userCourseEnv
!=
null
&&
!
userCourseEnv
.
isCourseReadOnly
())
{
emailLink
=
LinkFactory
.
createToolLink
(
"email"
,
translate
(
CourseTool
.
email
.
getI18nKey
()),
this
,
CourseTool
.
email
.
getIconCss
());
emailLink
.
setUrl
(
BusinessControlFactory
.
getInstance
()
.
getAuthenticatedURLFromBusinessPathStrings
(
businessPathEntry
,
"[email:0]"
));
...
...
@@ -932,7 +934,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
toolbarPanel
.
addTool
(
emailLink
);
}
if
(!
assessmentLock
&&
userCourseEnv
!=
null
)
{
if
(!
assessmentLock
&&
disclaimerAccepted
&&
userCourseEnv
!=
null
)
{
blogLink
=
LinkFactory
.
createToolLink
(
"blog"
,
translate
(
CourseTool
.
blog
.
getI18nKey
()),
this
,
CourseTool
.
blog
.
getIconCss
());
blogLink
.
setUrl
(
BusinessControlFactory
.
getInstance
()
.
getAuthenticatedURLFromBusinessPathStrings
(
businessPathEntry
,
"[blog:0]"
));
...
...
@@ -940,7 +942,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
toolbarPanel
.
addTool
(
blogLink
);
}
if
(!
assessmentLock
&&
userCourseEnv
!=
null
)
{
if
(!
assessmentLock
&&
disclaimerAccepted
&&
userCourseEnv
!=
null
)
{
wikiLink
=
LinkFactory
.
createToolLink
(
"wiki"
,
translate
(
CourseTool
.
wiki
.
getI18nKey
()),
this
,
CourseTool
.
wiki
.
getIconCss
());
wikiLink
.
setUrl
(
BusinessControlFactory
.
getInstance
()
.
getAuthenticatedURLFromBusinessPathStrings
(
businessPathEntry
,
"[wiki:0]"
));
...
...
@@ -948,7 +950,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
toolbarPanel
.
addTool
(
wikiLink
);
}
if
(!
assessmentLock
&&
userCourseEnv
!=
null
)
{
if
(!
assessmentLock
&&
disclaimerAccepted
&&
userCourseEnv
!=
null
)
{
forumLink
=
LinkFactory
.
createToolLink
(
"forum"
,
translate
(
CourseTool
.
forum
.
getI18nKey
()),
this
,
CourseTool
.
forum
.
getIconCss
());
forumLink
.
setUrl
(
BusinessControlFactory
.
getInstance
()
.
getAuthenticatedURLFromBusinessPathStrings
(
businessPathEntry
,
"[forum:0]"
));
...
...
@@ -956,7 +958,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
toolbarPanel
.
addTool
(
forumLink
);
}
if
(!
assessmentLock
&&
userCourseEnv
!=
null
)
{
if
(!
assessmentLock
&&
disclaimerAccepted
&&
userCourseEnv
!=
null
)
{
documentsLink
=
LinkFactory
.
createToolLink
(
"documents"
,
translate
(
CourseTool
.
documents
.
getI18nKey
()),
this
,
CourseTool
.
documents
.
getIconCss
());
documentsLink
.
setUrl
(
BusinessControlFactory
.
getInstance
()
.
getAuthenticatedURLFromBusinessPathStrings
(
businessPathEntry
,
"[documents:0]"
));
...
...
@@ -964,7 +966,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
toolbarPanel
.
addTool
(
documentsLink
);
}
if
(!
assessmentLock
)
{
if
(!
assessmentLock
&&
disclaimerAccepted
)
{
glossary
=
new
Dropdown
(
"glossary"
,
"command.glossary"
,
false
,
getTranslator
());
glossary
.
setIconCSS
(
"o_icon o_FileResource-GLOSSARY_icon"
);
glossary
.
setVisible
(
cc
.
hasGlossary
()
&&
cc
.
isGlossaryEnabled
());
...
...
@@ -979,7 +981,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
}
//add group chat to toolbox
boolean
chatIsEnabled
=
!
assessmentLock
&&
!
isGuestOnly
&&
imModule
.
isEnabled
()
boolean
chatIsEnabled
=
!
assessmentLock
&&
!
isGuestOnly
&&
disclaimerAccepted
&&
imModule
.
isEnabled
()
&&
imModule
.
isCourseEnabled
()
&&
reSecurity
.
canLaunch
();
if
(
chatIsEnabled
&&
userCourseEnv
!=
null
&&
!
userCourseEnv
.
isCourseReadOnly
())
{
chatLink
=
LinkFactory
.
createToolLink
(
"chat"
,
translate
(
"command.coursechat"
),
this
,
"o_icon_chat"
);
...
...
@@ -988,7 +990,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
}
// add course search to toolbox
boolean
isSearchEnabled
=
!
assessmentLock
&&
searchModule
.
isSearchAllowed
(
roles
);
boolean
isSearchEnabled
=
!
assessmentLock
&&
disclaimerAccepted
&&
searchModule
.
isSearchAllowed
(
roles
);
if
(
isSearchEnabled
)
{
searchLink
=
LinkFactory
.
createToolLink
(
"coursesearch"
,
translate
(
"command.coursesearch"
),
this
,
"o_icon_search"
);
searchLink
.
setVisible
(
cc
.
isCourseSearchEnabled
());
...
...
@@ -1164,6 +1166,8 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
}
else
if
(
event
instanceof
OpenCourseToolEvent
)
{
CourseTool
tool
=
((
OpenCourseToolEvent
)
event
).
getTool
();
doOpenTool
(
ureq
,
tool
);
}
else
if
(
event
==
RunMainController
.
COURSE_DISCLAIMER_ACCEPTED
)
{
initToolbar
();
}
}
else
if
(
lifeCycleChangeCtr
==
source
)
{
if
(
event
==
RepositoryEntryLifeCycleChangeController
.
deletedEvent
)
{
...
...
@@ -2038,7 +2042,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
currentToolCtr
=
participatListCtrl
;
}
else
{
delayedClose
=
Delayed
.
participantList
;
}
;
}
}
private
void
doParticipantInfo
(
UserRequest
ureq
)
{
...
...
@@ -2068,7 +2072,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
currentToolCtr
=
participatInfoCtrl
;
}
else
{
delayedClose
=
Delayed
.
participantInfo
;
}
;
}
}
private
void
doEmail
(
UserRequest
ureq
)
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/org/olat/course/run/RunMainController.java
+
15
−
5
View file @
c160d183
...
...
@@ -125,6 +125,7 @@ public class RunMainController extends MainLayoutBasicController implements Gene
private
static
final
Logger
log
=
Tracing
.
createLoggerFor
(
RunMainController
.
class
);
public
static
final
Event
COURSE_DISCLAIMER_ACCEPTED
=
new
Event
(
"course-disclaimer-accepted"
);
public
static
final
String
REBUILD
=
"rebuild"
;
public
static
final
String
ORES_TYPE_COURSE_RUN
=
OresHelper
.
calculateTypeName
(
RunMainController
.
class
,
CourseModule
.
ORES_TYPE_COURSE
);
private
final
OLATResourceable
courseRunOres
;
//course run ores for course run channel
...
...
@@ -154,6 +155,7 @@ public class RunMainController extends MainLayoutBasicController implements Gene
private
boolean
needsRebuildAfter
=
false
;
private
boolean
needsRebuildAfterPublish
=
false
;
private
boolean
needsRebuildAfterRunDone
=
false
;
private
boolean
disclaimerAccepted
=
true
;
private
String
courseTitle
;
private
Link
nextLink
,
previousLink
;
...
...
@@ -283,13 +285,15 @@ public class RunMainController extends MainLayoutBasicController implements Gene
coursemain
.
contextPut
(
"courserepokey"
,
courseRepositoryEntry
.
getKey
());
// if a disclaimer is enabled, show it first
if
(
courseModule
.
isDisclaimerEnabled
()
&&
course
.
getCourseEnvironment
().
getCourseConfig
().
isDisclaimerEnabled
()
&&
!
disclaimerManager
.
isAccessGranted
(
courseRepositoryEntry
,
getIdentity
(),
ureq
.
getUserSession
().
getRoles
()))
{
disclaimerAccepted
=
!
courseModule
.
isDisclaimerEnabled
()
||
!
course
.
getCourseEnvironment
().
getCourseConfig
().
isDisclaimerEnabled
()
||
disclaimerManager
.
isAccessGranted
(
courseRepositoryEntry
,
getIdentity
(),
ureq
.
getUserSession
().
getRoles
());
if
(
disclaimerAccepted
)
{
coursemain
.
put
(
"coursemain"
,
columnLayoutCtr
.
getInitialComponent
());
}
else
{
disclaimerController
=
new
CourseDisclaimerConsentController
(
ureq
,
getWindowControl
(),
courseRepositoryEntry
);
listenTo
(
disclaimerController
);
coursemain
.
put
(
"coursemain"
,
disclaimerController
.
getInitialComponent
());
}
else
{
coursemain
.
put
(
"coursemain"
,
columnLayoutCtr
.
getInitialComponent
());
}
// on initial call we have to set the data-nodeid manually. later it
...
...
@@ -318,6 +322,10 @@ public class RunMainController extends MainLayoutBasicController implements Gene
CoordinatorManager
.
getInstance
().
getCoordinator
().
getEventBus
().
registerFor
(
this
,
identity
,
courseRepositoryEntry
);
}
public
boolean
isDisclaimerAccepted
()
{
return
disclaimerAccepted
;
}
protected
void
setTextMarkingEnabled
(
boolean
enabled
)
{
if
(
glossaryMarkerCtr
!=
null
)
{
glossaryMarkerCtr
.
setTextMarkingEnabled
(
enabled
);
...
...
@@ -431,7 +439,7 @@ public class RunMainController extends MainLayoutBasicController implements Gene
}
else
{
List
<
TreeNode
>
flatTree
=
new
ArrayList
<>();
TreeHelper
.
makeTreeFlat
(
luTree
.
getTreeModel
().
getRootNode
(),
flatTree
);
hasPrevious
=
getPreviousNonDelegatingNode
(
flatTree
,
luTree
.
getSelectedNode
())
!=
null
;
;
hasPrevious
=
getPreviousNonDelegatingNode
(
flatTree
,
luTree
.
getSelectedNode
())
!=
null
;
int
index
=
flatTree
.
indexOf
(
luTree
.
getSelectedNode
());
hasNext
=
index
>=
0
&&
index
+
1
<
flatTree
.
size
();
}
...
...
@@ -754,8 +762,10 @@ public class RunMainController extends MainLayoutBasicController implements Gene
}
}
else
if
(
source
==
disclaimerController
)
{
if
(
event
==
Event
.
DONE_EVENT
)
{
disclaimerAccepted
=
true
;
coursemain
.
put
(
"coursemain"
,
columnLayoutCtr
.
getInitialComponent
());
coursemain
.
setDirty
(
true
);
fireEvent
(
ureq
,
COURSE_DISCLAIMER_ACCEPTED
);
}
}
}
...
...
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