Back to index

plone3  3.1.7
Classes | Functions | Variables
ExternalEditor.ExternalEditor Namespace Reference

Classes

class  PDataStreamIterator
class  ExternalEditor

Functions

def wl_isLocked
def registerCallback
def applyCallbacks
def EditLink
def querystr

Variables

 IStreamIterator = None
string ExternalEditorPermission = 'Use external editor'
list _callbacks = []
tuple is_mac_user_agent = re.compile('.*Mac OS X.*|.*Mac_PowerPC.*')

Function Documentation

def ExternalEditor.ExternalEditor.applyCallbacks (   ob,
  metadata,
  request,
  response 
)
Apply the registered callbacks in the order they were
registered. The callbacks are free to perform any operation,
including appending new metadata attributes and setting response
headers.

Definition at line 71 of file ExternalEditor.py.

00071 
00072 def applyCallbacks(ob, metadata, request, response):
00073     """Apply the registered callbacks in the order they were
00074     registered. The callbacks are free to perform any operation,
00075     including appending new metadata attributes and setting response
00076     headers.
00077     """
00078     for cb in _callbacks:
00079         cb(ob, metadata, request, response)

Here is the caller graph for this function:

def ExternalEditor.ExternalEditor.EditLink (   self,
  object,
  borrow_lock = 0,
  skip_data = 0 
)
Insert the external editor link to an object if appropriate

Definition at line 257 of file ExternalEditor.py.

00257 
00258 def EditLink(self, object, borrow_lock=0, skip_data=0):
00259     """Insert the external editor link to an object if appropriate"""
00260     base = Acquisition.aq_base(object)
00261     user = getSecurityManager().getUser()
00262     editable = (hasattr(base, 'manage_FTPget')
00263                 or hasattr(base, 'EditableBody')
00264                 or hasattr(base, 'document_src')
00265                 or hasattr(base, 'read'))
00266     if editable and user.has_permission(ExternalEditorPermission, object):
00267         query = {}
00268         if is_mac_user_agent(object.REQUEST['HTTP_USER_AGENT']):
00269             # Add extension to URL so that the Mac finder can
00270             # launch the ZopeEditManager helper app
00271             # this is a workaround for limited MIME type
00272             # support on MacOS X browsers
00273             ext = '.zem'
00274             query['macosx'] = 1
00275         else:
00276             ext = ''
00277         if borrow_lock:
00278             query['borrow_lock'] = 1
00279         if skip_data:
00280             query['skip_data'] = 1
00281         url = "%s/externalEdit_/%s%s%s" % (object.aq_parent.absolute_url(),
00282                                            urllib.quote(object.getId()),
00283                                            ext, querystr(query))
00284         return ('<a href="%s" '
00285                 'title="Edit using external editor">'
00286                 '<img src="%s/misc_/ExternalEditor/edit_icon" '
00287                 'align="middle" hspace="2" border="0" alt="External Editor" />'
00288                 '</a>' % (url, object.REQUEST.BASEPATH1)
00289                )
00290     else:
00291         return ''

Here is the call graph for this function:

Create a query string from a dict

Definition at line 292 of file ExternalEditor.py.

00292 
00293 def querystr(d):
00294     """Create a query string from a dict"""
00295     if d:
00296         return '?' + '&'.join(
00297             ['%s=%s' % (name, val) for name, val in d.items()])
00298     else:
00299         return ''
00300 

Here is the caller graph for this function:

Register a callback to be called by the External Editor when
it's about to be finished with collecting metadata for the
to-be-edited file to allow actions to be taken, like for example
inserting more metadata headers or enabling response compression
or anything.

Definition at line 62 of file ExternalEditor.py.

00062 
00063 def registerCallback(cb):
00064     """Register a callback to be called by the External Editor when
00065     it's about to be finished with collecting metadata for the
00066     to-be-edited file to allow actions to be taken, like for example
00067     inserting more metadata headers or enabling response compression
00068     or anything.
00069     """
00070     _callbacks.append(cb)

Definition at line 33 of file ExternalEditor.py.

00033 
00034     def wl_isLocked(ob):
00035         return 0
try:

Here is the caller graph for this function:


Variable Documentation

Definition at line 43 of file ExternalEditor.py.

Definition at line 41 of file ExternalEditor.py.

tuple ExternalEditor.ExternalEditor.is_mac_user_agent = re.compile('.*Mac OS X.*|.*Mac_PowerPC.*')

Definition at line 255 of file ExternalEditor.py.

Definition at line 39 of file ExternalEditor.py.