当前位置: 首页>>代码示例>>Python>>正文


Python _content.IFolderish类代码示例

本文整理汇总了Python中Products.CMFCore.interfaces._content.IFolderish的典型用法代码示例。如果您正苦于以下问题:Python IFolderish类的具体用法?Python IFolderish怎么用?Python IFolderish使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了IFolderish类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __call__

    def __call__(self, **kwargs):
        settings = self.parseRegistry()
        config = {}
        config = self.mapFormatCategories(settings, config)
        config = self.mapFormats(settings, config)
        config = self.mapTinyMCEActionCategories(settings, config)
        config = self.mapTinyMCEToolbarFormats(settings, config)
        config = self.mapTinyMCEContextMenuFormats(settings, config)
        config = self.mapActions(settings, config)
        config = self.mapTilesCategories(settings, config)
        for tile_category in ["structure_tiles", "app_tiles"]:
            config = self.mapTiles(settings, config, tile_category)
        config = self.mapFieldTiles(settings, config, kwargs)

        args = {"type": None, "context": None, "request": None}
        args.update(kwargs)
        if IFolderish.providedBy(args["context"]):
            config["parent"] = args["context"].absolute_url() + "/"
        elif args["context"]:
            config["parent"] = getattr(args["context"].aq_inner, "aq_parent", None).absolute_url() + "/"
        else:
            # context can be None, at least in tests.  Do nothing
            # then.  See test_config in test_mosaicregistry.py
            pass

        return config
开发者ID:plonejp,项目名称:plone.app.mosaic,代码行数:26,代码来源:registry.py

示例2: __call__

    def __call__(self, **kwargs):
        settings = self.parseRegistry()
        config = {}
        config = self.mapFormatCategories(settings, config)
        config = self.mapFormats(settings, config)
        config = self.mapActions(settings, config)
        config = self.mapTilesCategories(settings, config)
        for tile_category in ['structure_tiles', 'app_tiles']:
            config = self.mapTiles(settings, config, tile_category)
        config = self.mapFieldTiles(settings, config, kwargs)

        args = {
            'type': None,
            'context': None,
            'request': None,
        }
        args.update(kwargs)
        if IFolderish.providedBy(args['context']):
            config['parent'] = args['context'].absolute_url() + "/"
        elif args['context']:
            config['parent'] = getattr(args['context'].aq_inner, 'aq_parent',
                                       None).absolute_url() + "/"
        else:
            # context can be None, at least in tests.  Do nothing
            # then.  See test_config in test_mosaicregistry.py
            pass

        return config
开发者ID:ispires,项目名称:plone.app.mosaic,代码行数:28,代码来源:registry.py

示例3: getBreadcrumbs

    def getBreadcrumbs(self, path=None):
        """Get breadcrumbs"""
        result = []

        root_url = getNavigationRoot(self.context)
        root = aq_inner(self.context.restrictedTraverse(root_url))
        root_url = root.absolute_url()

        if path is not None:
            root_abs_url = root.absolute_url()
            path = path.replace(root_abs_url, '', 1)
            path = path.strip('/')
            root = aq_inner(root.restrictedTraverse(path))

        relative = aq_inner(self.context).getPhysicalPath()[len(root.getPhysicalPath()):]
        if path is None:
            # Add siteroot
            result.append({'title': root.title_or_id(), 'url': '/'.join(root.getPhysicalPath())})

        for i in range(len(relative)):
            now = relative[:i + 1]
            obj = aq_inner(root.restrictedTraverse(now))

            if IFolderish.providedBy(obj):
                if not now[-1] == 'talkback':
                    result.append({'title': obj.title_or_id(), 'url': root_url + '/' + '/'.join(now)})
        return result
开发者ID:simplesconsultoria,项目名称:sc.tinymce.mediaembed,代码行数:27,代码来源:browser.py

