emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Revised iCalendar visibility
@ 2018-06-26  9:00 Tobias Schlemmer
  2018-06-26  9:53 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Tobias Schlemmer @ 2018-06-26  9:00 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org >> emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 315 bytes --]

Hi,

some time ago sent pull request from GitHub to support per-entry
visibility in iCalendar export.

I attach the patch and some short documentation of the feature in the
attaced files. They have been updated to honour the timezone patch and
the documentation switch from texinfo to org-mode.

Regards,


Tobias


[-- Attachment #2: 0001-Add-support-for-the-iCalendar-CLASS-property.patch --]
[-- Type: text/x-patch, Size: 4884 bytes --]

From fb3bd3b3a953569af6bb3e41c7d4338b41c4a1fc Mon Sep 17 00:00:00 2001
From: Tobias Schlemmer <keinstein@users.sourceforge.net>
Date: Fri, 11 Aug 2017 22:18:06 +0200
Subject: [PATCH 1/2] Add support for the iCalendar CLASS property

* ox-icalendar.el (org-icalendar-entry): Pick the CLASS
property and pass it to `org-icalendar--vevent' and
`org-icalendar--vtodo'.
(org-icalendar--vevent,org-icalendar--vtodo): Add a new parameter
`class' and use it to generate a `CLASS' field in the `VEVENT'
entry.

TINYCHANGE
---
 lisp/ox-icalendar.el | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 7d7c85004..e410fa2ed 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -540,6 +540,10 @@ inlinetask within the section."
 		   (org-export-get-node-property
 		    :LOCATION entry
 		    (org-property-inherit-p "LOCATION"))))
+	     (class (org-icalendar-cleanup-string
+		     (org-export-get-node-property
+		      :CLASS entry
+		      (org-property-inherit-p "CLASS"))))
 	     ;; Build description of the entry from associated section
 	     ;; (headline) or contents (inlinetask).
 	     (desc
@@ -568,14 +572,14 @@ inlinetask within the section."
 		       org-icalendar-use-deadline)
 		 (org-icalendar--vevent
 		  entry deadline (concat "DL-" uid)
-		  (concat "DL: " summary) loc desc cat tz)))
+		  (concat "DL: " summary) loc desc cat tz class)))
 	  (let ((scheduled (org-element-property :scheduled entry)))
 	    (and scheduled
 		 (memq (if todo-type 'event-if-todo 'event-if-not-todo)
 		       org-icalendar-use-scheduled)
 		 (org-icalendar--vevent
 		  entry scheduled (concat "SC-" uid)
-		  (concat "S: " summary) loc desc cat tz)))
+		  (concat "S: " summary) loc desc cat tz class)))
 	  ;; When collecting plain timestamps from a headline and its
 	  ;; title, skip inlinetasks since collection will happen once
 	  ;; ENTRY is one of them.
@@ -593,7 +597,7 @@ inlinetask within the section."
 			   ((t) t)))
 		   (let ((uid (format "TS%d-%s" (cl-incf counter) uid)))
 		     (org-icalendar--vevent
-		      entry ts uid summary loc desc cat tz))))
+		      entry ts uid summary loc desc cat tz class))))
 	       info nil (and (eq type 'headline) 'inlinetask))
 	     ""))
 	  ;; Task: First check if it is appropriate to export it.  If
@@ -607,7 +611,7 @@ inlinetask within the section."
 			     (not (org-icalendar-blocked-headline-p
 				   entry info))))
 		       ((t) (eq todo-type 'todo))))
-	    (org-icalendar--vtodo entry uid summary loc desc cat tz))
+	    (org-icalendar--vtodo entry uid summary loc desc cat tz class))
 	  ;; Diary-sexp: Collect every diary-sexp element within ENTRY
 	  ;; and its title, and transcode them.  If ENTRY is
 	  ;; a headline, skip inlinetasks: they will be handled
@@ -638,7 +642,7 @@ inlinetask within the section."
        contents))))
 
 (defun org-icalendar--vevent
-    (entry timestamp uid summary location description categories timezone)
+    (entry timestamp uid summary location description categories timezone class)
   "Create a VEVENT component.
 
 ENTRY is either a headline or an inlinetask element.  TIMESTAMP
@@ -648,7 +652,9 @@ summary or subject for the event.  LOCATION defines the intended
 venue for the event.  DESCRIPTION provides the complete
 description of the event.  CATEGORIES defines the categories the
 event belongs to.  TIMEZONE specifies a time zone for this event
-only.
+only. CLASS contains the visibility attribute. Three of them
+(PUBLIC, CONFIDENTIAL and PRIVATE) are predefined, others
+should be treated as PRIVATE if they are unknown to the iCalendar server.
 
 Return VEVENT component as a string."
   (org-icalendar-fold-string
@@ -669,6 +675,7 @@ Return VEVENT component as a string."
 		       (org-element-property :repeater-value timestamp)))
 	     "SUMMARY:" summary "\n"
 	     (and (org-string-nw-p location) (format "LOCATION:%s\n" location))
