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
abc7ff30
Commit
abc7ff30
authored
7 years ago
by
gnaegi
Browse files
Options
Downloads
Patches
Plain Diff
OO-2505 update course editor title on import only when repo entry title was modified
parent
e6153ad1
No related branches found
Branches containing commit
Tags
OpenOLAT_8.2.0beta
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/olat/repository/handlers/CourseHandler.java
+25
-3
25 additions, 3 deletions
...main/java/org/olat/repository/handlers/CourseHandler.java
with
25 additions
and
3 deletions
src/main/java/org/olat/repository/handlers/CourseHandler.java
+
25
−
3
View file @
abc7ff30
...
...
@@ -26,6 +26,8 @@
package
org.olat.repository.handlers
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.nio.file.DirectoryStream
;
import
java.nio.file.FileVisitResult
;
...
...
@@ -254,9 +256,29 @@ public class CourseHandler implements RepositoryHandler {
course
=
CourseFactory
.
loadCourse
(
cgm
.
getCourseResource
());
course
.
postImport
(
fImportBaseDirectory
,
envMapper
);
//rename root nodes
course
.
getRunStructure
().
getRootNode
().
setShortTitle
(
Formatter
.
truncateOnly
(
displayname
,
25
));
//do not use truncate!
course
.
getRunStructure
().
getRootNode
().
setLongTitle
(
displayname
);
//rename root nodes, but only when user modified the course title
boolean
doUpdateTitle
=
true
;
File
repoConfigXml
=
new
File
(
fImportBaseDirectory
,
"repo.xml"
);
if
(
repoConfigXml
.
exists
())
{
RepositoryEntryImport
importConfig
;
try
{
importConfig
=
RepositoryEntryImportExport
.
getConfiguration
(
new
FileInputStream
(
repoConfigXml
));
if
(
importConfig
!=
null
)
{
if
(
displayname
.
equals
(
importConfig
.
getDisplayname
()))
{
// do not update if title was not modified during import
// user does not expect to have an updated title and there is a chance
// the root node title is not the same as the course title
doUpdateTitle
=
false
;
}
}
}
catch
(
FileNotFoundException
e
)
{
// ignore
}
}
if
(
doUpdateTitle
)
{
course
.
getRunStructure
().
getRootNode
().
setShortTitle
(
Formatter
.
truncateOnly
(
displayname
,
25
));
//do not use truncate!
course
.
getRunStructure
().
getRootNode
().
setLongTitle
(
displayname
);
}
//course.saveRunStructure();
CourseEditorTreeNode
editorRootNode
=
((
CourseEditorTreeNode
)
course
.
getEditorTreeModel
().
getRootNode
());
editorRootNode
.
getCourseNode
().
setShortTitle
(
Formatter
.
truncateOnly
(
displayname
,
25
));
//do not use truncate!
...
...
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