示例4: tinymce

    def tinymce(self):
        """
        data-pat-tinymce : JSON.stringify({
            relatedItems: {
              vocabularyUrl: config.portal_url +
                '/@@getVocabulary?name=plone.app.vocabularies.Catalog'
            },
            tiny: config,
            prependToUrl: 'resolveuid/',
            linkAttribute: 'UID',
            prependToScalePart: '/@@images/image/'
          })
        """

        generator = TinyMCESettingsGenerator(self.context, self.request)
        settings = generator.settings

        folder = aq_inner(self.context)
        # Test if we are currently creating an Archetype object
        if IFactoryTempFolder.providedBy(aq_parent(folder)):
            folder = aq_parent(aq_parent(aq_parent(folder)))
        if not IFolderish.providedBy(folder):
            folder = aq_parent(folder)

        if IPloneSiteRoot.providedBy(folder):
            initial = None
        else:
            initial = IUUID(folder, None)
        current_path = folder.absolute_url()[len(generator.portal_url):]

        image_types = settings.image_objects or []
        folder_types = settings.contains_objects or []
        configuration = {
            'relatedItems': {
                'vocabularyUrl':
                    '%s/@@getVocabulary?name=plone.app.vocabularies.Catalog' % (
                        generator.portal_url),
                'folderTypes': folder_types
            },
            'upload': {
                'initialFolder': initial,
                'currentPath': current_path,
                'baseUrl': generator.portal_url,
                'relativePath': '@@fileUpload',
                'uploadMultiple': False,
                'maxFiles': 1,
                'showTitle': False
            },
            'base_url': self.context.absolute_url(),
            'tiny': generator.get_tiny_config(),
            # This is for loading the languages on tinymce
            'loadingBaseUrl': '%s/++plone++static/components/tinymce-builded/js/tinymce' % generator.portal_url,  # noqa
            'prependToUrl': '{0}/resolveuid/'.format(generator.portal_url),
            'linkAttribute': 'UID',
            'prependToScalePart': '/@@images/image/',
            'imageTypes': image_types
            # 'anchorSelector': utility.anchor_selector,
        }

        return {'data-pat-tinymce': json.dumps(configuration)}
开发者ID:ramiroluz,项目名称:Products.CMFPlone,代码行数:60,代码来源:__init__.py

示例5: getListing

    def getListing(self, filter_portal_types, rooted, document_base_url, upload_type=None):
        """Returns the actual listing"""

        catalog_results = []
        results = {}

        object = aq_inner(self.context)
        portal_catalog = getToolByName(object, 'portal_catalog')
        normalizer = getUtility(IIDNormalizer)

        # check if object is a folderish object, if not, get it's parent.
        if not IFolderish.providedBy(object):
            object = object.getParentNode()

        if INavigationRoot.providedBy(object) or (rooted == "True" and document_base_url[:-1] == object.absolute_url()):
            results['parent_url'] = ''
        else:
            results['parent_url'] = object.getParentNode().absolute_url()

        if rooted == "True":
            results['path'] = self.getBreadcrumbs(results['parent_url'])
        else:
            # get all items from siteroot to context (title and url)
            results['path'] = self.getBreadcrumbs()

        # get all portal types and get information from brains
        path = '/'.join(object.getPhysicalPath())
        for brain in portal_catalog(portal_type=filter_portal_types, sort_on='getObjPositionInParent', path={'query': path, 'depth': 1}):
            if brain.is_folderish:
                icon = self.folder_icon
            else:
                icon = self.picture_icon

            catalog_results.append({
                'id': brain.getId,
                'uid': brain.UID or None,  # Maybe Missing.Value
                'url': brain.getURL(),
                'portal_type': brain.portal_type,
                'normalized_type': normalizer.normalize(brain.portal_type),
                'title': brain.Title == "" and brain.id or brain.Title,
                'icon': icon,
                'description': brain.Description,
                'is_folderish': brain.is_folderish,
                })

        # add catalog_ressults
        results['items'] = catalog_results

        # decide whether to show the upload new button
        results['upload_allowed'] = False
        if upload_type:
            portal_types = getToolByName(object, 'portal_types')
            fti = getattr(portal_types, upload_type, None)
            if fti is not None:
                results['upload_allowed'] = fti.isConstructionAllowed(object)

        # return results in JSON format
        self.context.REQUEST.response.setHeader("Content-type", "application/json")
        return json.dumps(results)
开发者ID:vincent-psarga,项目名称:Products.TinyMCE,代码行数:59,代码来源:JSONFolderListing.py

示例6: __call__

    def __call__(self):
        """
        data-pat-tinymce : JSON.stringify({
            relatedItems: {
              vocabularyUrl: config.portal_url + '/@@getVocabulary?name=plone.app.vocabularies.Catalog'
            },
            rel_upload_path: '@@fileUpload',
            folder_url: config.document_base_url,
            tiny: config,
            prependToUrl: 'resolveuid/',
            linkAttribute: 'UID',
            prependToScalePart: '/@@images/image/'
          })
        """

        folder = self.context
        if not IFolderish.providedBy(self.context):
            folder = aq_parent(self.context)
        if IPloneSiteRoot.providedBy(folder):
            initial = None
        else:
            initial = IUUID(folder, None)
        current_path = folder.absolute_url()[len(self.config['portal_url']):]
        configuration = {
            'relatedItems': format_pattern_settings(
                self.settings.relatedItems,
                self.config),
            'upload': {
                'initialFolder': initial,
                'currentPath': current_path,
                'baseUrl': self.config['document_base_url'],
                'relativePath': format_pattern_settings(
                    self.settings.rel_upload_path,
                    self.config),
                'uploadMultiple': False,
                'maxFiles': 1,
                'showTitle': False
            },
            'base_url': self.config['document_base_url'],
            'tiny': {
                'content_css': self.settings.content_css,
            },
            # This is for loading the languages on tinymce
            'loadingBaseUrl': '++plone++static/components/tinymce-builded/js/tinymce',
            'prependToUrl': 'resolveuid/',
            'linkAttribute': format_pattern_settings(
                self.settings.linkAttribute,
                self.config),
            'prependToScalePart': format_pattern_settings(
                self.settings.prependToScalePart,
                self.config),
            # XXX need to get this from somewhere...
            'folderTypes': ','.join(['Folder']),
            'imageTypes': ','.join(['Image']),
            #'anchorSelector': utility.anchor_selector,
            #'linkableTypes': utility.linkable.replace('\n', ',')
        }

        return {'data-pat-tinymce': json.dumps(configuration)}
