'.$lt{'stdno'}.' | '.
''.
&prettyprint('stdno',$dynmeta{'stdno'}).
@@ -739,7 +799,7 @@ sub print_dynamic_metadata {
$r->print(''.
&mt('Detailed Assessment Statistical Data').
'');
- my $table = ''.
+ my $table = ''.
''.
'Course | '.
'Section(s) | '.
@@ -799,7 +859,7 @@ sub print_dynamic_metadata {
exists($dynmeta{'correct'}) ||
exists($dynmeta{'technical'})){
$r->print(''.&mt('Evaluation Data').''.
- '');
+ '');
foreach ('clear','depth','helpful','correct','technical') {
$r->print(''.$lt{$_}.' | '.
''.
@@ -810,8 +870,8 @@ sub print_dynamic_metadata {
$r->print(''.&mt('No Evaluation Data is available for this resource.').'');
}
$uri=~/^\/res\/(\w+)\/(\w+)\//;
- if ((($ENV{'user.domain'} eq $1) && ($ENV{'user.name'} eq $2))
- || ($ENV{'user.role.ca./'.$1.'/'.$2})) {
+ if ((($env{'user.domain'} eq $1) && ($env{'user.name'} eq $2))
+ || ($env{'user.role.ca./'.$1.'/'.$2})) {
if (exists($dynmeta{'comments'})) {
$r->print(''.&mt('Evaluation Comments').' ('.
&mt('visible to author and co-authors only').
@@ -861,6 +921,81 @@ sub print_dynamic_metadata {
$r->print(" | ");
return;
}
+sub save_instructor_metadata {
+ my ($r) = @_;
+ my $uri=$r->uri;
+ my $fn=&Apache::lonnet::filelocation('',$uri);
+ my @words = &Apache::loncommon::get_env_multiple('form.keywords');
+ $r->print('This is the save instructor metadata area ');
+ my $mfh;
+ my $formname='store';
+ my $file_content;
+ foreach (sort keys %Apache::lonpublisher::metadatafields) {
+ next if ($_ =~ /\./);
+ my $unikey=$_;
+ $unikey=~/^([A-Za-z]+)/;
+ my $tag=$1;
+ $tag=~tr/A-Z/a-z/;
+ $file_content.= "\n\<$tag";
+ foreach (split(/\,/,
+ $Apache::lonpublisher::metadatakeys{$unikey})
+ ) {
+ my $value=$Apache::lonpublisher::metadatafields{$unikey.'.'.$_};
+ $value=~s/\"/\'\'/g;
+ $file_content.=' '.$_.'="'.$value.'"' ;
+ # print $mfh ' '.$_.'="'.$value.'"';
+ }
+ $file_content.= '>'.
+ &HTML::Entities::encode
+ ($Apache::lonpublisher::metadatafields{$unikey},
+ '<>&"').
+ ''.$tag.'>';
+ }
+
+ foreach my $word (@words) {
+ $r->print('You entered:'.$word.' ');
+ }
+ my $tag = 'keywords';
+ $file_content.= "\n\<$tag";
+ $file_content.= '>'.
+ &HTML::Entities::encode
+ (join(', ',@words),
+ '<>&"').
+ '';
+ $fn =~ /\/portfolio\/(.*)$/;
+ my $new_fn = '/'.$1;
+ $env{'form.'.$formname}=$file_content;
+ $env{'form.'.$formname.'.filename'}=$new_fn;
+ &Apache::lonnet::userfileupload('uploaddoc','',
+ 'portfolio'.$env{'form.currentpath'});
+ my $status =&Apache::lonnet::userfileupload($formname,'','portfolio');
+ if (&Apache::lonnet::userfileupload($formname,'','portfolio') eq 'error: no uploaded file') {
+ $r->print(''.
+ &mt('Could not write metadata').', '.
+ &mt('FAIL').' ');
+ } else {
+ $r->print(''.&mt('Wrote Metadata').
+ ' '.&Apache::lonlocal::locallocaltime(time).
+ ' ');
+ }
+ return 'ok';
+}
+sub present_instructor_metadata {
+ my ($r,$uri, $file_type) = @_;
+ $r->print('This is the instructor metadata area ');
+ my @keywords = sort(split /, /,$env{$env{'form.metacourse'}.'.metadata.keywords'});
+ $r->print($env{'form.metacourse'}.' ');
+ $r->print('');
+ return 'ok';
+}
+
#####################################################
#####################################################
@@ -870,7 +1005,7 @@ sub print_dynamic_metadata {
#####################################################
#####################################################
sub present_editable_metadata {
- my ($r,$uri) = @_;
+ my ($r,$uri, $file_type) = @_;
# Construction Space Call
# Header
my $disuri=$uri;
@@ -878,24 +1013,45 @@ sub present_editable_metadata {
$disuri=~s/^\/\~/\/priv\//;
$disuri=~s/\.meta$//;
my $target=$uri;
- $target=~s/^\/\~/\/res\/$ENV{'request.role.domain'}\//;
+ $target=~s/^\/\~/\/res\/$env{'request.role.domain'}\//;
$target=~s/\.meta$//;
my $bombs=&Apache::lonmsg::retrieve_author_res_msg($target);
if ($bombs) {
- if ($ENV{'form.delmsg'}) {
+ my $showdel=1;
+ if ($env{'form.delmsg'}) {
if (&Apache::lonmsg::del_url_author_res_msg($target) eq 'ok') {
$bombs=&mt('Messages deleted.');
+ $showdel=0;
} else {
$bombs=&mt('Error deleting messages');
}
}
- my $del=&mt('Delete Messages');
+ if ($env{'form.clearmsg'}) {
+ my $cleardir=$target;
+ $cleardir=~s/\/[^\/]+$/\//;
+ if (&Apache::lonmsg::clear_author_res_msg($cleardir) eq 'ok') {
+ $bombs=&mt('Messages cleared.');
+ $showdel=0;
+ } else {
+ $bombs=&mt('Error clearing messages');
+ }
+ }
+ my $del=&mt('Delete Messages for this Resource');
+ my $clear=&mt('Clear all Messages in Subdirectory');
+ my $goback=&mt('Back to Source File');
$r->print(<$disuri
|