has tradition_index => (
traits => ['Hash'],
- isa => 'HashRef[Str]',
+ isa => 'HashRef[HashRef[Str]]',
handles => {
add_index => 'set',
del_index => 'delete',
- name => 'get',
+ info => 'get',
tradition_ids => 'keys',
},
default => sub { {} },
foreach my $obj ( $stream->items ) {
my $uuid = $self->object_to_id( $obj );
if( ref( $obj ) eq 'Text::Tradition' ) {
- $self->add_index( $uuid => $obj->name );
+ $self->add_index( $uuid => { 'name' => $obj->name,
+ 'id' => $uuid, 'has_stemma' => $obj->has_stemma } );
} else {
warn "Found root object in DB that is not a Text::Tradition";
}
return;
}
my $uuid = $self->store( $obj );
- $self->add_index( $uuid => $obj->name ) if $uuid;
+ $self->add_index( $uuid => { 'name' => $obj->name,
+ 'id' => $uuid, 'has_stemma' => $obj->has_stemma } ) if $uuid;
return $uuid;
}
my $user = $c->request->param( 'user' ) || 'ALL';
my @textlist;
foreach my $id ( $m->tradition_ids ) {
- my $data = {
- 'id' => $id,
- 'name' => $m->name( $id ),
- };
- push( @textlist, $data );
+ my $t = $m->info( $id );
+ push( @textlist, $t );
}
$c->stash->{texts} = \@textlist;
$c->stash->{template} = 'directory.tt';
}
+=head2 variantgraph
+
+ GET /variantgraph/$textid
+
+Returns the variant graph for the text specified at $textid, in SVG form.
+
+=cut
+
+sub variantgraph :Local :Args(1) {
+ my( $self, $c, $textid ) = @_;
+ my $m = $c->model('Directory');
+ my $collation = $m->tradition( $textid )->collation;
+
+ $c->stash->{'result'} = $collation->as_svg;
+ $c->forward('View::SVG');
+}
+
=head2 alignment
GET /alignment/$textid
<style type="text/css" media="screen">
+
+/* General site-wide layout */
body {
margin: 0;
padding: 20px;
font-size: 85%;
color: #666;
}
-#svg_graph {
+h1 {
+ border-bottom: 1px solid #488dd2;
+ color: #488dd2;
+ font-size: 24px;
+ font-weight: 100;
+ margin: 0 0 17px;
+ padding: 0;
+ width: 650px;
+}
+h2 {
+ margin-top: 0px;
+}
+
+/* Index page components */
+
+#directory {
+ float: left;
+ width: 300px;
+ height: 450px;
+ border: 1px #c6dcf1 solid;
+}
+#variant_graph {
+ clear: both;
+ width: 900px;
+ height: 400px;
+ border: 1px #c6dcf1 solid;
+}
+#stemma_graph {
float: left;
width: 500px;
height: 450px;
- border-right: 1px #c6dcf1 solid;
+ border: 1px #c6dcf1 solid;
}
+/* Additional components for the stexaminer */
#variants_table {
float: left;
width: 450px;
position: relative;
top: -15px;
}
-h1 {
- border-bottom: 1px solid #488dd2;
- color: #488dd2;
- font-size: 24px;
- font-weight: 100;
- margin: 0 0 17px;
- padding: 0;
- width: 280px;
-}
-h2 {
- margin-top: 0px;
-}
.genealogical {
background: #88ffaa;
}
background: #ff6666;
}
.active_variant_row {
- #background: #c6dcf1;
+ background: #c6dcf1;
font-style: italic;
}
.active_variant_cell {
- #background: #e8f1fe;
+ background: #e8f1fe;
}
.cellb0 {
border-right: 20px solid #ffeeaa;
--- /dev/null
+function loadTradition( textid ) {
+ $('#stemma_graph').load( "stemma/" + textid );
+ $('#stemma_graph > svg').width('485px');
+ $('#variant_graph').load( "variantgraph/" + textid );
+ $('#variant_graph > svg').height('300px');
+}
\ No newline at end of file
<ul>
[% SET i = 0 -%]
[% FOREACH t IN texts -%]
- <li>[% t.name %] | <a href="relationships?textid=[% t.id %]">Relationship mapper</a>
-[% IF t.has_stemma -%]
- | <a href="stexaminer?textid=[% t.id %]">Stexaminer</a>
-[% END -%]</li>
+ <li><span class="traditionname" onClick="loadTradition('[% t.id %]')">[% t.name %]</span></li>
[% i = i + 1 -%]
[% END -%]
</table>
--- /dev/null
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <META http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <link type="text/css" href="[% c.uri_for('/css/cupertino/jquery-ui-1.8.13.custom.css') %]" rel="stylesheet" />
+ <link type="text/css" href="[% c.uri_for('/css/style.css') %]" rel="stylesheet" />
+ <script type="text/javascript" src="/js/jquery-1.4.4.min.js"></script>
+ <script type="text/javascript" src="/js/jquery-ui-1.8.10.custom.min.js"></script>
+ <script type="text/javascript" src="[% applicationjs %]"></script>
+ [% content %]
+ <title>[% pagetitle %]</title>
+ </head>
+ <body>
\ No newline at end of file
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
- <head>
- <META http-equiv="Content-Type" content="text/html; charset=utf-8">
- <link type="text/css" href="[% c.uri_for('css/cupertino/jquery-ui-1.8.13.custom.css') %]" rel="stylesheet" />
- <link type="text/css" href="[% c.uri_for('css/style.css') %]" rel="stylesheet" />
- <script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
- <script type="text/javascript" src="js/jquery-ui-1.8.10.custom.min.js"></script>
- <script type="text/javascript" src="js/interaction.js"></script>
- <title>Text tradition tools</title>
- </head>
- <body>
-[% content %]
- </body>
-</html>
+[% WRAPPER header.tt
+ pagetitle = "Stemmaweb - Text tradition tools"
+ applicationjs = "js/componentload.js"
+%]
+ <script type="text/javascript">
+$(document).ready(function() {
+ // call out to load the directory div
+ $('#directory').load( "[% c.uri_for( 'directory' ) %]" );
+});
+ </script>
+
+[% END %]
+
+ <div id="topbanner"><h1>Stemmaweb - a collection of tools for analysis of collated texts</h1></div>
+ <div id="directory"></div>
+ <div id="stemma_graph"></div>
+ <div id="variant_graph"></div>
+
+[% PROCESS footer.tt %]
\ No newline at end of file
-[% BLOCK js %]
- <script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
- <script type="text/javascript" src="js/jquery-ui-1.8.10.custom.min.js"></script>
- <script type="text/javascript" src="js/interaction.js"></script>
-[% END %]
+[% PROCESS header.tt
+ pagetitle = "Stexaminer - $text_title"
+ applicationjs = "/js/stexaminer.js"
+%]
+ <h1>Stexaminer</h1>
+ <h2>[% text_title %]</h2>
+ <div id="statistics">
+ <p>Analyzed [% total %] variant locations, of which [% genealogical %] entirely followed the stemma. [% conflict %] readings conflicted with the stemma.</p>
+ </div>
+ <div id="stemma_graph">
+ [% svg %]
+ </div>
+ <div id="variants_table">
+ <table>
+[% FOREACH row IN variants -%]
+[% INCLUDE variantrow %]
+[% END -%]
+ </table>
+ </div>
+[% PROCESS footer.tt %]
+
[% BLOCK variantrow -%]
[% SET rowclass = 'class="genealogical"' IF row.genealogical -%]
[% END -%]
</tr>
[% END -%]
- <h1>Stexaminer</h1>
- <h2>[% text_title %]</h2>
- <div id="statistics">
- <p>Analyzed [% total %] variant locations, of which [% genealogical %] entirely followed the stemma. [% conflict %] readings conflicted with the stemma.</p>
- </div>
- <div id="svg_graph">
- [% svg %]
- </div>
- <div id="variants_table">
- <table>
-[% FOREACH row IN variants -%]
-[% INCLUDE variantrow %]
-[% END -%]
- </table>
- </div>
-