def render(self, query, results=''): frontend.BasePage.render(self, 'tform.html', title = 'SPARQL search...', rows = 22, cols = 0, buttons = [ Button('Search', 1, 2) ], fields = [ Field.textarea('SPARQL', 'query', 75, 26, data=query) ], content = results )
def _show_contents(self, name, annotate): #---------------------------------------- repo = options.repository title = 'Recordings in %s' % repo.uri if name: uri = name recording = repo.get_recording(uri, open_dataset=False) if recording is None: ## Not part of a recording, so return RDF self.set_header('Content-Type', rdf.Format.RDFXML) self.write(repo.describe(uri, format=rdf.Format.RDFXML)) return selectedsig = None if str(recording.uri) != uri: if repo.has_signal(uri): selectedsig = uri uri = str(recording.uri) # By now we should have all of recording's RDF as a Graph so we # can use this to get events, annotations, etc, etc ## Is sending tree each time, that then has JScript setting up tooltips ## a cause of connection closed problems...??? kwds = dict(title=title, bodytitle=uri, style='signal', tree=self._xmltree(repo.recording_uris(), name), content=recording_info(recording) + signal_table(self, recording, selectedsig)) target = selectedsig if selectedsig else uri annotations = [ annotation_info(ann) for ann in repo.get_annotations(target, recording.graph.uri) ] if not annotate: annotations.append(annotatelink(target)) kwds['content'] += self.render_string('annotate.html', uri=target, annotations=annotations) if annotate: self.render( 'tform.html', bottom=True, # Form below other content treespace=True, formclass='annotform', rows=6, cols=0, buttons=[Button('Annotate', 1, 4), Button('Cancel', 1, 5)], fields=[ Field.textarea('Add Annotation', 'annotation', 60, 8), Field.hidden('target', target) ], **kwds) else: self.render('tpage.html', **kwds) else: self.render('tpage.html', title=title, tree=self._xmltree(repo.recording_uris()))
def _show_contents(self, name, annotate): #---------------------------------------- repo = options.repository title = 'Recordings in %s' % repo.uri if name: uri = name recording = repo.get_recording(uri, open_dataset=False) if recording is None: ## Not part of a recording, so return RDF self.set_header('Content-Type', rdf.Format.RDFXML) self.write(repo.describe(uri, format=rdf.Format.RDFXML)) return selectedsig = None if str(recording.uri) != uri: if repo.has_signal(uri): selectedsig = uri uri = str(recording.uri) # By now we should have all of recording's RDF as a Graph so we # can use this to get events, annotations, etc, etc ## Is sending tree each time, that then has JScript setting up tooltips ## a cause of connection closed problems...??? kwds = dict(title=title, bodytitle=uri, style='signal', tree = self._xmltree(repo.recording_uris(), name), content = recording_info(recording) + signal_table(self, recording, selectedsig) ) target = selectedsig if selectedsig else uri annotations = [ annotation_info(ann) for ann in repo.get_annotations(target, recording.graph.uri) ] if not annotate: annotations.append(annotatelink(target)) kwds['content'] += self.render_string('annotate.html', uri=target, annotations=annotations) if annotate: self.render('tform.html', bottom = True, # Form below other content treespace = True, formclass = 'annotform', rows = 6, cols = 0, buttons = [ Button('Annotate', 1, 4), Button('Cancel', 1, 5) ], fields = [ Field.textarea('Add Annotation', 'annotation', 60, 8), Field.hidden('target', target ) ], **kwds) else: self.render('tpage.html', **kwds) else: self.render('tpage.html', title=title, tree=self._xmltree(repo.recording_uris()))