Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
e4568234
Commit
e4568234
authored
Nov 16, 2015
by
Thomas Müller
Browse files
Use uri as displayname
parent
a0b64944
Changes
2
Hide whitespace changes
Inline
Side-by-side
apps/dav/lib/caldav/caldavbackend.php
View file @
e4568234
...
...
@@ -169,19 +169,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
* @return void
*/
function
createCalendar
(
$principalUri
,
$calendarUri
,
array
$properties
)
{
$fieldNames
=
[
'principaluri'
,
'uri'
,
'synctoken'
,
'transparent'
,
'components'
];
$values
=
[
'principaluri'
=>
$principalUri
,
'uri'
=>
$calendarUri
,
'synctoken'
=>
1
,
'transparent'
=>
0
,
'components'
=>
'VEVENT,VTODO'
'components'
=>
'VEVENT,VTODO'
,
'displayname'
=>
$calendarUri
];
// Default value
...
...
@@ -199,22 +193,16 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
foreach
(
$this
->
propertyMap
as
$xmlName
=>
$dbName
)
{
if
(
isset
(
$properties
[
$xmlName
]))
{
$values
[
$dbName
]
=
$properties
[
$xmlName
];
$fieldNames
[]
=
$dbName
;
}
}
$query
=
$this
->
db
->
getQueryBuilder
();
$query
->
insert
(
'calendars'
)
->
values
([
'principaluri'
=>
$query
->
createNamedParameter
(
$values
[
'principaluri'
]),
'uri'
=>
$query
->
createNamedParameter
(
$values
[
'uri'
]),
'synctoken'
=>
$query
->
createNamedParameter
(
$values
[
'synctoken'
]),
'transparent'
=>
$query
->
createNamedParameter
(
$values
[
'transparent'
]),
'components'
=>
$query
->
createNamedParameter
(
$values
[
'components'
]),
])
->
execute
();
$query
->
insert
(
'calendars'
);
foreach
(
$values
as
$column
=>
$value
)
{
$query
->
setValue
(
$column
,
$query
->
createNamedParameter
(
$value
));
}
$query
->
execute
();
}
/**
...
...
apps/dav/tests/unit/caldav/caldavbackendtest.php
View file @
e4568234
...
...
@@ -249,14 +249,19 @@ EOD;
}
private
function
createTestCalendar
()
{
$this
->
backend
->
createCalendar
(
self
::
UNIT_TEST_USER
,
'Example'
,
[]);
$this
->
backend
->
createCalendar
(
self
::
UNIT_TEST_USER
,
'Example'
,
[
'{http://apple.com/ns/ical/}calendar-color'
=>
'#1C4587FF'
]);
$calendars
=
$this
->
backend
->
getCalendarsForUser
(
self
::
UNIT_TEST_USER
);
$this
->
assertEquals
(
1
,
count
(
$calendars
));
$this
->
assertEquals
(
self
::
UNIT_TEST_USER
,
$calendars
[
0
][
'principaluri'
]);
/** @var SupportedCalendarComponentSet $components */
$components
=
$calendars
[
0
][
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'
];
$this
->
assertEquals
([
'VEVENT'
,
'VTODO'
],
$components
->
getValue
());
$color
=
$calendars
[
0
][
'{http://apple.com/ns/ical/}calendar-color'
];
$this
->
assertEquals
(
'#1C4587FF'
,
$color
);
$this
->
assertEquals
(
'Example'
,
$calendars
[
0
][
'uri'
]);
$this
->
assertEquals
(
'Example'
,
$calendars
[
0
][
'{DAV:}displayname'
]);
$calendarId
=
$calendars
[
0
][
'id'
];
return
$calendarId
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment