Ejemplo n.º 1
0
    def update(self):
        context = self.context
        request = self.request
        registry = request.registry

        self.deleteContent = ptah.check_permission(
            cms.DeleteContent, context)

        # cms(uri).read()
        # cms(uri).create(type)
        # cms(uri).delete()
        # cms(uri).update(**kwargs)
        # cms(uri).items(offset, limit)

        if self.deleteContent and 'form.buttons.remove' in request.POST:
            uris = self.request.POST.getall('item')
            for uri in uris:
                cms.wrap(uri).delete()

                self.message("Selected content items have been removed.")

        if 'form.buttons.rename' in request.POST:
            uris = self.request.POST.getall('item')
            print '=============', uris

        if 'form.buttons.cut' in request.POST:
            uris = self.request.POST.getall('item')
            print '=============', uris
Ejemplo n.º 2
0
    def update(self):
        context = self.context
        request = self.request
        registry = request.registry

        self.deleteContent = ptah.check_permission(ptahcms.DeleteContent,
                                                   context)

        # cms(uri).read()
        # cms(uri).create(type)
        # cms(uri).delete()
        # cms(uri).update(**kwargs)
        # cms(uri).items(offset, limit)

        if self.deleteContent and 'form.buttons.remove' in request.POST:
            uris = self.request.POST.getall('item')
            for uri in uris:
                ptahcms.wrap(uri).delete()

                self.message("Selected content items have been removed.")
Ejemplo n.º 3
0
def createContentAction(content, request, *args):
    """Create content"""
    name = request.GET.get('name')
    tinfo = request.GET.get('tinfo')

    tinfo = ptah.resolve(tinfo)

    fieldset = tinfo.fieldset.bind(None, request.POST)
    data, errors = fieldset.extract()
    if errors:
        request.response.status = 500
        return {'errors': errors.msg}

    item = wrap(content).create(tinfo.__uri__, name, **data)
    return nodeInfo(item, request)
Ejemplo n.º 4
0
def createContentAction(content, request, *args):
    """Create content"""
    name = request.GET.get('name')
    tinfo = request.GET.get('tinfo')

    tinfo = ptah.resolve(tinfo)

    fieldset = tinfo.fieldset.bind(None, request.POST)
    data, errors = fieldset.extract()
    if errors:
        request.response.status = 500
        return {'errors': errors.msg}

    item = wrap(content).create(tinfo.__uri__, name, **data)
    return nodeInfo(item, request)
Ejemplo n.º 5
0
def cmsApplications(request, *args):
    apps = []

    for name, factory in ptahcms.get_app_factories().items():
        root = factory()

        try:
            info = wrap(root).info()
        except (AttributeError, TypeException):
            continue

        info['__mount__'] = name
        if name:
            info['__link__'] = '%s/content:%s/%s/' % (request.application_url,
                                                      name, root.__uri__)
        else:
            info['__link__'] = '%s/content/%s/' % (request.application_url,
                                                   root.__uri__)
        apps.append(info)

    return apps
Ejemplo n.º 6
0
def cmsApplications(request, *args):
    apps = []

    for name, factory in ptahcms.get_app_factories().items():
        root = factory()

        try:
            info = wrap(root).info()
        except (AttributeError, TypeException):
            continue

        info['__mount__'] = name
        if name:
            info['__link__'] = '%s/content:%s/%s/'%(
                request.application_url, name, root.__uri__)
        else:
            info['__link__'] = '%s/content/%s/'%(
                request.application_url, root.__uri__)
        apps.append(info)

    return apps
Ejemplo n.º 7
0
def nodeInfo(content, request, *args):
    info = wrap(content).info()
    info['__link__'] = '%s%s/' % (request.application_url, content.__uri__)
    return info
Ejemplo n.º 8
0
def nodeInfo(content, request, *args):
    info = wrap(content).info()
    info['__link__'] = '%s%s/'%(request.application_url, content.__uri__)
    return info