Ticket #7291 (closed Bug: fixed)

Opened 7 years ago

Last modified 4 years ago

External Editor link conditionally needs .zem extension and ?macosx=1 query string parameter on OSX

Reported by: grahamperrin Owned by:
Priority: minor Milestone: 4.0
Component: General Version:
Keywords: ZEM Zope Edit Manager ZopeEditManager newbie Cc: grahamperrin

Description

See for example  http://plone.org/products/zope-externaleditor-client/ and discussion at  http://ringinginunison.blogspot.com/2007/09/zopeeditmanager-safari-automation.html

If the option to 'Edit with external application' can result in a filename that bears a .zem suffix then I think it will be easier to resolve such issues.

As things stand, it's difficult (impossible?) to have external editors work _neatly_ with Safari, if the user attempts to use the feature from a page view within Plone.

(Working within ZMI, less of an issue; clicking a pencil icon results in a file with a .zem suffix.)

Thanks!

Change History

comment:1 Changed 7 years ago by limi

  • Status changed from new to closed
  • Resolution set to worksforme

Brice solved this on the client side, quoting from the link above:

You may be in luck this evening (morning!) - I've come up with a script that will detect the header info that external_edit pops in the file when its downloaded. You may still want the original Automator script for .zem files - not sure if they contain the same header info or not (and its too late to check!)

But anyhow, the script I got working is a simple one-step workflow using "Run Shell Script" (gotta love UNIX).

Set "Pass input:" to "as arguments", then between the "do" and "done" (the loop body), put the following:

grep -l meta_type "$f" | xargs -I {} open -a ZopeEditManager -g {}

Breakdown:

  1. grep -l will search for "meta_type" and print out just the name of the file, if it matches
  2. xargs will take the printed filename from stdin and pass it to an invoked command, as a parameter
  3. open -a will open the ZopeEditManager application (or just re-invoking, if already open) and pass the filename "{}" as a parameter. The "-g" just prevents "open" from bringing ZEM to the foreground (which isn't really desired, the app ZEM activates should come to the foreground.)

There ya go! Should work like a charm :)

comment:2 Changed 7 years ago by limi

  • Summary changed from Edit with external application: add .zem suffix to filename to Using Safari with Zope External Editor

Making it easier to find this issue. :)

comment:3 Changed 7 years ago by grahamperrin

  • Status changed from closed to reopened
  • Resolution worksforme deleted

I'd prefer a solution that doesn't rely on scripting ...

comment:4 Changed 7 years ago by grahamperrin

  • Cc grahamperrin added

 http://pastebin.ca/754765 did not help :-(

comment:5 Changed 7 years ago by grahamperrin

I use one of those products that automatically organises downloads by date, so for example

[grahamperrin:~/Desktop/downloads/misc] gjp22% ls

2007-09-01      2007-10-02      2007-10-26      2007-11-11
2007-09-05      2007-10-03      2007-10-29      2007-11-12
2007-09-06      2007-10-06      2007-10-30      2007-11-13
2007-09-14      2007-10-07      2007-11-02      2007-11-16
2007-09-18      2007-10-11      2007-11-04      2007-11-17
2007-09-20      2007-10-13      2007-11-07      2007-11-20
2007-09-26      2007-10-15      2007-11-08

A script/workaround that assumes downloads to a static location would work for one day only.

Is the .zem filename suffix not an option?

Thanks
Graham

comment:6 Changed 7 years ago by grahamperrin

  • Keywords ZopeEditManager added

comment:7 Changed 7 years ago by grahamperrin

  • Summary changed from Using Safari with Zope External Editor to Using ZopeEditManager with browsers on Mac OS: focus on .zem suffix to file name

Environment (using Camino, other browsers may behave similarly)

I have an appropriate string in my
~/Library/Preferences/com.apple.DownloadAssessment.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>LSRiskCategorySafe</key>
        <dict>
                <key>LSRiskCategoryMIMETypes</key>
                <array>
                        <string>application/x-zope-edit</string>
                </array>
        </dict>
</dict>
</plist>

and my  Camino (Gecko) browser is set to Open downloaded files (with helper applications).


Example 1: success (in ZMI, with a .zem suffix to the file name)

If at http://localhost:8080/Plone/front-page/manage_metadata
I click the pencil icon (Edit using external editor)

then the resulting URL is
http://localhost:8080/Plone/externalEdit_/front-page.zem?macosx=1 ( http://localhost:8080/Plone/externalEdit_/front-page.zem is also acceptable)
and the resulting front-page.zem file is

1) downloaded to
/tmp

2) opened by ZopeEditManager

A WebDAV lock occurs, ZopeEditManager passes the file to my preferred editor (Smultron) and when I finish there is no debris. Success.


Example 2: failure (in normal views, without a .zem suffix)

If at http://localhost:8080/Plone/front-page
I click Edit with external application'

then the resulting URL is
http://localhost:8080/Plone/front-page/external_edit

1) The front-page file, which lacks a .zem suffix to its name:

a) is not opened by ZopeEditManager or passed to Smultron

b) is opened by an editor that I do not prefer

c) may be saved, but changes are not passed to the server

and

2) no WebDAV lock occurs

and

3) there's debris, housekeeping to perform after each edit (a temporary path is not used).

comment:8 Changed 7 years ago by grahamperrin

I'm experimenting with changes to the URL/string at
/portal_actions/document_actions/extedit/manage_propertiesForm

but I'm not sure how to construct it :-/

comment:9 Changed 7 years ago by grahamperrin

Experimenting with

string:externalEdit_/${object/getId}.zem

(credit to Deichi in IRC)
I'm getting closer but at this point,  http://paste.plone.org/18069

comment:10 Changed 7 years ago by grahamperrin

Great progress, inspired by Deichi and with my limited understanding of
/Applications/Plone-3.0.2/Instance/Products/ExternalEditor/README.txt

At
/Plone/portal_actions/document_actions/extedit/manage_propertiesForm

string:${here/aq_parent/absolute_url}/externalEdit_/${here/getId}.zem?macosx=1

seems to have the desired effect, at least in Camino.


If
?macosx=1
is omitted from the string then

Exception Type  	AttributeError
Exception Value 	home.zem

If
?macosx=1
is included then the result appears to be fine in (at least) Camino on Mac OS and IE 7 on Windows.


I have not tested client applications on Linux.


If developers agree that the alternative string
string:${here/aq_parent/absolute_url}/externalEdit_/${here/getId}.zem?macosx=1
is suitable, then please include it in Plone. Thanks.

(Still, I have an issue with Safari 3.0.4 on both Windows and Mac OS -- Safari downloads but does not automatically open the .zem file, and the WebDAV lock is not applied until the file is opened manually -- but I should treat this issue separately.)

comment:11 Changed 7 years ago by grahamperrin

Incidentally, to convert a binary plist to xml,

plutil -convert xml1 ~/Library/Preferences/com.apple.DownloadAssessment.plist

 Mac OS X Manual Page For plutil

comment:12 Changed 7 years ago by hannosch

  • Component changed from Unknown to WebDAV

Not exactly a webdav issue but that is the closest category we have.

comment:13 Changed 6 years ago by hannosch

  • Milestone changed from 3.x to Future

I'm inclined to say, that we'd be better of removing ExternalEditor support from the core Plone product, since it is completely unmaintained.

comment:14 Changed 6 years ago by grahamperrin

Please, don't remove ExternalEditor support until after WebDAV compatibility with (for example) Mac OS X is improved.

comment:15 Changed 6 years ago by hannosch

  • Component changed from WebDAV to Infrastructure

comment:16 Changed 5 years ago by optilude

  • Keywords newbie added
  • Summary changed from Using ZopeEditManager with browsers on Mac OS: focus on .zem suffix to file name to External Editor link conditionally needs .zem extension and ?macosx=1 query string parameter on OSX

Fixing this is probably really simple, if I'm understanding the issue.

ExternalEditor includes a method EditLink() which will conditionally add a suffix '.zem' to the EE URL and the query string parameter ?macosx=1 if the client is on OSX. In combination, these two make opening the a file directly possible, so long as the '.zem' extension is mapped to the ZopeEditManager application in the finder.

comment:17 Changed 5 years ago by optilude

  • Status changed from reopened to closed
  • Resolution set to fixed

(In [30188]) Make the external_editor link on OS X use the .zem extension. Fixes #7291

comment:18 Changed 5 years ago by optilude

  • Type changed from Feature Request to Bug

comment:19 Changed 5 years ago by optilude

(In [30189]) Forward port fix refs #7291

comment:20 Changed 4 years ago by hannosch

  • Milestone changed from Future to 4.0

comment:21 Changed 2 years ago by davisagli

  • Component changed from Infrastructure to General
Note: See TracTickets for help on using tickets.