+	     (and (org-string-nw-p class) (format "CLASS:%s\n" class))
 	     (and (org-string-nw-p description)
 		  (format "DESCRIPTION:%s\n" description))
 	     "CATEGORIES:" categories "\n"
@@ -677,7 +684,7 @@ Return VEVENT component as a string."
 	     "END:VEVENT"))))
 
 (defun org-icalendar--vtodo
-  (entry uid summary location description categories timezone)
+  (entry uid summary location description categories timezone class)
   "Create a VTODO component.
 
 ENTRY is either a headline or an inlinetask element.  UID is the
@@ -712,6 +719,7 @@ Return VTODO component as a string."
 			  "\n"))
 	     "SUMMARY:" summary "\n"
 	     (and (org-string-nw-p location) (format "LOCATION:%s\n" location))
+	     (and (org-string-nw-p class) (format "CLASS:%s\n" class))
 	     (and (org-string-nw-p description)
 		  (format "DESCRIPTION:%s\n" description))
 	     "CATEGORIES:" categories "\n"
-- 
2.18.0.rc2


[-- Attachment #3: 0002-Add-support-for-the-iCalendar-CLASS-property.patch --]
[-- Type: text/x-patch, Size: 3029 bytes --]

From 128d45bf1c7f9b2b01009f9a8f87862aaaf934c0 Mon Sep 17 00:00:00 2001
From: Tobias Schlemmer <keinstein@users.sourceforge.net>
Date: Tue, 26 Jun 2018 10:05:41 +0200
Subject: [PATCH 2/2] Add support for the iCalendar CLASS property

* doc/org-manual.org (iCalendar export): Document the CLASS tag

    TINYCHANGE
---
 doc/org-manual.org | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index ee25fc78b..68da3adff 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -15029,18 +15029,20 @@ connections.
 #+cindex: @samp{DESCRIPTION}, property
 #+cindex: @samp{LOCATION}, property
 #+cindex: @samp{TIMEZONE}, property
+#+cindex: @samp{CLASS}, property
 The iCalendar export back-end includes =SUMMARY=, =DESCRIPTION=,
-=LOCATION= and =TIMEZONE= properties from the Org entries when
-exporting.  To force the back-end to inherit the =LOCATION= and
-=TIMEZONE= properties, configure the ~org-use-property-inheritance~
-variable.
+=LOCATION=, =TIMEZONE= and =CLASS= properties from the Org entries
+when exporting.  To force the back-end to inherit the =LOCATION=,
+=TIMEZONE= and =CLASS= properties, configure the
+~org-use-property-inheritance~ variable.
 
 #+vindex: org-icalendar-include-body
-When Org entries do not have =SUMMARY=, =DESCRIPTION= and =LOCATION=
-properties, the iCalendar export back-end derives the summary from the
-headline, and derives the description from the body of the Org item.
-The ~org-icalendar-include-body~ variable limits the maximum number of
-characters of the content are turned into its description.
+When Org entries do not have =SUMMARY=, =DESCRIPTION=, =LOCATION= and
+=CLASS= properties, the iCalendar export back-end derives the summary
+from the headline, and derives the description from the body of the
+Org item.  The ~org-icalendar-include-body~ variable limits the
+maximum number of characters of the content are turned into its
+description.
 
 The =TIMEZONE= property can be used to specify a per-entry time zone,
 and is applied to any entry with timestamp information.  Time zones
@@ -15048,6 +15050,16 @@ should be specified as per the IANA time zone database format, e.g.,
 =Asia/Almaty=.  Alternately, the property value can be =UTC=, to force
 UTC time for this entry only.
 
+The =CLASS= property can be used to specify a per-entry visibility
+class or access restrictions, and is applied to any entry with class
+information. The iCalendar standard defines three visibility classes:
+- PUBLIC :: The entry is publicly visible (this is the default).
+- CONFIDENTIAL :: Only a limited group of clients get access to the
+     event.
+- PRIVATE :: The entry can be retrieved only by its owner.
+The server should treat unknown class
+properties the same as PRIVATE.
+
 Exporting to iCalendar format depends in large part on the
 capabilities of the destination application.  Some are more lenient
 than others.  Consult the Org mode FAQ for advice on specific
-- 
2.18.0.rc2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Revised iCalendar visibility
  2018-06-26  9:00 Revised iCalendar visibility Tobias Schlemmer
@ 2018-06-26  9:53 ` Nicolas Goaziou
  2018-06-26 17:53   ` Tobias Schlemmer
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2018-06-26  9:53 UTC (permalink / raw)
  To: Tobias Schlemmer; +Cc: emacs-orgmode@gnu.org >> emacs-orgmode

Hello,

Tobias Schlemmer <keinstein_junior@gmx.net> writes:

> some time ago sent pull request from GitHub to support per-entry
> visibility in iCalendar export.

We don't use GitHub.

> I attach the patch and some short documentation of the feature in the
> attaced files. They have been updated to honour the timezone patch and
> the documentation switch from texinfo to org-mode.

Applied in "next" branch. Thank you.

Would you mind providing an entry for ORG-NEWS about it?

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Revised iCalendar visibility
  2018-06-26  9:53 ` Nicolas Goaziou
@ 2018-06-26 17:53   ` Tobias Schlemmer
  2018-06-27  6:26     ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Tobias Schlemmer @ 2018-06-26 17:53 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 677 bytes --]

