Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes
kupu.plone.plonelibrarytool.PloneKupuLibraryTool Class Reference
Inheritance diagram for kupu.plone.plonelibrarytool.PloneKupuLibraryTool:
Inheritance graph
[legend]
Collaboration diagram for kupu.plone.plonelibrarytool.PloneKupuLibraryTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def manage_afterAdd
def getLinkbyuid
def getRefBrowser
def ensureReferencesLayer
def getCaptioning
def getTableClassnames
def getParagraphStyles
def getStyleList
def filterToolbar
def getFilterOptions
def set_toolbar_filters
def getGlobalButtonFilter
def getHtmlExclusions
def getStyleWhitelist
def getClassBlacklist
def getDefaultResource
def setDefaultResource
def installBeforeUnload
def getFiltersourceedit
def getAllowOriginalImageSize
def isKupuEnabled
def getWysiwygmacros
def forcekupu_url
def query_string
def url_plus_query
def kupuUrl
def getCookedLibraries
def getSingleLibrary
def scanIds
def scanKWS
def docs
def link_migration
def zmi_get_libraries
def zmi_add_library
def zmi_update_libraries
def zmi_delete_libraries
def zmi_move_up
def zmi_move_down
def zmi_get_default_library
def zmi_set_default_library
def zmi_get_type_mapping
def export_resource_types
def get_resourcetypes
def zmi_get_resourcetypes
def zmi_update_resource_types
def zmi_delete_resource_types
def getPreviewForType
def getNormalViewForType
def getScaleFieldForType
def getDefaultImageType
def getDefaultScaleForType
def getClassesForType
def getMediaForType
def set_html_exclusions
def get_stripped_tags
def set_stripped_tags
def get_stripped_attributes
def set_stripped_attributes
def get_stripped_combinations
def set_stripped_combinations
def have_plone_filtering
def configure_kupu
def getPreviewable
def getResourceType
def getFolderItems
def getSingleObjectInfo
def getBreadCrumbs
def getCurrentObject
def getCurrentParent
def getCurrentSelection
def getMyItems
def getRecentItems
def kupuSearch
def infoForQuery
def infoForBrains
def canCaption
def getLabelFromWidget
def getKupuFields
def supportedCaptioning
def unsupportedCaptioning
def transformIsEnabled
def isUploadSupported
def getBaseUrl
def getUploadImageSizes
def getUploadImageClasses
def convertUidsToPaths

Public Attributes

 linkbyuid
 html_exclusions
 style_whitelist
 default_resource
 table_classnames
 install_beforeunload
 filtersourceedit
 allowOriginalImageSize
 paragraph_styles
 class_blacklist
 captioning

Static Public Attributes

 id = TOOLNAME
string meta_type = "Kupu Library Tool"
 title = TOOLTITLE
tuple security = ClassSecurityInfo()
tuple manage_options
tuple zmi_links = PageTemplateFile("zmi_links.pt", globals())
tuple zmi_toolbar = PageTemplateFile("zmi_toolbar.pt", globals())
tuple zmi_docs = PageTemplateFile("zmi_docs.pt", globals())
tuple kupu_config = PageTemplateFile("kupu_config.pt", globals())
tuple zmi_libraries = PageTemplateFile("libraries.pt", globals())
tuple zmi_resource_types = PageTemplateFile("resource_types.pt", globals())

Private Attributes

 _libraries
 _res_types
 _default_library

Detailed Description

Plone specific version of the kupu library tool

Definition at line 106 of file plonelibrarytool.py.


Constructor & Destructor Documentation

Definition at line 124 of file plonelibrarytool.py.

00124 
00125     def __init__(self):
00126         self._libraries = PersistentList()
00127         self._res_types = PersistentMapping()
00128         self.linkbyuid = False


Member Function Documentation

def kupu.plone.plonedrawers.PloneDrawers.canCaption (   self,
  field 
) [inherited]

Definition at line 786 of file plonedrawers.py.

00786 
00787     def canCaption(self, field):
00788         return (getattr(field, 'default_output_type', None) in
00789             ('text/x-html-safe', 'text/x-html-captioned'))

Here is the caller graph for this function:

def kupu.plone.plonelibrarytool.PloneKupuLibraryTool.configure_kupu (   self,
  linkbyuid = None,
  table_classnames = None,
  html_exclusions = None,
  style_whitelist = None,
  class_blacklist = None,
  installBeforeUnload = None,
  parastyles = None,
  refbrowser = None,
  captioning = None,
  filterSourceEdit = None,
  allowOriginalImageSize = None,
  REQUEST = None 
)
Delete resource types through the ZMI

Definition at line 810 of file plonelibrarytool.py.

00810 
00811         REQUEST=None):
00812         """Delete resource types through the ZMI"""
00813         if linkbyuid is not None:
00814             self.linkbyuid = bool(linkbyuid)
00815         if table_classnames is not None:
00816             self.table_classnames = [t for t in table_classnames if t]
00817         if installBeforeUnload is not None:
00818             self.install_beforeunload = bool(installBeforeUnload)
00819         if filterSourceEdit is not None:
00820             self.filtersourceedit = bool(filterSourceEdit)
00821         if allowOriginalImageSize is not None:
00822             self.allowOriginalImageSize = bool(allowOriginalImageSize)
00823 
00824         if parastyles is not None:
00825             self.paragraph_styles = [ line.strip() for line in parastyles if line.strip() ]
00826 
00827         if html_exclusions is not None:
00828             newex = html_exclusions[-1]
00829             html_exclusions = html_exclusions[:-1]
00830             
00831             html_exclusions = [ (tuple(h.get('tags', ())), tuple(h.get('attributes', ())))
00832                 for h in html_exclusions if h.get('keep')]
00833 
00834             tags = newex.get('tags', '').replace(',',' ').split()
00835             attr = newex.get('attributes', '').replace(',',' ').split()
00836             if tags or attr:
00837                 html_exclusions.append((tuple(tags), tuple(attr)))
00838             self.set_html_exclusions(html_exclusions)
00839 
00840         if style_whitelist is not None:
00841             self.style_whitelist = list(style_whitelist)
00842         if class_blacklist is not None:
00843             self.class_blacklist = list(class_blacklist)
00844 
00845         if refbrowser is not None:
00846             out = StringIO()
00847             if refbrowser:
00848                 self.ensureReferencesLayer(True);
00849             else:
00850                 util.unregister_layers(self, ['kupu_references'], out)
00851             # Force compressed javascript to be recomputed.
00852             try:
00853                 self.portal_javascripts.cookResources()
00854             except AttributeError:
00855                 pass
00856 
00857         if captioning is not None:
00858             self.captioning = bool(captioning)
00859 
00860         if self.linkbyuid or self.getCaptioning():
00861             util.install_transform(self)
00862         else:
00863             util.remove_transform(self)
00864 
00865         if REQUEST:
00866             REQUEST.RESPONSE.redirect(self.absolute_url() + '/kupu_config')
00867         
00868 InitializeClass(PloneKupuLibraryTool)

Here is the caller graph for this function:

def kupu.plone.plonedrawers.PloneDrawers.convertUidsToPaths (   self,
  value = None 
) [inherited]
Convert a list of uids
(or a single space or newline separated string)
to a list of paths

Definition at line 935 of file plonedrawers.py.

00935 
00936     def convertUidsToPaths(self, value=None):
00937         """Convert a list of uids
00938         (or a single space or newline separated string)
00939         to a list of paths"""
00940         uid_catalog = getToolByName(self, 'uid_catalog')
00941         ppath = getToolByName(self, 'portal_url').getPortalPath()[1:]+'/'
00942         
00943         if isinstance(value, basestring):
00944             value = value.split()
00945         if not value:
00946             return []
00947             
00948         brains = uid_catalog.searchResults(UID=value)
00949         paths = [ppath+b.getPath() for b in brains]
00950         return paths
00951 
00952 InitializeClass(PloneDrawers)

