--- loncom/interface/lonmeta.pm 2012/11/09 18:56:50 1.248
+++ loncom/interface/lonmeta.pm 2023/11/07 21:31:11 1.257
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.248 2012/11/09 18:56:50 bisitz Exp $
+# $Id: lonmeta.pm,v 1.257 2023/11/07 21:31:11 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -389,9 +389,9 @@ sub select_course {
&mt('You can choose to transfer data from the added fields to the "Notes" field if you are planning to change the course association.').' '.
&Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row().
- '
Copy to notes? '."\n".
- 'Field name '."\n".
- 'Values '."\n".
+ ''.&mt('Copy to notes?').' '."\n".
+ ''.&mt('Field Name').' '."\n".
+ ''.&mt('Values').' '."\n".
&Apache::loncommon::end_data_table_header_row().
$transfernotes.
&Apache::loncommon::end_data_table().' ';
@@ -455,7 +455,7 @@ sub prettyprint {
}
# MIME
if ($type eq 'mime') {
- return ' '.
+ return ' '.
&Apache::loncommon::filedescription($value);
}
# Person
@@ -550,13 +550,17 @@ sub direct {
}
sub selectbox {
- my ($name,$value,$functionref,@idlist)=@_;
+ my ($name,$value,$readonly,$functionref,@idlist)=@_;
if (! defined($functionref)) {
$functionref=\&direct;
}
+ my $disabled;
+ if ($readonly) {
+ $disabled = ' disabled="disabled"';
+ }
my $selout='';
foreach my $id (@idlist) {
- $selout.=''.&{$functionref}($id).' ';
} else {
@@ -582,7 +586,7 @@ sub relatedfield {
}
sub prettyinput {
- my ($type,$value,$fieldname,$formname,
+ my ($type,$value,$readonly,$fieldname,$formname,
$relatedsearchflag,$relatedsep,$relatedvalue,$size,$course_key)=@_;
if (! defined($size)) {
$size = 80;
@@ -661,7 +665,7 @@ sub prettyinput {
# Language
if ($type eq 'language') {
return &selectbox($fieldname,
- $value,
+ $value,'',
\&Apache::loncommon::languagedescription,
(&Apache::loncommon::languageids)).
&relatedfield(0,$relatedsearchflag,$relatedsep);
@@ -669,7 +673,7 @@ sub prettyinput {
# Copyright
if ($type eq 'copyright') {
return &selectbox($fieldname,
- $value,
+ $value,$readonly,
\&Apache::loncommon::copyrightdescription,
(&Apache::loncommon::copyrightids)).
&relatedfield(0,$relatedsearchflag,$relatedsep);
@@ -677,7 +681,7 @@ sub prettyinput {
# Source Copyright
if ($type eq 'sourceavail') {
return &selectbox($fieldname,
- $value,
+ $value,'',
\&Apache::loncommon::source_copyrightdescription,
(&Apache::loncommon::source_copyrightids)).
&relatedfield(0,$relatedsearchflag,$relatedsep);
@@ -704,11 +708,20 @@ sub prettyinput {
}
# Customdistribution file
if ($type eq 'customdistributionfile') {
- return '".&mt('Select').' '.
- &relatedfield(0,$relatedsearchflag,$relatedsep);
+ my $disabled;
+ if ($readonly) {
+ $disabled = ' disabled="disabled"';
+ }
+ my $output;
+ $output = ' ';
+ unless ($readonly) {
+ $output .= '".&mt('Select').' ';
+ }
+ $output .= &relatedfield(0,$relatedsearchflag,$relatedsep);
+ return $output;
}
# Source Customdistribution file
if ($type eq 'sourcerights') {
@@ -763,7 +776,7 @@ sub pageheader {
sub handler {
my $r=shift;
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
- ['currentpath','changecourse']);
+ ['currentpath','changecourse','modal']);
my $uri=$r->uri;
#
# Set document type
@@ -777,9 +790,18 @@ sub handler {
&Apache::lonhtmlcommon::clear_breadcrumbs();
if ($env{'request.state'} eq 'construct') {
+ my $text = 'Authoring Space';
+ my $href = &Apache::loncommon::authorspace($uri);
+ if ($env{'request.course.id'}) {
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ if ($href eq "/priv/$cdom/$cnum/") {
+ $text = 'Course Authoring Space';
+ }
+ }
&Apache::lonhtmlcommon::add_breadcrumb({
- 'text' => 'Construction Space',
- 'href' => &Apache::loncommon::authorspace($uri),
+ 'text' => $text,
+ 'href' => $href,
});
}
@@ -829,7 +851,7 @@ sub handler {
$r->print(&pageheader());
&present_editable_metadata($r,$uri,'groups');
} elsif ($uri=~m|^/priv|) {
- # Construction space
+ # Authoring space
&Apache::lonhtmlcommon::add_breadcrumb({
'text' => 'Edit Metadata',
'href' => '',
@@ -854,7 +876,21 @@ sub handler {
'only_body' => 1,})
.''.&mt('Metadata').' '
);
+ if ($env{'form.modal'}) {
+ my $width = 500;
+ my $height = 400;
+ my $machine = &Apache::lonnet::absolute_url();
+ $r->print(&Apache::loncommon::nicescroll_javascript('metadatawrapper',
+ {cursorcolor => '#00F',
+ railalign => 'right',
+ railoffset => '{top:5,left:40}'},
+ undef,1,$machine.$uri));
+ $r->print('');
+ }
&present_uneditable_metadata($r,$uri);
+ if ($env{'form.modal'}) {
+ $r->print('
');
+ }
}
$r->print(&Apache::loncommon::end_page());
return OK;
@@ -872,7 +908,11 @@ sub report_bombs {
# Set document type
$uri =~ s:/adm/bombs/::;
$uri = &Apache::lonnet::declutter($uri);
- $r->print(''.&Apache::lonnet::clutter($uri).' ');
+ $r->print(
+ ''.&mt('Folder: [_1]',
+ ''.&Apache::lonnet::clutter($uri).' ')
+ .'
'
+ );
my ($domain,$author)=($uri=~/^($match_domain)\/($match_username)\//);
if (!&Apache::lonnet::constructaccess('/priv/'.$domain.'/'.$author.'/')) {
$r->print(''.&mt('Not authorized').'
');
@@ -965,7 +1005,7 @@ sub present_uneditable_metadata {
$currentversion :
&mt('information not available')).')';
} else {
- $versiondisplay='Version: '.$currentversion;
+ $versiondisplay=&mt('Version: [_1]',$currentversion);
}
}
# crumbify displayed URL uri target prefix form
@@ -983,7 +1023,7 @@ sub present_uneditable_metadata {
my $table='';
my $title = $content{'title'};
if (! defined($title)) {
- $title = 'Untitled Resource';
+ $title = &mt('Untitled Resource');
}
my @fields;
if ($uploaded) {
@@ -1118,6 +1158,7 @@ sub print_dynamic_metadata {
if (exists($dynmeta{'stats'})) {
my $table=&Apache::loncommon::start_data_table()
.&Apache::loncommon::start_data_table_header_row()
+ .''.&mt('Domain').' '
.''.&mt('Course').' '
.''.&mt('Section(s)').' '
.''.&mt('Num Students').' '
@@ -1138,6 +1179,8 @@ sub print_dynamic_metadata {
next;
}
$table .= &Apache::loncommon::start_data_table_row();
+ $table .=
+ ''.$courseinfo{'domain'}.' ';
$table .=
''.$courseinfo{'description'}.' ';
$table .=
@@ -1174,7 +1217,6 @@ sub print_dynamic_metadata {
&mt('No Assessment Statistical Data is available for this resource').
'');
}
-
#
# Evaluation Data
$r->print(''.&mt('Evaluation Data').' ');
@@ -1289,9 +1331,19 @@ sub print_dynamic_metadata {
#####################################################
sub present_editable_metadata {
my ($r,$uri,$file_type) = @_;
- # Construction Space Call
+ # Authoring Space Call
# Header
my $disuri=$uri;
+ my ($courseauthor,$crsaurights,$readonly);
+ if ($env{'request.course.id'}) {
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ if ($uri =~ m{^\Q/priv/$cdom/$cnum/\E}) {
+ $courseauthor = $cnum.':'.$cdom;
+ $crsaurights = "/res/$cdom/$cnum/default.rights";
+ $readonly = 1;
+ }
+ }
my $fn=&Apache::lonnet::filelocation('',$uri);
$disuri=~s{^/\~}{/priv/};
$disuri=~s/\.meta$//;
@@ -1306,7 +1358,12 @@ sub present_editable_metadata {
my $bombs=&Apache::lonmsg::retrieve_author_res_msg($target);
if ($bombs) {
# Display Bombs, not Metadata
- $r->print("$disuri ");
+ $r->print(
+ ''.&mt('Error Messages').' '
+ .''.&mt('Folder: [_1]',
+ ''.$disuri.' ')
+ .'
'
+ );
my $showbuttons=1;
my $message='';
my $rc='';
@@ -1367,7 +1424,7 @@ sub present_editable_metadata {
# Display Metadata, not Bombs
my $displayfile =
&mt('Metadata for [_1]'
- ,'');
+ ,''.$disuri.' ');
if ($disuri=~/\/default$/) {
my $dir=$disuri;
$dir=~s/default$//;
@@ -1403,7 +1460,7 @@ sub present_editable_metadata {
}
}
$r->print(<$displayfile
+$displayfile