[WIP] Make Tasks a DAV client, close #280 #291

Merged
merged 58 commits into from May 16, 2016

Projects

None yet

9 participants

@raimund-schluessler
Member
raimund-schluessler commented Feb 13, 2016 edited

We want to get rid of the calendar dependency and use the CalDAV server build-in in oC core 9.x.

In order to hopefully make the development easier the same DAV library as in core and calendar will be used. No more server side CalDAV stuff in the app itself.

Todos:

_Calendars_

  • Get calendars
  • Create calendar
  • Delete calendar
  • Rename calendar

_Tasks_

  • Get tasks
  • Create task (subtask)
  • Fix creating tasks in the collection views
  • Toggle subtasks visibility
  • Delete task
  • Toggle task state
  • Rename task
  • Set task priority
  • Set start date
  • Set end date
  • Set progress
  • Edit categories
  • Edit note
  • Change calendar
  • Respect write privileges for drag-n-drop
  • Creating subtasks in "All" view does not work
  • Only load uncomplete tasks, load completed tasks on demand
  • Load completed subtasks when opening parent task
  • Respect timezone setting for start, due and reminder
  • Enable copying tasks
  • Set reminder (with notification support)
  • Implement comments

_Various_

  • Check compliance ./occ app:check-code tasks
  • Add makefile for appstore packaging
  • Add an issue template

_Search_

  • Implement search provider
@raimund-schluessler raimund-schluessler Remove server side CalDAV stuff 2868021
@raimund-schluessler raimund-schluessler Use bower, update dependencies
d268392
@raimund-schluessler raimund-schluessler changed the title from [WIP] Make Tasks a DAV client, closes #280 to [WIP] Make Tasks a DAV client, close #280 Feb 13, 2016
@raimund-schluessler

@georgehrke @raghunayyar I would like to use your implementation of the client side calendar service and maybe other files from the calendar-rework if its ok with you.

@georgehrke

I would like to use your implementation of the client side calendar service and maybe other files from the calendar-rework if its ok with you.

Sure, it's free software, go ahead :)

@raimund-schluessler raimund-schluessler Load calendars via DAV
95979ec
@raimund-schluessler

Can someone tell me if it is possible to also get the id of a calendar? If yes, how has the request body to look like?

I tried something like this

<?xml version="1.0"?>
<d:propfind  xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:aapl="http://apple.com/ns/ical/" xmlns:oc="http://owncloud.org/ns" xmlns:cs="http://calendarserver.org/ns/">
  <d:prop>
    <d:displayname />
    <d:id />
    <c:id />
    <aapl:id />
    <c:calendar-description />
    <c:calendar-timezone />
    <aapl:calendar-order />
    <aapl:calendar-color />
    <c:supported-calendar-component-set />
    <oc:calendar-enabled />
    <d:acl />
    <d:owner />
    <oc:invite />
  </d:prop>
</d:propfind>

but this does not return an id. @DeepDiver1975 @georgehrke maybe?

@georgehrke

<d:href>/remote.php/dav/calendars/admin/personal/</d:href> is unique. I don't think you can get the database id. It wouldn't be of any use anyway, because you always need the url.

@raimund-schluessler

It wouldn't be of any use anyway, because you always need the url.

Yes, that's true. But I need something to show in the address bar when a user opens a calendar, so the page history works correctly. The database ID would have been the easiest solution.

@georgehrke

The display name is supposed to be unique. Although I'm not sure this if this is enforced at the moment.

@raimund-schluessler

The displayname is currently not enforced to be unique and it won't be for different users.

For the moment I will just count upwards, but this might result in a usability problem when a user bookmarks the link to a certain calendar. I will have to think of a better solution later on.

@DeepDiver1975
Member

The displayname is indeed not unique. But the Uri is.

@raimund-schluessler

The Uri also seems to only be unique for one user. But when User1 shares a calendar with the (for him) unique Uri 'test' with User2 which also has a calendar with this Uri, User2 has two calendars with the same Uri. Hence, only the principaluri is really unique, or am I wrong?

@DeepDiver1975
Member

The shared Uri will be test_shared_by_user1

@raimund-schluessler

The shared Uri will be test_shared_by_user1

Ah, alright, thank you.
Can I query the Uri directly, or do I have to extract it from the url?
The request

<?xml version="1.0"?>
<d:propfind  xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:aapl="http://apple.com/ns/ical/" xmlns:oc="http://owncloud.org/ns" xmlns:cs="http://calendarserver.org/ns/">
  <d:prop>
    <d:displayname />
    <d:uri />
    <c:uri />
    <aapl:uri />
    <oc:uri />
    <c:calendar-description />
    <c:calendar-timezone />
    <aapl:calendar-order />
    <aapl:calendar-color />
    <c:supported-calendar-component-set />
    <oc:calendar-enabled />
    <d:acl />
    <d:owner />
    <oc:invite />
  </d:prop>