Here is the call graph for this function:

Returns Kupu docs formatted as HTML

Definition at line 510 of file plonelibrarytool.py.

00510 
00511     def docs(self):
00512         """Returns Kupu docs formatted as HTML"""
00513         docpath = os.path.join(Globals.package_home(kupu_globals), 'doc')
00514         f = open(os.path.join(docpath, 'PLONE2.txt'), 'r')
00515         _docs = f.read()
00516         return _docs

Called from the link tab code: we must have the
kupu_references directory view at least present for
the link tab to work.

Definition at line 152 of file plonelibrarytool.py.

00152 
00153     def ensureReferencesLayer(self, add=False):
00154         """Called from the link tab code: we must have the
00155         kupu_references directory view at least present for
00156         the link tab to work."""
00157         out = StringIO()
00158         util.register_layer(self, 'plone/kupu_references', 'kupu_references', out, add)

Build a list of resource types formatted for export.
'blacklist' type lists are inverted so the listed types are the ones we don't want.

Definition at line 632 of file plonelibrarytool.py.

00632 
00633     def export_resource_types(self):
00634         """Build a list of resource types formatted for export.
00635         'blacklist' type lists are inverted so the listed types are the ones we don't want.
00636         """
00637         types = self.get_resourcetypes()
00638         typetool = getToolByName(self, 'portal_types')
00639         portal_types = dict([ (t.id, 1) for t in typetool.listTypeInfo()])
00640         for t in types:
00641             if t.newtype:
00642                 t.types = self.invertTypeList(t.types)
00643                 t.mode = 'blacklist'
00644             else:
00645                 t.mode = 'whitelist'
00646         return types

Here is the call graph for this function:

def kupu.plone.plonelibrarytool.PloneKupuLibraryTool.filterToolbar (   self,
  context,
  field = None 
)

Definition at line 211 of file plonelibrarytool.py.

00211 
00212     def filterToolbar(self, context, field=None):
00213         return helpers.ButtonFilter(self, context, field)

Definition at line 399 of file plonelibrarytool.py.

00399 
00400     def forcekupu_url(self, fieldName):
00401         args = {'kupu.convert':fieldName,
00402             'kupu.suppress':None,
00403             'portal_status_message':None
00404             }
00405         qs = self.query_string(args);
00406         return "%s?%s" % (self.REQUEST.URL0, qs)

Here is the call graph for this function:

Return the type mapping, but without the ZMI dummy entry

Definition at line 648 of file plonelibrarytool.py.

00648 
00649     def get_resourcetypes(self):
00650         """Return the type mapping, but without the ZMI dummy entry"""
00651         keys = self._res_types.keys()
00652         keys.sort()
00653         real = []
00654         for name in keys:
00655             value = self._res_types[name]
00656             wrapped = Object(name=name, types=tuple(value), newtype=self.getNewTypeHandler(name))
00657             real.append(wrapped)
00658         return real

Here is the call graph for this function:

Here is the caller graph for this function:

Returns a list of attributes to be stripped

Definition at line 766 of file plonelibrarytool.py.

00766 
00767     def get_stripped_attributes(self):
00768         """Returns a list of attributes to be stripped"""
00769         stripped = []
00770         for (tags, attrs) in self.getHtmlExclusions():
00771             if not tags:
00772                 stripped.extend(attrs)
00773         return stripped
        

Here is the call graph for this function:

Returns a list of tag/attribute combinations to be stripped

Definition at line 782 of file plonelibrarytool.py.

00782 
00783     def get_stripped_combinations(self):
00784         """Returns a list of tag/attribute combinations to be stripped"""
00785         stripped = [(tags, attrs) for (tags, attrs) in self.getHtmlExclusions() if tags and attrs]
00786         return stripped

Here is the call graph for this function:

Returns a list of tags to be stripped

Definition at line 750 of file plonelibrarytool.py.

00750 
00751     def get_stripped_tags(self):
00752         """Returns a list of tags to be stripped"""
00753         stripped = []
00754         for (tags, attrs) in self.getHtmlExclusions():
00755             if not attrs:
00756                 stripped.extend(tags)
00757         return stripped

Here is the call graph for this function:

Definition at line 296 of file plonelibrarytool.py.

00296 
00297     def getAllowOriginalImageSize(self):
00298         return getattr(self, 'allowOriginalImageSize', False)

def kupu.plone.plonedrawers.PloneDrawers.getBaseUrl (   self,
  context,
  include_factory = False,
  resource_type = None 
) [inherited]

Definition at line 866 of file plonedrawers.py.

00866 
00867     def getBaseUrl(self, context, include_factory=False, resource_type=None):
00868         base = context.absolute_url()
00869 
00870         if resource_type:
00871             rt = self.getResourceType(resource_type);
00872             sd = rt.startup_directory
00873             if sd:
00874                 base = sd
00875 
00876         posfactory = base.find('/portal_factory/')
00877         if posfactory>0:
00878             if include_factory:
00879                 base = base[:posfactory+15]
00880             else:
00881                 base = base[:posfactory]
00882         return base

Here is the call graph for this function:

def kupu.plone.plonedrawers.PloneDrawers.getBreadCrumbs (   self,
  context,
  template 
) [inherited]
Return breadcrumbs for drawer

Definition at line 597 of file plonedrawers.py.

00597 
00598     def getBreadCrumbs(self, context, template):
00599         """Return breadcrumbs for drawer"""
00600         resource_type = self.getResourceType()
00601         if not resource_type.allow_browse:
00602             return []
00603 
00604         id = template.getId()
00605         putils = getToolByName(self, 'plone_utils')
00606         path = [ ("Home", getToolByName(self, 'portal_url')())]
00607 
00608         if getattr(putils.aq_base, 'createBreadCrumbs', None) is not None:
00609             path = path + [(x['Title'],x['absolute_url']) for x in putils.createBreadCrumbs(context)]
00610         else:
00611             path = path + self.breadcrumbs(context)[1:-1]
00612 
00613         # Last crumb should not be linked:
00614         path[-1] = (path[-1][0], None)
00615 
00616         crumbs = []
00617         for title,url in path:
00618             if url:
00619                 url = self.kupuUrl("%s/%s" % (url.rstrip('/'), id))
00620             crumbs.append({'Title':title, 'absolute_url':url})
00621 
00622         return crumbs

Here is the call graph for this function:

Returns True if captioning is enabled

Definition at line 160 of file plonelibrarytool.py.

00160 
00161     def getCaptioning(self):
00162         """Returns True if captioning is enabled"""
00163         try:
00164             return bool(self.captioning)
00165         except AttributeError:
00166             return False

Definition at line 276 of file plonelibrarytool.py.

00276 
00277     def getClassBlacklist(self):
00278         return getattr(self, 'class_blacklist', [])

Definition at line 725 of file plonelibrarytool.py.

00725 
00726     def getClassesForType(self, portal_type):
00727         action_map = getattr(self, '_preview_actions', {})
00728         return action_map.get(portal_type, {}).get('classes', ())

Here is the call graph for this function:

Here is the caller graph for this function:

Return a list of libraries with our own parameters included.
The library with id 'search' is excluded from this list.

Definition at line 468 of file plonelibrarytool.py.