Am 26.06.2018 um 11:53 schrieb Nicolas Goaziou:
> Hello,
>
> Tobias Schlemmer <keinstein_junior@gmx.net> writes:
>
>> some time ago sent pull request from GitHub to support per-entry
>> visibility in iCalendar export.
> We don't use GitHub.
No problem.
I don't remember where I got this advise. Usually I don't send requests
to random destinations.
>> I attach the patch and some short documentation of the feature in the
>> attaced files. They have been updated to honour the timezone patch and
>> the documentation switch from texinfo to org-mode.
> Applied in "next" branch. Thank you.
>
> Would you mind providing an entry for ORG-NEWS about it?
Attached.

Regards,
Tobias

[-- Attachment #2: 0001-Add-an-entry-for-iCalendar-export-CLASS-attribute-to.patch --]
[-- Type: text/x-patch, Size: 1268 bytes --]

From 810c66b23aa9302b6a723b257210d97342cebba8 Mon Sep 17 00:00:00 2001
From: Tobias Schlemmer <keinstein@users.sourceforge.net>
Date: Tue, 26 Jun 2018 19:47:26 +0200
Subject: [PATCH] Add an entry for iCalendar export CLASS attribute to ORG-NEWS

* etc/ORG-NEWS: Document iCalendar export CLASS attribute
---
 etc/ORG-NEWS | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 734732b2b..24f14a097 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -19,6 +19,16 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 See [[git:3367ac9457]] for details.
 
 ** New features
+*** iCalendar export respects a =CLASS= property
+Set the =CLASS= property on an entry to specify a visibility class for
+that entry only during iCalendar export. The property can be set to
+anything the calendar server supports. The iCalendar standard defines
+the values =PUBLIC=, =CONFIDENTIAL=, =PRIVATE=, which can be
+interpreted as publicly visable, accessible to a specific group, and
+private respectively.
+
+This property can be inherited during iCalendar export,
+depending on the value of ~org-use-property-inheritance~.
 *** Babel
 **** Add LaTeX output support in PlantUML
 *** New parameter for =INCLUDE= keyword
-- 
2.18.0.rc2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Revised iCalendar visibility
  2018-06-26 17:53   ` Tobias Schlemmer
@ 2018-06-27  6:26     ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2018-06-27  6:26 UTC (permalink / raw)
  To: Tobias Schlemmer; +Cc: emacs-orgmode

Hello,

Tobias Schlemmer <keinstein_junior@gmx.net> writes:

> From 810c66b23aa9302b6a723b257210d97342cebba8 Mon Sep 17 00:00:00 2001
> From: Tobias Schlemmer <keinstein@users.sourceforge.net>
> Date: Tue, 26 Jun 2018 19:47:26 +0200
> Subject: [PATCH] Add an entry for iCalendar export CLASS attribute to ORG-NEWS
>
> * etc/ORG-NEWS: Document iCalendar export CLASS attribute

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-27  6:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-26  9:00 Revised iCalendar visibility Tobias Schlemmer
2018-06-26  9:53 ` Nicolas Goaziou
2018-06-26 17:53   ` Tobias Schlemmer
2018-06-27  6:26     ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).