sub index :Path :Args(0) {
my ( $self, $c ) = @_;
+ # Are we being asked to load a text immediately? If so
+ if( $c->req->param('withtradition') ) {
+ $c->stash->{'withtradition'} = $c->req->param('withtradition');
+ }
$c->stash->{template} = 'index.tt';
}
my $stemma = $tradition->stemma( $stemid );
$c->stash->{svg} = $stemma->as_svg( { size => [ 600, 350 ] } );
$c->stash->{graphdot} = $stemma->editable({ linesep => ' ' });
+ $c->stash->{text_id} = $textid;
$c->stash->{text_title} = $tradition->name;
$c->stash->{template} = 'stexaminer.tt';
<ul>
[% SET i = 0 -%]
[% FOREACH t IN usertexts -%]
- <li><span class="traditionname" onClick="$('.traditionname').removeClass('selected');$(this).addClass('selected');loadTradition('[% t.id %]','[% t.name %]', 1)">[% t.name %]</span></li>
+ <li><span id="[% t.id %]" class="traditionname" onClick="$('.traditionname').removeClass('selected');$(this).addClass('selected');loadTradition('[% t.id %]','[% t.name %]', 1)">[% t.name %]</span></li>
[% i = i + 1 -%]
[% END -%]
</ul>
<ul>
[% SET i = 0 -%]
[% FOREACH t IN publictexts -%]
- <li><span class="traditionname" onClick="$('.traditionname').removeClass('selected');$(this).addClass('selected');loadTradition('[% t.id %]','[% t.name %]', 0)">[% t.name %]</span></li>
+ <li><span id="[% t.id %]" class="traditionname" onClick="$('.traditionname').removeClass('selected');$(this).addClass('selected');loadTradition('[% t.id %]','[% t.name %]', 0)">[% t.name %]</span></li>
[% i = i + 1 -%]
[% END -%]
</ul>
if( basepath.lastIndexOf('/') == basepath.length - 1 ) {
basepath = basepath.slice( 0, basepath.length - 1)
};
+var textOnLoad = "[% withtradition %]";
var selectedTextID;
var selectedTextInfo;
var selectedStemmaID = -1;
if (status == "error") {
var msg = "An error occurred: ";
$("#directory").html(msg + xhr.status + " " + xhr.statusText);
+ } else {
+ if( textOnLoad != "" ) {
+ // Call the click callback for the relevant text, if it is
+ // in the page.
+ $('#'+textOnLoad).click();
+ textOnLoad = "";
+ }
}
}
);
<div id="topbanner">
<h1>Stemmaweb - a collection of tools for analysis of collated texts</h1>
- <span class="mainnav">[% IF c.user_exists %]Hello! [% c.user.get_object.email %] <a class="navlink" href="[% c.uri_for( '/logout' ) %]">Sign out</a> | [% ELSE %]<a class="navlink" onclick="window.open('[% c.uri_for( '/login' ) %]', 'loginwindow', 'height=385,width=445')">Login</a> | <a class="navlink" onclick="window.open('[% c.uri_for( '/register' ) %]', 'regwindow', 'height=385,width=445')">Register</a> | [% END %]<a class="navlink" href="[% c.uri_for( 'about.html' ) %]">About</a> </span>
+ <span class="mainnav">[% IF c.user_exists %]Hello! [% c.user.get_object.email %] <a class="navlink" href="[% c.uri_for( '/logout' ) %]">Sign out</a> | [% ELSE %]<a class="navlink" onclick="window.open('[% c.uri_for( '/login' ) %]', 'loginwindow', 'height=385,width=445')">Login</a> | [% END %]<a class="navlink" href="[% c.uri_for( 'about.html' ) %]">About</a> </span>
</div>
<div id="directory_container">
<h2>Text directory</h2>
<div id="topbanner">
<div id="bannerinfo">
- <a href="help/[% text_lang %]" title="Relationship mapper help" class="helptag">Help / About</a>
+ <a href="help/[% text_lang %]" title="Relationship mapper help" class="helptag">Help / About</a> | <a href="[% c.uri_for( '/' ) %]?withtradition=[% textid %]" class="navlink">Return to index</a>
</div>
<h1>Relationship mapper</h1>
<h2>[% text_title %]</h2>
[% END -%]
<div id="topbanner">
<div id="bannerinfo">
- <a href="help" title="Stexaminer help" class="navlink" id="aboutlink">Help / About</a>
+ <a href="help" title="Stexaminer help" class="navlink" id="aboutlink">Help / About</a> | <a href="[% c.uri_for( '/' ) %]?withtradition=[% text_id %]" title="Index" class="navlink">Return to index</a>
</div>
<h1>Stexaminer</h1>
<h2>[% text_title %]</h2>