version 1.336, 2012/12/18 16:48:19
|
version 1.341, 2014/01/10 17:03:30
|
Line 163 sub get_target {
|
Line 163 sub get_target {
|
} |
} |
} |
} |
# |
# |
# End of Construction Space |
# End of Authoring Space |
# |
# |
} |
} |
# |
# |
Line 508 sub check_access {
|
Line 508 sub check_access {
|
# return ('UNCHECKEDOUT','needs to be checked out'); |
# return ('UNCHECKEDOUT','needs to be checked out'); |
#} |
#} |
|
|
|
|
&Apache::lonxml::debug("sending back :$status:$datemsg:"); |
&Apache::lonxml::debug("sending back :$status:$datemsg:"); |
if (($Apache::lonhomework::browse eq 'F') && ($status eq 'CLOSED')) { |
if (($Apache::lonhomework::browse eq 'F') && ($status eq 'CLOSED')) { |
&Apache::lonxml::debug("should be allowed to browse a resource when closed"); |
&Apache::lonxml::debug("should be allowed to browse a resource when closed"); |
Line 608 sub showhashsubset {
|
Line 607 sub showhashsubset {
|
|
|
sub setuppermissions { |
sub setuppermissions { |
$Apache::lonhomework::browse= &Apache::lonnet::allowed('bre',$env{'request.filename'}); |
$Apache::lonhomework::browse= &Apache::lonnet::allowed('bre',$env{'request.filename'}); |
|
unless ($Apache::lonhomework::browse eq 'F') { |
|
$Apache::lonhomework::browse=&Apache::lonnet::allowed('bro',$env{'request.filename'}); |
|
} |
my $viewgrades = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $viewgrades = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
if (! $viewgrades && |
if (! $viewgrades && |
exists($env{'request.course.sec'}) && |
exists($env{'request.course.sec'}) && |
Line 667 sub setupheader {
|
Line 669 sub setupheader {
|
} |
} |
|
|
sub handle_save_or_undo { |
sub handle_save_or_undo { |
my ($request,$problem,$result) = @_; |
my ($request,$problem,$result,$getobjref) = @_; |
|
|
my $file = &Apache::lonnet::filelocation("",$request->uri); |
my $file = &Apache::lonnet::filelocation("",$request->uri); |
my $filebak =$file.".bak"; |
my $filebak =$file.".bak"; |
Line 710 sub handle_save_or_undo {
|
Line 712 sub handle_save_or_undo {
|
my $fh=Apache::File->new(">$file"); |
my $fh=Apache::File->new(">$file"); |
if (defined($fh)) { |
if (defined($fh)) { |
print $fh $$result; |
print $fh $$result; |
|
if (ref($getobjref) eq 'SCALAR') { |
|
if ($file =~ m{([^/]+)\.(html?)$}) { |
|
my $fname = $1; |
|
my $ext = $2; |
|
my $path = $file; |
|
$path =~ s/\Q$fname\E\.\Q$ext\E$//; |
|
my (%allfiles,%codebase); |
|
&Apache::lonnet::extract_embedded_items($file,\%allfiles, |
|
\%codebase,$result); |
|
if (keys(%allfiles) > 0) { |
|
my $url = $request->uri; |
|
my $state = <<STATE; |
|
<input type="hidden" name="action" value="upload_embedded" /> |
|
<input type="hidden" name="url" value="$url" /> |
|
STATE |
|
$$getobjref = "<h3>".&mt("Reference Warning")."</h3>". |
|
"<p>".&mt("Completed upload of the file. This file contained references to other files.")."</p>". |
|
"<p>".&mt("Please select the locations from which the referenced files are to be uploaded.")."</p>". |
|
&Apache::loncommon::ask_for_embedded_content($url,$state,\%allfiles,\%codebase, |
|
{'error_on_invalid_names' => 1, |
|
'ignore_remote_references' => 1,}); |
|
} |
|
} |
|
} |
} else { |
} else { |
&Apache::lonxml::info('<span class="LC_error">'. |
&Apache::lonxml::info('<span class="LC_error">'. |
&mt("Unable to write to [_1]", |
&mt("Unable to write to [_1]", |
Line 728 sub analyze_header {
|
Line 754 sub analyze_header {
|
|
|
# Breadcrumbs |
# Breadcrumbs |
my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri), |
my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri), |
'text' => 'Construction Space'}, |
'text' => 'Authoring Space'}, |
{'href' => '', |
{'href' => '', |
'text' => 'Problem Testing'}, |
'text' => 'Problem Testing'}, |
{'href' => '', |
{'href' => '', |
Line 962 sub editxmlmode {
|
Line 988 sub editxmlmode {
|
|
|
# Breadcrumbs |
# Breadcrumbs |
my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri), |
my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri), |
'text' => 'Construction Space'}, |
'text' => 'Authoring Space'}, |
{'href' => '', |
{'href' => '', |
'text' => 'Problem Editing'}]; |
'text' => 'Problem Editing'}]; |
|
|
Line 1039 sub renderpage {
|
Line 1065 sub renderpage {
|
$problem=''; |
$problem=''; |
my $filename=(split('/',$file))[-1]; |
my $filename=(split('/',$file))[-1]; |
my $error = |
my $error = |
'<p class="LC_error">' |
&mt('Unable to find [_1]', |
.&mt('Unable to find [_1]', |
'<span class="LC_filename">'.$filename.'</span>'); |
'<span class="LC_filename">'.$filename.'</span>') |
|
."</p>"; |
|
$result.= |
$result.= |
&Apache::loncommon::simple_error_page($request,'Not available', |
&Apache::loncommon::simple_error_page($request,'Not available', |
$error); |
$error,{'no_auto_mt_msg' => 1}); |
return; |
return; |
} |
} |
|
|
Line 1109 sub get_template_list {
|
Line 1133 sub get_template_list {
|
&mt(&Apache::lonnet::metadata($_, 'help'))]} (@files); |
&mt(&Apache::lonnet::metadata($_, 'help'))]} (@files); |
@files = sort {$a->[2].$a->[1] cmp $b->[2].$b->[1]} (@files); |
@files = sort {$a->[2].$a->[1] cmp $b->[2].$b->[1]} (@files); |
my ($midpoint,$seconddiv,$numfiles); |
my ($midpoint,$seconddiv,$numfiles); |
|
my @noexamplelink = ('blank.problem','blank.library','script.library'); |
$numfiles = 0; |
$numfiles = 0; |
foreach my $file (@files) { |
foreach my $file (@files) { |
next if ($file->[1] !~ /\S/); |
next if ($file->[1] !~ /\S/); |
Line 1147 sub get_template_list {
|
Line 1172 sub get_template_list {
|
if ($file->[3]) { |
if ($file->[3]) { |
$result.=&Apache::loncommon::help_open_topic($file->[3]); |
$result.=&Apache::loncommon::help_open_topic($file->[3]); |
} |
} |
|
# Provide example link |
my $filename=$file->[0]; |
my $filename=$file->[0]; |
$filename=~s{^\Q$londocroot\E}{}; |
$filename=~s{^\Q$londocroot\E}{}; |
$result.=' <span class="LC_fontsize_small">' |
if (!(grep $filename =~ $_, @noexamplelink)) { |
.&Apache::loncommon::modal_link($filename.'?inhibitmenu=yes',&mt('Example'),600,420,'sample') |
$result .= ' <span class="LC_fontsize_small">' |
.'</span><br />'."\n"; |
.&Apache::loncommon::modal_link( |
|
$filename.'?inhibitmenu=yes',&mt('Example'),600,420,'sample') |
|
.'</span>'; |
|
}; |
|
$result .= '<br />'."\n"; |
$count ++; |
$count ++; |
} |
} |
if ($numfiles > 0) { |
if ($numfiles > 0) { |
Line 1188 sub newproblem {
|
Line 1218 sub newproblem {
|
my $errormsg; |
my $errormsg; |
my $instructions; |
my $instructions; |
my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri), |
my $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri), |
'text' => 'Construction Space'}, |
'text' => 'Authoring Space'}, |
{'href' => '', |
{'href' => '', |
'text' => "Create New $extension"}]; |
'text' => "Create New $extension"}]; |
my $start_page = |
my $start_page = |