--- loncom/interface/lonaboutme.pm 2009/06/08 18:04:45 1.137
+++ loncom/interface/lonaboutme.pm 2010/03/29 12:21:38 1.146
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Personal Information Page
#
-# $Id: lonaboutme.pm,v 1.137 2009/06/08 18:04:45 bisitz Exp $
+# $Id: lonaboutme.pm,v 1.146 2010/03/29 12:21:38 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -168,16 +168,22 @@ sub handler {
if ($is_course) {
if ($target ne 'tex') {
- my $brcrum = [{href=>"/adm/navmaps",text=>"Navigate Course Contents"},
- {href=>"/adm/aboutme",text=>"Course Information"}];
- my $start_page =
- &Apache::loncommon::start_page(
- "Course Information",
- undef,
- {'function' => $env{'forcestudent'},
- 'domain' => $cdom,
- 'force_register' => $env{'forceregister'},
- 'bread_crumbs' => $brcrum});
+ my $args = {'function' => $env{'forcestudent'},
+ 'domain' => $cdom};
+ if ($env{'form.register'}) {
+ $args->{'force_register'} = $env{'form.register'};
+ } else {
+ my %coursedescription =
+ &Apache::lonnet::coursedescription($cdom.'_'.$cnum);
+ my $cdescr = $coursedescription{'description'};
+ my $brcrum = [{href=>"/adm/$cdom/$cnum/aboutme",
+ text=>&mt('Course Information - [_1]',$cdescr),
+ no_mt=>1}
+ ];
+ $args->{'bread_crumbs'} = $brcrum;
+ }
+ my $start_page = &Apache::loncommon::start_page(
+ "Course Information",undef,$args);
$r->print($start_page);
$r->print('
'.&mt('Group Portfolio').'
');
&print_portfiles_link($r,$is_course);
@@ -190,11 +196,6 @@ sub handler {
my $forcestudent='';
if ($env{'form.forcestudent'}) { $forcestudent='student'; };
- my $forceregister = '';
- if ($forcestudent eq '') {
- $forceregister = $env{'form.register'};
- }
-
#------------Get rights
my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum);
my %syllabus=&Apache::lonnet::dump('aboutme',$cdom,$cnum);
@@ -203,22 +204,72 @@ sub handler {
($env{'user.domain'} eq $cdom));
if ($forcestudent or $target eq 'tex') { $allowed=0; }
-
# --------------------------------------- There is such a user, get environment
if ($target ne 'tex') {
my $rss_link = &Apache::lonrss::rss_link($cnum,$cdom);
- my $args = {'function' => $forcestudent,
+ my $args = {'function' => undef,
'domain' => $cdom,
- 'force_register' => $forceregister};
- if ($env{'form.popup'}) {
+ 'force_register' => $env{'form.register'},
+ };
+ if ($env{'form.popup'}) { # Don't show breadcrumbs in popup window
$args->{'no_nav_bar'} = 1;
- } else { # Don't show breadcrumbs in popup window
- $args->{'bread_crumbs'} = [{href=>"/adm/$cdom/$cnum/aboutme",text=>"Personal Information Page"}];
+ } elsif (!$env{'form.register'}) { #Don't show breadcrumbs twice, when this page is part of course content and you call it
+ $args->{'bread_crumbs'} = [{href=>"/adm/$cdom/$cnum/aboutme",
+ text=>"Personal Information Page"}];
}
my $start_page = &Apache::loncommon::start_page('Personal Information Page',$rss_link,$args);
$r->print($start_page);
+ }
+#----------------Print Functions
+ if ($target ne 'tex') {
+ my $functions=&Apache::lonhtmlcommon::start_funclist();
+ if ($allowed) {
+ my $query_string = &build_query_string(
+ {'forcestudent' => '1',
+ 'popup' => $env{'form.popup'}});
+ $functions.=&Apache::lonhtmlcommon::add_item_funclist(
+ ''
+ .&mt('Show Public View').''
+ .&Apache::loncommon::help_open_topic(
+ 'Uploaded_Templates_PublicView'));
+ } elsif ($privleged) {
+ my $query_string = &build_query_string(
+ {'forceedit' => '1',
+ 'popup' => $env{'form.popup'}});
+ $functions.=&Apache::lonhtmlcommon::add_item_funclist(
+ ''
+ .&mt('Edit').'');
+ }
+ $functions.=&Apache::lonhtmlcommon::add_item_funclist(
+ &Apache::lontemplate::send_message($r,$cnum,$cdom));
+
+ if ($env{'request.course.id'} &&
+ &Apache::lonnet::allowed('srm',$env{'request.course.id'}) &&
+ &in_course($cdom,$cnum)) {
+ if (&Apache::lonnet::allowed('vsa', $env{'request.course.id'}) ||
+ &Apache::lonnet::allowed('vsa', $env{'request.course.id'}.'/'.$env{'request.course.sec'})) {
+ $functions.=&Apache::lonhtmlcommon::add_item_funclist(
+ &Apache::loncommon::track_student_link(
+ 'View recent activity by this student',$cnum,$cdom));
+ }
+ if (&Apache::lonnet::allowed('vgr', $env{'request.course.id'}) ||
+ &Apache::lonnet::allowed('vgr', $env{'request.course.id'}.'/'.$env{'request.course.sec'})) {
+ $functions.=&Apache::lonhtmlcommon::add_item_funclist(
+ &Apache::loncommon::slot_reservations_link(
+ 'Slot reservation history',$cnum,$cdom));
+ }
+ $functions.=&Apache::lonhtmlcommon::add_item_funclist(
+ &Apache::loncommon::noteswrapper(
+ &mt('Add Records'),$cnum,$cdom));
+ }
+ $functions.=&Apache::lonhtmlcommon::end_funclist();
+ $r->print(&Apache::loncommon::head_subbox($functions));
+ }
+
+# Print Privacy Note
+ if ($target ne 'tex') {
#Print Privacy Note
if ($allowed) {
$r->print(''
@@ -227,9 +278,11 @@ sub handler {
.'
'
);
}
+ }
#Print last modified
+ if ($target ne 'tex') {
my $lastmod;
if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) {
$lastmod=$syllabus{'uploaded.lastmodified'};
@@ -246,37 +299,6 @@ sub handler {
}
}
-#----------------Print Functions
- if ($target ne 'tex') {
- $r->print(&Apache::lontemplate::start_functionslist());
- if ($allowed) {
- my $query_string = &build_query_string({'forcestudent' => '1','popup' => $env{'form.popup'}});
- $r->print(&Apache::lontemplate::item_functionslist(
- ''.&mt('Show Public View').''
- .&Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView')));
- } elsif ($privleged) {
- my $query_string = &build_query_string({'forceedit' => '1','popup' => $env{'form.popup'}});
- $r->print(&Apache::lontemplate::item_functionslist(
- ''. &mt('Edit').''));
- }
- $r->print(&Apache::lontemplate::item_functionslist(
- &Apache::lontemplate::send_message($r,$cnum,$cdom)));
-
- if ($env{'request.course.id'} && &Apache::lonnet::allowed('srm',$env{'request.course.id'}) && &in_course($cdom,$cnum)) {
- if (&Apache::lonnet::allowed('vsa', $env{'request.course.id'}) || &Apache::lonnet::allowed('vsa', $env{'request.course.id'}.'/'.$env{'request.course.sec'})) {
- $r->print(&Apache::lontemplate::item_functionslist(
- &Apache::loncommon::track_student_link('View recent activity by this student',$cnum,$cdom)));
- }
- if (&Apache::lonnet::allowed('vgr', $env{'request.course.id'}) ||
- &Apache::lonnet::allowed('vgr', $env{'request.course.id'}.'/'.$env{'request.course.sec'})) {
- $r->print(&Apache::lontemplate::item_functionslist(
- &Apache::loncommon::slot_reservations_link('Slot reservation history',$cnum,$cdom)));
- }
- $r->print(&Apache::lontemplate::item_functionslist(
- &Apache::loncommon::noteswrapper(&mt('Add Records'),$cnum,$cdom)));
- }
- $r->print(&Apache::lontemplate::end_functionslist());
- }
#------Print Headtitle
if ($target ne 'tex') {
$r->print('');
@@ -301,7 +323,8 @@ sub handler {
&Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
}
$syllabus{'uploaded.photourl'}=
- &Apache::lonnet::userphotoupload('uploaddoc','aboutme');
+ &Apache::lonnet::userfileupload('uploaddoc',undef,'aboutme',
+ undef,undef,undef,undef,undef,undef,undef,'400','500');
}
$syllabus{'uploaded.lastmodified'}=time;
&Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum);
@@ -330,38 +353,35 @@ sub handler {
if ($syllabus{'uploaded.photourl'}) {
&Apache::lonnet::allowuploaded('/adm/aboutme',$syllabus{'uploaded.photourl'});
- #This call is to resize all "Personal Information" images in the LonCapa System. When its done, you can remove this line.
- &Apache::lonnet::resizeImage(&Apache::lonnet::filelocation('',$syllabus{'uploaded.photourl'}));
- #---End Resize---
-
- $image=qq{

};
+ $image=qq|

|;
if ($target eq 'tex') {
$image=&Apache::lonxml::xmlparse($r,'tex',$image);
}
-
}
if ($allowed) {
$r->print(
- '
');
if ($syllabus{'uploaded.photourl'}) {
- $r->print('
')
+ $r->print('
')
}
- $r->print('
');
+ $r->print('
');
}
if($allowed) {
- $r->print('
';
+ } elsif ($is_course) {
+ $output .= ''.&mt('There are currently no publicly accessible or password protected group portfolio files.').'
';
}
$r->print($output);
return;
@@ -542,34 +563,47 @@ sub display_portfolio_header {
my ($r,$is_course) = @_;
my ($cdom,$cnum,$name) = &aboutme_info($r,$is_course);
my $query_string = &build_query_string();
- &Apache::lonhtmlcommon::clear_breadcrumbs();
- my $forcestudent='';
- if ($env{'form.forcestudent'}) { $forcestudent='student'; };
-
+ my $args = {'domain' => $cdom};
+ if ($env{'form.forcestudent'}) {
+ $args->{'function'} = 'student';
+ }
my $output;
if ($is_course) {
- $output =
- &Apache::loncommon::start_page('Viewable group portfolio files',undef,
- {'function' => $forcestudent,
- 'domain' => $cdom,});
- $output .= ''.&mt('Group Portfolio files').'
';
- } else {
- $output =
- &Apache::loncommon::start_page('Viewable portfolio files',undef,
- {'function' => $forcestudent,
- 'domain' => $cdom,});
- if (!($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public')) {
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"/adm/$cdom/$cnum/aboutme".$query_string,
- text=>&mt('Personal Information Page - [_1]',$name),
- title=>&mt('Go to personal information page for [_1]', $name)},
- {href=>"/adm/$cdom/$cnum/aboutme/portfolio",
- text=>&mt('Viewable files - [_1]', $name),
- title=>&mt('Viewable portfolio files for [_1]', $name)}
- );
- $output .= &Apache::lonhtmlcommon::breadcrumbs(&mt('Viewable portfolio files.'));
+ if (($env{'request.course.id'} eq $cdom.'_'.$cnum) &&
+ ($env{'form.register'})) {
+ $args->{force_register} = $env{'form.register'};
+ } else {
+ my %coursedescription = &Apache::lonnet::coursedescription($cdom.'_'.$cnum);
+ my $cdescr = $coursedescription{'description'};
+ my $brcrum = [{href=>"/adm/$cdom/$cnum/aboutme".$query_string,
+ text=>&mt('Course Information - [_1]',$cdescr),
+ no_mt=>1},
+ {href=>"/adm/$cdom/$cnum/aboutme/portfolio".$query_string,
+ text=>'Viewable group portfolio files'}
+ ];
+ $args->{bread_crumbs} = $brcrum;
}
- $output .= ''.&mt('Portfolio files for [_1]',$name).'
';
+ $output = &Apache::loncommon::start_page('Viewable group portfolio files',undef,$args).
+ ''.&mt('Group Portfolio files').'
';
+ } else {
+ if ($env{'request.course.id'} && $env{'form.register'}) {
+ $args->{force_register} = $env{'form.register'};
+ } else {
+ my $brcrum = [{href => "/adm/$cdom/$cnum/aboutme".$query_string,
+ text => &mt('Personal Information Page - [_1]',$name),
+ title => &mt('Go to personal information page for [_1]',$name),
+ no_mt => 1},
+ {href => "/adm/$cdom/$cnum/aboutme/portfolio".$query_string,
+ text => 'Viewable files',
+ title => &mt('Viewable portfolio files for [_1]',$name),
+ no_mt => 1}
+ ];
+ $args->{bread_crumbs} = $brcrum;
+ }
+ $output =
+ &Apache::loncommon::start_page('Viewable portfolio files',
+ undef,$args).
+ ''.&mt('Portfolio files for [_1]',$name).'
';
}
$r->print($output);
return;
@@ -599,23 +633,28 @@ sub display_portfolio_files {
}
$output .= '>'.$lt{$type}.'';
}
- $output .= ''."\n".
- '';
- $output .= '
';
+ $output .= ''."\n";
+ if ($env{'form.register'}) {
+ $output .= ''."\n";
+ }
+ $output .= ''.
+ '
';
$r->print($output);
my $filecounts = &portfolio_files($r,'listfiles',\%lt,$is_course,
$cdom,$cnum,$name);
if (!($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public')) {
- my $query_string = &build_query_string();
- $r->print('
');
- if ($is_course) {
- $r->print(&mt('Course Information page'));
- } else {
- $r->print(&mt('Information about [_1]',$name));
+ if ($env{'request.course.id'} && $env{'form.register'}) {
+ my $query_string = &build_query_string();
+ $r->print('
');
+ if ($is_course) {
+ $r->print(&mt('Course Information page'));
+ } else {
+ $r->print(&mt('Information about [_1]',$name));
+ }
+ $r->print('');
}
- $r->print('');
}
return;
}
@@ -785,7 +824,7 @@ sub parse_directory {
$output.='';
if ($have_meta) {
$output.= ' ';
}
$output .= ' | '
@@ -806,7 +845,7 @@ sub aboutme_access {
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
if (($cdom eq '') || ($cnum eq '')) {
- my %coursehash = &coursedescription($env{'request.course.id'});
+ my %coursehash = &Apache::lonnet::coursedescription($env{'request.course.id'});
$cdom = $coursehash{'domain'};
$cnum = $coursehash{'cnum'};
}