00468 
00469     def getCookedLibraries(self, context):
00470         """Return a list of libraries with our own parameters included.
00471         The library with id 'search' is excluded from this list."""
00472         libraries = [l for l in self.getLibraries(context) if not l['id'].startswith('_')]
00473         default_library = getattr(self, '_default_library', '')
00474 
00475         for l in libraries:
00476             l['src'] = self.kupuUrl(l['src'])
00477             l['selected'] = l['id']==default_library or None
00478         return libraries

Here is the call graph for this function:

def kupu.plone.plonedrawers.PloneDrawers.getCurrentObject (   self,
  portal = None 
) [inherited]
Returns object information for a selected object

Definition at line 624 of file plonedrawers.py.

00624 
00625     def getCurrentObject(self, portal=None):
00626         '''Returns object information for a selected object'''
00627         request = self.REQUEST
00628         if portal is None:
00629             portal = getToolByName(self, 'portal_url').getPortalObject()
00630         reference_tool = getToolByName(portal, 'reference_catalog')
00631         rt = self.getResourceType()
00632         portal_types = rt.portal_types
00633         src = request.get('src')
00634         # Remove any spurious query string or fragment
00635         for c in '#?':
00636             if c in src:
00637                 src = src.split(c, 1)[0]
00638 
00639         match = UIDURL.match(src)
00640 
00641         if match:
00642             # src=http://someurl/resolveuid/<uid>
00643             uid = match.group(1)
00644             obj = reference_tool.lookupObject(uid)
00645             
00646         elif src and '://' in src:
00647             # src=http://someurl/somepath/someobject
00648             base = portal.absolute_url()
00649             if src.startswith(base):
00650                 src = src[len(base):].lstrip('/')
00651             try:
00652                 obj = portal.restrictedTraverse(src)
00653                 if portal_types:
00654                     while not shasattr(obj.aq_base, 'portal_type'):
00655                         obj = obj.aq_parent
00656                     while obj.portal_type not in portal_types:
00657                         obj = obj.aq_parent
00658                         if obj is portal:
00659                             return []
00660             except (KeyError, AttributeError):
00661                 return []
00662         else:
00663             # src=<uid1> <uid2> ... <uidn>
00664             src = src.split(' ') # src is a list of uids.
00665             objects = [ reference_tool.lookupObject(uid) for uid in src ]
00666             objects = [ o for o in objects if o is not None ]
00667             return objects
00668 
00669         if obj is None:
00670             return None
00671         return [obj]

Here is the call graph for this function:

Here is the caller graph for this function:

Find the parent of the object specified in the src string.
If multiple objects and they don't have the same parent, or if no suitable object
returns None, otherwise returns the parent.

Definition at line 673 of file plonedrawers.py.

00673 
00674     def getCurrentParent(self):
00675         """Find the parent of the object specified in the src string.
00676         If multiple objects and they don't have the same parent, or if no suitable object
00677         returns None, otherwise returns the parent."""
00678         objects = self.getCurrentObject()
00679         parent = None
00680         for obj in objects:
00681             if parent is not None and parent is not obj.aq_parent:
00682                 return None
00683             parent = obj.aq_parent
00684         return parent

Here is the call graph for this function:

def kupu.plone.plonedrawers.PloneDrawers.getCurrentSelection (   self,
  portal = None 
) [inherited]
Returns object information for a selected object

Definition at line 686 of file plonedrawers.py.

00686 
00687     def getCurrentSelection(self, portal=None):
00688         '''Returns object information for a selected object'''
00689         objects = self.getCurrentObject(portal)
00690         return self.infoForBrains(objects, self.getResourceType(), portal)

Here is the call graph for this function:

Definition at line 713 of file plonelibrarytool.py.

00713 
00714     def getDefaultImageType(self):
00715         return 'Image'

Here is the caller graph for this function:

Definition at line 280 of file plonelibrarytool.py.

00280 
00281     def getDefaultResource(self):
00282         return getattr(self, 'default_resource', 'linkable')

Definition at line 717 of file plonelibrarytool.py.

00717 
00718     def getDefaultScaleForType(self, portal_type = None):
00719         if not portal_type:
00720             portal_type = self.getDefaultImageType()
00721         action_map = getattr(self, '_preview_actions', {})
00722         value = action_map.get(portal_type, {}).get('defscale', 'image_preview')
00723         return value

Here is the call graph for this function:

Definition at line 215 of file plonelibrarytool.py.

00215 
00216     def getFilterOptions(self, field=None):
00217         filters = helpers.FILTERS
00218         config = self._getToolbarFilterOptions()
00219         res = []
00220         for (id, title, default, klass) in filters:
00221             cfg = config.get(id, {})
00222             visible = cfg.get('visible', default)
00223             expr = cfg.get('override', None)
00224             if expr is not None:
00225                 expr = expr.text
00226             res.append(dict(id=id, title=title, visible=visible, override=expr, classname=klass))
00227         return res

Here is the call graph for this function:

Definition at line 292 of file plonelibrarytool.py.

00292 
00293     def getFiltersourceedit(self):
00294         return getattr(self, 'filtersourceedit', True)

def kupu.plone.plonedrawers.PloneDrawers.getFolderItems (   self,
  context,
  resource_type = None,
  portal = None 
) [inherited]
List the contents of a folder

Definition at line 543 of file plonedrawers.py.

00543 
00544     def getFolderItems(self, context, resource_type=None, portal=None):
00545         """List the contents of a folder"""
00546         resource_type = self.getResourceType(resource_type)
00547         collection_type = self.getResourceType('collection')
00548         coll_types = collection_type.portal_types
00549         link_types = resource_type.portal_types
00550         allow_browse = resource_type.allow_browse
00551 
00552         if portal is None:
00553             portal = getToolByName(self, 'portal_url').getPortalObject()
00554 
00555         query = resource_type.getQuery()
00556         content =  context.getFolderContents(contentFilter=query)
00557         linkable = dict([(o.id,1) for o in content ])
00558 
00559         if allow_browse and coll_types:
00560             # Do an extended query which includes collections whether
00561             # or not they were matched by the first query,
00562             # and which also, unfortunately may include content which
00563             # doesn't match the original query.
00564             query2 = {}
00565             if link_types:
00566                 query2['portal_type'] = tuple(link_types) + tuple(coll_types)
00567             else:
00568                 query2['portal_type'] = ()
00569 
00570             if 'sort_on' in query:
00571                 query2['sort_on'] = query['sort_on']
00572 
00573             allcontent = context.getFolderContents(contentFilter=query2)
00574             content = [c for c in allcontent
00575                 if c.portal_type in coll_types or c.id in linkable ]
00576 
00577         link_types = query['portal_type']
00578         items = self.infoForBrains(content, resource_type, portal, linkids=linkable)
00579 
00580         if allow_browse and context is not portal:
00581             parent = context.aq_parent
00582             pt = getattr(parent, 'portal_type', None)
00583             if pt in collection_type.portal_types:
00584                 data = self.getSingleObjectInfo(parent, resource_type)
00585                 data['label'] = '.. (Parent folder)'
00586                 items.insert(0, data)
00587         return items

Here is the call graph for this function:

Definition at line 245 of file plonelibrarytool.py.

00245 
00246     def getGlobalButtonFilter(self):
00247         gfilter = getattr(self, '_global_toolbar_filter', None)
00248         if gfilter is not None:
00249             return gfilter.text
00250         return ''

Definition at line 252 of file plonelibrarytool.py.

00252 
00253     def getHtmlExclusions(self):
00254         try:
00255             excl = self.html_exclusions
00256         except AttributeError:
00257             excl = self.html_exclusions = _excluded_html
00258 
00259         res = []
00260         for (t,a) in excl:
00261             if t and t[0]=='':
00262                 t = []
00263             if a and a[0]=='':
00264                 a = []
00265             res.append((t,a))
00266         return res

