sub index :Path :Args(1) {
my( $self, $c, $textid ) = @_;
my $m = $c->model('Directory');
+ my $am = $c->model('Analysis');
my $tradition = $m->tradition( $textid );
if( $tradition->stemma_count ) {
my $stemma = $tradition->stemma(0);
$c->stash->{'show_type1'} = $use_type1;
$c->stash->{'ignore_variant'} = $ignore_sort;
# TODO Run the analysis as AJAX from the loaded page.
- my %analysis_options;
+ my %analysis_options = ( calcdir => $am );
$analysis_options{'exclude_type1'} = !$use_type1;
if( $ignore_sort eq 'spelling' ) {
$analysis_options{'merge_types'} = [ qw/ spelling orthographic / ];
foreach my $rhash ( @{$loc->{'readings'}} ) {
my $gst = wit_stringify( $rhash->{'group'} );
$rhash->{'group'} = $gst;
- my $roots = join( ', ', @{$rhash->{'independent_occurrence'}} );
- $rhash->{'independent_occurrence'} = $roots;
+ _stringify_element( $rhash, 'independent_occurrence' );
+ _stringify_element( $rhash, 'reversions' );
unless( $rhash->{'text'} ) {
$rhash->{'text'} = $rhash->{'readingid'};
}
}
}
+sub _stringify_element {
+ my( $hash, $key ) = @_;
+ my $str = join( ', ', @{$hash->{$key}} );
+ $hash->{$key} = $str;
+}
+
=head2 graphsvg
POST stexaminer/graphsvg
--- /dev/null
+package stemmaweb::Model::Analysis;
+use strict;
+use warnings;
+use Moose;
+use Text::Tradition::Directory;
+
+extends 'Catalyst::Model::KiokuDB';
+
+has '+model_class' => ( default => 'Text::Tradition::Directory' );
+
+1;
.readinglabel {
font-weight: bold;
}
-.readingroots {
+.readingroots .reversionroots {
font-weight: bold;
color: #488dd2;
}
.conflict {
background: #ff6666;
}
+.reversion {
+ background: #ffd700;
+}
.active_variant_row {
background: #c6dcf1;
font-style: italic;
rdgstats.find('.reading_changed').append( rdghash.not_followed );
rdgstats.find('.reading_unclear').append( rdghash.follow_unknown );
rdgstats.find('.readingroots').append( rdghash.independent_occurrence );
- if( ! $.isEmptyObject( rdghash.reading_parents ) ) {
- var parentstats = $('#reading_parent_template').clone();
- $.each( rdghash.reading_parents, function( parentid, pdata ) {
- var parentdesc = pdata.label;
- if( pdata.relation ) {
- parentdesc += ' - variant type ' + pdata.relation.type;
- if( pdata.relation.annotation ) {
- parentdesc += ' [ ' + pdata.relation.annotation + ' ]';
- }
- } else {
- parentdesc += ' - no syntactic relation';
- }
- var parentitem = $('<li>').append( parentdesc );
- parentstats.find('.reading_parent_list').append( parentitem );
- });
- rdgstats.find('.reading_statistics').append( parentstats.contents() );
+ if( rdghash.is_reverted ) {
+ rdgstats.find('.reversionroots').append( rdghash.reversions );
+ } else {
+ rdgstats.find('.readingreversions').empty();
}
+ rdgstats.find('.reading_statistics').append(
+ fill_parent_template( rdghash, 'source' ) );
+ rdgstats.find('.reading_statistics').append(
+ fill_parent_template( rdghash, 'reversion' ) );
rshtml.append( rdgstats.contents() );
});
$('#row_statistics').empty();
$('#row_statistics').append( rshtml.contents() );
+
};
+function fill_parent_template( rdghash, type ) {
+ var objname = type + '_parents';
+ var template_id = '#reading_' + type + '_template';
+ var list_class = '.reading_' + type + '_list';
+ if( ! $.isEmptyObject( rdghash[objname] ) ) {
+ var parentstats = $( template_id ).clone();
+ $.each( rdghash[objname], function( parentid, pdata ) {
+ var parentdesc = pdata.label;
+ if( pdata.relation ) {
+ parentdesc += ' - variant type ' + pdata.relation.type;
+ if( pdata.relation.annotation ) {
+ parentdesc += ' [ ' + pdata.relation.annotation + ' ]';
+ }
+ } else {
+ parentdesc += ' - no syntactic relation';
+ }
+ var parentitem = $('<li>').append( parentdesc );
+ parentstats.find( list_class ).append( parentitem );
+ });
+ return( parentstats.contents() );
+ }
+}
+
// Save the original unextended SVG for when we need it.
$(document).ready(function () {
original_svg = $('#stemma_graph > svg').clone();
<div class="reading_statistics">
<span class="readinglabel"></span> - copied <span class="reading_copied"></span> time(s), changed <span class="reading_changed"></span> time(s)<br/>
Reading root(s) at <span class="readingroots"></span><br/>
- <!-- reading_parent_template will be appended here if there are parents -->
+ <span class="readingreversions">Reading reversion(s) at <span class="reversionroots"></span><br/></span>
+ <!-- source_parent_template will be appended here if there are parents -->
+ <!-- reversion_parent_template will be appended here if there are reversions -->
</div>
</div>
- <div id="reading_parent_template" class="template">
+ <div id="reading_source_template" class="template">
<div class="parent_statistics">
Reading parent(s):
- <ul class="reading_parent_list"></ul>
+ <ul class="reading_source_list"></ul>
+ </div>
+ </div>
+ <div id="reading_reversion_template" class="template">
+ <div class="parent_statistics">
+ Reverted reading parent(s):
+ <ul class="reading_reversion_list"></ul>
</div>
</div>
[% BLOCK variantrow -%]
+[% SET rowclass = 'class="coincidental"' -%]
[% SET rowclass = 'class="genealogical"' IF row.genealogical -%]
-[% SET rowclass = 'class="coincidental"' UNLESS row.genealogical -%]
<tr [% rowclass %]>
<th><span class="rowid" onclick="handle_row_click($(this))">[% row.id %]</span></th>
[% FOREACH reading IN row.readings -%]
-[% SET cellclass = 'clickable conflict' IF reading.conflict -%]
-[% SET cellclass = 'clickable' IF !reading.conflict -%]
+[% SET cellclass = 'clickable' -%]
+[% SET cellclass = 'clickable reversion' IF reading.is_reverted -%]
+[% SET cellclass = 'clickable conflict' IF reading.is_conflict -%]
<td class="[% cellclass %]"><span onclick="color_nodes($(this).parent().index(), [% reading.group %], [% row.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 -%]
# rename this file to stemmaweb.yml and put a ':' after 'name' if
# you want to use YAML like in old versions of Catalyst
name = stemmaweb
+<Model Analysis>
+ dsn dbi:SQLite:dbname=db/analysis.db
+</Model>
<Model Directory>
dsn dbi:SQLite:dbname=db/traditions.db
</Model>