allow division of fetch for table and SVG stemma
Tara L Andrews [Mon, 10 Oct 2011 13:57:08 +0000 (15:57 +0200)]
TreeOfTexts/lib/TreeOfTexts/Controller/Root.pm
TreeOfTexts/root/src/table_gadget.tt [new file with mode: 0644]

index 2cd3a76..e9deda3 100644 (file)
@@ -49,6 +49,24 @@ sub view_text :Local {
        $c->stash->{conflict} = $t->{'conflict_count'};
        $c->stash->{template} = 'index.tt'; 
 }
+
+sub view_table :Local {
+    my( $self, $c ) = @_;
+    my $m = $c->model( 'Analysis' );
+    my $t = $m->{'data'}->[ $c->request->params->{'textid'} ];
+       $c->stash->{variants} = $t->{'variants'};
+    $c->stash->{template} = 'table_gadget.tt';
+}
+
+sub view_svg :Local {
+    my( $self, $c ) = @_;
+    my $m = $c->model( 'Analysis' );
+    my $t = $m->{'data'}->[ $c->request->params->{'textid'} ];
+    $c->stash->{result} = $t->{'svg'};
+    $c->forward( "View::SVG" );
+}
+
+
 =head2 default
 
 Standard 404 error page
diff --git a/TreeOfTexts/root/src/table_gadget.tt b/TreeOfTexts/root/src/table_gadget.tt
new file mode 100644 (file)
index 0000000..201b05d
--- /dev/null
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+  <head>
+    <META http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <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>
+    <link type="text/css" href="[% c.uri_for('css/cupertino/jquery-ui-1.8.13.custom.css') %]" rel="stylesheet" />
+    [% INCLUDE style.tt2 %]
+  </head>
+  <body>
+    <div id="variants_table">
+      <table>
+[% FOREACH row IN variants -%]
+[% INCLUDE variantrow %]
+[% END -%]
+     </table>
+    </div>
+  </body>
+</html>
+
+[% BLOCK variantrow -%]
+[% SET rowclass = 'class="genealogical"' IF row.genealogical -%]
+[% SET rowclass = 'class="coincidental"' UNLESS row.genealogical -%]
+        <tr [% rowclass %]>
+          <th><span class="rowid">[% row.id %]</span></th>
+[% FOREACH reading IN row.readings -%]
+[% SET cellclass = 'clickable conflict' IF reading.conflict -%]
+[% SET cellclass = 'clickable' IF !reading.conflict -%]
+          <td class="[% cellclass %]"><span onclick="color_nodes($(this).parent().index(), [% reading.group %], [% reading.missing %]);$(this).parents('tr').addClass('active_variant_row');$(this).parent().addClass('active_variant_cell cellb'+($(this).parent().index()-1))">[% reading.text %]</span></td>
+[% END -%]
+[% FILTER repeat( row.empty ) -%]
+          <td/>
+[% END -%]
+        </tr>
+[% END -%]
\ No newline at end of file