Here is the caller graph for this function:

def kupu.plone.plonedrawers.PloneDrawers.getKupuFields (   self,
  filter = 1 
) [inherited]
Returns a list of all kupu editable fields

Definition at line 799 of file plonedrawers.py.

00799 
00800     def getKupuFields(self, filter=1):
00801         """Returns a list of all kupu editable fields"""
00802         inuse = getToolByName(self, 'portal_catalog').uniqueValuesFor('portal_type')
00803         for t,f,pt in self._getKupuFields():
00804             if html2captioned.sanitize_portal_type(pt) in inuse or not filter:
00805                 yield dict(type=t, name=f.getName(), portal_type=pt,
00806                            label=self.getLabelFromWidget(f.widget))

Here is the call graph for this function:

def kupu.plone.plonedrawers.PloneDrawers.getLabelFromWidget (   self,
  widget 
) [inherited]
Get the label for a widget converting from i18n message if needed

Definition at line 791 of file plonedrawers.py.

00791 
00792     def getLabelFromWidget(self, widget):
00793         """Get the label for a widget converting from i18n message if needed"""
00794         label = util.translate(widget.Label(self), self.REQUEST)
00795         if isinstance(label, str):
00796             label = label.decode('utf8', 'replace')
00797         return label

Here is the caller graph for this function:

Returns 'is linking by UID enabled'?

Definition at line 139 of file plonelibrarytool.py.

00139 
00140     def getLinkbyuid(self):
00141         """Returns 'is linking by UID enabled'?"""
00142         try:
00143             return bool(self.linkbyuid)
00144         except AttributeError:
00145             return False

Definition at line 730 of file plonelibrarytool.py.

00730 
00731     def getMediaForType(self, portal_type):
00732         action_map = getattr(self, '_preview_actions', {})
00733         value = action_map.get(portal_type, {}).get('mediatype', 'image')
00734         return value

Here is the call graph for this function:

Definition at line 692 of file plonedrawers.py.

00692 
00693     def getMyItems(self):
00694         request = self.REQUEST
00695         response = request.RESPONSE
00696         response.setHeader('Cache-Control', 'no-cache')
00697 
00698         member_tool = getToolByName(self, 'portal_membership')
00699         member = member_tool.getAuthenticatedMember()
00700 
00701         # the default resource type is mediaobject
00702         search_params = {}
00703         search_params['sort_on'] = 'modified'
00704         search_params['sort_order'] = 'reverse'
00705         search_params['limit'] = 20
00706         search_params['Creator'] = member.getMemberId()
00707 
00708         return self.infoForQuery(search_params)

Here is the call graph for this function:

Definition at line 701 of file plonelibrarytool.py.

00701 
00702     def getNormalViewForType(self, portal_type):
00703         action_map = getattr(self, '_preview_actions', {})
00704         expr = action_map.get(portal_type, {}).get('normal', '')
00705         return getattr(expr, 'text', expr)

Here is the call graph for this function:

Return a list of classnames supported by paragraphs

Definition at line 176 of file plonelibrarytool.py.

00176 
00177     def getParagraphStyles(self):
00178         """Return a list of classnames supported by paragraphs"""
00179         try:
00180             return self.paragraph_styles
00181         except AttributeError:
00182             return _default_paragraph_styles

Here is the caller graph for this function:

Returns previewable types and a possible preview path

Definition at line 483 of file plonedrawers.py.

00483 
00484     def getPreviewable(self):
00485         """Returns previewable types and a possible preview path"""
00486         if HAS_PIL:
00487             def best_preview(field):
00488                 sizes = getattr(field, 'sizes', None)
00489                 if not sizes:
00490                     return field.getName()
00491 
00492                 preview = None
00493                 previewsize = (0,0)
00494                 for k in sizes:
00495                     try:
00496                         if previewsize < sizes[k] <= (128,128):
00497                             preview = k
00498                             previewsize = sizes[k]
00499                     except TypeError: # Fails on Plone 2.1
00500                         return field.getName()
00501                 if not preview:
00502                     smallest = min(sizes.values())
00503                     for k in sizes:
00504                         if sizes[k]==smallest:
00505                             preview = k
00506                             break
00507                 return "%s_%s" % (field.getName(), preview)
00508 
00509         else:
00510             def best_preview(field):
00511                 return field.getName()
00512 
00513         result = []
00514         typestool = getToolByName(self, 'portal_types')
00515         archetype_tool = getToolByName(self, 'archetype_tool', None)
00516         if archetype_tool is None:
00517             return result
00518         valid = dict.fromkeys([t.getId() for t in typestool.listTypeInfo()])
00519         types = archetype_tool.listRegisteredTypes()
00520         for t in types:
00521             name = t['portal_type']
00522             if not name in valid:
00523                 continue
00524             schema = t['schema']
00525             for field in schema.fields():
00526                 if not isinstance(field, ImageField):
00527                     continue
00528                 result.append((name, best_preview(field)))
00529                 break
00530         return result
        

Here is the call graph for this function:

Definition at line 695 of file plonelibrarytool.py.

00695 
00696     def getPreviewForType(self, portal_type):
00697         action_map = getattr(self, '_preview_actions', {})
00698         expr = action_map.get(portal_type, {}).get('expression', '')
00699         return getattr(expr, 'text', expr)

Here is the call graph for this function:

Definition at line 710 of file plonedrawers.py.

00710 
00711     def getRecentItems(self):
00712         search_params = {}
00713         search_params['sort_on'] = 'modified'
00714         search_params['sort_order'] = 'reverse'
00715         search_params['limit'] = 20
00716         search_params['review_state'] = 'visible', 'published'
00717 
00718         return self.infoForQuery(search_params)

Here is the call graph for this function:

Returns True if kupu_references is in all skin layers

Definition at line 147 of file plonelibrarytool.py.

00147 
00148     def getRefBrowser(self):
00149         """Returns True if kupu_references is in all skin layers"""
00150         return util.layer_installed(self, 'kupu_references')

def kupu.plone.plonedrawers.PloneDrawers.getResourceType (   self,
  resource_type = None 
) [inherited]
Convert resource type string to instance

Definition at line 532 of file plonedrawers.py.

00532 
00533     def getResourceType(self, resource_type=None):
00534         """Convert resource type string to instance"""
00535         if isinstance(resource_type, ResourceType):
00536             return resource_type
00537 
00538         if not resource_type:
00539             resource_type = self.REQUEST.get('resource_type', 'mediaobject')
00540 
00541         return ResourceType(self, resource_type)

Here is the caller graph for this function:

Definition at line 707 of file plonelibrarytool.py.

00707 
00708     def getScaleFieldForType(self, portal_type):
00709         action_map = getattr(self, '_preview_actions', {})
00710         value = action_map.get(portal_type, {}).get('scalefield', 'image')
00711         return value

Here is the call graph for this function:

Return the library with id=search or None

Definition at line 480 of file plonelibrarytool.py.

00480 
00481     def getSingleLibrary(self, context, id):
00482         """Return the library with id=search or None"""
00483         libraries = [l for l in self.getLibraries(context) if l['id']==id]
00484 
00485         for l in libraries:
00486             l['src'] = self.kupuUrl(l['src'])
00487         if libraries:
00488             return libraries[0]
00489         return None

Here is the call graph for this function:

def kupu.plone.plonedrawers.PloneDrawers.getSingleObjectInfo (   self,
  context,
  resource_type = None,
  portal = None 
) [inherited]
Return info for a single object

Definition at line 589 of file plonedrawers.py.

