X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=stemmaweb%2Flib%2Fstemmaweb%2FController%2FStexaminer.pm;h=e7eee1b32772930597900eeecf576bae99672052;hb=e217c221e9686dd0a819bdd72afa4861dfb99236;hp=d2aa2617d787fca0938760827f2a735a83ec81b0;hpb=f8d13166a3dca3726a5ccf07ed7d701ff93d28c3;p=scpubgit%2Fstemmatology.git diff --git a/stemmaweb/lib/stemmaweb/Controller/Stexaminer.pm b/stemmaweb/lib/stemmaweb/Controller/Stexaminer.pm index d2aa261..e7eee1b 100644 --- a/stemmaweb/lib/stemmaweb/Controller/Stexaminer.pm +++ b/stemmaweb/lib/stemmaweb/Controller/Stexaminer.pm @@ -39,8 +39,25 @@ sub index :Path :Args(1) { $c->stash->{graphdot} = $stemma->editable({ linesep => ' ' }); $c->stash->{text_title} = $tradition->name; $c->stash->{template} = 'stexaminer.tt'; + + # Get the analysis options + my( $use_type1, $ignore_sort ) = ( 0, 'none' ); + if( $c->req->method eq 'POST' ) { + $use_type1 = $c->req->param( 'show_type1' ) eq 'on' ? 1 : 0; + $ignore_sort = $c->req->param( 'ignore_variant' ); + } + $c->stash->{'show_type1'} = $use_type1; + $c->stash->{'ignore_variant'} = $ignore_sort; # TODO Run the analysis as AJAX from the loaded page. - my $t = run_analysis( $tradition, 'exclude_type1' => 1 ); + my %analysis_options; + $analysis_options{'exclude_type1'} = !$use_type1; + if( $ignore_sort eq 'spelling' ) { + $analysis_options{'collapse'} = [ qw/ spelling orthographic / ]; + } elsif( $ignore_sort eq 'orthographic' ) { + $analysis_options{'collapse'} = 'orthographic'; + } + + my $t = run_analysis( $tradition, %analysis_options ); # Stringify the reading groups foreach my $loc ( @{$t->{'variants'}} ) { my $mst = wit_stringify( $loc->{'missing'} ); @@ -48,6 +65,11 @@ sub index :Path :Args(1) { foreach my $rhash ( @{$loc->{'readings'}} ) { my $gst = wit_stringify( $rhash->{'group'} ); $rhash->{'group'} = $gst; + my $roots = join( ', ', @{$rhash->{'independent_occurrence'}} ); + $rhash->{'independent_occurrence'} = $roots; + unless( $rhash->{'text'} ) { + $rhash->{'text'} = $rhash->{'readingid'}; + } } } # Values for TT rendering