</d:propfind>

does not return any uri, but gives

...
  <d:propstat>
   <d:prop>
    <d:uri/>
    <cal:uri/>
    <x1:uri xmlns:x1="http://apple.com/ns/ical/"/>
    <oc:uri/>
   </d:prop>
   <d:status>HTTP/1.1 404 Not Found</d:status>
  </d:propstat>
...

instead.

@DeepDiver1975
Member

Can I query the Uri directly, or do I have to extract it from the url?

you have to extract it

@raimund-schluessler raimund-schluessler Enable creating calendars 8c56ebf
@raimund-schluessler raimund-schluessler Enable deleting calendars
58386c1
@raimund-schluessler raimund-schluessler Update dependencies 5876ae5
@raimund-schluessler raimund-schluessler Add request tokens
f2aa79e
@raimund-schluessler raimund-schluessler Use getter for calendar properties 04030b5
@raimund-schluessler raimund-schluessler Use getter for calendar properties everywhere 07bd2b5
@raimund-schluessler raimund-schluessler Remove coffeescript
ce7dfa9
@raimund-schluessler raimund-schluessler Enable renaming calendars
8911653
@raimund-schluessler raimund-schluessler Enable adding tasks
d709791
@raimund-schluessler raimund-schluessler Load all tasks and add them to the model
20fdb6d
@raimund-schluessler raimund-schluessler Trigger scope.apply after tasks were loaded
407a6d3
@raimund-schluessler raimund-schluessler Enable setting priority
f82b396
@raimund-schluessler raimund-schluessler Enable completing tasks
39aacec
@raimund-schluessler raimund-schluessler Show correct tasks, enable showing details
cad16a9
@raimund-schluessler raimund-schluessler Correctly show subtasks, toggle their visibility
d7116f5
@raimund-schluessler raimund-schluessler Don't show task input if not writable
ee78a4a
@raimund-schluessler raimund-schluessler Also toggle state of children and parents
21da0c0
@raimund-schluessler raimund-schluessler Let the vtodo save its properties
21ca98d
@raimund-schluessler raimund-schluessler Fix deleting lists, enable deleting tasks c8acb1b
@raimund-schluessler raimund-schluessler Fix creating tasks 4af6363
@raimund-schluessler raimund-schluessler Remove console.log
b7db800
@raimund-schluessler raimund-schluessler Fix quick deleting priority and percent complete
6567bad
@raimund-schluessler raimund-schluessler Add category support
babc581
@raimund-schluessler raimund-schluessler Fix IRequest error
2b1053e
@Henni
Member
Henni commented Mar 8, 2016

I'm somehow missing JS files:
image

@raimund-schluessler raimund-schluessler Fix undefined variables
3fd6469
@raimund-schluessler raimund-schluessler Fix script error when not in debug mode
No idea why this is necessary
c8888cb
@raimund-schluessler raimund-schluessler Adjust gitignore to commit ical and angular-ui-select
b499428
@Henni
Member
Henni commented Mar 9, 2016

Adding a list with the name hello results in:

owncloud.log:
Invalid Request (Malformed HTTP request)

Request payload:

<c:mkcalendar xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:" xmlns:a="http://apple.com/ns/ical/" xmlns:o="http://owncloud.org/ns"><d:set><d:prop><d:displayname>hello</d:displayname><o:calendar-enabled>1</o:calendar-enabled><a:calendar-color>#FF7A66</a:calendar-color><c:supported-calendar-component-set><c:comp name="VTODO"/></c:supported-calendar-component-set></d:prop></d:set></c:mkcalendar>

Response payload:
[empty]

DevTools console:
image

@raimund-schluessler
Member

@Henni Sorry, I can't reproduce this. Creating a calendar with name "hello" works fine with OC 9.0.0 and the current DAVclient branch.