00589 
00590     def getSingleObjectInfo(self, context, resource_type=None, portal=None):
00591         """Return info for a single object"""
00592         if not resource_type: resource_type = self.getResourceType()
00593         if portal is None:
00594             portal = getToolByName(self, 'portal_url').getPortalObject()
00595         return self.infoForBrains([context], resource_type, portal)[0]

Here is the call graph for this function:

Here is the caller graph for this function:

Return the styles for a field.

Definition at line 184 of file plonelibrarytool.py.

00184 
00185     def getStyleList(self, field=None):
00186         """Return the styles for a field."""
00187         gstyles = self.getParagraphStyles()
00188         if field:
00189             widget = field.widget
00190             redefine = getattr(widget, 'redefine_parastyles', False)
00191             lstyles = getattr(widget, 'parastyles', ())
00192         else:
00193             redefine = False
00194             lstyles = []
00195 
00196         result = []
00197         __traceback_info__ = (gstyles, lstyles)
00198         if redefine:
00199             styles = lstyles
00200         else:
00201             styles = list(gstyles) + list(lstyles)
00202             
00203         for style in styles:
00204             parts = style.split('|',1)+['','']
00205             value = parts[1]
00206             content = parts[0]
00207             result.append({'value':value, 'content':content})
00208 
00209         return result

Here is the call graph for this function:

Definition at line 268 of file plonelibrarytool.py.

00268 
00269     def getStyleWhitelist(self):
00270         try:
00271             return self.style_whitelist
00272         except AttributeError:
00273             self.style_whitelist = _style_whitelist
00274             return self.style_whitelist

Return a list of classnames supported in tables

Definition at line 168 of file plonelibrarytool.py.

00168 
00169     def getTableClassnames(self):
00170         """Return a list of classnames supported in tables"""
00171         try:
00172             return self.table_classnames
00173         except AttributeError:
00174             return ('plain', 'listing', 'vertical listing', 'listing nosort|unsorted listing')

def kupu.plone.plonedrawers.PloneDrawers.getUploadImageClasses (   self,
  portal_type = None 
) [inherited]

Definition at line 900 of file plonedrawers.py.

00900 
00901     def getUploadImageClasses(self, portal_type=None):
00902         if portal_type is None:
00903             portal_type = self.getDefaultImageType()
00904         stored = self.getClassesForType(portal_type)
00905         classes = []
00906         for c in stored:
00907             c = c.strip()
00908             if not c:
00909                 continue
00910             if '|' in c:
00911                 title, classname = c.split('|', 1)
00912                 classes.append({'title': title, 'classname': classname})
00913             else:
00914                 classes.append({'title': c, 'classname': c})
00915         return classes
00916 

Here is the call graph for this function:

def kupu.plone.plonedrawers.PloneDrawers.getUploadImageSizes (   self,
  portal_type = None 
) [inherited]

Definition at line 884 of file plonedrawers.py.

00884 
00885     def getUploadImageSizes(self, portal_type=None):
00886         resource_type = self.getResourceType()
00887         portal = getToolByName(self, 'portal_url').getPortalObject()
00888         mediatypes = resource_type.get_portal_types()
00889         catalog = getToolByName(self, 'portal_catalog')
00890         adaptor = InfoAdaptor(self, resource_type, portal)
00891         if portal_type is None:
00892             portal_type = self.getDefaultImageType()
00893 
00894         brains = catalog.searchResults(portal_type=portal_type, limit=1)[:1]
00895         if brains:
00896             info = adaptor.get_image_sizes(brains[0], portal_type, '')
00897             return info
00898         return []

Here is the call graph for this function:

Find the appropriate template to use for the kupu widget

Definition at line 379 of file plonelibrarytool.py.

00379 
00380     def getWysiwygmacros(self):
00381         """Find the appropriate template to use for the kupu widget"""
00382         pm = getToolByName(self, 'portal_membership')
00383         user = pm.getAuthenticatedMember()
00384         editor = user.getProperty('wysiwyg_editor', '')
00385         if editor: editor = editor.lower()
00386         if editor=='fck editor':
00387             editor = 'editor_fck'
00388 
00389         portal = getToolByName(self, 'portal_url').getPortalObject()
00390         for path in ('%s_wysiwyg_support' % editor,
00391             '%s/wysiwyg_support' % editor,
00392             'portal_skins/plone_wysiwyg/wysiwyg_support'):
00393                 template = portal.restrictedTraverse(path, None)
00394                 if template:
00395                     break
00396 
00397         return template.macros

Here is the call graph for this function:

Definition at line 795 of file plonelibrarytool.py.

00795 
00796     def have_plone_filtering(self):
00797         return HAVE_PLONE_FILTERING

Here is the call graph for this function:

def kupu.plone.plonedrawers.PloneDrawers.infoForBrains (   self,
  values,
  resource_type,
  portal = None,
  linkids = None 
) [inherited]

Definition at line 751 of file plonedrawers.py.

00751 
00752     def infoForBrains(self, values, resource_type, portal=None, linkids=None):
00753         request = self.REQUEST
00754         response = request.RESPONSE
00755         response.setHeader('Cache-Control', 'no-cache')
00756         linktypes=resource_type.portal_types
00757         if portal is None:
00758             portal = getToolByName(self, 'portal_url').getPortalObject()
00759         
00760         adaptor = InfoAdaptor(self, resource_type, portal)
00761         
00762         # For Plone 2.0.5 compatability, if getId is callable we assume
00763         # we have an object rather than a brains.
00764         if values and callable(values[0].getId):
00765             info = adaptor.info_object
00766         else:
00767             info = adaptor.info
00768 
00769         res = []
00770 
00771         for obj in values:
00772             portal_type = getattr(obj, 'portal_type', '')
00773 
00774             if linkids is not None:
00775                 linkable = obj.id in linkids
00776             elif len(linktypes)==0:
00777                 linkable = True
00778             else:
00779                 linkable = portal_type in linktypes
00780 
00781             data = info(obj, linkable)
00782             if data:
00783                 res.append(data)
00784         return res

Here is the call graph for this function:

Here is the caller graph for this function:

def kupu.plone.plonedrawers.PloneDrawers.infoForQuery (   self,
  query,
  resource_type = None,
  portal = None 
) [inherited]

Definition at line 733 of file plonedrawers.py.

00733 
00734     def infoForQuery(self, query, resource_type=None, portal=None):
00735         resource_type = self.getResourceType()
00736         if portal is None:
00737             portal = getToolByName(self, 'portal_url').getPortalObject()
00738         
00739         baseQuery = resource_type.getQuery()
00740         query.update(baseQuery)
00741         limit = query.get('limit', None)
00742         pt = query['portal_type']
00743         if not pt:
00744             del query['portal_type']
00745         catalog = getToolByName(portal, 'portal_catalog')
00746         values = catalog.searchResults(query)
00747         if limit:
00748             values = values[:limit]
00749         return self.infoForBrains(values, resource_type, portal)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 288 of file plonelibrarytool.py.

00288 
00289     def installBeforeUnload(self):
00290         return getattr(self, 'install_beforeunload', False)

def kupu.plone.plonelibrarytool.PloneKupuLibraryTool.isKupuEnabled (   self,
  useragent = '',
  allowAnonymous = False,
  REQUEST = None,
  context = None,
  fieldName = None 
)

Definition at line 300 of file plonelibrarytool.py.

00300 
00301     def isKupuEnabled(self, useragent='', allowAnonymous=False, REQUEST=None, context=None, fieldName=None):
00302         if not REQUEST:
00303             REQUEST = self.REQUEST
00304         def numerics(s):
00305             '''Convert a string into a tuple of all digit sequences
00306             '''
00307             seq = ['']
00308             for c in s:
00309                 if c.isdigit():
00310                     seq[-1] = seq[-1] + c
00311                 elif seq[-1]:
00312                     seq.append('')
00313             return tuple([ int(val) for val in seq if val])
00314 
00315         # First check whether the user actually wants kupu
00316         pm = getToolByName(self, 'portal_membership')
00317         if pm.isAnonymousUser() and not allowAnonymous:
00318             return False
00319 
00320         user = pm.getAuthenticatedMember()
00321         if not pm.isAnonymousUser():
00322             editor = user.getProperty('wysiwyg_editor')
00323             if editor and editor.lower() != 'kupu':
00324                 return False
00325 
00326         # Then check whether the current content allows html
00327         if context is not None and fieldName and hasattr(context, 'getWrappedField'):
00328             field = context.getWrappedField(fieldName)
00329             if field:
00330                 allowedTypes = getattr(field, 'allowable_content_types', None)
00331                 if allowedTypes is not None and not 'text/html' in [t.lower() for t in allowedTypes]:
00332                     return False
00333 
00334         # Then check whether their browser supports it.
00335         if not useragent:
00336             useragent = REQUEST['HTTP_USER_AGENT']
00337 
00338         if 'BEOS' in useragent:
00339             return False
00340 
00341         def getver(s):
00342             """Extract a version number given the string which precedes it"""
00343             pos = useragent.find(s)
00344             if pos >= 0:
00345                 tail = useragent[pos+len(s):].strip()
00346                 verno = numerics(tail.split(' ')[0])
00347                 return verno
00348             return None
00349             
00350         try:
00351             v = getver('Opera/')
00352             if not v:
00353                 v = getver('Opera ')
00354             if v:
00355                 return v >= (9,0)
00356 
00357             mozillaver = getver('Mozilla/')
00358             if mozillaver > (5,0):
00359                 return True
00360             elif mozillaver == (5,0):
00361                 verno = getver(' rv:')
00362                 if verno:
00363                     return verno >= (1,3,1)
00364                 verno = getver(' AppleWebKit/')
00365                 if verno:
00366                     return verno >= (525,1)
00367                     verno = getver(' Safari/')
00368                     if verno:
00369                         return verno >= (522,12)
00370 
00371             verno = getver('MSIE')
00372             if verno:
00373                 return verno >= (5,5)
00374         except:
00375             # In case some weird browser makes the test code blow up.
00376             pass
00377         return False

Here is the call graph for this function:

def kupu.plone.plonedrawers.PloneDrawers.isUploadSupported (   self,
  context 
) [inherited]
Returns True if we can upload the the current folder.

Definition at line 852 of file plonedrawers.py.

00852 
00853     def isUploadSupported(self, context):
00854         """Returns True if we can upload the the current folder."""
00855         resource_type = self.getResourceType()
00856         if resource_type.name != 'mediaobject':
00857             return False
00858 
00859         allowedContent = context.getAllowedTypes()
00860         allowed = dict.fromkeys([a.getId() for a in allowedContent])
00861         for t in resource_type.portal_types:
00862             if t in allowed:
00863                 return True
00864         return False

Here is the call graph for this function:

Definition at line 720 of file plonedrawers.py.

00720 
00721     def kupuSearch(self):
00722         request = self.REQUEST
00723         search_params = {}
00724         search_params.update(request.form)
00725 
00726         # Get the maximum number of results with 500 being the default and
00727         # absolute maximum.
00728         abs_max = 500
00729         search_params['limit'] = min(request.get('max_results', abs_max), abs_max)
00730 
00731         return self.infoForQuery(search_params)

Here is the call graph for this function:

def kupu.plone.plonelibrarytool.PloneKupuLibraryTool.kupuUrl (   self,
  url,
  query = None 
)
Generate a url which includes resource_type and instance

Definition at line 457 of file plonelibrarytool.py.

00457 
00458     def kupuUrl(self, url, query=None):
00459         """Generate a url which includes resource_type and instance"""
00460         request = self.REQUEST
00461         resource_type = request.get('resource_type', 'mediaobject')
00462         instance = request.get('instance', None)
00463         newquery = { 'instance':instance, 'resource_type':resource_type }
00464         if query is not None:
00465             newquery.update(query)
00466         return self.url_plus_query(url, newquery)
        

Here is the call graph for this function:

Here is the caller graph for this function:

Do link checking or conversion, a little bit at a time

Definition at line 518 of file plonelibrarytool.py.

00518 
00519     def link_migration(self, action=None):
00520         """Do link checking or conversion, a little bit at a time"""
00521         if action is None:
00522             action = self.REQUEST.form.get('button', '')
00523 
00524         commit = self.REQUEST.form.get('commit', False)
00525         migrator = html2captioned.Migration(self)
00526         if action=='continue':
00527             migrator.restoreState()
00528             res = migrator.docontinue()
00529             return migrator.getInfo()
00530         elif action=='status':
00531             try:
00532                 migrator.restoreState()
00533             except KeyError:
00534                 return "state cleared"
00535             return migrator.status()
00536         elif action=='query':
00537             migrator.initFromRequest()
00538             return migrator.mkQuery()
00539         elif commit:
00540             migrator.initCommit()
00541             return migrator.getInfo()
00542         else:
00543             migrator.initFromRequest()
00544             return migrator.getInfo()

def kupu.plone.plonelibrarytool.PloneKupuLibraryTool.manage_afterAdd (   self,
  item,
  container 
)

Definition at line 129 of file plonelibrarytool.py.

00129 
00130     def manage_afterAdd(self, item, container):
00131         # We load default values here, so __init__ can still be used
00132         # in unit tests. Plus, it only makes sense to load these if
00133         # we're being added to a Plone site anyway
00134         if not len(self._libraries):
00135             for lib in _default_libraries:
00136                 self.addLibrary(**lib)
00137             self._res_types.update(_default_resource_types)

Here is the call graph for this function:

def kupu.plone.plonelibrarytool.PloneKupuLibraryTool.query_string (   self,
  replace = {},
  original = None 
)
Updates 'original' dictionary by the values in the 'replace'
    dictionary and returns the result as url quoted query string.

    The 'original' dictionary defaults to 'REQUEST.form' if no
    parameter is passed to it. Keys in the 'replace' dictionary
    with a value of 'None' (or _.None in DTML) will be deleted
    from 'original' dictionary before being quoted.

    The original 'REQUEST.form' will remain unchanged.

Definition at line 408 of file plonelibrarytool.py.

00408 
00409     def query_string(self, replace={}, original=None):
00410         """ Updates 'original' dictionary by the values in the 'replace'
00411             dictionary and returns the result as url quoted query string.
00412 
00413             The 'original' dictionary defaults to 'REQUEST.form' if no
00414             parameter is passed to it. Keys in the 'replace' dictionary
00415             with a value of 'None' (or _.None in DTML) will be deleted
00416             from 'original' dictionary before being quoted.
00417 
00418             The original 'REQUEST.form' will remain unchanged.
00419         """
00420         # Based on code by Grégoire Weber
00421         if original is None:
00422             query = self.REQUEST.form.copy()
00423         else:
00424             query = original.copy()
00425 
00426         # delete key/value pairs if value is None
00427         for k,v in replace.items():
00428             if v is None:
00429                 if query.has_key(k):
00430                     del query[k]
00431                 del replace[k]
00432 
00433         # update dictionary
00434         query.update(replace)
00435         qs = '&'.join(["%s=%s" % (quote_plus(str(k)), quote_plus(str(v)))
00436             for k,v in query.items()])
00437 
00438         return qs

Here is the caller graph for this function:

Finds the relevant source files and the doller/Id/dollar strings they contain

Definition at line 500 of file plonelibrarytool.py.

