version 1.155, 2006/08/12 22:41:53
|
version 1.159, 2006/08/16 17:58:54
|
Line 164 TABLE
|
Line 164 TABLE
|
} |
} |
|
|
sub display_directory_line { |
sub display_directory_line { |
my ($r,$select_mode,$fullpath, $filename, $mtime, $size, $css_class, |
my ($r,$select_mode, $filename, $mtime, $size, $css_class, |
$line, $access_controls, $curr_access, $now, $version_flag, |
$line, $access_controls, $curr_access, $now, $version_flag, |
$href_location, $url, $current_path, $access_admin_text, $versions)=@_; |
$href_location, $url, $current_path, $access_admin_text, $versions)=@_; |
# my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); |
|
|
my $fullpath = &prepend_group($current_path.$filename); |
$r->print('<tr class="'.$css_class.'">'); |
$r->print('<tr class="'.$css_class.'">'); |
$r->print($line); # contains first two cells of table |
$r->print($line); # contains first two cells of table |
$filename = $filename; |
|
$filename = &prepend_group($filename); |
|
my $lock_info; |
my $lock_info; |
if ($$version_flag{$filename}) { # versioned can't be versioned, so TRUE when root file |
if ($version_flag) { # versioned can't be versioned, so TRUE when root file |
$r->print('<td><img alt="" src="'.&Apache::loncommon::icon($filename).'" /></td>'); |
$r->print('<td><img alt="" src="'.&Apache::loncommon::icon($filename).'" /></td>'); |
$r->print('<td>'.$$version_flag{$filename}.'</td>'); |
$r->print('<td>'.$version_flag.'</td>'); |
} else { # this is a graded or handed back file |
} else { # this is a graded or handed back file |
my ($user,$domain) = &get_name_dom(); |
my ($user,$domain) = &get_name_dom(); |
my $permissions_hash = &Apache::lonnet::get_portfile_permissions($domain,$user); |
my $permissions_hash = &Apache::lonnet::get_portfile_permissions($domain,$user); |
if (defined($filename) && defined($$permissions_hash{'/'.$filename})) { |
if (defined($$permissions_hash{$fullpath})) { |
foreach my $array_item (@{$$permissions_hash{'/'.$filename}}) { |
foreach my $array_item (@{$$permissions_hash{$fullpath}}) { |
if (ref($array_item) eq 'ARRAY') { |
if (ref($array_item) eq 'ARRAY') { |
if ($$array_item[(@$array_item - 1)] eq 'handback') { |
if ($$array_item[-1] eq 'handback') { |
$lock_info = 'Handback'; |
$lock_info = 'Handback'; |
} elsif ($$array_item[(@$array_item - 1)] eq 'graded') { |
} elsif ($$array_item[-1] eq 'graded') { |
$lock_info = 'Graded'; |
$lock_info = 'Graded'; |
} |
} |
} |
} |
} |
} |
} |
} |
if ($lock_info) { |
if ($lock_info) { |
my %anchor_fields = ( |
my %anchor_fields = ('lockinfo' => $fullpath); |
'lockinfo' => '/'.$filename |
$lock_info = &make_anchor(undef,\%anchor_fields,$lock_info); |
); |
} |
$lock_info = &make_anchor(undef,\%anchor_fields,$lock_info); |
$r->print('<td colspan="2">'.$lock_info.'</td>'); |
} |
|
$r->print('<td colspan="2">'.$lock_info.'</td>'); |
|
} |
} |
# $r->print('<td>'.$$version_flag{$filename}.'</td><td>'); |
# $r->print('<td>'.$$version_flag{$filename}.'</td><td>'); |
$r->print('<td>'.&make_anchor($href_location.$filename,undef,$filename).'</td>'); |
$r->print('<td>'.&make_anchor($href_location.$filename,undef,$filename).'</td>'); |
Line 265 sub display_directory {
|
Line 262 sub display_directory {
|
my $href_location="/uploaded/$udom/$uname/$port_path".$current_path; |
my $href_location="/uploaded/$udom/$uname/$port_path".$current_path; |
my $href_edit_location="/editupload/$udom/$uname/$port_path".$current_path; |
my $href_edit_location="/editupload/$udom/$uname/$port_path".$current_path; |
my @dir_lines; |
my @dir_lines; |
my @version_lines; |
|
my %versioned; |
my %versioned; |
foreach my $dir_line (sort |
foreach my $dir_line (sort |
{ |
{ |
Line 279 sub display_directory {
|
Line 275 sub display_directory {
|
$filename =~ s/\s+$//; |
$filename =~ s/\s+$//; |
my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename); |
my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename); |
if ($version) { |
if ($version) { |
push(@version_lines, [$filename,$dom,$testdir,$size,$mtime,$obs]); |
my $fullpath = &prepend_group($current_path.$fname.'.'.$extension); |
$versioned{$fname.'.'.$extension} .= $version.","; |
push(@{ $versioned{$fullpath} }, |
|
[$filename,$dom,$testdir,$size,$mtime,$obs,]); |
} else { |
} else { |
push(@dir_lines, [$filename,$dom,$testdir,$size,$mtime,$obs]); |
push(@dir_lines, [$filename,$dom,$testdir,$size,$mtime,$obs]); |
} |
} |
Line 289 sub display_directory {
|
Line 286 sub display_directory {
|
my ($filename,$dom,$testdir,$size,$mtime,$obs) = @$dir_line; |
my ($filename,$dom,$testdir,$size,$mtime,$obs) = @$dir_line; |
my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename); |
my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename); |
if (($filename ne '.') && ($filename ne '..') && ($filename !~ /\.meta$/ ) && ($filename !~ /(.*)\.(\d+)\.([^\.]*)$/)) { |
if (($filename ne '.') && ($filename ne '..') && ($filename !~ /\.meta$/ ) && ($filename !~ /(.*)\.(\d+)\.([^\.]*)$/)) { |
my %version_flag; |
my $version_flag; |
my $show_versions; |
my $show_versions; |
|
my $fullpath = &prepend_group($current_path.$filename); |
if ($env{'form.showversions'} eq $filename) { |
if ($env{'form.showversions'} eq $filename) { |
$show_versions = 'true'; |
$show_versions = 'true'; |
} |
} |
if (exists($versioned{$filename})) { |
if (exists($versioned{$fullpath})) { |
my %anchor_fields = ( |
my %anchor_fields = ( |
'selectfile' => $filename, |
'selectfile' => $fullpath, |
'continue' => 'false', |
'continue' => 'false', |
'currentpath' => $current_path, |
'currentpath' => $current_path, |
); |
); |
if ($show_versions) { |
if ($show_versions) { |
$version_flag{$filename} = &make_anchor('portfolio',\%anchor_fields, |
$version_flag = &make_anchor('portfolio',\%anchor_fields, |
'<img class="LC_icon" alt="'.&mt('opened folder').'" src="'.$iconpath.'folder_pointer_opened.gif" />'); |
'<img class="LC_icon" alt="'.&mt('opened folder').'" src="'.$iconpath.'folder_pointer_opened.gif" />'); |
} else { |
} else { |
$anchor_fields{'showversions'} = $filename; |
$anchor_fields{'showversions'} = $filename; |
$version_flag{$filename} = &make_anchor('portfolio',\%anchor_fields, |
$version_flag = &make_anchor('portfolio',\%anchor_fields, |
'<img class="LC_icon" alt="'.&mt('closed folder').'" src="'.$iconpath.'folder_pointer_closed.gif" />'); |
'<img class="LC_icon" alt="'.&mt('closed folder').'" src="'.$iconpath.'folder_pointer_closed.gif" />'); |
} |
} |
} else { |
} else { |
$version_flag{$filename} = ' '; |
$version_flag = ' '; |
} |
} |
if ($dirptr&$testdir) { |
if ($dirptr&$testdir) { |
my $colspan='colspan="2"'; |
my $colspan='colspan="2"'; |
Line 325 sub display_directory {
|
Line 323 sub display_directory {
|
'fieldname' => $env{"form.fieldname"}, |
'fieldname' => $env{"form.fieldname"}, |
'continue' => $env{"form.continue"} |
'continue' => $env{"form.continue"} |
); |
); |
$r->print('<td>'.$version_flag{$filename}.'</td><td>'.&make_anchor($url,\%anchor_fields,$filename.'/').'</td>'); |
$r->print('<td>'.$version_flag.'</td><td>'.&make_anchor($url,\%anchor_fields,$filename.'/').'</td>'); |
$r->print('</tr>'); |
$r->print('</tr>'); |
} else { |
} else { |
my $css_class = 'LC_browser_file'; |
my $css_class = 'LC_browser_file'; |
my $line; |
my $line; |
my $fullpath = $current_path.$filename; |
|
$fullpath = &prepend_group($fullpath); |
|
if ($select_mode eq 'true') { |
if ($select_mode eq 'true') { |
$line='<td><input type="checkbox" name="checkfile" value="'.$filename.'"'; |
$line='<td><input type="checkbox" name="checkfile" value="'.$filename.'"'; |
if ($$checked_files{$filename} eq 'selected') { |
if ($$checked_files{$filename} eq 'selected') { |
Line 341 sub display_directory {
|
Line 337 sub display_directory {
|
} else { |
} else { |
if (exists $locked_files{$fullpath}) { |
if (exists $locked_files{$fullpath}) { |
my %anchor_fields = ( |
my %anchor_fields = ( |
'lockinfo' => $current_path.$filename |
'lockinfo' => $fullpath |
); |
); |
$line.='<td colspan="2">'.&make_anchor($url,\%anchor_fields,'Locked').'</td>'; |
$line.='<td colspan="2">'.&make_anchor($url,\%anchor_fields,'Locked').'</td>'; |
$css_class= 'LC_browser_file_locked'; |
$css_class= 'LC_browser_file_locked'; |
Line 362 sub display_directory {
|
Line 358 sub display_directory {
|
currentpath => $current_path |
currentpath => $current_path |
); |
); |
$line .= &make_anchor($url,\%anchor_fields,'Rename'); |
$line .= &make_anchor($url,\%anchor_fields,'Rename'); |
$line .= '</td><td>'.&make_anchor($href_edit_location.$filename.'.meta',undef,$cat); |
$line .= '</td><td>'.&make_anchor($href_edit_location.$filename.'.meta',\%anchor_fields,$cat); |
# '<a href="'.$href_edit_location.$filename.'.meta">'.$cat.'</a>'; |
# '<a href="'.$href_edit_location.$filename.'.meta">'.$cat.'</a>'; |
} |
} |
$line .= '</td>'; |
$line .= '</td>'; |
Line 401 sub display_directory {
|
Line 397 sub display_directory {
|
$curr_access = join('+ ',@allaccesses); |
$curr_access = join('+ ',@allaccesses); |
} |
} |
} |
} |
&display_directory_line($r,$select_mode,$fullpath, $filename, $mtime, $size, $css_class, $line, |
&display_directory_line($r,$select_mode, $filename, $mtime, $size, $css_class, $line, |
\%access_controls, $curr_access,$now, \%version_flag, $href_location, |
\%access_controls, $curr_access,$now, $version_flag, $href_location, |
$url, $current_path, $access_admin_text); |
$url, $current_path, $access_admin_text); |
if ($show_versions) { |
if ($show_versions) { |
foreach my $dir_line (@version_lines) { |
foreach my $dir_line (@{ $versioned{$fullpath} }) { |
my ($v_filename,$dom,$testdir,$size,$mtime,$obs) = @$dir_line; |
my ($v_filename,$dom,$testdir,$size,$mtime,$obs) = |
my ($v_fname,$version,$v_extension) = &Apache::grades::file_name_version_ext($v_filename); |
@$dir_line; |
$line = '<td colspan="2"> </td>'; |
$line = '<td colspan="2"> </td>'; |
if (($v_fname eq $fname)&&($v_extension eq $extension)) { |
&display_directory_line($r,$select_mode, $v_filename, $mtime, $size, |
&display_directory_line($r,$select_mode,$fullpath, $v_filename, $mtime, $size, |
$css_class, $line, \%access_controls, $curr_access, $now, |
$css_class, $line, \%access_controls, $curr_access, $now, |
undef, $href_location, $url, $current_path, $access_admin_text, 1); |
\%version_flag, $href_location, $url, $current_path, $access_admin_text, 1); |
|
} |
|
} |
} |
} |
} |
} |
} |
Line 1609 sub lock_info {
|
Line 1603 sub lock_info {
|
$file_name = &prepend_group($file_name); |
$file_name = &prepend_group($file_name); |
if (defined($file_name) && defined($$current_permissions{$file_name})) { |
if (defined($file_name) && defined($$current_permissions{$file_name})) { |
foreach my $array_item (@{$$current_permissions{$file_name}}) { |
foreach my $array_item (@{$$current_permissions{$file_name}}) { |
if (ref($array_item) eq 'ARRAY') { |
next if (ref($array_item) ne 'ARRAY'); |
my $filetext; |
|
if (defined($group)) { |
my $filetext; |
$filetext = '<strong>'.$env{'form.lockinfo'}. |
if (defined($group)) { |
'</strong> (group: '.$group.')'; |
$filetext = '<strong>'.$env{'form.lockinfo'}. |
} else { |
'</strong> (group: '.$group.')'; |
$filetext = '<strong>'.$file_name.'</strong>'; |
} else { |
} |
$filetext = '<strong>'.$file_name.'</strong>'; |
if ($$array_item[(@$array_item - 1)] eq 'graded') { |
} |
$r->print(&mt('[_1] was submitted in response to problem: ', |
|
$filetext). |
my $title ='<strong>'.&Apache::lonnet::gettitle($$array_item[0]). |
'<strong>'.&Apache::lonnet::gettitle($$array_item[0]). |
'</strong><br />'; |
'</strong><br />'); |
if ($$array_item[-1] eq 'graded') { |
my %course_description = &Apache::lonnet::coursedescription($$array_item[1]); |
$r->print(&mt('[_1] was submitted in response to problem: [_2]', |
$r->print(&mt('In the course: <strong>[_1]</strong><br />', |
$filetext,$title)); |
$course_description{'description'})); |
} elsif ($$array_item[-1] eq 'handback') { |
} elsif ($$array_item[(@$array_item - 1)] eq 'handback') { |
$r->print(&mt('[_1] was handed back in response to problem: [_2]', |
$r->print(&mt('[_1] was handed back in response to problem: ', |
$filetext,$title)); |
$filetext). |
} else { |
'<strong>'.&Apache::lonnet::gettitle($$array_item[0]). |
# submission style lock |
'</strong><br />'); |
$r->print(&mt('[_1] was submitted in response to problem: [_2]', |
my %course_description = &Apache::lonnet::coursedescription($$array_item[1]); |
$filetext,$title)); |
$r->print(&mt('In the course: <strong>[_1]</strong><br />', |
} |
$course_description{'description'})); |
my %course_description = |
|
&Apache::lonnet::coursedescription($$array_item[1]); |
} |
if ( $course_description{'description'} ne '') { |
# $r->print('the third is '.$$array_item[2].'<br>'); |
$r->print(&mt('In the course: <strong>[_1]</strong><br />', |
# $r->print("item is $$array_item[0]<br> and $$array_item[0]"); |
$course_description{'description'})); |
} |
} |
} |
} |
} |
} |
$r->print(&done('Back',$url)); |
$r->print(&done('Back',$url)); |