Skip to content

Commit

Permalink
SAK-31068 Add Forums Import As Draft setting (sakaiproject#2368)
Browse files Browse the repository at this point in the history
* SAK-31068 Add Forums Import As Draft setting

This feature allows the forums tool to have it's own importAsDraft
functionality.

* SAK-31068 Fixup Logic change error

* SAK-31068 Use import.importAsDraft as default also...

changed all instances of retrieving import.importAsDraft from
getString to getBoolean because getting a string is of a boolean
is dumb and needless.
  • Loading branch information
master-bob authored and jonespm committed Apr 6, 2017
1 parent b8457bd commit a060b25
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ public Map<String, String> transferCopyEntitiesRefMigrator(String fromContext, S
nMessageHeader.setDate(oMessageHeader.getDate());
nMessageHeader.setMessage_order(oMessageHeader.getMessage_order());
// when importing, refer to property to determine draft status
if ("false".equalsIgnoreCase(m_serverConfigurationService.getString("import.importAsDraft")))
if (!m_serverConfigurationService.getBoolean("import.importAsDraft", true))
{
nMessageHeader.setDraft(oMessageHeader.getDraft());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6601,7 +6601,7 @@ else if (oldUrl.startsWith("/content/group/" + fromSiteId + "/"))
} // for

// when importing, refer to property to determine draft status
if ("false".equalsIgnoreCase(m_serverConfigurationService.getString("import.importAsDraft")))
if (!m_serverConfigurationService.getBoolean("import.importAsDraft", true))
{
String draftAttribute = el2clone.getAttribute("draft");
if (draftAttribute.equalsIgnoreCase("true") || draftAttribute.equalsIgnoreCase("false"))
Expand Down Expand Up @@ -6767,7 +6767,7 @@ public Map<String, String> transferCopyEntitiesRefMigrator(String fromContext, S
nAssignment.setContext(toContext);

// when importing, refer to property to determine draft status
if ("false".equalsIgnoreCase(m_serverConfigurationService.getString("import.importAsDraft")))
if (!m_serverConfigurationService.getBoolean("import.importAsDraft", true))
{
nAssignment.setDraft(oAssignment.getDraft());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1772,6 +1772,12 @@
# DEFAULT: use the categories defined in the tool xml file
# tool.categories.{toolid}=category1,category2,category3

# Controls whether when importing / duplicating a site to have them be as draft
# Applies to announcements, assignments, and messages
# msgcntr has own property of msgcntr.forums.import.importAsDraft
# DEFAULT: true
# import.importAsDraft=false

# GRADEBOOK 1
# Controls the display of the number of decimal points for the class average.
# In Gradebook Items -> {click on an item}.
Expand Down Expand Up @@ -3850,6 +3856,11 @@
# DEFAULT: false
# msgcntr.forums.revealIDsToRoles.revisable=false

# SAK-31068 Configure forums Import / Duplication behavior
# By default, will set imported objects in Draft mode
# DEFAULT: true
# msgcntr.forums.import.importAsDraft=false

## SAK-19178
# Should we load the initial jobs on startup.
# - "init" will schedule the jobs *only* on the first startup of Sakai.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ else if (element2.getTagName().equals(SYNOPTIC_TOOL))
}
// TODO: reall want a draft? -ggolden
// set draft status based upon property setting
if ("false".equalsIgnoreCase(m_serverConfigurationService.getString("import.importAsDraft")))
if (!m_serverConfigurationService.getBoolean("import.importAsDraft", true))
{
String draftAttribute = element4.getAttribute("draft");
if (draftAttribute.equalsIgnoreCase("true") || draftAttribute.equalsIgnoreCase("false"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ public Map<String, String> transferCopyEntitiesRefMigrator(String fromContext, S
Area area = areaManager.getDiscussionArea(toContext, false);
newForum.setArea(area);

if ("false".equalsIgnoreCase(ServerConfigurationService.getString("import.importAsDraft")))
if (!getImportAsDraft())
{
forumManager.saveDiscussionForum(newForum, newForum.getDraft().booleanValue());
}
Expand Down Expand Up @@ -923,7 +923,7 @@ else if (propertiesElement.getTagName().equals(PERMISSIONS)) {
{
Area area = areaManager.getDiscussionArea(siteId);
dfForum.setArea(area);
if ("false".equalsIgnoreCase(ServerConfigurationService.getString("import.importAsDraft")))
if (!getImportAsDraft())
{
forumManager.saveDiscussionForum(dfForum, dfForum.getDraft().booleanValue());
}
Expand All @@ -944,7 +944,7 @@ else if (propertiesElement.getTagName().equals(PERMISSIONS)) {
{
Area area = areaManager.getDiscussionArea(siteId);
dfForum.setArea(area);
if ("false".equalsIgnoreCase(ServerConfigurationService.getString("import.importAsDraft")))
if (!getImportAsDraft())
{
forumManager.saveDiscussionForum(dfForum, dfForum.getDraft().booleanValue());
}
Expand Down Expand Up @@ -1360,5 +1360,9 @@ private String replaceAllRefs(String msgBody, Set<Entry<String, String>> entrySe
return msgBody;
}

private Boolean getImportAsDraft() {
boolean importAsDraft = ServerConfigurationService.getBoolean("import.importAsDraft", true);
return ServerConfigurationService.getBoolean("msgcntr.forums.import.importAsDraft", importAsDraft);
}

}

0 comments on commit a060b25

Please sign in to comment.