00500 
00501     def scanIds(self):
00502         """Finds the relevant source files and the doller/Id/dollar strings they contain"""
00503         return scanner.scanIds()

Check that kupu_wysiwyg_support is up to date

Definition at line 505 of file plonelibrarytool.py.

00505 
00506     def scanKWS(self):
00507         """Check that kupu_wysiwyg_support is up to date"""
00508         return scanner.scanKWS()

Set the html_exclusions.
Expects a list/tuple of 2-tuples [(tags,attrs),...]

Definition at line 736 of file plonelibrarytool.py.

00736 
00737     def set_html_exclusions(self, exclusions):
00738         """Set the html_exclusions.
00739         Expects a list/tuple of 2-tuples [(tags,attrs),...]
00740         """
00741         excl = []
00742         for (tags,attrs) in exclusions:
00743             if len(tags)==1 and tags[0]=="":
00744                 tags = []
00745             if len(attrs)==1 and attrs[0]=="":
00746                 attrs = []
00747             excl.append((tags, attrs))
00748         self.html_exclusions = excl

Here is the caller graph for this function:

Sets a list of attributes to be stripped

Definition at line 775 of file plonelibrarytool.py.

00775 
00776     def set_stripped_attributes(self, stripped):
00777         """Sets a list of attributes to be stripped"""
00778         exclusions = [(tags, attrs) for (tags, attrs) in self.html_exclusions if tags]
00779         exclusions.append(((), tuple(stripped)))
00780         self.set_html_exclusions(exclusions)

Here is the call graph for this function:

Sets a list of tag/attribute pairs to be stripped

Definition at line 788 of file plonelibrarytool.py.

00788 
00789     def set_stripped_combinations(self, stripped):
00790         """Sets a list of tag/attribute pairs to be stripped"""
00791         exclusions = [(tags, attrs) for (tags, attrs) in self.getHtmlExclusions() if not (tags and attrs)]
00792         self.set_html_exclusions(stripped + exclusions)
00793 

Here is the call graph for this function:

Sets a list of tags to be stripped

Definition at line 759 of file plonelibrarytool.py.

00759 
00760     def set_stripped_tags(self, stripped):
00761         """Sets a list of tags to be stripped"""
00762         exclusions = [(tags, attrs) for (tags, attrs) in self.getHtmlExclusions() if attrs]
00763         exclusions.append((tuple(stripped), ()))
00764         self.set_html_exclusions(exclusions)

Here is the call graph for this function:

def kupu.plone.plonelibrarytool.PloneKupuLibraryTool.set_toolbar_filters (   self,
  filters,
  globalfilter,
  REQUEST = None 
)
Set the toolbar filtering
filter is a list of records with: id, checked, expression

Definition at line 229 of file plonelibrarytool.py.

00229 
00230     def set_toolbar_filters(self, filters, globalfilter, REQUEST=None):
00231         """Set the toolbar filtering
00232         filter is a list of records with: id, checked, expression"""
00233         DEFAULTS = helpers.FILTERDICT
00234         def nonstandard(f):
00235             expr = f['override']
00236             id = f['id']
00237             visible = bool(f.get('visible', False))
00238             return expr != '' or visible != DEFAULTS.get(id, False)
00239             
00240         cleaned = [ f for f in filters if nonstandard(f) ]
00241         self._setToolbarFilters(cleaned, globalfilter)
00242         if REQUEST:
00243             REQUEST.RESPONSE.redirect(self.absolute_url() + '/zmi_toolbar')

Here is the call graph for this function:

Definition at line 284 of file plonelibrarytool.py.

00284 
00285     def setDefaultResource(self, resource_type):
00286         self.default_resource = resource_type

Returns a list of document/fields which have support for captioning

Definition at line 821 of file plonedrawers.py.

00821 
00822     def supportedCaptioning(self):
00823         """Returns a list of document/fields which have support for captioning"""
00824         supported = [t+'/'+self.getLabelFromWidget(f.widget) for (t,f,pt) in self._getKupuFields() if self.canCaption(f) ]
00825         return str.join(', ', supported)

Here is the call graph for this function:

Test whether the output transform is enabled for x-html-safe

Definition at line 833 of file plonedrawers.py.

00833 
00834     def transformIsEnabled(self):
00835         """Test whether the output transform is enabled for x-html-safe"""
00836         uid_catalog = getToolByName(self, 'uid_catalog', None)
00837         portal_transforms = getToolByName(self, 'portal_transforms', None)
00838         if not uid_catalog or not portal_transforms:
00839             return False
00840         # Find something, anything which has a UID
00841         content = uid_catalog.searchResults(sort_on='', sort_limit=1)
00842         if not content:
00843             return False
00844         uid = content[0].UID # Get an arbitrary used UID.
00845         link = 'resolveuid/%s' % uid
00846         test = '<a href="%s"></a>' % link
00847         txfrm = portal_transforms.convertTo('text/x-html-safe', test, mimetype='text/html', context=self)
00848         if hasattr(txfrm, 'getData'):
00849             txfrm = txfrm.getData()
00850         return txfrm and not link in txfrm

Here is the call graph for this function:

Returns a list of document/fields which do not have support for captioning

Definition at line 827 of file plonedrawers.py.

00827 
00828     def unsupportedCaptioning(self):
00829         """Returns a list of document/fields which do not have support for captioning"""
00830         unsupp = [t+'/'+self.getLabelFromWidget(f.widget) for (t,f,pt) in self._getKupuFields() if not self.canCaption(f) ]
00831         return str.join(', ', unsupp)

Here is the call graph for this function:

def kupu.plone.plonelibrarytool.PloneKupuLibraryTool.url_plus_query (   self,
  url,
  query = None 
)
Adds query segment to an existing URL.
Existing query parameters are may be overridden by query,
otherwise they are preserved.

Definition at line 440 of file plonelibrarytool.py.

00440 
00441     def url_plus_query(self, url, query=None):
00442         """Adds query segment to an existing URL.
00443         Existing query parameters are may be overridden by query,
00444         otherwise they are preserved.
00445         """
00446         if query is None:
00447             query = {}
00448         parts = url.split('?', 1)
00449         oldargs = {}
00450         if len(parts) > 1:
00451             for arg in parts[1].split('&'):
00452                 k,v = [unquote_plus(s) for s in arg.split('=',1)]
00453                 oldargs[k] = v
00454 
00455         return "%s?%s" % (parts[0], self.query_string(query, oldargs))

Here is the call graph for this function:

Here is the caller graph for this function:

def kupu.plone.plonelibrarytool.PloneKupuLibraryTool.zmi_add_library (   self,
  id,
  title,
  uri,
  src,
  icon,
  REQUEST 
)
Add a library through the ZMI

Definition at line 581 of file plonelibrarytool.py.

00581 
00582     def zmi_add_library(self, id, title, uri, src, icon, REQUEST):
00583         """Add a library through the ZMI"""
00584         self.addLibrary(id, title, uri, src, icon)
00585         REQUEST.RESPONSE.redirect(self.absolute_url() + '/zmi_libraries')

Here is the call graph for this function:

Delete libraries through the ZMI

Definition at line 595 of file plonelibrarytool.py.

00595 
00596     def zmi_delete_libraries(self, indices, REQUEST):
00597         """Delete libraries through the ZMI"""
00598         self.deleteLibraries(indices)
00599         REQUEST.RESPONSE.redirect(self.absolute_url() + '/zmi_libraries')

Here is the call graph for this function:

def kupu.plone.plonelibrarytool.PloneKupuLibraryTool.zmi_delete_resource_types (   self,
  resource_types = None,
  preview_types = None,
  REQUEST = None 
)
Delete resource types through the ZMI

Definition at line 685 of file plonelibrarytool.py.