@raimund-schluessler raimund-schluessler Enable setting start and end date
916dde9
@raimund-schluessler raimund-schluessler Make app compliant
c4c956b
@raimund-schluessler raimund-schluessler Add drag and drop support
2060657
@raimund-schluessler raimund-schluessler Fix creating tasks in collection view
af923d1
@raimund-schluessler raimund-schluessler Hide what does not work yet
38c31a8
@raimund-schluessler raimund-schluessler Fix a bunch of JSHint errors and warnings
c12113c
@raimund-schluessler raimund-schluessler Add makefile
19d3ac7
@raimund-schluessler raimund-schluessler Fix showing calendarname in week view
0e7b461
@raimund-schluessler raimund-schluessler Reflect write privileges in GUI
f21d861
@raimund-schluessler raimund-schluessler Prevent dropping in not writable lists b2a87ca
@raimund-schluessler raimund-schluessler Show tasks which are related to themself
3b7d254
@raimund-schluessler raimund-schluessler Always check write privileges
7b2d8af
@raimund-schluessler raimund-schluessler Make drag and drop more robust 76c9b8f
@raimund-schluessler raimund-schluessler Only allow copy of not writable tasks
8314f48
@raimund-schluessler raimund-schluessler Don't hide source element when it is copied
dd88d78
@raimund-schluessler raimund-schluessler Only allow moving tasks for now b0bac86
@raimund-schluessler raimund-schluessler Fix undefined return falue 74fba33
@raimund-schluessler raimund-schluessler Prevent dropping on collection when copying task
80d517c
@onny
onny commented Mar 17, 2016

Thank you Raimund for the hard work! Can't wait to use the new version! πŸ‘

@raghunayyar
Member

\o/

@raimund-schluessler raimund-schluessler Only load not completed tasks
8808e77
@raimund-schluessler

With 8808e77 we only load pending tasks. But this also means completed tasks are not loaded at all at the moment.

@DeepDiver1975 Is there a possibility to load the five newest completed tasks per list? And maybe also a query to get the total number of completed tasks at the server?

@DeepDiver1975
Member

CalDAV and carddav queries have no understanding of aggregation functions - we have been looking for this for Contacts already.
But getting the five newest should be possible this the calendar query

@raimund-schluessler

Hm, can someone give me a hint on how to limit and order the result set? My naive try to limit the result set to five didn't succeed and I don't seem to be able to figure it out by myself:

<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:" xmlns:a="http://apple.com/ns/ical/" xmlns:o="http://owncloud.org/ns">
   <d:prop>
      <d:getetag/>
      <c:calendar-data/>
   </d:prop>
   <d:limit>
      <d:nresults>5</d:nresults>
   </d:limit>
   <c:filter>
      <c:comp-filter name="VCALENDAR">
         <c:comp-filter name="VTODO">
            <c:prop-filter name="COMPLETED">
               <c:is-not-defined/>
            </c:prop-filter>
         </c:comp-filter>
      </c:comp-filter>
   </c:filter>
</c:calendar-query>

@Henni @georgehrke @DeepDiver1975

@georgehrke

I don't think that CalDAV reports support limit and offset.
One way to do this is in two requests.
First one: send your request without <c:calendar-data/>
Second request: Take the hrefs from request one and send a multiget to the server

@raimund-schluessler

I thought this was possible because of this: https://tools.ietf.org/html/rfc5323#section-5.17 Did I misunderstand it?

@georgehrke

The webdav search extension has nothing to do with CalDAV and CardDAV reports.

@DeepDiver1975
Member

I don't think that CalDAV reports support limit and offset.

indeed - only carddav query supports that ... my bad - sorry

@raimund-schluessler raimund-schluessler Update dependencies
202085a
@raimund-schluessler raimund-schluessler Fix adding task in all view
dd7c777
@raimund-schluessler raimund-schluessler Show subtasks after creating a subtask 56c29b9
@raimund-schluessler raimund-schluessler Redirect to all view if not otherwise specified
400cfb3
@raimund-schluessler raimund-schluessler Fix undefined variable when adding root task 59b2fa1
@raimund-schluessler raimund-schluessler Enable loading completed tasks
c496d62
@raimund-schluessler raimund-schluessler Load completed children when opening parent task
a800ebc
@raimund-schluessler raimund-schluessler Only load completed subtasks once b7a7ed3
@raimund-schluessler raimund-schluessler Add issue template (thanks Calendar app)
7218f2c
@raimund-schluessler raimund-schluessler merged commit ff877e3 into master May 16, 2016

2 checks passed

Scrutinizer 33 new issues, 3 updated code elements
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@raimund-schluessler

Merging this. Remaining problems are tracked in separate issues:

Timezone for start, due and reminder: #312
Copying tasks: #313
Setting reminder: #314
Implement comment feature: #315
Search: #311

@janvonde

will you release the app soon and add the features afterwards, or will you just continue to develop in the master branch and release the app when everything is done?

@raimund-schluessler

As it was requested by several users, I will release a version to the appstore soon and indicate the yet missing features. So it is possible to install via the appstore again and everybody can decide whether or not he is willing to update.

@janvonde

awesome! πŸ‘

@nickvergessen
Contributor

Thanks a lot @raimund-schluessler

@Gomez
Member
Gomez commented May 24, 2016

Great work @raimund-schluessler. 🍻 at ownCloudConf!

@nickvergessen nickvergessen deleted the DAVclient branch May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment