#!/usr/bin/perl -
use open qw(:std :utf8);
binmode(STDOUT, ":encoding(UTF-8)");
use strict ;
use Apache2::Connection ();
my ($no_access, $db, $dbh, $r, $req, $user, $output, $count, $table, $sth, @row, $user_language, $javascript_in_head, $surname, $givenName, $admin_school,
$admin_system, $directory, $sub_directory, $filename, $add_time, $thesis_id, $icon, $size, $display_size, $target, $document_id, $home_org, $affiliation,
$how_many_thesis, $no_of_thesis, $person_id, $school_id, $field_of_study_id, $degree_title_id, $thesis_name_en, $thesis_name_fi, $thesis_name_sv, $link, $sth_inner,
$field_of_study_id_name_fi, $field_of_study_id_name_en, $field_of_study_id_name_sv, $degree_title_name_fi, $degree_title_name_en, $degree_title_name_sv, $allowed_school_name_fi,
$school_name_fi, $school_name_sv, $school_name_en, $students_name, $first_name, $school_claus, $field_of_study_claus, $degree_title_claus, $thesis_name_claus, $description,
$search1, $search2, $students_name_claus, @split, $match, $video_count, $max_videos, $unique_code1, $link_to_theseus, $current_page, $random_key, $random_key_id, $random_key_access_id,
$user_can_make_course, $query_string) ;
$r = shift ;
$req = Apache2::Request->new($r);
$javascript_in_head = "" ;
$dbh = thesis::header($r, \$user, \$db, $javascript_in_head, \$user_language, \$surname, \$givenName, \$no_access, \$admin_system, \$admin_school, \$home_org, \$affiliation, \$person_id, 0, \$current_page) ;
$query_string = $r->args ;
if ($dbh != 1){
$output = thesis::load_language_and_standard_variables ($user_language) ;
if ($no_access){
}
else{
if ($query_string){
# user getting access to a course
$sth = thesis::query("SELECT random_key_id FROM random_key WHERE random_key='$query_string'", $dbh) ;
($random_key_id) = $sth->fetchrow() ;
$sth->finish ;
$sth = thesis::query("SELECT random_key_access_id FROM random_key_access WHERE random_key_id=$random_key_id AND person_id=$person_id", $dbh) ;
($random_key_access_id) = $sth->fetchrow() ;
$sth->finish ;
if (!$random_key_access_id){
$sth = thesis::query ("INSERT INTO random_key_access VALUES (NULL, $random_key_id, $person_id)", $dbh) ;
}
}
$sth = thesis::query("SELECT count(thesis_id) FROM thesis WHERE person_id=$person_id", $dbh) ;
($no_of_thesis) = $sth->fetchrow() ;
$sth->finish ;
$sth = thesis::query("SELECT how_many_thesis FROM allowed_schools WHERE home_org='$home_org'", $dbh) ;
($how_many_thesis) = $sth->fetchrow() ;
$sth->finish ;
#print "
USE IN PORTRAIT MODE!
" ;
thesis::menu ($db, $dbh, $output, $user, $user_language, $surname, $givenName, $admin_system, $admin_school) ;
$sth = thesis::query("SELECT count(thesis.thesis_id) FROM document, thesis
WHERE document.thesis_id = thesis.thesis_id AND thesis.person_id = $person_id
AND thesis.random_key_id < 1 AND deleted < 1
AND extension='webm'", $dbh) ;
($video_count) = $sth->fetchrow() ;
$sth->finish ;
$max_videos = $how_many_thesis - $video_count ;
if ($user eq "alexsc01" || $user eq "virpte01"){
$max_videos = 1 ;
}
print "
". thesis::language ($output, "index_front_page_virpi00") ."
$givenName $surname!
". thesis::language ($output, "index_front_page_virpi01") ."
". thesis::language ($output, "index_front_page_virpi02") ."
". thesis::language ($output, "index_front_page_virpi03") ."
". thesis::language ($output, "index_front_page_virpi04") ."
" ;
if ($max_videos < 1){
print "
| ". thesis::language ($output, "exceeded_max_videos_amount") ." |
| ". thesis::language ($output, "view_my_videos") ." |
" ;
}
else{
print "
". thesis::language ($output, "make_my_video") ."
" ;
print "
" ;
}
}
}
thesis::footer($output, $user_language) ;