mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ALF-9156 More on the Calendar code, including improved dates for the get webscript
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28847 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -8,14 +8,28 @@
|
|||||||
"description": "${result.description}",
|
"description": "${result.description}",
|
||||||
"location": "${result.location}",
|
"location": "${result.location}",
|
||||||
"tags": [<#list result.tags as tag>"${tag}"<#if tag_has_next>,</#if></#list>],
|
"tags": [<#list result.tags as tag>"${tag}"<#if tag_has_next>,</#if></#list>],
|
||||||
|
"startAt": {
|
||||||
|
"iso8601": "${xmldate(result.from)}",
|
||||||
|
"legacyDate": "${result.from?string("M/d/yyyy")}",
|
||||||
|
"legacyTime": "${result.from?string("HH:mm")}",
|
||||||
|
},
|
||||||
|
"endAt": {
|
||||||
|
"iso8601": "${xmldate(result.to)}",
|
||||||
|
"legacyDate": "${result.to?string("M/d/yyyy")}",
|
||||||
|
"legacyTime": "${result.to?string("HH:mm")}",
|
||||||
|
},
|
||||||
|
"allday": "${result.allday?string}",
|
||||||
|
|
||||||
|
<#-- These are the old ones we'll get rid of soon -->
|
||||||
"from": "${result.from?string("M/d/yyyy")}",
|
"from": "${result.from?string("M/d/yyyy")}",
|
||||||
"start": "${result.from?string("HH:mm")}",
|
"start": "${result.from?string("HH:mm")}",
|
||||||
"to": "${result.to?string("M/d/yyyy")}",
|
"to": "${result.to?string("M/d/yyyy")}",
|
||||||
"end": "${result.to?string("HH:mm")}",
|
"end": "${result.to?string("HH:mm")}",
|
||||||
"allday": "${result.allday?string}",
|
|
||||||
|
|
||||||
"docfolder": "${result.docfolder}",
|
"docfolder": "${result.docfolder}",
|
||||||
"recurrence": "${result.recurrence}",
|
"recurrence": "${result.recurrence}",
|
||||||
"isoutlook": "${result.isoutlook?string}"
|
"isoutlook": "${result.isoutlook?string}"
|
||||||
</#if>
|
</#if>
|
||||||
}
|
}
|
||||||
</#escape>
|
</#escape>
|
||||||
|
@@ -21,14 +21,10 @@ package org.alfresco.repo.web.scripts.calendar;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.repo.model.Repository;
|
|
||||||
import org.alfresco.service.cmr.calendar.CalendarEntry;
|
import org.alfresco.service.cmr.calendar.CalendarEntry;
|
||||||
import org.alfresco.service.cmr.calendar.CalendarEntryDTO;
|
import org.alfresco.service.cmr.calendar.CalendarEntryDTO;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.cmr.site.SiteInfo;
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
import org.alfresco.service.cmr.site.SiteService;
|
|
||||||
import org.springframework.extensions.webscripts.Cache;
|
import org.springframework.extensions.webscripts.Cache;
|
||||||
import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
|
||||||
import org.springframework.extensions.webscripts.Status;
|
import org.springframework.extensions.webscripts.Status;
|
||||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||||
|
|
||||||
@@ -64,8 +60,8 @@ public class CalendarEntryGet extends AbstractCalendarWebScript
|
|||||||
result.put("isoutlook", entry.isOutlook());
|
result.put("isoutlook", entry.isOutlook());
|
||||||
result.put("outlookuid", entry.getOutlookUID());
|
result.put("outlookuid", entry.getOutlookUID());
|
||||||
result.put("allday", CalendarEntryDTO.isAllDay(entry));
|
result.put("allday", CalendarEntryDTO.isAllDay(entry));
|
||||||
|
result.put("docfolder", entry.getSharePointDocFolder());
|
||||||
result.put("recurrence", null); // TODO
|
result.put("recurrence", null); // TODO
|
||||||
result.put("docfolder", null); // TODO
|
|
||||||
|
|
||||||
// Replace nulls with blank strings for the JSON
|
// Replace nulls with blank strings for the JSON
|
||||||
for(String key : result.keySet())
|
for(String key : result.keySet())
|
||||||
|
@@ -360,6 +360,14 @@ public class CalendarRestApiTest extends BaseWebScriptTest
|
|||||||
assertEquals("13:00", entry.getString("end"));
|
assertEquals("13:00", entry.getString("end"));
|
||||||
assertEquals("false", entry.getString("allday"));
|
assertEquals("false", entry.getString("allday"));
|
||||||
|
|
||||||
|
// Check the new style dates too
|
||||||
|
// assertEquals("2011-06-29T12:00:00Z", entry.getJSONObject("startAt").get("iso8601")); // TODO Needs TZ going in
|
||||||
|
assertEquals("6/29/2011", entry.getJSONObject("startAt").get("legacyDate"));
|
||||||
|
assertEquals("12:00", entry.getJSONObject("startAt").get("legacyTime"));
|
||||||
|
// assertEquals("2011-06-29T13:00:00Z", entry.getJSONObject("endAt").get("iso8601")); // TODO Needs TZ going in
|
||||||
|
assertEquals("6/29/2011", entry.getJSONObject("endAt").get("legacyDate"));
|
||||||
|
assertEquals("13:00", entry.getJSONObject("endAt").get("legacyTime"));
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
entry = updateEntry(name, EVENT_TITLE_ONE, "More Where", "More Thing", Status.STATUS_OK);
|
entry = updateEntry(name, EVENT_TITLE_ONE, "More Where", "More Thing", Status.STATUS_OK);
|
||||||
|
Reference in New Issue
Block a user