예제 #1
0
def edit(request, node):

    if request.method == "POST":

        # sanity check
        if node.user_id != request.user.id:
            return error_page(request, 'Journal can only be added by its owner!')

        d = parse_form(request.params)
        node.update(d)

        if request.params['_method'].endswith('_edit'):
            return HTTPFound(location = request.route_url('node-edit', path=node.url))

        return HTTPFound(location = request.route_url('node-index', path=node.url))

    else:

        eform, jscode = edit_form(node, request)

        return render_to_response('cmsfix:templates/node/edit.mako',
            {   'parent_url': '%s <%s>' % (node.title, node.path),
                'node': node,
                'toolbar': toolbar(request, node),
                'eform': eform,
                'code': jscode,
            }, request = request )
예제 #2
0
파일: pagenode.py 프로젝트: trmznt/cmsfix
def render_pagenode(node, request):

    # set the formatter
    if node.mimetype == 'text/x-rst':
        content = literal(render_rst(node.content))
        content = literal(postrender(content, node))
    else:
        content = node.content

    return render_to_response('cmsfix:templates/pagenode/node.mako',
            {   'node': node,
                'toolbar': toolbar(request, node),
                'html': content,
            }, request = request )
예제 #3
0
def view(request, node):

    content = div()[
        #div( breadcrumb(request, node.parent) ),
        toolbar(request, node),
        h3('Log date: %s | Title: %s' % (node.log_date, node.title) ),

    ]

    if node.mimetype == 'text/x-rst':
        html = literal(render_rst(node.content))
    else:
        html = node.content

    content.add( html )

    return render_to_response('cmsfix:templates/node/generics.mako',
            { 'content': content,
            }, request = request )
예제 #4
0
파일: pagenode.py 프로젝트: trmznt/cmsfix
def edit(request, node):

    if request.method == 'POST':
        # update data

        d = parse_form(request.params)
        node.update(d)

        if request.params['_method'] == 'save_edit':
            return HTTPFound(location = request.route_url('node-edit', path=node.url))

        print(node.url)
        return HTTPFound(location = request.route_url('node-index', path=node.url))

    eform, jscode = edit_form(node, request)

    return render_to_response('cmsfix:templates/pagenode/edit.mako',
            {   'parent_url': ('/' + node.parent.url) if node.parent else 'None',
                'node': node,
                'toolbar': toolbar(request, node),
                'eform': eform,
                'code': jscode,
            }, request = request )