00685 
00686     def zmi_delete_resource_types(self, resource_types=None, preview_types=None, REQUEST=None):
00687         """Delete resource types through the ZMI"""
00688         if resource_types:
00689             self.deleteResourceTypes(resource_types)
00690         if preview_types:
00691             self.deletePreviewActions(preview_types)
00692         if (REQUEST):
00693             REQUEST.RESPONSE.redirect(self.absolute_url() + '/zmi_resource_types')

Here is the call graph for this function:

Return the default selected library for the ZMI view

Definition at line 615 of file plonelibrarytool.py.

00615 
00616     def zmi_get_default_library(self):
00617         """Return the default selected library for the ZMI view"""
00618         return getattr(self, '_default_library', '')

Return the libraries sequence for the ZMI view

Definition at line 571 of file plonelibrarytool.py.

00571 
00572     def zmi_get_libraries(self):
00573         """Return the libraries sequence for the ZMI view"""
00574         #return ()
00575         def text(value):
00576             return getattr(value, 'text', value)
00577         return [dict([(key, text(value)) for key, value in lib.items()])
00578                 for lib in self._libraries]

Here is the call graph for this function:

Return the type mapping for the ZMI view

Definition at line 660 of file plonelibrarytool.py.

00660 
00661     def zmi_get_resourcetypes(self):
00662         """Return the type mapping for the ZMI view"""
00663         real = self.get_resourcetypes()
00664         real.append(Object(name='', types=()))
00665         return real

Here is the call graph for this function:

Here is the caller graph for this function:

Return the type mapping for the ZMI view:
   Old version of code. Returns name,types pairs plus a dummy

Definition at line 626 of file plonelibrarytool.py.

00626 
00627     def zmi_get_type_mapping(self):
00628         """Return the type mapping for the ZMI view:
00629            Old version of code. Returns name,types pairs plus a dummy"""
00630         return [(t.name, t.types) for t in self.zmi_get_resourcetypes()] + [('',())]

Here is the call graph for this function:

def kupu.plone.plonelibrarytool.PloneKupuLibraryTool.zmi_move_down (   self,
  indices,
  REQUEST 
)
Move libraries down through the ZMI

Definition at line 609 of file plonelibrarytool.py.

00609 
00610     def zmi_move_down(self, indices, REQUEST):
00611         """Move libraries down through the ZMI"""
00612         self.moveDown(indices)
00613         REQUEST.RESPONSE.redirect(self.absolute_url() + '/zmi_libraries')

Here is the call graph for this function:

def kupu.plone.plonelibrarytool.PloneKupuLibraryTool.zmi_move_up (   self,
  indices,
  REQUEST 
)
Move libraries up through the ZMI

Definition at line 602 of file plonelibrarytool.py.

00602 
00603     def zmi_move_up(self, indices, REQUEST):
00604         """Move libraries up through the ZMI"""
00605         self.moveUp(indices)
00606         REQUEST.RESPONSE.redirect(self.absolute_url() + '/zmi_libraries')

Here is the call graph for this function:

Return the libraries sequence for the ZMI view

Definition at line 621 of file plonelibrarytool.py.

00621 
00622     def zmi_set_default_library(self, defid=''):
00623         """Return the libraries sequence for the ZMI view"""
00624         self._default_library = defid

def kupu.plone.plonelibrarytool.PloneKupuLibraryTool.zmi_update_libraries (   self,
  libraries,
  REQUEST 
)
Update libraries through the ZMI

Definition at line 588 of file plonelibrarytool.py.

00588 
00589     def zmi_update_libraries(self, libraries, REQUEST):
00590         """Update libraries through the ZMI"""
00591         self.updateLibraries(libraries)
00592         REQUEST.RESPONSE.redirect(self.absolute_url() + '/zmi_libraries')

Here is the call graph for this function:

def kupu.plone.plonelibrarytool.PloneKupuLibraryTool.zmi_update_resource_types (   self,
  type_info = None,
  preview_action = None,
  default_resource = None,
  REQUEST = None 
)
Update resource types through the ZMI

Definition at line 668 of file plonelibrarytool.py.

00668 
00669     def zmi_update_resource_types(self, type_info=None, preview_action=None, default_resource=None, REQUEST=None):
00670         """Update resource types through the ZMI"""
00671 
00672         if type_info:
00673             self.updateResourceTypes(type_info)
00674 
00675         if preview_action:
00676             self.updatePreviewActions(preview_action)
00677 
00678         if default_resource is not None:
00679             self.default_resource = default_resource
00680 
00681         if REQUEST:
00682             REQUEST.RESPONSE.redirect(self.absolute_url() + '/zmi_resource_types')

Here is the call graph for this function:


Member Data Documentation

Definition at line 623 of file plonelibrarytool.py.

Definition at line 125 of file plonelibrarytool.py.

Definition at line 126 of file plonelibrarytool.py.

Definition at line 821 of file plonelibrarytool.py.

Definition at line 857 of file plonelibrarytool.py.

Definition at line 842 of file plonelibrarytool.py.

Definition at line 285 of file plonelibrarytool.py.

Definition at line 819 of file plonelibrarytool.py.

Definition at line 256 of file plonelibrarytool.py.

Definition at line 109 of file plonelibrarytool.py.

Definition at line 817 of file plonelibrarytool.py.

tuple kupu.plone.plonelibrarytool.PloneKupuLibraryTool.kupu_config = PageTemplateFile("kupu_config.pt", globals()) [static]

Definition at line 558 of file plonelibrarytool.py.

Definition at line 127 of file plonelibrarytool.py.

Initial value:
(SimpleItem.manage_options[1:] + (
         dict(label='Config', action='kupu_config'),
         dict(label='Libraries', action='zmi_libraries'),
         dict(label='Resource types', action='zmi_resource_types'),
         dict(label='Documentation', action='zmi_docs'),
         ))

Definition at line 491 of file plonelibrarytool.py.

string kupu.plone.plonelibrarytool.PloneKupuLibraryTool.meta_type = "Kupu Library Tool" [static]

Definition at line 110 of file plonelibrarytool.py.

Definition at line 824 of file plonelibrarytool.py.

tuple kupu.plone.plonelibrarytool.PloneKupuLibraryTool.security = ClassSecurityInfo() [static]

Reimplemented from kupu.plone.plonedrawers.PloneDrawers.

Definition at line 112 of file plonelibrarytool.py.

Definition at line 272 of file plonelibrarytool.py.

Definition at line 815 of file plonelibrarytool.py.

Definition at line 111 of file plonelibrarytool.py.

tuple kupu.plone.plonelibrarytool.PloneKupuLibraryTool.zmi_docs = PageTemplateFile("zmi_docs.pt", globals()) [static]

Definition at line 554 of file plonelibrarytool.py.

tuple kupu.plone.plonelibrarytool.PloneKupuLibraryTool.zmi_libraries = PageTemplateFile("libraries.pt", globals()) [static]

Definition at line 562 of file plonelibrarytool.py.

tuple kupu.plone.plonelibrarytool.PloneKupuLibraryTool.zmi_links = PageTemplateFile("zmi_links.pt", globals()) [static]

Definition at line 546 of file plonelibrarytool.py.

tuple kupu.plone.plonelibrarytool.PloneKupuLibraryTool.zmi_resource_types = PageTemplateFile("resource_types.pt", globals()) [static]

Definition at line 566 of file plonelibrarytool.py.

tuple kupu.plone.plonelibrarytool.PloneKupuLibraryTool.zmi_toolbar = PageTemplateFile("zmi_toolbar.pt", globals()) [static]

Definition at line 550 of file plonelibrarytool.py.


The documentation for this class was generated from the following file: