Ejemplo n.º 1
0
def create_node(request, parent_id):
    parent = Slot.objects.get(pk=parent_id)
    createTextNodeForm = CreateTextForm({'text' : "", 'slot_id' : parent_id})
    anchor_nodes = getDataForAlternativesGraph(request, parent.id)
    return render_to_response("node/create.html",
            {"pagename": "Alternative erstellen in "+parent.getShortTitle(),
             "slot_title": parent.getShortTitle(),
             "authForm": AuthenticationForm(),
             "navigation" : getNavigationData(request, parent_id, parent.getType()),
             "anchor_nodes" : anchor_nodes,
             "alternative_form" : createTextNodeForm
            },
        context_instance=RequestContext(request))
Ejemplo n.º 2
0
def refine_structure_node(request, id):
    pattern_node = StructureNode.objects.get(pk=id)
    createTextForm = CreateTextForm({'text' : pattern_node.getText(), 'slot_id' : pattern_node.parent_id})
    anchor_nodes = getDataForAlternativesGraph(request, pattern_node.parent_id)
    return render_to_response("node/refine.html",
        {"pagename": "Verbessern oder erweitern von "+pattern_node.getShortTitle(),
         "pattern_title": pattern_node.getShortTitle(),
         "pattern_text": pattern_node.getText(),
         "this_url": pattern_node.getTextPath(),
         "authForm": AuthenticationForm(),
         "navigation" : getNavigationData(request, pattern_node.id, pattern_node.getType()),
         "anchor_nodes" : anchor_nodes,
         "selected_id" : pattern_node.id,
         "parent_id" : pattern_node.parent_id,
         "refine_form" : createTextForm
        },
        context_instance=RequestContext(request))
Ejemplo n.º 3
0
def path(request, path):
    node = getNodeForPath(path).as_leaf_class()
    if isinstance(node, Slot):
        node = node.node_set.order_by('-rating')[0].as_leaf_class()

    ## structure : Graph  : get top rated siblings and select node
    ###            Path   : path to parent select node
    ###            Content: slots
    ## text      : Graph  : get top rated siblings and select node
    ###            Path   : path to parent select node
    ###            Content: slots

    anchor_nodes = getDataForAlternativesGraph(request, node.parent_id, include_node=node.id)
    return render_to_response("node/show.html",
        {"pagename": node.getShortTitle(),
         "this_url": node.getTextPath(),
         "authForm": AuthenticationForm(),
         "navigation": getNavigationData(request, node.id, node.getType()),
         "anchor_nodes": anchor_nodes,
         "selected_id": node.id
        },
        context_instance=RequestContext(request))