@@ -2893,6 +2893,36 @@ public int compare(String s1, String s2) {
2893
2893
context.put("selectedTools", selectedTools);
2894
2894
}
2895
2895
2896
+ // SAK-33335
2897
+ //
2898
+ // If the old site has either Gradebook or GradebookNG,
2899
+ // and the new site has either Gradebook or GradebookNG,
2900
+ // we should allow the gradebook to import (even if the
2901
+ // old site used Gradebook and the new site uses
2902
+ // GradebookNG, or vice versa).
2903
+ List<String> targetSiteToolIds = selectedTools;
2904
+ List<String> sourceSiteToolIds = allImportableToolIdsInOriginalSites;
2905
+
2906
+ List<String> gradebooksInTargetSite = new ArrayList<String>();
2907
+ for (String toolId : targetSiteToolIds) {
2908
+ if (org.apache.commons.lang3.StringUtils.equalsAny(toolId, "sakai.gradebook.tool", "sakai.gradebookng")) {
2909
+ gradebooksInTargetSite.add(toolId);
2910
+ }
2911
+ }
2912
+
2913
+ if (gradebooksInTargetSite.size() == 1) {
2914
+ // If we only have one of the Gradebooks, we
2915
+ // need to make sure that it's represented in
2916
+ // the source site (so we get the option to
2917
+ // import)
2918
+ String targetSiteGradebook = gradebooksInTargetSite.get(0);
2919
+
2920
+ if (!sourceSiteToolIds.contains(targetSiteGradebook)) {
2921
+ sourceSiteToolIds.add(targetSiteGradebook);
2922
+ }
2923
+ }
2924
+
2925
+
2896
2926
//get all known tool names from the sites selected to import from (importSites) and the selectedTools list
2897
2927
Map<String,Set<String>> toolNames = this.getToolNames(selectedTools, importSites);
2898
2928
@@ -15479,11 +15509,18 @@ private Map<String, Set<String>> getSiteImportToolsWithContent(List<Site> sites,
15479
15509
Set<String> toolsWithContent = new HashSet<>();
15480
15510
15481
15511
for(String toolId: toolIds) {
15482
- if(site.getToolForCommonId(toolId) != null) {
15483
-
15512
+ if(site.getToolForCommonId(toolId) != null ||
15513
+ (org.apache.commons.lang3.StringUtils.equalsAny(toolId, "sakai.gradebook.tool", "sakai.gradebookng") &&
15514
+ (site.getToolForCommonId("sakai.gradebook.tool") != null || site.getToolForCommonId("sakai.gradebookng") != null)))
15515
+ {
15484
15516
//check the tool has content
15485
15517
if(hasContent(toolId, site.getId())) {
15486
15518
toolsWithContent.add(toolId);
15519
+ } else {
15520
+ if (org.apache.commons.lang3.StringUtils.equalsAny(toolId, "sakai.gradebook.tool", "sakai.gradebookng") &&
15521
+ hasContent("sakai.gradebook.tool", site.getId()) || hasContent("sakai.gradebookng", site.getId())) {
15522
+ toolsWithContent.add(toolId);
15523
+ }
15487
15524
}
15488
15525
}
15489
15526
}
0 commit comments