コード例 #1
0
ファイル: views.py プロジェクト: DanCoughlin/caps
def search(request, keyword):
    results = RDFMask().search(keyword)
    myobj = []
    id_tracker = ""
    o = None 
    print len(myobj)
    for r in results:
        
        if not r.phile.identifier == id_tracker:
            if not o == None: 
                myobj.append(o)
            title = RDFMask().get_title(r.phile)
            version = len(storage.list_versions(r.phile.identifier))
            if settings.ICONS.has_key(r.phile.obj_type):
                o = DigitalObject(title, r.phile.identifier, r.phile.obj_type, version, r.phile.date_updated, settings.ICONS[r.phile.obj_type][0], settings.ICONS[r.phile.obj_type][1], [])
            else:
                o = DigitalObject(title, r.phile.identifier, r.phile.obj_type, version, r.phile.date_updated, settings.ICONS["default"][0], settings.ICONS["default"][1], [])

        o.metadata.append( (r.triple_predicate, r.triple_object) ) 
        id_tracker = r.phile.identifier

    if not o == None:
        myobj.append(o)

    return render_to_response('search.html', {'keyword': keyword, 'obj': myobj})
コード例 #2
0
ファイル: views.py プロジェクト: DanCoughlin/caps
def add_metadata(request):
    ark = request.POST.get('ark') 
    add_assertions(request, ark)

    p = Philes().get_phile(ark) 
    md = RDFMask().get_md(p) 
    versions = storage.list_versions(ark)
    return render_to_response('meta_new.html', {'phile': p, 'metadata': md, 'versions': versions, 'meta': sorted(settings.METADATA_URLS.keys()) })
コード例 #3
0
ファイル: views.py プロジェクト: psu-stewardship/caps
def management(request, arkid):
    stats = Philes().get_stats()
    p = Philes().get_phile(arkid)
    md = RDFMask().get_md(p)
    last_audit = Audit().get_last_audit(p)
    title = RDFMask().get_title(p)
    versions = storage.list_versions(arkid)
    path = p.path + "/data"
    for pth, drs, files in os.walk(path):
        pass
    return render_to_response('management.html', {'arkid': arkid, 'phile' : p, 'md' : md, 'files' : files, 'meta' : sorted(settings.METADATA_URLS.keys()), 'versions': versions, 'stats': stats, 'obj_name' : title, 'last_audit': last_audit})
コード例 #4
0
ファイル: views.py プロジェクト: DanCoughlin/caps
def management(request, arkid):
    stats = Philes().get_stats()
    p = Philes().get_phile(arkid)
    md = RDFMask().get_md(p)
    last_audit = Audit().get_last_audit(p)
    title = RDFMask().get_title(p)
    versions = storage.list_versions(arkid)
    path = p.path + "/data"
    img = "icon_folder"
    if settings.ICONS.has_key(p.obj_type):
        img = settings.ICONS[p.obj_type][0]

    for pth, drs, files in os.walk(path):
        pass
    return render_to_response('management.html', {'phile' : p, 'md' : md, 'files' : files, 'meta' : sorted(settings.METADATA_URLS.keys()), 'versions': versions, 'stats': stats, 'obj_name' : title, 'last_audit': last_audit, 'img': img})
コード例 #5
0
ファイル: views.py プロジェクト: psu-stewardship/caps
def default(request, display):
    phils = Philes.objects.filter(owner='dmc186')
    stats = Philes().get_stats()
    myobj = []
    for p in phils:
        print "id:%s" % p.identifier
        metadata = RDFMask.objects.filter(phile=p)
        version = len(storage.list_versions(p.identifier))
        title = RDFMask().get_title(p) 
        obj_type = ""
        for md in metadata:
            if md.triple_predicate == "type":
                obj_type = md.triple_object
        myobj.append(DigitalObject(title, p.identifier, obj_type, version, p.date_updated))

    return render_to_response('index.html', {'objects': myobj, 'display': display, 'stats': stats})
コード例 #6
0
ファイル: views.py プロジェクト: DanCoughlin/caps
def default(request, display='icons'):
    phils = Philes.objects.filter(owner='dmc186')
    stats = Philes().get_stats()
    myobj = []
#movie: <img src="/site_images/icon_movie_48.png" alt="movie file" />
#zip: <img src="/site_images/icon_zip_48.png" alt="zip file" />
    for p in phils:
        
        metadata = RDFMask.objects.filter(phile=p)
        version = len(storage.list_versions(p.identifier))
        title = RDFMask().get_title(p) 
        # if we don't have the object type then default to compound
        if settings.ICONS.has_key(p.obj_type):
            myobj.append(DigitalObject(title, p.identifier, p.obj_type, version, p.date_updated, settings.ICONS[p.obj_type][0], settings.ICONS[p.obj_type][1])) 
        else:
            myobj.append(DigitalObject(title, p.identifier, p.obj_type, version, p.date_updated, settings.ICONS["default"][0], settings.ICONS["default"][1])) 

    if display == 'icons':
        return render_to_response('icons.html', {'objects': myobj, 'stats': stats})
    else: 
        return render_to_response('list.html', {'objects': myobj, 'stats': stats})
コード例 #7
0
ファイル: views.py プロジェクト: psu-stewardship/caps
def search(request, keyword):
    results = RDFMask().search(keyword)
    myobj = []
    id_tracker = ""
    o = None 
    print len(myobj)
    for r in results:
        
        if not r.phile.identifier == id_tracker:
            if not o == None: 
                myobj.append(o)
            title = RDFMask().get_title(r.phile)
            version = len(storage.list_versions(r.phile.identifier))
            o = DigitalObject(title, r.phile.identifier, "", version, r.phile.date_updated, "", [])

        o.metadata.append( (r.triple_predicate, r.triple_object) ) 
        id_tracker = r.phile.identifier

    if not o == None:
        myobj.append(o)

    print len(myobj)
    print len(myobj[0].metadata)
    return render_to_response('search.html', {'keyword': keyword, 'obj': myobj})
コード例 #8
0
ファイル: views.py プロジェクト: DanCoughlin/caps
def get_versions(request, arkid):
    versions = storage.list_versions(arkid)
    return render_to_response('versions.html', {'versions': versions, 'ark': arkid})