[LON-CAPA-cvs] cvs: loncom /interface lonmeta.pm
bisitz
bisitz@source.lon-capa.org
Wed, 27 May 2009 13:29:47 -0000
bisitz Wed May 27 13:29:47 2009 EDT
Modified files:
/loncom/interface lonmeta.pm
Log:
Optimized screen design for Edit Metadata screen:
- Replaced data_table by pick_box which fits better here
- Don't use <h1> for info text
- Added filename style to directory/filename
- Removed unused variable $row_alt
- Added save button at top of table
- Added standard confirm style to confirm save message
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.232 loncom/interface/lonmeta.pm:1.233
--- loncom/interface/lonmeta.pm:1.232 Wed Apr 29 15:20:54 2009
+++ loncom/interface/lonmeta.pm Wed May 27 13:29:47 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.232 2009/04/29 15:20:54 bisitz Exp $
+# $Id: lonmeta.pm,v 1.233 2009/05/27 13:29:47 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1262,7 +1262,8 @@
if ($disuri=~/\/default$/) {
my $dir=$disuri;
$dir=~s/default$//;
- $displayfile=&mt('Default Metadata for Directory [_1]',$dir);
+ $displayfile=&mt('Default Metadata for Directory [_1]'
+ ,'<span class="LC_filename">'.$dir.'</span>');
}
%Apache::lonpublisher::metadatafields=();
%Apache::lonpublisher::metadatakeys=();
@@ -1289,7 +1290,7 @@
}
}
$r->print(<<ENDEDIT);
-<h1>$displayfile</h1>
+<p>$displayfile</p>
<form method="post" action="" name="defaultmeta">
ENDEDIT
my %lt=&fieldnames($file_type);
@@ -1381,9 +1382,11 @@
$lt{$field_name} = $$added_metadata_fields{$field_name};
}
}
- $output .= &Apache::loncommon::start_data_table();
- my $row_alt = 1;
+ $output .= &Apache::lonhtmlcommon::start_pick_box();
+ my $last = $#fields + 1;
+ my $rowcount = 0;
foreach my $field_name (@fields) {
+ $rowcount++;
if (defined($env{'form.new_'.$field_name})) {
my @values = &Apache::loncommon::get_env_multiple('form.new_'.$field_name);
my $newvalue = '';
@@ -1402,31 +1405,32 @@
($field_name eq 'courserestricted'))&&
(!($env{$Apache::lonpublisher::metadatafields{'courserestricted'}.'.metadata.'.$field_name.'.options'} =~ m/deleted/))){
- $output .= "\n".&Apache::loncommon::start_data_table_row();
- $output .= ('<td><span class="LC_metadata">'.$lt{$field_name}.':</span></td><td> '.
- &prettyinput($field_name,
+ $output .= &Apache::lonhtmlcommon::row_title($lt{$field_name})
+ .&prettyinput($field_name,
$Apache::lonpublisher::metadatafields{$field_name},
'new_'.$field_name,'defaultmeta',
undef,undef,undef,undef,
- $Apache::lonpublisher::metadatafields{'courserestricted'}).'</td>');
- $output .= &Apache::loncommon::end_data_table_row();
+ $Apache::lonpublisher::metadatafields{'courserestricted'});
+ $output .= &Apache::lonhtmlcommon::row_closure($rowcount == $last?1:0);
}
} else {
- $output.=(&Apache::loncommon::start_data_table_row().'<td><span class="LC_metadata">'.$lt{$field_name}.':</span></td><td> '.
- &prettyinput($field_name,
+ $output .= &Apache::lonhtmlcommon::row_title($lt{$field_name})
+ .&prettyinput($field_name,
$Apache::lonpublisher::metadatafields{$field_name},
- 'new_'.$field_name,'defaultmeta').'</td>'.&Apache::loncommon::end_data_table_row());
+ 'new_'.$field_name,'defaultmeta')
+ .&Apache::lonhtmlcommon::row_closure($rowcount == $last?1:0);
}
}
- $output .= &Apache::loncommon::end_data_table();
+ $output .= &Apache::lonhtmlcommon::end_pick_box();
if ($env{'form.store'}) {
my ($outcome,$result) = &store_metadata($fn,$uri,'store');
$r->print($result);
}
- $r->print($output.'<br /><input type="submit" title="'.&mt('Save Metadata').'" name="store" value="'.
- &mt('Save').'" />');
+ my $savebutton = '<p><input type="submit" name="store"'
+ .' value="'.&mt('Save').'" title="'.&mt('Save Metadata').'" /></p>';
+ $r->print($savebutton.$output.$savebutton);
if ($file_type eq 'portfolio' || $file_type eq 'groups') {
my ($port_path,$group) = &get_port_path_and_group($uri);
@@ -1499,14 +1503,15 @@
print $mfh ($file_content);
close($mfh);
&update_metadata_table($uri);
- $output .= '<p class="LC_success">';
+ my $confirmtext;
if ($caller eq 'transfer') {
- $output .= &mt('Transferred data in added fields to notes');
+ $confirmtext = &mt('Transferred data in added fields to notes');
} else {
- $output .= &mt('Wrote Metadata');
+ $confirmtext = &mt('Wrote Metadata');
}
- $output .= ' '.&Apache::lonlocal::locallocaltime(time).
- '</p>';
+ $output .= &Apache::loncommon::confirmwrapper(
+ &Apache::lonhtmlcommon::confirm_success(
+ $confirmtext.' '.&Apache::lonlocal::locallocaltime(time)));
$outcome = 'ok';
}
}