开发者ID:jcerjak,项目名称:Products.CMFPlone,代码行数:59,代码来源:tinymce.py

示例7: get_tinymce_options

def get_tinymce_options(context, field, request):
    args = {'pattern_options': {}}
    folder = context
    if not IFolderish.providedBy(context):
        folder = aq_parent(context)
    if IPloneSiteRoot.providedBy(folder):
        initial = None
    else:
        initial = IUUID(folder, None)
    portal_url = get_portal_url(context)
    current_path = folder.absolute_url()[len(portal_url):]

    utility = getToolByName(aq_inner(context), 'portal_tinymce', None)
    if utility:
        # Plone 4.3
        config = utility.getConfiguration(context=context,
                                          field=field,
                                          request=request)

        config['content_css'] = config['portal_url'] + '/base.css'
        del config['customplugins']
        del config['plugins']
        del config['theme']

        config['content_css'] = '++resource++plone.app.widgets-tinymce-content.css'
        args['pattern_options'] = {
            'relatedItems': {
                'vocabularyUrl': config['portal_url'] +
                '/@@getVocabulary?name=plone.app.vocabularies.Catalog'
            },
            'upload': {
                'initialFolder': initial,
                'currentPath': current_path,
                'baseUrl': config['document_base_url'],
                'relativePath': '@@fileUpload',
                'uploadMultiple': False,
                'maxFiles': 1,
                'showTitle': False
            },
            'tiny': config,
            # This is for loading the languages on tinymce
            'loadingBaseUrl': '++plone++static/components/tinymce-builded/js/tinymce',
            'prependToUrl': 'resolveuid/',
            'linkAttribute': 'UID',
            'prependToScalePart': '/@@images/image',
            'folderTypes': utility.containsobjects.replace('\n', ','),
            'imageTypes': utility.imageobjects.replace('\n', ','),
            'anchorSelector': utility.anchor_selector,
            'linkableTypes': utility.linkable.replace('\n', ',')
        }
    else:
        # Plone 5
        # They are setted on the body
        pattern_options = getMultiAdapter(
            (context, request, field),
            name="tinymce_settings")()['data-pat-tinymce']
        args['pattern_options'] = json.loads(pattern_options)
    return args
开发者ID:fctm,项目名称:ctm-buildout,代码行数:58,代码来源:__init__.py

示例8: update

    def update(self):
        portal_state = getView(self.context, self.request, "plone_portal_state")
        self.portal_url = portal_state.portal_url()

        # Create <base href=""> directive of <head>
        if IFolderish.providedBy(self.context):
            # Folderish URLs must end to slash
            self.base = self.context.absolute_url() + "/"
        else:
            self.base = self.context.absolute_url()
开发者ID:plone-gomobile,项目名称:gomobiletheme.basic,代码行数:10,代码来源:viewlets.py

示例9: remove

    def remove(self):
        super(AjaxFavoriteActions, self).remove()

        if IFolderish.providedBy(self.context):
            msg = _("The folder has been removed from your favorites")
        else:
            msg = _("The document has been removed from your favorites")

        return {'status': 'favorite-off',
                'msg': translate(msg, context=self.request)}
开发者ID:Conectivo,项目名称:collective.favorites,代码行数:10,代码来源:actions.py

示例10: __init__

    def __init__(self, context, request, **kwargs):
        """ Contructor """
        self.context = context
        self.request = request
        util = api.content.get_view(u'plone', self.context, self.request)
        self.getIcon = util.getIcon

        # check if object is a folderish object, if not, get it's parent.
        if not IFolderish.providedBy(self.context):
            self.obj = aq_parent(self.context)
        else:
            self.obj = aq_inner(self.context)
