version 1.1057, 2012/03/04 15:42:52
|
version 1.1059, 2012/03/17 20:11:26
|
Line 4017 sub findallcourses {
|
Line 4017 sub findallcourses {
|
if ($tstart) { |
if ($tstart) { |
next if ($tstart > $now); |
next if ($tstart > $now); |
} |
} |
my ($cdom,$cnum,$sec,$cnumpart,$secpart,$role,$realsec); |
my ($cdom,$cnum,$sec,$cnumpart,$secpart,$role); |
(undef,$cdom,$cnumpart,$secpart) = split(/\//,$entry); |
(undef,$cdom,$cnumpart,$secpart) = split(/\//,$entry); |
|
my $value = $trole.'/'.$cdom.'/'; |
if ($secpart eq '') { |
if ($secpart eq '') { |
($cnum,$role) = split(/_/,$cnumpart); |
($cnum,$role) = split(/_/,$cnumpart); |
$sec = 'none'; |
$sec = 'none'; |
$realsec = ''; |
$value .= $cnum.'/'; |
} else { |
} else { |
$cnum = $cnumpart; |
$cnum = $cnumpart; |
($sec,$role) = split(/_/,$secpart); |
($sec,$role) = split(/_/,$secpart); |
$realsec = $sec; |
$value .= $cnum.'/'.$sec; |
|
} |
|
if (ref($courses{$cdom.'_'.$cnum}{$sec}) eq 'ARRAY') { |
|
unless (grep(/^\Q$value\E$/,@{$courses{$cdom.'_'.$cnum}{$sec}})) { |
|
push(@{$courses{$cdom.'_'.$cnum}{$sec}},$value); |
|
} |
|
} else { |
|
@{$courses{$cdom.'_'.$cnum}{$sec}} = ($value); |
} |
} |
$courses{$cdom.'_'.$cnum}{$sec} = $trole.'/'.$cdom.'/'.$cnum.'/'.$realsec; |
|
} |
} |
} else { |
} else { |
foreach my $key (keys(%env)) { |
foreach my $key (keys(%env)) { |
Line 4046 sub findallcourses {
|
Line 4053 sub findallcourses {
|
if ($now>$endtime) { $active=0; } |
if ($now>$endtime) { $active=0; } |
} |
} |
if ($active) { |
if ($active) { |
|
my $value = $role.'/'.$cdom.'/'.$cnum.'/'; |
if ($sec eq '') { |
if ($sec eq '') { |
$sec = 'none'; |
$sec = 'none'; |
|
} else { |
|
$value .= $sec; |
|
} |
|
if (ref($courses{$cdom.'_'.$cnum}{$sec}) eq 'ARRAY') { |
|
unless (grep(/^\Q$value\E$/,@{$courses{$cdom.'_'.$cnum}{$sec}})) { |
|
push(@{$courses{$cdom.'_'.$cnum}{$sec}},$value); |
|
} |
|
} else { |
|
@{$courses{$cdom.'_'.$cnum}{$sec}} = ($value); |
} |
} |
$courses{$cdom.'_'.$cnum}{$sec} = |
|
$role.'/'.$cdom.'/'.$cnum.'/'.$sec; |
|
} |
} |
} |
} |
} |
} |
Line 4143 sub blockcheck {
|
Line 4158 sub blockcheck {
|
if ($otheruser) { |
if ($otheruser) { |
# Resource belongs to user other than current user. |
# Resource belongs to user other than current user. |
# Assemble privs for that user, and check for 'evb' priv. |
# Assemble privs for that user, and check for 'evb' priv. |
my ($trole,$tdom,$tnum,$tsec); |
my (%allroles,%userroles); |
my $entry = $live_courses{$course}{$sec}; |
if (ref($live_courses{$course}{$sec}) eq 'ARRAY') { |
if ($entry =~ /^cr/) { |
foreach my $entry (@{$live_courses{$course}{$sec}}) { |
($trole,$tdom,$tnum,$tsec) = |
my ($trole,$tdom,$tnum,$tsec); |
($entry =~ m|^(cr/$match_domain/$match_username/\w+)\./($match_domain)/($match_username)/?(\w*)$|); |
if ($entry =~ /^cr/) { |
} else { |
($trole,$tdom,$tnum,$tsec) = |
($trole,$tdom,$tnum,$tsec) = split(/\//,$entry); |
($entry =~ m|^(cr/$match_domain/$match_username/\w+)\./($match_domain)/($match_username)/?(\w*)$|); |
} |
} else { |
my ($spec,$area,$trest,%allroles,%userroles); |
($trole,$tdom,$tnum,$tsec) = split(/\//,$entry); |
$area = '/'.$tdom.'/'.$tnum; |
} |
$trest = $tnum; |
my ($spec,$area,$trest); |
if ($tsec ne '') { |
$area = '/'.$tdom.'/'.$tnum; |
$area .= '/'.$tsec; |
$trest = $tnum; |
$trest .= '/'.$tsec; |
if ($tsec ne '') { |
} |
$area .= '/'.$tsec; |
$spec = $trole.'.'.$area; |
$trest .= '/'.$tsec; |
if ($trole =~ /^cr/) { |
} |
&Apache::lonnet::custom_roleprivs(\%allroles,$trole, |
$spec = $trole.'.'.$area; |
$tdom,$spec,$trest,$area); |
if ($trole =~ /^cr/) { |
} else { |
&Apache::lonnet::custom_roleprivs(\%allroles,$trole, |
&Apache::lonnet::standard_roleprivs(\%allroles,$trole, |
$tdom,$spec,$trest,$area); |
$tdom,$spec,$trest,$area); |
} else { |
} |
&Apache::lonnet::standard_roleprivs(\%allroles,$trole, |
my ($author,$adv) = &Apache::lonnet::set_userprivs(\%userroles,\%allroles); |
$tdom,$spec,$trest,$area); |
if ($userroles{'user.priv.'.$checkrole} =~ /evb\&([^\:]*)/) { |
} |
if ($1) { |
} |
$no_userblock = 1; |
my ($author,$adv) = &Apache::lonnet::set_userprivs(\%userroles,\%allroles); |
last; |
if ($userroles{'user.priv.'.$checkrole} =~ /evb\&([^\:]*)/) { |
|
if ($1) { |
|
$no_userblock = 1; |
|
last; |
|
} |
} |
} |
} |
} |
} else { |
} else { |
Line 9986 sub archive_row {
|
Line 10005 sub archive_row {
|
my ($is_dir,$item,$currdir,$depth,$count) = @_; |
my ($is_dir,$item,$currdir,$depth,$count) = @_; |
my ($name) = ($item =~ m{([^/]+)$}); |
my ($name) = ($item =~ m{([^/]+)$}); |
my %choices = &Apache::lonlocal::texthash ( |
my %choices = &Apache::lonlocal::texthash ( |
'display' => 'Add as File', |
'display' => 'Add as file', |
'dependency' => 'Include as dependency', |
'dependency' => 'Include as dependency', |
'discard' => 'Discard', |
'discard' => 'Discard', |
); |
); |
if ($is_dir) { |
if ($is_dir) { |
$choices{'display'} = &mt('Add as Folder'); |
$choices{'display'} = &mt('Add as folder'); |
} |
} |
my $output = &start_data_table_row().'<td align="right">'.$count.'</td>'."\n"; |
my $output = &start_data_table_row().'<td align="right">'.$count.'</td>'."\n"; |
my $offset = 0; |
my $offset = 0; |
Line 10004 sub archive_row {
|
Line 10023 sub archive_row {
|
if ($is_dir) { |
if ($is_dir) { |
$output .= ' onclick="javascript:propagateCheck(this.form,'."'$count'".');"'; |
$output .= ' onclick="javascript:propagateCheck(this.form,'."'$count'".');"'; |
if ($action eq 'display') { |
if ($action eq 'display') { |
$text = &mt('Add as Folder'); |
$text = &mt('Add as folder'); |
} |
} |
} else { |
} else { |
$output .= ' onclick="javascript:dependencyCheck(this.form,'."$count,$offset".');"'; |
$output .= ' onclick="javascript:dependencyCheck(this.form,'."$count,$offset".');"'; |
Line 10018 sub archive_row {
|
Line 10037 sub archive_row {
|
'<option value=""></option>'."\n". |
'<option value=""></option>'."\n". |
'</select>'."\n". |
'</select>'."\n". |
'</div>'; |
'</div>'; |
|
} elsif ($action eq 'display') { |
|
$output .= '<div id="arc_title_'.$count.'" style="display:none;">'."\n". |
|
&mt('Title:').' <input type="text" name="archive_title_'.$count.'" id="archive_title_'.$count.'" />'."\n". |
|
'</div>'; |
} |
} |
$output .= '</td>'; |
$output .= '</td>'; |
} |
} |
Line 10046 sub archive_options_form {
|
Line 10069 sub archive_options_form {
|
'</p>'. |
'</p>'. |
'<div class="LC_columnSection"><fieldset>'. |
'<div class="LC_columnSection"><fieldset>'. |
'<legend>'.&mt('Content actions for all').'</legend>'. |
'<legend>'.&mt('Content actions for all').'</legend>'. |
'<input type="button" value="'.&mt('Display in Contents').'" '. |
'<input type="button" value="'.&mt('Add as folder/file').'" '. |
'onclick="javascript:checkAll(document.'.$form.",'display'".')" />'. |
'onclick="javascript:checkAll(document.'.$form.",'display'".')" />'. |
' <input type="button" value="'.&mt('Include as dependency for a displayed item').'"'. |
' <input type="button" value="'.&mt('Include as dependency for a displayed file').'"'. |
' onclick="javascript:checkAll(document.'.$form.",'dependency'".')" />'. |
' onclick="javascript:checkAll(document.'.$form.",'dependency'".')" />'. |
' <input type="button" value="'.&mt('Discard').'"'. |
' <input type="button" value="'.&mt('Discard').'"'. |
' onclick="javascript:checkAll(document.'.$form.",'discard'".')" />'. |
' onclick="javascript:checkAll(document.'.$form.",'discard'".')" />'. |
Line 10065 sub archive_options_form {
|
Line 10088 sub archive_options_form {
|
sub archive_javascript { |
sub archive_javascript { |
my ($startcount,$numitems,$titles,$children) = @_; |
my ($startcount,$numitems,$titles,$children) = @_; |
return unless ((ref($titles) eq 'HASH') && (ref($children) eq 'HASH')); |
return unless ((ref($titles) eq 'HASH') && (ref($children) eq 'HASH')); |
|
my $maintitle = $env{'form.comment'}; |
my $scripttag = <<START; |
my $scripttag = <<START; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 10078 function checkAll(form,prefix) {
|
Line 10102 function checkAll(form,prefix) {
|
if (form.elements[i].type == 'radio') { |
if (form.elements[i].type == 'radio') { |
form.elements[i].checked = true; |
form.elements[i].checked = true; |
var nostart = i-$startcount; |
var nostart = i-$startcount; |
var offset = nostart%6; |
var offset = nostart%7; |
var count = (nostart-offset)/6; |
var count = (nostart-offset)/7; |
dependencyCheck(form,count,offset); |
dependencyCheck(form,count,offset); |
} |
} |
} |
} |
Line 10089 function checkAll(form,prefix) {
|
Line 10113 function checkAll(form,prefix) {
|
|
|
function propagateCheck(form,count) { |
function propagateCheck(form,count) { |
if (count > 0) { |
if (count > 0) { |
var startelement = $startcount + ((count-1) * 6); |
var startelement = $startcount + ((count-1) * 7); |
for (var j=1; j<5; j++) { |
for (var j=1; j<6; j++) { |
if (j != 3) { |
if ((j != 2) && (j != 4)) { |
var item = startelement + j; |
var item = startelement + j; |
if (form.elements[item].type == 'radio') { |
if (form.elements[item].type == 'radio') { |
if (form.elements[item].checked) { |
if (form.elements[item].checked) { |
Line 10110 var parents = new Array(numitems);
|
Line 10134 var parents = new Array(numitems);
|
for (var i=0; i<numitems; i++) { |
for (var i=0; i<numitems; i++) { |
parents[i] = new Array; |
parents[i] = new Array; |
} |
} |
|
var maintitle = '$maintitle'; |
|
|
START |
START |
|
|
Line 10129 START
|
Line 10154 START
|
function containerCheck(form,count,offset) { |
function containerCheck(form,count,offset) { |
if (count > 0) { |
if (count > 0) { |
dependencyCheck(form,count,offset); |
dependencyCheck(form,count,offset); |
var item = (offset+$startcount)+6*(count-1); |
var item = (offset+$startcount)+7*(count-1); |
form.elements[item].checked = true; |
form.elements[item].checked = true; |
if(Object.prototype.toString.call(parents[count]) === '[object Array]') { |
if(Object.prototype.toString.call(parents[count]) === '[object Array]') { |
if (parents[count].length > 0) { |
if (parents[count].length > 0) { |
Line 10143 function containerCheck(form,count,offse
|
Line 10168 function containerCheck(form,count,offse
|
|
|
function dependencyCheck(form,count,offset) { |
function dependencyCheck(form,count,offset) { |
if (count > 0) { |
if (count > 0) { |
var chosen = (offset+$startcount)+6*(count-1); |
var chosen = (offset+$startcount)+7*(count-1); |
var depitem = $startcount + ((count-1) * 6) + 3; |
var depitem = $startcount + ((count-1) * 7) + 4; |
var currtype = form.elements[depitem].type; |
var currtype = form.elements[depitem].type; |
if (form.elements[chosen].value == 'dependency') { |
if (form.elements[chosen].value == 'dependency') { |
document.getElementById('arc_depon_'+count).style.display='block'; |
document.getElementById('arc_depon_'+count).style.display='block'; |
form.elements[depitem].options.length = 0; |
form.elements[depitem].options.length = 0; |
form.elements[depitem].options[0] = new Option('Select','',true,true); |
form.elements[depitem].options[0] = new Option('Select','',true,true); |
for (var i=1; i<count; i++) { |
for (var i=1; i<count; i++) { |
var startelement = $startcount + (i-1) * 6; |
var startelement = $startcount + (i-1) * 7; |
for (var j=1; j<5; j++) { |
for (var j=1; j<6; j++) { |
if (j != 3) { |
if ((j != 2) && (j!= 4)) { |
var item = startelement + j; |
var item = startelement + j; |
if (form.elements[item].type == 'radio') { |
if (form.elements[item].type == 'radio') { |
if (form.elements[item].checked) { |
if (form.elements[item].checked) { |
Line 10171 function dependencyCheck(form,count,offs
|
Line 10196 function dependencyCheck(form,count,offs
|
form.elements[depitem].options.length = 0; |
form.elements[depitem].options.length = 0; |
form.elements[depitem].options[0] = new Option('Select','',true,true); |
form.elements[depitem].options[0] = new Option('Select','',true,true); |
} |
} |
|
titleCheck(form,count,offset); |
} |
} |
} |
} |
|
|
function propagateSelect(form,count,offset) { |
function propagateSelect(form,count,offset) { |
if (count > 0) { |
if (count > 0) { |
var item = (1+offset+$startcount)+6*(count-1); |
var item = (2+offset+$startcount)+7*(count-1); |
var picked = form.elements[item].options[form.elements[item].selectedIndex].value; |
var picked = form.elements[item].options[form.elements[item].selectedIndex].value; |
if (Object.prototype.toString.call(parents[count]) === '[object Array]') { |
if (Object.prototype.toString.call(parents[count]) === '[object Array]') { |
if (parents[count].length > 0) { |
if (parents[count].length > 0) { |
Line 10190 function propagateSelect(form,count,offs
|
Line 10216 function propagateSelect(form,count,offs
|
|
|
function containerSelect(form,count,offset,picked) { |
function containerSelect(form,count,offset,picked) { |
if (count > 0) { |
if (count > 0) { |
var item = (offset+$startcount)+6*(count-1); |
var item = (1+offset+$startcount)+7*(count-1); |
if (form.elements[item].type == 'radio') { |
if (form.elements[item].type == 'radio') { |
if (form.elements[item].value == 'dependency') { |
if (form.elements[item].value == 'dependency') { |
if (form.elements[item+1].type == 'select-one') { |
if (form.elements[item+1].type == 'select-one') { |
Line 10213 function containerSelect(form,count,offs
|
Line 10239 function containerSelect(form,count,offs
|
} |
} |
} |
} |
|
|
|
function titleCheck(form,count,offset) { |
|
if (count > 0) { |
|
var chosen = (offset+$startcount)+7*(count-1); |
|
var depitem = $startcount + ((count-1) * 7) + 2; |
|
var currtype = form.elements[depitem].type; |
|
if (form.elements[chosen].value == 'display') { |
|
document.getElementById('arc_title_'+count).style.display='block'; |
|
if ((count==1) && ((parents[count].length > 0) || (numitems == 1))) { |
|
document.getElementById('archive_title_'+count).value=maintitle; |
|
} |
|
} else { |
|
document.getElementById('arc_title_'+count).style.display='none'; |
|
if (currtype == 'text') { |
|
document.getElementById('archive_title_'+count).value=''; |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
// ]]> |
// ]]> |
</script> |
</script> |
END |
END |
Line 10279 sub process_extracted_files {
|
Line 10325 sub process_extracted_files {
|
} |
} |
} |
} |
} elsif ($env{'form.archive_'.$i} eq 'display') { |
} elsif ($env{'form.archive_'.$i} eq 'display') { |
my ($title,$url,$outer); |
my ($docstitle,$title,$url,$outer); |
($title) = ($path =~ m{/([^/]+)$}); |
($title) = ($path =~ m{/([^/]+)$}); |
|
$docstitle = $env{'form.archive_title_'.$i}; |
|
if ($docstitle eq '') { |
|
$docstitle = $title; |
|
} |
$outer = 0; |
$outer = 0; |
if (ref($dirorder{$i}) eq 'ARRAY') { |
if (ref($dirorder{$i}) eq 'ARRAY') { |
if (@{$dirorder{$i}} > 0) { |
if (@{$dirorder{$i}} > 0) { |
Line 10306 sub process_extracted_files {
|
Line 10356 sub process_extracted_files {
|
$folders{$i}.'.'.$containers{$i}; |
$folders{$i}.'.'.$containers{$i}; |
my $newidx = &LONCAPA::map::getresidx(); |
my $newidx = &LONCAPA::map::getresidx(); |
$LONCAPA::map::resources[$newidx]= |
$LONCAPA::map::resources[$newidx]= |
$title.':'.$url.':false:normal:res'; |
$docstitle.':'.$url.':false:normal:res'; |
push(@LONCAPA::map::order,$newidx); |
push(@LONCAPA::map::order,$newidx); |
my ($outtext,$errtext) = |
my ($outtext,$errtext) = |
&LONCAPA::map::storemap('/uploaded/'.$docudom.'/'. |
&LONCAPA::map::storemap('/uploaded/'.$docudom.'/'. |
Line 10331 sub process_extracted_files {
|
Line 10381 sub process_extracted_files {
|
$newdest{$i} = "$prefix$dir/$docstype/$mapinner{$outer}/$newidx"; |
$newdest{$i} = "$prefix$dir/$docstype/$mapinner{$outer}/$newidx"; |
} |
} |
$LONCAPA::map::resources[$newidx]= |
$LONCAPA::map::resources[$newidx]= |
$title.':'.$url.':false:normal:res'; |
$docstitle.':'.$url.':false:normal:res'; |
push(@LONCAPA::map::order, $newidx); |
push(@LONCAPA::map::order, $newidx); |
my ($outtext,$errtext)= |
my ($outtext,$errtext)= |
&LONCAPA::map::storemap('/uploaded/'.$docudom.'/'. |
&LONCAPA::map::storemap('/uploaded/'.$docudom.'/'. |