version 1.597, 2015/09/12 15:47:57
|
version 1.598, 2016/01/26 14:30:25
|
Line 586 sub recurse_html {
|
Line 586 sub recurse_html {
|
} |
} |
|
|
sub group_import { |
sub group_import { |
my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_; |
my ($coursenum, $coursedom, $folder, $container, $caller, $ltitoolsref, @files) = @_; |
my ($donechk,$allmaps,%hierarchy,%titles,%addedmaps,%removefrommap, |
my ($donechk,$allmaps,%hierarchy,%titles,%addedmaps,%removefrommap, |
%removeparam,$importuploaded,$fixuperrors); |
%removeparam,$importuploaded,$fixuperrors); |
$allmaps = {}; |
$allmaps = {}; |
Line 615 sub group_import {
|
Line 615 sub group_import {
|
} |
} |
} |
} |
if ($url) { |
if ($url) { |
|
if ($url =~ m{^(/adm/$coursedom/$coursenum/(\d+)/exttool)s?\:?(.*)$}) { |
|
$url = $1; |
|
my $marker = $2; |
|
my $info = $3; |
|
my ($toolid,%toolhash); |
|
my @toolinfo = split(/:/,$info); |
|
if ($residx) { |
|
my %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$coursedom,$coursenum); |
|
$toolid = $toolsettings{'id'}; |
|
} else { |
|
$toolid = shift(@toolinfo); |
|
} |
|
$toolid =~ s/\D//g; |
|
($toolhash{'target'},$toolhash{'width'},$toolhash{'height'}) = @toolinfo; |
|
if (ref($ltitoolsref) eq 'HASH') { |
|
if (ref($ltitoolsref->{$toolid}) eq 'HASH') { |
|
if ($ltitoolsref->{$toolid}->{'url'} =~ m{^https://}) { |
|
$url =~ s/exttool$/exttools/; |
|
} |
|
$toolhash{'id'} = $toolid; |
|
if ($toolhash{'target'} eq 'iframe') { |
|
delete($toolhash{'width'}); |
|
delete($toolhash{'height'}); |
|
} elsif ($toolhash{'target'} eq 'window') { |
|
foreach my $item ('width','height') { |
|
$toolhash{$item} =~ s/^\s+//; |
|
$toolhash{$item} =~ s/\s+$//; |
|
} |
|
} |
|
my $putres = &Apache::lonnet::put('exttool_'.$marker,\%toolhash,$coursedom,$coursenum); |
|
} |
|
} |
|
} |
if (($caller eq 'londocs') && |
if (($caller eq 'londocs') && |
($folder =~ /^default/)) { |
($folder =~ /^default/)) { |
if (($url =~ /\.(page|sequence)$/) && (!$donechk)) { |
if (($url =~ /\.(page|sequence)$/) && (!$donechk)) { |
Line 1150 sub print_paste_buffer {
|
Line 1183 sub print_paste_buffer {
|
($url ne '')) { |
($url ne '')) { |
$clipboardcount ++; |
$clipboardcount ++; |
my ($is_external,$othercourse,$fromsupp,$is_uploaded_map,$parent, |
my ($is_external,$othercourse,$fromsupp,$is_uploaded_map,$parent, |
$canpaste,$nopaste,$othercrs,$areachange); |
$canpaste,$nopaste,$othercrs,$areachange,$is_exttool); |
my $extension = (split(/\./,$env{'docs.markedcopy_url_'.$suffix}))[-1]; |
my $extension = (split(/\./,$env{'docs.markedcopy_url_'.$suffix}))[-1]; |
if ($url =~ m{^(?:/adm/wrapper/ext|(?:http|https)(?::|:))//} ) { |
if ($url =~ m{^(?:/adm/wrapper/ext|(?:http|https)(?::|:))//} ) { |
$is_external = 1; |
$is_external = 1; |
|
} elsif ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/exttools?$}) { |
|
$is_exttool = 1; |
} |
} |
if ($folder =~ /^supplemental/) { |
if ($folder =~ /^supplemental/) { |
$canpaste = &supp_pasteable($env{'docs.markedcopy_url_'.$suffix}); |
$canpaste = &supp_pasteable($env{'docs.markedcopy_url_'.$suffix}); |
Line 1202 sub print_paste_buffer {
|
Line 1237 sub print_paste_buffer {
|
} |
} |
} |
} |
my $buffer; |
my $buffer; |
if ($is_external) { |
if (($is_external) || ($is_exttool)) { |
$buffer = &mt('External Resource').': '. |
$buffer = &mt('External Resource').': '. |
&LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix}).' ('. |
&LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix}).' ('. |
&LONCAPA::map::qtescape($url).')'; |
&LONCAPA::map::qtescape($url).')'; |
Line 1362 sub supp_pasteable {
|
Line 1397 sub supp_pasteable {
|
(($url =~ /\.sequence$/) && ($url =~ m{^/uploaded/})) || |
(($url =~ /\.sequence$/) && ($url =~ m{^/uploaded/})) || |
($url =~ m{^/uploaded/$match_domain/$match_courseid/(docs|supplemental)/(default|\d+)/\d+/}) || |
($url =~ m{^/uploaded/$match_domain/$match_courseid/(docs|supplemental)/(default|\d+)/\d+/}) || |
($url =~ m{^/adm/$match_domain/$match_username/aboutme}) || |
($url =~ m{^/adm/$match_domain/$match_username/aboutme}) || |
($url =~ m{^/public/$match_domain/$match_courseid/syllabus})) { |
($url =~ m{^/public/$match_domain/$match_courseid/syllabus}) || |
|
($url =~ m{^/adm/$match_domain/$match_courseid/\d+/exttools?$})) { |
return 1; |
return 1; |
} |
} |
return; |
return; |
Line 2880 sub handle_edit_cmd {
|
Line 2916 sub handle_edit_cmd {
|
|
|
sub editor { |
sub editor { |
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype, |
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype, |
$supplementalflag,$orderhash,$iconpath,$pathitem)=@_; |
$supplementalflag,$orderhash,$iconpath,$pathitem,$ltitoolsref)=@_; |
my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container); |
my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container); |
if ($allowed) { |
if ($allowed) { |
(my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain, |
(my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain, |
Line 3079 sub editor {
|
Line 3115 sub editor {
|
} else { |
} else { |
return $errortxt; |
return $errortxt; |
} |
} |
|
} elsif ($url =~ m{^/adm/$coursedom/$coursenum/new/exttool}) { |
|
my ($suffix,$errortxt,$locknotfreed) = |
|
&new_timebased_suffix($coursedom,$coursenum,'exttool'); |
|
if ($locknotfreed) { |
|
$r->print($locknotfreed); |
|
} |
|
if ($suffix) { |
|
$url =~ s{^(/adm/$coursedom/$coursenum)/new}{$1/$suffix}; |
|
} else { |
|
return $errortxt; |
|
} |
} elsif ($url =~ m{^/uploaded/$coursedom/$coursenum/(docs|supplemental)/(default|\d+)/new.html$}) { |
} elsif ($url =~ m{^/uploaded/$coursedom/$coursenum/(docs|supplemental)/(default|\d+)/new.html$}) { |
if ($supplementalflag) { |
if ($supplementalflag) { |
next unless ($1 eq 'supplemental'); |
next unless ($1 eq 'supplemental'); |
Line 3101 sub editor {
|
Line 3148 sub editor {
|
} |
} |
($errtext,$fatal,my $fixuperrors) = |
($errtext,$fatal,my $fixuperrors) = |
&group_import($coursenum, $coursedom, $folder,$container, |
&group_import($coursenum, $coursedom, $folder,$container, |
'londocs',@imports); |
'londocs',$ltitoolsref,@imports); |
return $errtext if ($fatal); |
return $errtext if ($fatal); |
if ($fixuperrors) { |
if ($fixuperrors) { |
$r->print($fixuperrors); |
$r->print($fixuperrors); |
Line 3186 sub editor {
|
Line 3233 sub editor {
|
$output .= &entryline($idx,$name,$url,$folder,$allowed,$res, |
$output .= &entryline($idx,$name,$url,$folder,$allowed,$res, |
$coursenum,$coursedom,$crstype, |
$coursenum,$coursedom,$crstype, |
$pathitem,$supplementalflag,$container, |
$pathitem,$supplementalflag,$container, |
\%filters,\%curr_groups); |
\%filters,\%curr_groups,$ltitoolsref); |
$idx++; |
$idx++; |
$shown++; |
$shown++; |
} |
} |
Line 3552 sub is_supplemental_title {
|
Line 3599 sub is_supplemental_title {
|
|
|
sub entryline { |
sub entryline { |
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom, |
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom, |
$crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups)=@_; |
$crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups, |
|
$ltitoolsref)=@_; |
my ($foldertitle,$renametitle,$oldtitle); |
my ($foldertitle,$renametitle,$oldtitle); |
if (&is_supplemental_title($title)) { |
if (&is_supplemental_title($title)) { |
($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title); |
($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title); |
Line 3643 END
|
Line 3691 END
|
'rn' => 'Rename', |
'rn' => 'Rename', |
'cp' => 'Copy', |
'cp' => 'Copy', |
'ex' => 'External Resource', |
'ex' => 'External Resource', |
|
'et' => 'External Tool', |
'ed' => 'Edit', |
'ed' => 'Edit', |
'pr' => 'Preview', |
'pr' => 'Preview', |
'sv' => 'Save', |
'sv' => 'Save', |
Line 3660 END
|
Line 3709 END
|
|/aboutme$ |
|/aboutme$ |
|/navmaps$ |
|/navmaps$ |
|/bulletinboard$ |
|/bulletinboard$ |
|
|/exttools?$ |
|\.html$)}x) |
|\.html$)}x) |
|| $isexternal) { |
|| $isexternal) { |
$skip_confirm = 1; |
$skip_confirm = 1; |
Line 3796 END
|
Line 3846 END
|
} |
} |
} elsif ($url=~m|^/ext/|) { |
} elsif ($url=~m|^/ext/|) { |
$url='/adm/wrapper'.$url; |
$url='/adm/wrapper'.$url; |
} |
} elsif ($url=~m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) { |
|
$url='/adm/wrapper'.$url; |
|
} |
if (&Apache::lonnet::symbverify($symb,$url)) { |
if (&Apache::lonnet::symbverify($symb,$url)) { |
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb); |
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb); |
} else { |
} else { |
Line 3862 $form_common."\n".
|
Line 3914 $form_common."\n".
|
$form_end; |
$form_end; |
} |
} |
} elsif ($supplementalflag && !$allowed) { |
} elsif ($supplementalflag && !$allowed) { |
|
my $isexttool; |
|
if ($url=~m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) { |
|
$url='/adm/wrapper'.$url; |
|
$isexttool = 1; |
|
} |
$url .= ($url =~ /\?/) ? '&':'?'; |
$url .= ($url =~ /\?/) ? '&':'?'; |
$url .= 'folderpath='.&HTML::Entities::encode($esc_path,'<>&"'); |
$url .= 'folderpath='.&HTML::Entities::encode($esc_path,'<>&"'); |
if ($title) { |
if ($title) { |
$url .= '&title='.&HTML::Entities::encode($renametitle,'<>&"'); |
$url .= '&title='.&HTML::Entities::encode($renametitle,'<>&"'); |
} |
} |
if ($isexternal && $orderidx) { |
if ((($isexternal) || ($isexttool)) && $orderidx) { |
$url .= '&idx='.$orderidx; |
$url .= '&idx='.$orderidx; |
} |
} |
} |
} |
Line 3878 $form_end;
|
Line 3935 $form_end;
|
if ($isexternal) { |
if ($isexternal) { |
($editlink,$extresform) = |
($editlink,$extresform) = |
&Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem); |
&Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem); |
|
} elsif ($orig_url =~ m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) { |
|
($editlink,$extresform) = |
|
&Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem, |
|
undef,undef,undef,'tool',$coursedom, |
|
$coursenum,$ltitoolsref); |
} elsif (!$isfolder && !$ispage) { |
} elsif (!$isfolder && !$ispage) { |
my ($cfile,$home,$switchserver,$forceedit,$forceview) = |
my ($cfile,$home,$switchserver,$forceedit,$forceview) = |
&Apache::lonnet::can_edit_resource($fileloc,$coursenum,$coursedom,$orig_url); |
&Apache::lonnet::can_edit_resource($fileloc,$coursenum,$coursedom,$orig_url); |
Line 4789 sub handler {
|
Line 4851 sub handler {
|
my $container; |
my $container; |
my $containertag; |
my $containertag; |
my $pathitem; |
my $pathitem; |
|
my %ltitools; |
|
|
# Do we directly jump somewhere? |
# Do we directly jump somewhere? |
|
|
Line 4926 sub handler {
|
Line 4989 sub handler {
|
} |
} |
} |
} |
my $tabidstr = join("','",@tabids); |
my $tabidstr = join("','",@tabids); |
|
%ltitools = &Apache::lonnet::get_domain_ltitools($coursedom); |
|
my $exttoolurl = "/adm/$coursedom/$coursenum/new/exttool"; |
$script .= &editing_js($udom,$uname,$supplementalflag). |
$script .= &editing_js($udom,$uname,$supplementalflag). |
&history_tab_js(). |
&history_tab_js(). |
&inject_data_js(). |
&inject_data_js(). |
&Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr,$tid). |
&Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr,$tid). |
&Apache::lonextresedit::extedit_javascript(); |
&Apache::lonextresedit::extedit_javascript(\%ltitools); |
$addentries = { |
$addentries = { |
onload => "javascript:resize_scrollbox('contentscroll','1','1');", |
onload => "javascript:resize_scrollbox('contentscroll','1','1');", |
}; |
}; |
Line 5048 sub handler {
|
Line 5113 sub handler {
|
'impo' => 'Import', |
'impo' => 'Import', |
'lnks' => 'Import from Stored Links', |
'lnks' => 'Import from Stored Links', |
'impm' => 'Import from Assembled Map', |
'impm' => 'Import from Assembled Map', |
|
'extr' => 'External Resource', |
|
'extt' => 'External Tool', |
'selm' => 'Select Map', |
'selm' => 'Select Map', |
'load' => 'Load Map', |
'load' => 'Load Map', |
'newf' => 'New Folder', |
'newf' => 'New Folder', |
Line 5191 SEDFFORM
|
Line 5258 SEDFFORM
|
my $extresourcesform = |
my $extresourcesform = |
&Apache::lonextresedit::extedit_form(0,0,undef,undef,$pathitem, |
&Apache::lonextresedit::extedit_form(0,0,undef,undef,$pathitem, |
$help{'Adding_External_Resource'}); |
$help{'Adding_External_Resource'}); |
|
my $exttoolform = |
|
&Apache::lonextresedit::extedit_form(0,0,undef,undef,$pathitem, |
|
$help{'Adding_External_Tool'},undef, |
|
undef,'tool',$coursedom,$coursenum, |
|
\%ltitools); |
if ($allowed) { |
if ($allowed) { |
my $folder = $env{'form.folder'}; |
my $folder = $env{'form.folder'}; |
if ($folder eq '') { |
if ($folder eq '') { |
Line 5436 NGFFORM
|
Line 5508 NGFFORM
|
my @importdoc = ( |
my @importdoc = ( |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleUpload(\'ext\');" />'=>$extresourcesform} |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleUpload(\'ext\');" />'=>$extresourcesform} |
); |
); |
|
if (keys(%ltitools)) { |
|
push(@importdoc, |
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extt}.'" onclick="toggleUpload(\'tool\');" />'=>$exttoolform}, |
|
); |
|
} |
unless ($container eq 'page') { |
unless ($container eq 'page') { |
push(@importdoc, |
push(@importdoc, |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/ims.png" alt="'.$lt{imsf}.'" onclick="javascript:toggleUpload(\'ims\');" />'=>$imspform} |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/ims.png" alt="'.$lt{imsf}.'" onclick="javascript:toggleUpload(\'ims\');" />'=>$imspform} |
Line 5477 unless ($container eq 'page') {
|
Line 5554 unless ($container eq 'page') {
|
$hadchanges=0; |
$hadchanges=0; |
unless (($supplementalflag || $toolsflag)) { |
unless (($supplementalflag || $toolsflag)) { |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, |
$supplementalflag,\%orderhash,$iconpath,$pathitem); |
$supplementalflag,\%orderhash,$iconpath,$pathitem,\%ltitools); |
if ($error) { |
if ($error) { |
$r->print('<p><span class="LC_error">'.$error.'</span></p>'); |
$r->print('<p><span class="LC_error">'.$error.'</span></p>'); |
} |
} |
Line 5544 SNFFORM
|
Line 5621 SNFFORM
|
&Apache::lonextresedit::extedit_form(1,0,undef,undef,$pathitem, |
&Apache::lonextresedit::extedit_form(1,0,undef,undef,$pathitem, |
$help{'Adding_External_Resource'}); |
$help{'Adding_External_Resource'}); |
|
|
|
my $supexttoolform = |
|
&Apache::lonextresedit::extedit_form(1,0,undef,undef,$pathitem, |
|
$help{'Adding_External_Tool'}, |
|
undef,undef,'tool',$coursedom, |
|
$coursenum,\%ltitools); |
|
|
my $supnewsylform=(<<SNSFORM); |
my $supnewsylform=(<<SNSFORM); |
<form action="/adm/coursedocs" method="post" name="supnewsyl"> |
<form action="/adm/coursedocs" method="post" name="supnewsyl"> |
<input type="hidden" name="active" value="ff" /> |
<input type="hidden" name="active" value="ff" /> |
Line 5597 my @specialdocs = (
|
Line 5680 my @specialdocs = (
|
); |
); |
my @supimportdoc = ( |
my @supimportdoc = ( |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:toggleUpload(\'suppext\')" />' |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="javascript:toggleUpload(\'suppext\')" />' |
=>$supextform}, |
=>$supextform}); |
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'suppdoc\');" />' |
if (keys(%ltitools)) { |
|
push(@supimportdoc, |
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extt}.'" onclick="javascript:toggleUpload(\'supptool\')" />' |
|
=>$supexttoolform}); |
|
} |
|
push(@supimportdoc, |
|
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'suppdoc\');" />' |
=>$supupdocform}, |
=>$supupdocform}, |
); |
); |
|
|
$supupdocform = &create_form_ul(&create_list_elements(@supimportdoc)); |
$supupdocform = &create_form_ul(&create_list_elements(@supimportdoc)); |
my %suporderhash = ( |
my %suporderhash = ( |
Line 5610 my %suporderhash = (
|
Line 5699 my %suporderhash = (
|
); |
); |
if ($supplementalflag) { |
if ($supplementalflag) { |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, |
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype, |
$supplementalflag,\%suporderhash,$iconpath,$pathitem); |
$supplementalflag,\%suporderhash,$iconpath,$pathitem,\%ltitools); |
if ($error) { |
if ($error) { |
$r->print('<p><span class="LC_error">'.$error.'</span></p>'); |
$r->print('<p><span class="LC_error">'.$error.'</span></p>'); |
} else { |
} else { |
Line 6072 sub editing_js {
|
Line 6161 sub editing_js {
|
$backtourl = '/adm/navmaps'; |
$backtourl = '/adm/navmaps'; |
} |
} |
|
|
my $fieldsets = "'ext','doc'"; |
my $fieldsets = "'ext','tool','doc'"; |
unless ($main_container_page) { |
unless ($main_container_page) { |
$fieldsets .=",'ims'"; |
$fieldsets .=",'ims'"; |
} |
} |
if ($supplementalflag) { |
if ($supplementalflag) { |
$fieldsets = "'suppext','suppdoc'"; |
$fieldsets = "'suppext','supptool','suppdoc'"; |
} |
} |
|
|
return <<ENDNEWSCRIPT; |
return <<ENDNEWSCRIPT; |
Line 6187 function toggleUpload(caller) {
|
Line 6276 function toggleUpload(caller) {
|
} |
} |
} |
} |
document.getElementById('upload'+blocks[i]+'form').style.display=disp; |
document.getElementById('upload'+blocks[i]+'form').style.display=disp; |
|
if ((caller == 'tool') || (caller == 'supptool')) { |
|
if (disp == 'block') { |
|
if (document.getElementById('LC_exttoolid')) { |
|
var toolselector = document.getElementById('LC_exttoolid'); |
|
var suppflag = 0; |
|
if (caller == 'supptool') { |
|
suppflag = 1; |
|
} |
|
currForm = document.getElementById('new'+caller); |
|
updateExttool(toolselector,currForm,suppflag); |
|
} |
|
} |
|
} |
} |
} |
resize_scrollbox('contentscroll','1','1'); |
resize_scrollbox('contentscroll','1','1'); |
return; |
return; |