示例#1
0
    def publish(self):
        identity = request.environ.get("repoze.who.identity")
        if identity:
            #Get list of vocabularies created by userid
            c.userid = identity['repoze.who.userid']
            c.user_det = get_mediator_details(c.userid)
            vocabs = get_mediator_vocabs(c.userid)
            #Get status of vocab - is rdf, ready to convert to html, new rdf check, convert to html, html check
            c.vocab_list = {}

            for k, v in vocabs.iteritems():
                files = get_vocab_files(k)
                description = {}
                for f, vals in files.iteritems():
                    if vals['format'] == 'application/rdf+xml':
                        description = get_vocab_description(vals['path'], k)
                msgs = get_vocab_editorial_note(k)
                c.vocab_list[k] = description
                c.vocab_list[k]['files'] = files
                c.vocab_list[k]['uri'] = v[0]
                c.vocab_list[k]['svn'] = v[1]
                c.vocab_list[k]['note'] = msgs
            return render('/publish.html')
        else:
            session[
                'login_flash'] = "Please login to view vocabularies published and managed by you and to upload new vocabularies"
            session.save()
            destination = "/login?came_from=publish"
            return redirect(destination, code=303)
示例#2
0
 def index(self):
     """Generates the list of vocabs in the browse page."""
     vocabs = os.listdir(ag.vocabulariesdir)
     c.ox_vocab_list = {}
     c.ref_vocab_list = {}
     mediators_dir_name = ag.mediatorsdir.strip('/').split('/')[-1]
     reference_vocabs = get_ref_vocabs().keys()
     for v in vocabs:
         vocab_dict = {}
         if v.startswith(
                 '.') or v == mediators_dir_name or v == os.path.split(
                     ag.vocabulariesref)[1]:
             continue
         #Get the list of files
         files = get_vocab_files(v)
         if not files:
             continue
         description = {}
         for f, vals in files.iteritems():
             if vals['format'] == 'application/rdf+xml':
                 description = get_vocab_description(vals['path'], v)
         vocab_dict = description
         vocab_dict['files'] = files
         vocab_dict['mediators'] = get_vocab_mediator(v)
         properties = get_vocab_properties(v)
         vocab_dict['uri'] = properties['uri']
         vocab_dict['pref_uri'] = properties['preferredNamespaceUri']
         vocab_dict['pref_prefix'] = properties['preferredNamespacePrefix']
         if str(properties['uri']) in reference_vocabs:
             c.ref_vocab_list[v] = vocab_dict
         else:
             c.ox_vocab_list[v] = vocab_dict
     return render('/browse.html')
示例#3
0
    def publish(self):
        identity = request.environ.get("repoze.who.identity")
        if identity:
            #Get list of vocabularies created by userid
            c.userid = identity['repoze.who.userid']
            c.user_det = get_mediator_details(c.userid)
            vocabs = get_mediator_vocabs(c.userid)
            #Get status of vocab - is rdf, ready to convert to html, new rdf check, convert to html, html check
            c.vocab_list = {}

            for k, v in vocabs.iteritems():
                files = get_vocab_files(k)
                description = {}
                for f, vals in files.iteritems():
                    if vals['format'] == 'application/rdf+xml':
                        description = get_vocab_description(vals['path'], k)
                msgs = get_vocab_editorial_note(k)
                c.vocab_list[k] = description
                c.vocab_list[k]['files'] = files
                c.vocab_list[k]['uri'] = v[0]
                c.vocab_list[k]['svn'] = v[1]
                c.vocab_list[k]['note'] = msgs
            return render('/publish.html')
        else:
            session['login_flash'] = "Please login to view vocabularies published and managed by you and to upload new vocabularies"
            session.save()
            destination = "/login?came_from=publish"
            return redirect(destination, code=303)
示例#4
0
 def index(self):
     """Generates the list of vocabs in the browse page."""
     vocabs =  os.listdir(ag.vocabulariesdir)
     c.ox_vocab_list = {}
     c.ref_vocab_list = {}
     mediators_dir_name = ag.mediatorsdir.strip('/').split('/')[-1]
     reference_vocabs = get_ref_vocabs().keys()
     for v in vocabs:
         vocab_dict = {}
         if v.startswith('.') or v == mediators_dir_name or v == os.path.split(ag.vocabulariesref)[1]:
             continue
         #Get the list of files
         files = get_vocab_files(v)
         if not files:
             continue
         description = {}
         for f, vals in files.iteritems():
             if vals['format'] == 'application/rdf+xml':
                 description = get_vocab_description(vals['path'], v)
         vocab_dict = description
         vocab_dict['files'] = files
         vocab_dict['mediators'] = get_vocab_mediator(v)
         properties = get_vocab_properties(v)
         vocab_dict['uri'] = properties['uri']
         vocab_dict['pref_uri'] = properties['preferredNamespaceUri']
         vocab_dict['pref_prefix'] = properties['preferredNamespacePrefix']
         if str(properties['uri']) in reference_vocabs:
             c.ref_vocab_list[v] = vocab_dict
         else:
             c.ox_vocab_list[v] = vocab_dict
     return render('/browse.html')
示例#5
0
 def owner(self, owner_uuid):
     c.user_det = get_mediator_details(owner_uuid)
     c.vocab_list = {}
     if 'userid' in c.user_det and c.user_det['userid']:
         c.userid = c.user_det['userid']
         vocabs = get_mediator_vocabs(c.userid)
         #Get status of vocab - is rdf, ready to convert to html, new rdf check, convert to html, html check
         for k, v in vocabs.iteritems():
             files = get_vocab_files(k)
             description = {}
             for f, vals in files.iteritems():
                 if vals['format'] == 'application/rdf+xml':
                     description = get_vocab_description(vals['path'], k)
             c.vocab_list[k] = description
             c.vocab_list[k]['files'] = files
     return render('/owner.html')
示例#6
0
 def owner(self, owner_uuid):
     c.user_det = get_mediator_details(owner_uuid)
     c.vocab_list = {}
     if 'userid' in c.user_det and c.user_det['userid']:
         c.userid = c.user_det['userid']
         vocabs = get_mediator_vocabs(c.userid)
         #Get status of vocab - is rdf, ready to convert to html, new rdf check, convert to html, html check
         for k, v in vocabs.iteritems():
             files = get_vocab_files(k)
             description = {}
             for f, vals in files.iteritems():
                 if vals['format'] == 'application/rdf+xml':
                     description = get_vocab_description(vals['path'], k)
             c.vocab_list[k] = description
             c.vocab_list[k]['files'] = files
     return render ('/owner.html')