开发者ID:barseghyanartur,项目名称:collective.cover,代码行数:12,代码来源:contentchooser.py

示例11: add

    def add(self):
        request = self.request
        view = request.get('view', '')
        super(FavoriteActions, self).add()

        statusmsg = IStatusMessage(request)
        if IFolderish.providedBy(self.context):
            statusmsg.add(_("The folder has been added to your favorites"))
        else:
            statusmsg.add(_("The document has been added to your favorites"))

        request.response.redirect(self.context.absolute_url() + '/' + view)
开发者ID:Conectivo,项目名称:collective.favorites,代码行数:12,代码来源:actions.py

示例12: get_navigation

    def get_navigation(self):
        directory = self.request.get('dir', './')
        base_query = json.loads(self.request.get('query', '{}'),
                           object_hook=_decode_dict)
        pprops = getToolByName(self.context, 'portal_properties')
        site_props = pprops.site_properties
        folder_types = site_props.getProperty(
            'typesLinkToFolderContentsInFC', ['Folder', 'Large Plone Folder'])
        query = base_query.copy()
        if 'portal_type' in query:
            if type(query['portal_type']) in (list, tuple, set):
                query['portal_type'] = list(query['portal_type'])
                query['portal_type'].extend(list(folder_types))
            else:
                pt = query['portal_type']
                query['portal_type'] = list(folder_types)
                query['portal_type'].append(pt)

        site = getSite()
        context = aq_inner(self.context)
        if directory == './':
            if IFolderish.providedBy(context):
                context = aq_parent(context)
        elif directory == '/':
            context = site
        else:
            context = site.restrictedTraverse(directory)

        results = context.getFolderContents(contentFilter=base_query)
        html = '<ul class="jqueryFileTree" style="display: none;">'
        site_path = '/'.join(site.getPhysicalPath())
        for item in context.getFolderContents(contentFilter=query):
            path = item.getPath()[len(site_path) + 1:]
            klass = ''
            if aq_base(item) not in results:
                klass = 'unselectable'
            if item.portal_type in folder_types:
                html += """<li class="directory collapsed %s">
    <a class="item" href="#" rel="%s">%s</a></li>""" % (
                    klass,
                    path + '/',
                    item.Title
                )
            else:
                html += """<li class="file ext_txt %s">
    <a class="item" href="#" rel="%s">%s</a></li>""" % (
                    klass,
                    path,
                    item.Title
                )
        html += '</ul>'
        return html
开发者ID:collective,项目名称:wildcard.uberoverride,代码行数:52,代码来源:views.py

示例13: __init__

 def __init__(self, context, query=None, include_subfolders=False):
     if not IFolderish.providedBy(context):
         raise ValueError('context does not appear to be a folder')
     self.context = context
     if query and not IComposedQuery.providedBy(query):
         raise ValueError('query does not provide IComposedQuery')
     elif query is None:
         query = ComposedQuery()
     self.query = query
     sm = sitemanager_for(self.context)
     self.cachetools = sm.queryUtility(ISetCacheTools)
     if self.cachetools is None:
         raise ComponentLookupError('cannot find local set cache utility')
     self.include_subfolders = include_subfolders
开发者ID:gu-eresearch,项目名称:plone.app.folderui,代码行数:14,代码来源:listing.py

示例14: __init__

    def __init__(self, context, request, **kwargs):
        """ Contructor """
        self.context = context
        self.request = request
        self.catalog = getToolByName(self.context, "portal_catalog")
        self.plone_view = getMultiAdapter((self.context, self.request), name=u"plone")
        self.getIcon = self.plone_view.getIcon
        self.registry = getUtility(IRegistry)
        self.settings = self.registry.forInterface(ICoverSettings)

        # check if object is a folderish object, if not, get it's parent.
        if not IFolderish.providedBy(self.context):
            self.obj = aq_parent(self.context)
        else:
            self.obj = aq_inner(self.context)
开发者ID:jsbueno,项目名称:collective.cover,代码行数:15,代码来源:contentchooser.py

示例15: recurse

    def recurse(context):
        """ Recurse through all content on Plone site """

        annotations = IAnnotations(context)

        if name in annotations:
            msg = "Cleaning up annotation %s on item %s"
            msg = msg % (name, context.absolute_url())
            logger.info(msg)
            del annotations[name]

        # Make sure that we recurse to real folders only,
        # otherwise contentItems() might be acquired from higher level
        if IFolderish.providedBy(context):
            for id, item in context.contentItems():
                recurse(item)
开发者ID:barseghyanartur,项目名称:collective.favoriting,代码行数:16,代码来源:upgrades.py


注:本文中的Products.CMFCore.interfaces._content.IFolderish类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。