version 1.216, 2009/10/23 09:33:45
|
version 1.221, 2010/03/26 22:27:06
|
Line 38 use Apache::lonnet;
|
Line 38 use Apache::lonnet;
|
use Apache::longroup; |
use Apache::longroup; |
use Apache::lonhtmlcommon; |
use Apache::lonhtmlcommon; |
use HTML::Entities; |
use HTML::Entities; |
use LONCAPA; |
use LONCAPA qw(:DEFAULT :match); |
|
|
sub group_args { |
sub group_args { |
my $output; |
my $output; |
Line 223 sub display_usage {
|
Line 223 sub display_usage {
|
' <div id="meter3" style="display:block; background-color:'.$color.'; width:'.$prog_width.'%; height:10px; color:#000000; margin:0px;"></div>'."\n". |
' <div id="meter3" style="display:block; background-color:'.$color.'; width:'.$prog_width.'%; height:10px; color:#000000; margin:0px;"></div>'."\n". |
' </div>'."\n". |
' </div>'."\n". |
' </div>'; |
' </div>'; |
return $disk_meter; |
return &Apache::loncommon::head_subbox($disk_meter); |
} |
} |
|
|
sub display_directory_line { |
sub display_directory_line { |
Line 453 sub display_directory {
|
Line 453 sub display_directory {
|
$line .= '<input type="checkbox" name="selectfile" value="'.$filename.'" />'; |
$line .= '<input type="checkbox" name="selectfile" value="'.$filename.'" />'; |
} |
} |
if ($can_modify) { |
if ($can_modify) { |
my $cat='<img class="LC_icon" alt="'.&mt('Metadata').'"/>'; |
my $cat='<img class="LC_icon" alt="'.&mt('Metadata').'" title="'.&mt('Metadata').'" src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/catalog.png').'" />'; |
# src="'.#&Apache::loncommon::lonhttpdurl('/res/adm/pages/catalog.gif').'" />'; |
|
my %anchor_fields = ( |
my %anchor_fields = ( |
'rename' => $filename, |
'rename' => $filename, |
currentpath => $current_path |
currentpath => $current_path |
Line 881 sub display_access {
|
Line 880 sub display_access {
|
sub explain_conditionals { |
sub explain_conditionals { |
return |
return |
&mt('Conditional files are accessible to logged-in users with accounts in the LON-CAPA network, who satisfy the conditions you set.').'<br />'."\n". |
&mt('Conditional files are accessible to logged-in users with accounts in the LON-CAPA network, who satisfy the conditions you set.').'<br />'."\n". |
&mt('The conditions can include affiliation with a particular course, or a user account in a specific domain.').'<br />'."\n". |
&mt('The conditions can include affiliation with a particular course or community, or a user account in a specific domain.').'<br />'."\n". |
&mt('Alternatively access can be granted to people with specific LON-CAPA usernames and domains.'); |
&mt('Alternatively access can be granted to people with specific LON-CAPA usernames and domains.'); |
} |
} |
|
|
Line 922 sub build_access_summary {
|
Line 921 sub build_access_summary {
|
guest => 'Passphrase-protected', |
guest => 'Passphrase-protected', |
domains => 'Conditional: domain-based', |
domains => 'Conditional: domain-based', |
users => 'Conditional: user-based', |
users => 'Conditional: user-based', |
course => 'Conditional: course-based', |
course => 'Conditional: course/community-based', |
); |
); |
my @allscopes = ('public','guest','domains','users','course'); |
my @allscopes = ('public','guest','domains','users','course'); |
foreach my $scope (@allscopes) { |
foreach my $scope (@allscopes) { |
Line 947 sub build_access_summary {
|
Line 946 sub build_access_summary {
|
} |
} |
} |
} |
$r->print('<td>'.&mt($scope_desc{$scope})); |
$r->print('<td>'.&mt($scope_desc{$scope})); |
|
my $crstype; |
if ($scope eq 'course') { |
if ($scope eq 'course') { |
if ($chg ne 'delete') { |
if ($chg ne 'delete') { |
my $cid = $content->{'domain'}.'_'.$content->{'number'}; |
my $cid = $content->{'domain'}.'_'.$content->{'number'}; |
my %course_description = &Apache::lonnet::coursedescription($cid); |
my %course_description = &Apache::lonnet::coursedescription($cid); |
$r->print('<br />('.$course_description{'description'}.')'); |
$r->print('<br />('.$course_description{'description'}.')'); |
|
$crstype = 'Course'; |
|
if ($course_description{'type'} ne '') { |
|
$crstype = $course_description{'type'}; |
|
} |
} |
} |
} |
} |
$r->print('</td><td>'.&mt('Start: ').$showstart. |
$r->print('</td><td>'.&mt('Start: ').$showstart. |
Line 971 sub build_access_summary {
|
Line 975 sub build_access_summary {
|
foreach my $item ('role','access','section','group') { |
foreach my $item ('role','access','section','group') { |
$r->print('<td>'); |
$r->print('<td>'); |
if ($item eq 'role') { |
if ($item eq 'role') { |
my $ucscope = $scope; |
|
$ucscope =~ s/^(\w)/uc($1)/e; |
|
my $role_output; |
my $role_output; |
foreach my $role (@{$content->{'roles'}{$id}{$item}}) { |
foreach my $role (@{$content->{'roles'}{$id}{$item}}) { |
if ($role eq 'all') { |
if ($role eq 'all') { |
Line 980 sub build_access_summary {
|
Line 982 sub build_access_summary {
|
} elsif ($role =~ /^cr/) { |
} elsif ($role =~ /^cr/) { |
$role_output .= (split('/',$role))[3].','; |
$role_output .= (split('/',$role))[3].','; |
} else { |
} else { |
$role_output .= &Apache::lonnet::plaintext($role,$ucscope).','; |
$role_output .= &Apache::lonnet::plaintext($role,$crstype).','; |
} |
} |
} |
} |
$role_output =~ s/,$//; |
$role_output =~ s/,$//; |
Line 1106 sub update_access {
|
Line 1108 sub update_access {
|
my $totalnew = 0; |
my $totalnew = 0; |
my $status = 'new'; |
my $status = 'new'; |
my ($firstitem,$lastitem); |
my ($firstitem,$lastitem); |
foreach my $newitem ('course','domains','users') { |
my @types = ('course','domains','users'); |
|
foreach my $newitem (@types) { |
$allnew += $env{'form.new'.$newitem}; |
$allnew += $env{'form.new'.$newitem}; |
} |
} |
if ($allnew > 0) { |
if ($allnew > 0) { |
my $now = time; |
my $now = time; |
my $then = $now + (60*60*24*180); # six months approx. |
my $then = $now + (60*60*24*180); # six months approx. |
&open_form($r,$url); |
&open_form($r,$url); |
foreach my $newitem ('course','domains','users') { |
my %showtypes = &Apache::lonlocal::texthash ( |
|
course => 'course/community', |
|
domains => 'domain', |
|
users => 'user', |
|
); |
|
foreach my $newitem (@types) { |
if ($env{'form.new'.$newitem} > 0) { |
if ($env{'form.new'.$newitem} > 0) { |
$r->print('<br />'.&mt('Add new <b>[_1]-based</b> access control for portfolio file: <b>[_2]</b>',&mt($newitem),$env{'form.currentpath'}.$env{'form.selectfile'}).'<br /><br />'); |
$r->print('<br />'.&mt('Add new [_1]-based[_2] access control for portfolio file: [_3]','<b>'.$showtypes{$newitem},'</b>','<b>'.$env{'form.currentpath'}.$env{'form.selectfile'}.'</b>').'<br /><br />'); |
$firstitem = $totalnew; |
$firstitem = $totalnew; |
$lastitem = $totalnew + $env{'form.new'.$newitem}; |
$lastitem = $totalnew + $env{'form.new'.$newitem}; |
$totalnew = $lastitem; |
$totalnew = $lastitem; |
Line 1358 sub standard_settings {
|
Line 1366 sub standard_settings {
|
&build_access_summary($r,$count,$chg,%conditionals); |
&build_access_summary($r,$count,$chg,%conditionals); |
$r->print(&Apache::loncommon::end_data_table()); |
$r->print(&Apache::loncommon::end_data_table()); |
} else { |
} else { |
$r->print(&make_anchor($url,\%anchor_fields,&mt('Add conditional access')).' '.&mt('based on domain, username, or course affiliation.')); |
$r->print(&make_anchor($url,\%anchor_fields,&mt('Add conditional access')).' '.&mt('based on domain, username, or course/community affiliation.')); |
} |
} |
} |
} |
|
|
Line 1392 sub acl_status {
|
Line 1400 sub acl_status {
|
|
|
sub access_element { |
sub access_element { |
my ($r,$type,$acl_count,$items,$access_controls,$now,$then) = @_; |
my ($r,$type,$acl_count,$items,$access_controls,$now,$then) = @_; |
my $title = $type; |
my %typetext = &Apache::lonlocal::texthash( |
$title =~ s/s$//; |
domains => 'Domain', |
$title =~ s/^(\w)/uc($1)/e; |
users => 'User', |
$r->print('<h3>'.&mt('[_1]-based conditional access: ',&mt($title))); |
course => 'Course/Community' |
|
); |
|
$r->print('<h3>'.&mt('[_1]-based conditional access: ',$typetext{$type}).': '); |
if ($$acl_count{$type}) { |
if ($$acl_count{$type}) { |
$r->print($$acl_count{$type}.' '); |
$r->print($$acl_count{$type}.' '); |
if ($$acl_count{$type} > 1) { |
if ($$acl_count{$type} > 1) { |
Line 1413 sub access_element {
|
Line 1423 sub access_element {
|
|
|
sub display_access_row { |
sub display_access_row { |
my ($r,$status,$type,$items,$access_controls,$now,$then) = @_; |
my ($r,$status,$type,$items,$access_controls,$now,$then) = @_; |
|
my $showtype; |
|
if ($type eq 'course') { |
|
$showtype = &mt('Courses/Communities'); |
|
} elsif ($type eq 'domains') { |
|
$showtype = &mt('Domains'); |
|
} elsif ($type eq 'users') { |
|
$showtype = &mt('Users'); |
|
} |
if (@{$items} > 0) { |
if (@{$items} > 0) { |
my @all_doms; |
my @all_doms; |
my $colspan = 3; |
my $colspan = 3; |
my $uctype = $type; |
|
$uctype =~ s/^(\w)/uc($1)/e; |
|
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(&Apache::loncommon::start_data_table_header_row()); |
$r->print(&Apache::loncommon::start_data_table_header_row()); |
$r->print('<th>'.&mt('Action?').'</th><th>'.&mt($uctype).'</th><th>'. |
$r->print('<th>'.&mt('Action?').'</th><th>'.$showtype.'</th><th>'. |
&mt('Dates available').'</th>'); |
&mt('Dates available').'</th>'); |
if ($type eq 'course' && $status eq 'old') { |
if ($type eq 'course' && $status eq 'old') { |
$r->print('<th>'.&mt('Allowed [_1] member affiliations',$type). |
|
|
$r->print('<th>'.&mt('Allowed course/community affiliations'). |
'</th>'); |
'</th>'); |
$colspan ++; |
$colspan ++; |
} elsif ($type eq 'domains') { |
} elsif ($type eq 'domains') { |
Line 1450 sub display_access_row {
|
Line 1467 sub display_access_row {
|
} |
} |
$r->print(&Apache::loncommon::end_data_table()); |
$r->print(&Apache::loncommon::end_data_table()); |
} else { |
} else { |
$r->print(&mt('No [_1]-based conditions defined.',&mt($type)).'<br />' |
$r->print(&mt('No [_1]-based conditions defined.',$showtype).'<br />'. |
.&additional_item($type)); |
&additional_item($type)); |
} |
} |
return; |
return; |
} |
} |
Line 1512 sub course_row {
|
Line 1529 sub course_row {
|
} |
} |
my $js = &Apache::loncommon::coursebrowser_javascript($defdom) |
my $js = &Apache::loncommon::coursebrowser_javascript($defdom) |
.&course_js(); |
.&course_js(); |
my $uctype = $type; |
my $showtype = &mt('Course/Community'); |
$uctype =~ s/^(\w)/uc($1)/e; |
my $crstype = 'Course'; |
my ($num,$scope,$end,$start) = &set_identifiers($status,$item,$now,$then, |
my ($num,$scope,$end,$start) = &set_identifiers($status,$item,$now,$then, |
$type); |
$type); |
$r->print('<td>'.$js.&actionbox($status,$num,$scope).'</td>'); |
$r->print('<td>'.$js.&actionbox($status,$num,$scope).'</td>'); |
if ($status eq 'old') { |
if ($status eq 'old') { |
my $cid = $content->{'domain'}.'_'.$content->{'number'}; |
my $cid = $content->{'domain'}.'_'.$content->{'number'}; |
my %course_description = &Apache::lonnet::coursedescription($cid); |
my %course_description = &Apache::lonnet::coursedescription($cid); |
|
if ($course_description{'type'} ne '') { |
|
$crstype = $course_description{'type'}; |
|
} |
$r->print('<td><input type="hidden" name="crsdom_'.$num.'" value="'.$content->{'domain'}.'" /><input type="hidden" name="crsnum_'.$num.'" value="'.$content->{'number'}.'" />'.$course_description{'description'}.'</td>'); |
$r->print('<td><input type="hidden" name="crsdom_'.$num.'" value="'.$content->{'domain'}.'" /><input type="hidden" name="crsnum_'.$num.'" value="'.$content->{'number'}.'" />'.$course_description{'description'}.'</td>'); |
} elsif ($status eq 'new') { |
} elsif ($status eq 'new') { |
$r->print('<td>'.&Apache::loncommon::selectcourse_link('portform','crsnum_'.$num,'crsdom_'.$num,'description_'.$num,$num.'_1',undef,$uctype).' <input type="text" name="description_'.$num.'" size="30" /><input type="hidden" name="crsdom_'.$num.'" /><input type="hidden" name="crsnum_'.$num.'" /></td>'); |
$r->print('<td>'.&Apache::loncommon::selectcourse_link('portform','crsnum_'.$num,'crsdom_'.$num,'description_'.$num,$num.'_1',undef,$showtype).' <input type="text" name="description_'.$num.'" size="30" /><input type="hidden" name="crsdom_'.$num.'" /><input type="hidden" name="crsnum_'.$num.'" /></td>'); |
} |
} |
$r->print('<td>'.&dateboxes($num,$start,$end)); |
$r->print('<td>'.&dateboxes($num,$start,$end)); |
my $newrole_id = 1; |
my $newrole_id = 1; |
Line 1540 sub course_row {
|
Line 1560 sub course_row {
|
$max_id = $role_id; |
$max_id = $role_id; |
} |
} |
$max_id ++; |
$max_id ++; |
my $role_selects = &role_selectors($num,$role_id,$type,$content,'display'); |
my $role_selects = &role_selectors($num,$role_id,$crstype,$content,'display'); |
$r->print('<tr><td><span class="LC_nobreak"><label><input type="checkbox" name="delete_role_'.$num.'" value="'.$role_id.'" />'.&mt('Delete').'</label></span><br /><input type="hidden" name="preserve_role_'.$num.'" value="'.$role_id.'" /></td>'.$role_selects.'</tr>'); |
$r->print('<tr><td><span class="LC_nobreak"><label><input type="checkbox" name="delete_role_'.$num.'" value="'.$role_id.'" />'.&mt('Delete').'</label></span><br /><input type="hidden" name="preserve_role_'.$num.'" value="'.$role_id.'" /></td>'.$role_selects.'</tr>'); |
} |
} |
$r->print('</table>'); |
$r->print('</table>'); |
Line 1549 sub course_row {
|
Line 1569 sub course_row {
|
' <input type="checkbox" name="add_role_'. |
' <input type="checkbox" name="add_role_'. |
$num.'" onClick="javascript:setRoleOptions('."'$num', |
$num.'" onClick="javascript:setRoleOptions('."'$num', |
'$max_id','$content->{'domain'}','$content->{'number'}', |
'$max_id','$content->{'domain'}','$content->{'number'}', |
'$uctype'".')" value="" />'); |
'$showtype'".')" value="" />'); |
$newrole_id = $max_id; |
$newrole_id = $max_id; |
} else { |
} else { |
$r->print('<input type="hidden" name="add_role_'.$num.'" value="" />'); |
$r->print('<input type="hidden" name="add_role_'.$num.'" value="" />'); |
Line 1610 sub users_row {
|
Line 1630 sub users_row {
|
|
|
sub additional_item { |
sub additional_item { |
my ($type) = @_; |
my ($type) = @_; |
my $output = &mt('Add new [_1] condition(s)?',&mt($type)).' '.&mt('Number to add: ').'<input type="text" name="new'.$type.'" size="3" value="0" />'; |
my $showtype; |
|
if ($type eq 'course') { |
|
$showtype = &mt('course/community'); |
|
} elsif ($type eq 'domains') { |
|
$showtype = &mt('domains'); |
|
} elsif ($type eq 'users') { |
|
$showtype = &mt('users'); |
|
} |
|
my $output = &mt('Add new [_1] condition(s)?',$showtype).' '.&mt('Number to add: ').'<input type="text" name="new'.$type.'" size="3" value="0" />'; |
return $output; |
return $output; |
} |
} |
|
|
Line 1681 sub role_selectors {
|
Line 1709 sub role_selectors {
|
$cdom = $env{'form.cdom'}; |
$cdom = $env{'form.cdom'}; |
$cnum = $env{'form.cnum'}; |
$cnum = $env{'form.cnum'}; |
} |
} |
my $uctype = $type; |
my $crstype = 'Course'; |
$uctype =~ s/^(\w)/uc($1)/e; |
if ($cnum =~ /^$match_community$/) { |
|
$crstype = 'Community' |
|
} |
my ($sections,$groups,$allroles,$rolehash,$accesshash) = |
my ($sections,$groups,$allroles,$rolehash,$accesshash) = |
&Apache::loncommon::get_secgrprole_info($cdom,$cnum,1,$uctype); |
&Apache::loncommon::get_secgrprole_info($cdom,$cnum,1,$crstype); |
if (!@{$sections}) { |
if (!@{$sections}) { |
@{$sections} = ('none'); |
@{$sections} = ('none'); |
} else { |
} else { |
Line 1779 function getIndexByName(item) {
|
Line 1809 function getIndexByName(item) {
|
|
|
</script> |
</script> |
END_SCRIPT |
END_SCRIPT |
$r->print(&mt('Select roles, course status, section(s) and group(s) for users who will be able to access the portfolio file.')); |
$r->print( |
$r->print('<form name="rolepicker" action="/adm/portfolio" method="post"><table><tr><th>'.&mt('Roles').'</th><th>'.&mt('[_1] status',$type).'</th><th>'.&mt('Sections').'</th><th>'.&mt('Groups').'</th></tr><tr>'.$role_selects.'</tr></table><br /><input type="button" name="rolepickbutton" value="Save selections" onclick="setRoles()" />'); |
'<p>' |
|
.&mt('Select roles, '.lc($type).' status, section(s) and group(s) for users' |
|
.' who will be able to access the portfolio file.') |
|
.'</p>' |
|
); |
|
$r->print( |
|
'<form name="rolepicker" action="/adm/portfolio" method="post">' |
|
.'<table><tr>' |
|
.'<th>'.&mt('Roles').'</th>' |
|
.'<th>'.&mt("$type status").'</th>' |
|
.'<th>'.&mt('Sections').'</th>' |
|
.'<th>'.&mt('Groups').'</th>' |
|
.'</tr><tr>'.$role_selects.'</tr>' |
|
.'</table><br />' |
|
.'<input type="button" name="rolepickbutton" value="'.&mt('Save').'" onclick="setRoles()" />' |
|
); |
return; |
return; |
} |
} |
|
|