From: tla Date: Thu, 15 Mar 2012 10:03:29 +0000 (+0100) Subject: Merge branch 'master' of github.com:tla/stemmatology X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a37d2d4b11589e95aea4f1bab0c31d238bec72b7;hp=5a7e26a907032c98237756247791aa569487e7d7;p=scpubgit%2Fstemmatology.git Merge branch 'master' of github.com:tla/stemmatology --- diff --git a/lib/Text/Tradition/Analysis.pm b/lib/Text/Tradition/Analysis.pm index fda5137..8bfaf1a 100644 --- a/lib/Text/Tradition/Analysis.pm +++ b/lib/Text/Tradition/Analysis.pm @@ -56,8 +56,6 @@ is 0 (i.e. the first). =item * merge_types - Specify a list of relationship types, where related readings should be treated as identical for the purposes of analysis. -=item * exclude_type1 - Exclude those ranks whose groupings have only type-1 variants. - =back =begin testing @@ -152,13 +150,7 @@ sub run_analysis { my %lacunae; foreach my $rank ( @ranks ) { my $missing = [ @lacunose ]; - my $rankgroup = group_variants( $tradition, $rank, $missing, \@collapse ); - if( $opts{'exclude_type1'} ) { - # Check to see whether this is a "useful" group. - my( $rdgs, $grps ) = _useful_variant( $rankgroup ); - next unless @$rdgs; - } - push( @groups, $rankgroup ); + push( @groups, group_variants( $tradition, $rank, $missing, \@collapse ) ); $lacunae{$rank} = $missing; } $DB::single = 1; @@ -195,8 +187,8 @@ relationships in @merge_relationship_types as equivalent. $lacunose should be a reference to an array, to which the sigla of lacunose witnesses at this rank will be appended. -Returns a hash $group_readings where $rdg is attested by the witnesses listed -in $group_readings->{$rdg}. +Returns two ordered lists $readings, $groups, where $readings->[$n] is attested +by the witnesses listed in $groups->[$n]. =cut diff --git a/script/orth_case_links.pl b/script/orth_case_links.pl index 06149ca..a2ddbf1 100755 --- a/script/orth_case_links.pl +++ b/script/orth_case_links.pl @@ -18,21 +18,29 @@ my $dir = Text::Tradition::Directory->new( $connect_args ); foreach my $text ( $dir->traditionlist ) { my $id = $text->{'id'}; + next unless $text->{'name'} =~ /Virtutes/; my $scope = $dir->new_scope; my $tradition = $dir->lookup( $id ); print STDERR "Processing tradition " . $tradition->name . "\n"; my $c = $tradition->collation; + $c->flatten_ranks(); # just in case foreach my $rank ( 1 .. $c->end->rank - 1 ) { my @readings = $c->readings_at_rank( $rank ); + my %merged; while( @readings ) { my $r = pop @readings; next if $r->is_meta; + next if $merged{$r->id}; my @orthmatch = grep { lc( $r->text ) eq lc( $_->text ) } @readings; foreach my $om ( @orthmatch ) { - unless( $c->get_relationship( $r, $om ) ) { - print STDERR sprintf( "Adding orthographic link for %s / %s\n", - $r->text, $om->text ); - $DB::single = 1; + if( $r->text eq $om->text ) { + print STDERR "Merging identical readings $r and $om (" + . $r->text . ")\n"; + $merged{$om->id} = 1; + $c->merge_readings( $r, $om ); + } elsif ( $c->get_relationship( $r, $om ) ) { + print STDERR sprintf( "Adding orthographic link for %s and %s (%s / %s)\n", + $r->id, $om->id, $r->text, $om->text ); $c->add_relationship( $r, $om, { 'type' => 'orthographic', 'scope' => 'global' } ); } diff --git a/stemmaweb/lib/stemmaweb/Controller/Stexaminer.pm b/stemmaweb/lib/stemmaweb/Controller/Stexaminer.pm index cb9990f..1449ad2 100644 --- a/stemmaweb/lib/stemmaweb/Controller/Stexaminer.pm +++ b/stemmaweb/lib/stemmaweb/Controller/Stexaminer.pm @@ -37,7 +37,7 @@ sub index :Path :Args(1) { $c->stash->{text_title} = $tradition->name; $c->stash->{template} = 'stexaminer.tt'; # TODO Run the analysis as AJAX from the loaded page. - my $t = run_analysis( $tradition, 'exclude_type1' => 1 ); + my $t = run_analysis( $tradition ); # Stringify the reading groups foreach my $loc ( @{$t->{'variants'}} ) { my $mst = wit_stringify( $loc->{'missing'} ); diff --git a/stemmaweb/root/css/relationship.css b/stemmaweb/root/css/relationship.css index e2e2f25..bed28ee 100644 --- a/stemmaweb/root/css/relationship.css +++ b/stemmaweb/root/css/relationship.css @@ -81,7 +81,20 @@ span.apimore { width: 89%; z-index: 2; opacity: 0.7; - background-color: #c5c5c5; + background-image: url("cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png"); + background-repeat: repeat; + background-attachment: scroll; + background-position: 50% 50%; + background-color: #EEEEEE; +} +#loading_message { + position: relative; + background-color: #EDF1FA; + color: #222222; + border: 2px solid #B0C6F7; + height: 20px; + width: 150px; + padding: 20px; } #dialog_overlay { display: none; diff --git a/stemmaweb/root/js/relationship.js b/stemmaweb/root/js/relationship.js index 64bd041..7921b1d 100644 --- a/stemmaweb/root/js/relationship.js +++ b/stemmaweb/root/js/relationship.js @@ -23,6 +23,14 @@ function getRelationshipURL() { function svgEnlargementLoaded() { //Give some visual evidence that we are working $('#loading_overlay').show(); + lo_height = $("#enlargement_container").outerHeight(); + lo_width = $("#enlargement_container").outerWidth(); + $("#loading_overlay").height( lo_height ); + $("#loading_overlay").width( lo_width ); + $("#loading_overlay").offset( $("#enlargement_container").offset() ); + $("#loading_message").offset( + { 'top': lo_height / 2 - $("#loading_message").height() / 2, + 'left': lo_width / 2 - $("#loading_message").width() / 2 }); //Set viewbox widht and height to widht and height of $('#svgenlargement svg'). //This is essential to make sure zooming and panning works properly. $('#svgenlargement ellipse').attr( {stroke:'green', fill:'#b3f36d'} ); @@ -43,11 +51,10 @@ function svgEnlargementLoaded() { svg_g.setAttribute('transform', transform); //used to calculate min and max zoom level: start_element_height = $("#svgenlargement .node title:contains('#START#')").siblings('ellipse')[0].getBBox().height; - add_relations(); - // $('#loading_overlay').hide(); + add_relations( function() { $('#loading_overlay').hide(); }); } -function add_relations() { +function add_relations( callback_fn ) { var basepath = getRelativePath(); var textrelpath = getRelationshipURL(); $.getJSON( basepath + '/definitions', function(data) { @@ -68,7 +75,8 @@ function add_relations() { node_obj.set_draggable( false ); node_obj.ellipse.data( 'node_obj', null ); } - }) + }); + callback_fn.call(); }); }); } @@ -493,7 +501,7 @@ $(document).ready(function () { $(".ui-widget-overlay").css("background", "none"); $("#dialog_overlay").show(); $("#dialog_overlay").height( $("#enlargement_container").height() ); - $("#dialog_overlay").width( $("#enlargement_container").width() ); + $("#dialog_overlay").width( $("#enlargement_container").innerWidth() ); $("#dialog_overlay").offset( $("#enlargement_container").offset() ); }, close: function() { diff --git a/stemmaweb/root/src/relate.tt b/stemmaweb/root/src/relate.tt index 07b9b0a..89ca08c 100644 --- a/stemmaweb/root/src/relate.tt +++ b/stemmaweb/root/src/relate.tt @@ -19,7 +19,10 @@ $(function() {
-
+
+
Loading, please wait...
+
+
diff --git a/stemmaweb/script/stemmaweb_test.pl b/stemmaweb/script/stemmaweb_test.pl index 7274133..93f9c49 100755 --- a/stemmaweb/script/stemmaweb_test.pl +++ b/stemmaweb/script/stemmaweb_test.pl @@ -1,4 +1,5 @@ #!/usr/bin/env perl +eval { no warnings; $DB::deep = 1000; binmode $DB::OUT, ':utf8' }; use Catalyst::ScriptRunner; Catalyst::ScriptRunner->run('stemmaweb', 'Test');