コード例 #1
0
def adduseropts(user):
    ret = []

    field = Node("upload.type_image", "metafield")
    field.set("label", "image_schema")
    field.set("type", "text")
    ret.append(field)
    field = Node("upload.type_text", "metafield")
    field.set("label", "text_schema")
    field.set("type", "text")
    ret.append(field)
    db.session.commit()
    return ret
コード例 #2
0
ファイル: upload.py プロジェクト: mediatum/mediatum
def adduseropts(user):
    ret = []

    field = Node("upload.type_image", "metafield")
    field.set("label", "image_schema")
    field.set("type", "text")
    ret.append(field)
    field = Node("upload.type_text", "metafield")
    field.set("label", "text_schema")
    field.set("type", "text")
    ret.append(field)
    db.session.commit()
    return ret
コード例 #3
0
            ret = []
            for scheme in get_permitted_schemas_for_datatype(
                    req.params.get('contenttype')):
                ret.append({'id': scheme.name, 'name': scheme.getLongName()})
            req.write(json.dumps({'schemes': ret}, ensure_ascii=False))
            return None

        # create node with given type/schema
        if req.params.get('action') == "createobject":
            schema = req.params.get('schema')
            ctype = req.params.get('contenttype')

            node = Node(name=u"", type=ctype, schema=schema)
            basenode = q(Node).get(req.params.get('id'))
            basenode.children.append(node)
            node.set("creator", user.login_name)
            node.set(
                "creationtime",
                ustr(
                    time.strftime('%Y-%m-%dT%H:%M:%S',
                                  time.localtime(time.time()))))
            db.session.commit()
            res = {'newid': node.id, 'id': req.params.get('id')}
            req.write(json.dumps(res, ensure_ascii=False))
            return None

        # create node using given identifier (doi, ...)
        if req.params.get('action') == "obj_from_identifier":
            identifier_importer = req.params.get('identifier_importer')
            identifier = req.params.get('identifier')
コード例 #4
0
ファイル: upload.py プロジェクト: mediatum/mediatum
        if req.params.get('action') == 'getschemes':
            ret = []
            for scheme in get_permitted_schemas_for_datatype(req.params.get('contenttype')):
                ret.append({'id': scheme.name, 'name': scheme.getLongName()})
            req.write(json.dumps({'schemes': ret}, ensure_ascii=False))
            return None

        # create node with given type/schema
        if req.params.get('action') == "createobject":
            schema = req.params.get('schema')
            ctype = req.params.get('contenttype')

            node = Node(name=u"", type=ctype, schema=schema)
            basenode = q(Node).get(req.params.get('id'))
            basenode.children.append(node)
            node.set("creator", user.login_name)
            node.set("creationtime",  ustr(time.strftime('%Y-%m-%dT%H:%M:%S', time.localtime(time.time()))))
            db.session.commit()
            res = {'newid': node.id,
                   'id': req.params.get('id')}
            req.write(json.dumps(res, ensure_ascii=False))
            return None

        # create node using given identifier (doi, ...)
        if req.params.get('action') == "obj_from_identifier":
            identifier_importer = req.params.get('identifier_importer')
            identifier = req.params.get('identifier')

            logg.debug("... in %s.%s: going to create new node without file from identifier (%s)",
                __name__, funcname(), identifier)