fix undefined bug in javascript for wordform-less lexemes
Tara L Andrews [Wed, 6 Jun 2012 20:20:03 +0000 (22:20 +0200)]
lib/stemmaweb/Controller/Relation.pm
root/js/relationship.js

index 8ec7673..4bae11d 100644 (file)
@@ -145,7 +145,6 @@ sub help :Local :Args(1) {
                        $c->log->debug("Warning: could not load $mod");
                }
                my $has_mod = $mod->can('morphology_tags');
-               $DB::single = 1;
                if( $has_mod ) {
                        my $tagset = &$has_mod;
                        $c->stash->{'tagset'} = $tagset;
index a731474..0c34643 100644 (file)
@@ -75,13 +75,15 @@ function morphology_form ( lexlist ) {
        $('#morphology').empty();
        $.each( lexlist, function( idx, lex ) {
                var morphoptions = [];
-               $.each( lex['wordform_matchlist'], function( tdx, tag ) {
-                       var tagstr = stringify_wordform( tag );
-                       morphoptions.push( tagstr );
-               });
+               if( 'wordform_matchlist' in lex ) {
+                       $.each( lex['wordform_matchlist'], function( tdx, tag ) {
+                               var tagstr = stringify_wordform( tag );
+                               morphoptions.push( tagstr );
+                       });
+               }
                var formtag = 'morphology_' + idx;
                var formstr = '';
-               if( lex['form'] ) {
+               if( 'form' in lex ) {
                        formstr = stringify_wordform( lex['form'] );
                } 
                var form_morph_elements = morph_elements( 
@@ -93,8 +95,11 @@ function morphology_form ( lexlist ) {
 }
 
 function stringify_wordform ( tag ) {
-       var elements = tag.split(' // ');
-       return elements[1] + ' // ' + elements[2];
+       if( tag ) {
+               var elements = tag.split(' // ');
+               return elements[1] + ' // ' + elements[2];
+       }
+       return ''
 }
 
 function morph_elements ( formtag, formtxt, currform, morphoptions ) {