diff --git a/src/main/java/org/olat/course/assessment/bulk/_i18n/LocalStrings_pt_BR.properties b/src/main/java/org/olat/course/assessment/bulk/_i18n/LocalStrings_pt_BR.properties index 04c390355578cd44277428e24ecdf74ee1fe1341..293117e8b81228620ec0411cf634807793949c3c 100644 --- a/src/main/java/org/olat/course/assessment/bulk/_i18n/LocalStrings_pt_BR.properties +++ b/src/main/java/org/olat/course/assessment/bulk/_i18n/LocalStrings_pt_BR.properties @@ -1,4 +1,4 @@ -#Fri Jan 24 18:41:23 CET 2014 +#Tue May 28 13:51:03 CEST 2019 bulk.action.greaterThanMax=Valor maior do que 10000 ou maior do que sua maior pontua\u00E7\u00E3o ({0}) bulk.action.lessThanMin=Valor menor do que -10000 ou menor do que sua menor pontua\u00E7\u00E3o ({0}) bulk.action.no.coursenodes=Voc\u00EA n\u00E3o tem um bloco de constru\u00E7\u00E3o de curso adequado para a avalia\u00E7\u00E3o em massa. \r\nOs seguintes tipos s\u00E3o adequados\: $org.olat.course.nodes\:title_ms, $org.olat.course.nodes\:title_ita, $org.olat.course.nodes\:title_gta e $org.olat.course.nodes\:title_projectbroker @@ -21,50 +21,6 @@ bulk.assessment.error.title=Nem todas as avalia\u00E7\u00F5es puderam ser armaze bulk.wizard.desc=Com a ferramenta "avalia\u00E7\u00E3o em massa" voc\u00EA pode enviar dados de avalia\u00E7\u00E3o, tais como pontua\u00E7\u00E3o, status, coment\u00E1rios ou devolver os arquivos para v\u00E1rios membros do curso em uma \u00FAnica etapa. bulk.wizard.start=Selecione o bot\u00E3o "$\:new.bulk" para preparar ou executar uma avalia\u00E7\u00E3o de massa. Mais informa\u00E7\u00F5es sobre este processo e formato de arquivo aceito podem ser encontradas na ajuda de contexto. bulk.wizard.title=Avalia\u00E7\u00E3o em massa - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - choose.node.desc=Selecione o elemento deste curso para o qual a avalia\u00E7\u00E3o em massa deve ser executada. choose.node.title=Selecione o elemento de curso chooseColumns.description=Selecione as colunas dos dados de avalia\u00E7\u00E3o que dever\u00E3o ser utilizado durante a importa\u00E7\u00E3o. @@ -83,11 +39,18 @@ form.step2.error=Nenhum dado de avalia\u00E7\u00E3o foi enviado. form.step3.delimiter=Separado por form.step3.delimiter.comma=V\u00EDrgula form.step3.delimiter.tab=Tabula\u00E7\u00E3o - - - - - +form.step3.status=Status +form.step3.status.assessed=Defina como status "$org.olat.modules.assessment.ui\:assessment.status.done" +form.step3.status.dont.change=N\u00E3o alterar o status +form.step3.status.review=Defina como status "$org.olat.modules.assessment.ui\:assessment.status.inReview" +form.step3.submission=Envio +form.step3.submission.accept=Aceitar envio +form.step3.submission.dont.change=N\u00E3o alterar +form.step3.submission.help=O envio s\u00F3 \u00E9 aceito caso esta op\u00E7\u00E3o for escolhida e a pontua\u00E7\u00E3o m\u00EDnima ou "aprova\u00E7\u00E3o" estiverem definidos. +form.step3.visibility=Visibilidade de resultados +form.step3.visibility.dont.change=N\u00E3o altere a visibilidade dos resultados +form.step3.visibility.notvisible=Ainda n\u00E3o vis\u00EDvel para o usu\u00E1rio +form.step3.visibility.visible=Vis\u00EDvel diretamente para o usu\u00E1rio new.bulk=Iniciar nova Avalia\u00E7\u00E3o em Massa passed.false=$org.olat.course.assessment\:passed.false passed.true=$org.olat.course.assessment\:passed.true diff --git a/src/main/java/org/olat/course/db/_i18n/LocalStrings_pt_BR.properties b/src/main/java/org/olat/course/db/_i18n/LocalStrings_pt_BR.properties index edbf74546757aa1483fe78d49bfc18d2c550dc1e..19e65ac2effeb8d52cf4550adbf64c1a9ff2b27e 100644 --- a/src/main/java/org/olat/course/db/_i18n/LocalStrings_pt_BR.properties +++ b/src/main/java/org/olat/course/db/_i18n/LocalStrings_pt_BR.properties @@ -1,4 +1,4 @@ -#Thu May 23 15:03:54 CEST 2019 +#Tue May 28 13:51:06 CEST 2019 command.new_db=Criar novo banco de dados customDb.category=Nome customDb.create=Criar diff --git a/src/main/java/org/olat/restapi/repository/course/CoursesWebService.java b/src/main/java/org/olat/restapi/repository/course/CoursesWebService.java index 5091bb846066746da68e9c534dc5ddcc03ff7062..8a840056a1df2691d4c131c83f30b48aba1283da 100644 --- a/src/main/java/org/olat/restapi/repository/course/CoursesWebService.java +++ b/src/main/java/org/olat/restapi/repository/course/CoursesWebService.java @@ -250,6 +250,8 @@ public class CoursesWebService { @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response createEmptyCourse(@QueryParam("shortTitle") String shortTitle, @QueryParam("title") String title, @QueryParam("displayName") String displayName, @QueryParam("description") String description, + @QueryParam("objectives") String objectives, @QueryParam("requirements") String requirements, + @QueryParam("credits") String credits, @QueryParam("expenditureOfWork") String expenditureOfWork, @QueryParam("softKey") String softKey, @QueryParam("status") String status, @QueryParam("allUsers") Boolean allUsers, @QueryParam("guests") Boolean guests, @QueryParam("access") Integer access, @QueryParam("membersOnly") Boolean membersOnly, @@ -296,12 +298,14 @@ public class CoursesWebService { } if(copyFrom != null) { - course = copyCourse(copyFrom, ureq, id, shortTitle, title, displayName, description, softKey, - accessStatus, accessAllUsers, accessGuests, organisationKey, + course = copyCourse(copyFrom, ureq, id, shortTitle, title, displayName, description, + objectives, requirements, credits, expenditureOfWork, + softKey, accessStatus, accessAllUsers, accessGuests, organisationKey, authors, location, externalId, externalRef, managedFlags, configVO); } else { - course = createEmptyCourse(id, shortTitle, title, displayName, description, softKey, - accessStatus, accessAllUsers, accessGuests, organisationKey, + course = createEmptyCourse(id, shortTitle, title, displayName, description, + objectives, requirements, credits, expenditureOfWork, + softKey, accessStatus, accessAllUsers, accessGuests, organisationKey, authors, location, externalId, externalRef, managedFlags, configVO); } if(course == null) { @@ -334,7 +338,7 @@ public class CoursesWebService { CourseConfigVO configVO = new CourseConfigVO(); ICourse course = createEmptyCourse(ureq.getIdentity(), - courseVo.getTitle(), courseVo.getTitle(), courseVo.getTitle(), courseVo.getDescription(), + courseVo.getTitle(), courseVo.getTitle(), courseVo.getTitle(), courseVo.getDescription(), null, null, null, null, courseVo.getSoftKey(), RepositoryEntryStatusEnum.preparation, false, false, courseVo.getOrganisationKey(), courseVo.getAuthors(), courseVo.getLocation(), courseVo.getExternalId(), courseVo.getExternalRef(), courseVo.getManagedFlags(), @@ -474,7 +478,8 @@ public class CoursesWebService { } private ICourse copyCourse(Long copyFrom, UserRequest ureq, Identity initialAuthor, String shortTitle, String longTitle, String displayName, - String description, String softKey, RepositoryEntryStatusEnum status, boolean allUsers, boolean guests, Long organisationKey, + String description, String objectives, String requirements, String credits, String expenditureOfWork, String softKey, + RepositoryEntryStatusEnum status, boolean allUsers, boolean guests, Long organisationKey, String authors, String location, String externalId, String externalRef, String managedFlags, CourseConfigVO courseConfigVO) { OLATResourceable originalOresTrans = OresHelper.createOLATResourceableInstance(CourseModule.class, copyFrom); @@ -542,6 +547,18 @@ public class CoursesWebService { if(StringHelper.containsNonWhitespace(managedFlags)) { preparedEntry.setManagedFlagsString(managedFlags); } + if(StringHelper.containsNonWhitespace(objectives)) { + preparedEntry.setObjectives(objectives); + } + if(StringHelper.containsNonWhitespace(credits)) { + preparedEntry.setCredits(credits); + } + if(StringHelper.containsNonWhitespace(requirements)) { + preparedEntry.setRequirements(requirements); + } + if(StringHelper.containsNonWhitespace(expenditureOfWork)) { + preparedEntry.setExpenditureOfWork(expenditureOfWork); + } preparedEntry.setEntryStatus(status); preparedEntry.setAllUsers(allUsers); preparedEntry.setGuests(guests); @@ -573,7 +590,8 @@ public class CoursesWebService { * @return */ private ICourse createEmptyCourse(Identity initialAuthor, String shortTitle, String longTitle, String reDisplayName, - String description, String softKey, RepositoryEntryStatusEnum status, boolean allUsers, boolean guests, + String description, String objectives, String requirements, String credits, String expenditureOfWork, String softKey, + RepositoryEntryStatusEnum status, boolean allUsers, boolean guests, Long organisationKey, String authors, String location, String externalId, String externalRef, String managedFlags, CourseConfigVO courseConfigVO) { @@ -602,6 +620,10 @@ public class CoursesWebService { addedEntry.setExternalRef(externalRef); addedEntry.setManagedFlagsString(managedFlags); addedEntry.setDescription(description); + addedEntry.setObjectives(objectives); + addedEntry.setRequirements(requirements); + addedEntry.setCredits(credits); + addedEntry.setExpenditureOfWork(expenditureOfWork); if(RepositoryEntryManagedFlag.isManaged(addedEntry, RepositoryEntryManagedFlag.membersmanagement)) { addedEntry.setAllowToLeaveOption(RepositoryEntryAllowToLeaveOptions.never); } else { diff --git a/src/test/java/org/olat/restapi/CoursesTest.java b/src/test/java/org/olat/restapi/CoursesTest.java index 889043febdd05bbd9c43ed6e15b55e2a2cc48c27..bbdfc418ba5553b25fb24a38048b6d2d6896edc3 100644 --- a/src/test/java/org/olat/restapi/CoursesTest.java +++ b/src/test/java/org/olat/restapi/CoursesTest.java @@ -393,6 +393,47 @@ public class CoursesTest extends OlatJerseyTestCase { Assert.assertEquals(1, owners.size()); Assert.assertEquals(adhocAuthor, owners.get(0)); } + + @Test + public void testCreateEmpty_withMetadata() throws IOException, URISyntaxException { + Identity adhocAuthor = JunitTestHelper.createAndPersistIdentityAsRndUser("adhoc-author"); + dbInstance.commit(); + + assertTrue(conn.login("administrator", "openolat")); + + URI uri = UriBuilder.fromUri(getContextURI()).path("repo").path("courses") + .queryParam("shortTitle", "Course with metadata") + .queryParam("title", "Course with metadata") + .queryParam("initialAuthor", adhocAuthor.getKey().toString()) + .queryParam("objectives", "My objectives") + .queryParam("requirements", "My requirements") + .queryParam("credits", "My credits") + .queryParam("expenditureOfWork", "Take a long time") + .queryParam("location", "Zurich") + .queryParam("externalId", "825761") + .queryParam("externalRef", "AC-825761") + .build(); + HttpPut method = conn.createPut(uri, MediaType.APPLICATION_JSON, true); + + HttpResponse response = conn.execute(method); + Assert.assertEquals(200, response.getStatusLine().getStatusCode()); + CourseVO courseVo = conn.parse(response, CourseVO.class); + Assert.assertNotNull(courseVo); + Assert.assertEquals("Course with metadata", courseVo.getTitle()); + + // load repository entry + RepositoryEntry re = repositoryManager.lookupRepositoryEntry(courseVo.getRepoEntryKey()); + Assert.assertNotNull(re); + Assert.assertNotNull(re.getOlatResource()); + Assert.assertEquals("Course with metadata", re.getDisplayname()); + Assert.assertEquals("My objectives", re.getObjectives()); + Assert.assertEquals("My requirements", re.getRequirements()); + Assert.assertEquals("My credits", re.getCredits()); + Assert.assertEquals("Take a long time", re.getExpenditureOfWork()); + Assert.assertEquals("Zurich", re.getLocation()); + Assert.assertEquals("825761", re.getExternalId()); + Assert.assertEquals("AC-825761", re.getExternalRef()); + } @Test public void testImportCourse() throws IOException, URISyntaxException { @@ -516,6 +557,49 @@ public class CoursesTest extends OlatJerseyTestCase { assertTrue(response.getStatusLine().getStatusCode() == 404); EntityUtils.consume(response.getEntity()); } + + @Test + public void testCopyCourse_withMetadata() throws IOException, URISyntaxException { + Identity author = JunitTestHelper.createAndPersistIdentityAsAuthor("author-5"); + RepositoryEntry entry = JunitTestHelper.deployBasicCourse(author); + Assert.assertNotNull(entry); + + conn = new RestConnection(); + Assert.assertTrue(conn.login("administrator", "openolat")); + + URI uri = UriBuilder.fromUri(getContextURI()).path("repo").path("courses") + .queryParam("shortTitle", "Course copy") + .queryParam("title", "Course copy") + .queryParam("initialAuthor", author.getKey().toString()) + .queryParam("copyFrom", entry.getKey().toString()) + .queryParam("objectives", "My copied objectives") + .queryParam("requirements", "My copied requirements") + .queryParam("credits", "My copied credits") + .queryParam("expenditureOfWork", "Take a long time") + .queryParam("location", "Basel") + .queryParam("externalId", "825762") + .queryParam("externalRef", "AC-825762") + + .build(); + HttpPut method = conn.createPut(uri, MediaType.APPLICATION_JSON, true); + HttpResponse response = conn.execute(method); + assertTrue(response.getStatusLine().getStatusCode() == 200 || response.getStatusLine().getStatusCode() == 201); + + CourseVO vo = conn.parse(response, CourseVO.class); + assertNotNull(vo); + assertNotNull(vo.getRepoEntryKey()); + assertNotNull(vo.getKey()); + + // load repository entry + RepositoryEntry re = repositoryManager.lookupRepositoryEntry(vo.getRepoEntryKey()); + Assert.assertEquals("My copied objectives", re.getObjectives()); + Assert.assertEquals("My copied requirements", re.getRequirements()); + Assert.assertEquals("My copied credits", re.getCredits()); + Assert.assertEquals("Take a long time", re.getExpenditureOfWork()); + Assert.assertEquals("Basel", re.getLocation()); + Assert.assertEquals("825762", re.getExternalId()); + Assert.assertEquals("AC-825762", re.getExternalRef()); + } protected List<CourseVO> parseCourseArray(HttpEntity entity) { try(InputStream in=entity.getContent()) {