'
+ my $toolslink;
+ if ($allowed || &Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
+ $toolslink = ''
.&Apache::loncommon::help_open_menu('Navigation Screen',
'Navigation_Screen',undef,'RAT')
.' '.&mt('Tools:').' '
@@ -2605,6 +3253,7 @@ sub editor {
.'class="LC_toolbarItem" '
.'title="'.&mt('Supplemental Content Editor').'">'
.'
';
+ }
if ($shown) {
if ($allowed) {
$to_show = &Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll')
@@ -2620,9 +3269,13 @@ sub editor {
if ($folder !~ /^supplemental/) {
$lists{'canhide'} = join(',',@allidx);
$lists{'canrandomlyorder'} = join(',',@allmapidx);
- foreach my $item ('canremove','cancut','cancopy') {
+ my @possfilters = ('canremove','cancut','cancopy','hiddenresource','encrypturl',
+ 'randomorder','randompick');
+ foreach my $item (@possfilters) {
if (ref($filters{$item}) eq 'ARRAY') {
- $lists{$item} = join(',',@{$filters{$item}});
+ if (@{$filters{$item}} > 0) {
+ $lists{$item} = join(',',@{$filters{$item}});
+ }
}
}
if (@allidx > 0) {
@@ -2664,7 +3317,7 @@ sub editor {
}
$to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll')
.''
- .&mt('Currently no documents.')
+ .&mt('Currently empty')
.'
'
.&Apache::loncommon::end_scrollbox();
}
@@ -2677,7 +3330,7 @@ sub editor {
.'';
} else {
$to_show = ''
- .&mt('Currently no documents.')
+ .&mt('Currently empty')
.'
'
}
}
@@ -2744,7 +3397,11 @@ sub multiple_check_form {
' ';
if ($caller eq 'settings') {
$output .=
- ' ';
+ ' '."\n".
+ ' '."\n".
+ ' '."\n".
+ ' '."\n".
+ ' '."\n";
} elsif ($caller eq 'actions') {
$output .=
' '.
@@ -2758,8 +3415,33 @@ sub multiple_check_form {
}
sub process_file_upload {
- my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd) = @_;
+ my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd,$crstype) = @_;
# upload a file, if present
+ my $filesize = length($env{'form.uploaddoc'});
+ if (!$filesize) {
+ $$upload_output = ''.
+ &mt('Unable to upload [_1]. (size = [_2] bytes)',
+ ''.$env{'form.uploaddoc.filename'}.' ',
+ $filesize).' '.
+ &mt('Either the file you attempted to upload was empty, or your web browser was unable to read its contents.').' '.
+ '
';
+ return;
+ }
+ my $quotatype = 'unofficial';
+ if ($crstype eq 'Community') {
+ $quotatype = 'community';
+ } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.coursecode'}) {
+ $quotatype = 'official';
+ } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.textbook'}) {
+ $quotatype = 'textbook';
+ }
+ if (&Apache::loncommon::get_user_quota($coursenum,$coursedom,'course',$quotatype)) {
+ $filesize = int($filesize/1000); #expressed in kb
+ $$upload_output = &Apache::loncommon::excess_filesize_warning($coursenum,$coursedom,'course',
+ $env{'form.uploaddoc.filename'},$filesize,
+ 'upload',$quotatype);
+ return if ($$upload_output);
+ }
my ($parseaction,$showupload,$nextphase,$mimetype);
if ($env{'form.parserflag'}) {
$parseaction = 'parse';
@@ -2855,7 +3537,8 @@ sub process_file_upload {
$$upload_output .= &mt('No embedded items identified').' ';
}
$$upload_output = ''.$$upload_output.'
';
- } elsif (&Apache::loncommon::is_archive_file($mimetype)) {
+ } elsif ((&Apache::loncommon::is_archive_file($mimetype)) &&
+ ($env{'form.uploaddoc.filename'} =~ /\.(zip|tar|bz2|gz|tar.gz|tar.bz2|tgz)$/i)) {
$nextphase = 'decompress_uploaded';
my $position = scalar(@LONCAPA::map::order)-1;
my $noextract = &return_to_editor();
@@ -2916,8 +3599,9 @@ sub is_supplemental_title {
sub entryline {
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,
- $crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups)=@_;
- my ($foldertitle,$renametitle);
+ $crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups,
+ $ltitoolsref)=@_;
+ my ($foldertitle,$renametitle,$oldtitle);
if (&is_supplemental_title($title)) {
($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);
} else {
@@ -2930,7 +3614,10 @@ sub entryline {
$renametitle=~s/\\/\\\\/g;
$renametitle=~s/\"\;/\\\"/g;
+ $renametitle=~s/"/%22/g;
$renametitle=~s/ /%20/g;
+ $oldtitle = $renametitle;
+ $renametitle=~s/\'/\\\'/g;
my $line=&Apache::loncommon::start_data_table_row();
my ($form_start,$form_end,$form_common,$form_param);
# Edit commands
@@ -3004,6 +3691,7 @@ END
'rn' => 'Rename',
'cp' => 'Copy',
'ex' => 'External Resource',
+ 'et' => 'External Tool',
'ed' => 'Edit',
'pr' => 'Preview',
'sv' => 'Save',
@@ -3021,13 +3709,14 @@ END
|/aboutme$
|/navmaps$
|/bulletinboard$
+ |/exttools?$
|\.html$)}x)
|| $isexternal) {
$skip_confirm = 1;
}
if ($denied{'copy'}) {
- $copylink=(<$lt{'cp'}
ENDCOPY
} else {
@@ -3053,6 +3742,7 @@ ENDCUT
$cutlink=(<
$form_common
+
$lt{'ct'}
$form_end
ENDCUT
@@ -3070,6 +3760,7 @@ ENDREM
$removelink=(<
$form_common
+
$lt{'rm'}
$form_end
ENDREM
@@ -3077,11 +3768,9 @@ ENDREM
push(@{$filtersref->{'canremove'}},$orderidx);
}
}
- unless ($isexternal) {
- $renamelink=(<$lt{'rn'}
+ $renamelink=(<$lt{'rn'}
ENDREN
- }
$line.=(<
@@ -3157,7 +3846,9 @@ END
}
} elsif ($url=~m|^/ext/|) {
$url='/adm/wrapper'.$url;
- }
+ } elsif ($url=~m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {
+ $url='/adm/wrapper'.$url;
+ }
if (&Apache::lonnet::symbverify($symb,$url)) {
$url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb);
} else {
@@ -3192,6 +3883,9 @@ END
my $rpckchk;
if ($rpicknum) {
$rpckchk = ' checked="checked"';
+ if (($ishash) && (ref($filtersref->{'randompick'}) eq 'ARRAY')) {
+ push(@{$filtersref->{'randompick'}},$orderidx.':'.$rpicknum);
+ }
}
my $formname = 'edit_randompick_'.$orderidx;
$rand_pick_text =
@@ -3204,9 +3898,14 @@ $form_common."\n".
}
$rand_pick_text .= ''.
$form_end;
- my $ro_set=
- ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':'');
- my $formname = 'edit_rorder_'.$orderidx;
+ my $ro_set;
+ if ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i) {
+ $ro_set = 'checked="checked"';
+ if (($ishash) && (ref($filtersref->{'randomorder'}) eq 'ARRAY')) {
+ push(@{$filtersref->{'randomorder'}},$orderidx);
+ }
+ }
+ $formname = 'edit_rorder_'.$orderidx;
$rand_order_text =
'
'.&Apache::loncommon::end_data_table_row());
}
$r->print(
&Apache::loncommon::end_data_table().
@@ -3870,6 +4621,7 @@ ENDHEADERS
&untiehash();
$r->print(&endContentScreen());
+ return;
}
sub mark_hash_old {
@@ -3924,13 +4676,13 @@ $help{'Caching'}.''."\n\n");
sub init_breadcrumbs {
- my ($form,$text)=@_;
+ my ($form,$text,$help)=@_;
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?tools=1",
text=>&Apache::loncommon::course_type().' Editor',
faq=>273,
bug=>'Instructor Interface',
- help => 'Docs_Adding_Course_Doc'});
+ help => $help});
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?".$form.'=1',
text=>$text,
faq=>273,
@@ -3969,7 +4721,7 @@ sub startContentScreen {
$output .= ' '.&mt('Content Index').' '."\n";
$output .= ''.&mt('Supplemental Content').' ';
} else {
- $output .= ' '.&mt('Content Editor').' '."\n";
+ $output .= ' '.&mt('Main Content Editor').' '."\n";
$output .= ''.&mt('Supplemental Content Editor').' '."\n";
$output .= ' '.&mt('Content Utilities').' '."\n";
'> '.&mt('Content Utilities').' ';
@@ -3990,7 +4742,7 @@ sub endContentScreen {
}
sub supplemental_base {
- return 'supplemental&'.&escape(&mt('Supplemental '.&Apache::loncommon::course_type().' Content'));
+ return 'supplemental&'.&escape(&mt('Supplemental Content'));
}
sub handler {
@@ -4014,8 +4766,8 @@ sub handler {
'Adding_Folders','Docs_Overview', 'Load_Map',
'Supplemental','Score_Upload_Form','Adding_Pages',
'Importing_LON-CAPA_Resource','Importing_IMS_Course',
- 'Uploading_From_Harddrive',
- 'Check_Resource_Versions','Verify_Content') {
+ 'Uploading_From_Harddrive','Course_Roster','Web_Page',
+ 'Dropbox','Simple_Problem') {
$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);
}
# Composite help files
@@ -4023,16 +4775,12 @@ sub handler {
'Docs_About_Syllabus,Docs_Editing_Templated_Pages');
$help{'Simple Page'} = &Apache::loncommon::help_open_topic(
'Docs_About_Simple_Page,Docs_Editing_Templated_Pages');
- $help{'Simple Problem'} = &Apache::loncommon::help_open_topic(
- 'Option_Response_Simple');
$help{'Bulletin Board'} = &Apache::loncommon::help_open_topic(
'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages');
$help{'My Personal Information Page'} = &Apache::loncommon::help_open_topic(
'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages');
$help{'Group Portfolio'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files');
$help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
- $help{'Course Roster'} = &Apache::loncommon::help_open_topic('Docs_Course_Roster');
- $help{'Web Page'} = &Apache::loncommon::help_open_topic('Docs_Web_Page');
my $allowed;
# URI is /adm/supplemental when viewing supplemental docs in non-edit mode.
@@ -4041,13 +4789,9 @@ sub handler {
$allowed = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});
}
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['chooseserver',
- 'inhibitmenu']);
- if ($allowed && $env{'form.chooseserver'}) {
- &choose_dump_server($r);
- return OK;
- } elsif ($allowed && $env{'form.verify'}) {
- &init_breadcrumbs('verify','Verify Content');
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['inhibitmenu']);
+ if ($allowed && $env{'form.verify'}) {
+ &init_breadcrumbs('verify','Verify Content','Docs_Verify_Content');
&verifycontent($r);
} elsif ($allowed && $env{'form.listsymbs'}) {
&init_breadcrumbs('listsymbs','List Content IDs');
@@ -4060,10 +4804,10 @@ sub handler {
}
&docs_change_log($r,$coursenum,$coursedom,$folder,$allowed,$crstype,$iconpath);
} elsif ($allowed && $env{'form.versions'}) {
- &init_breadcrumbs('versions','Check/Set Resource Versions');
+ &init_breadcrumbs('versions','Check/Set Resource Versions','Docs_Check_Resource_Versions');
&checkversions($r);
} elsif ($allowed && $env{'form.dumpcourse'}) {
- &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' Content to Authoring Space');
+ &init_breadcrumbs('dumpcourse','Copy '.&Apache::loncommon::course_type().' Content to Authoring Space');
&dumpcourse($r);
} elsif ($allowed && $env{'form.exportcourse'}) {
&init_breadcrumbs('exportcourse','IMS Export');
@@ -4089,9 +4833,9 @@ sub handler {
# supplementalflag=0: show standard documents
# toolsflag=1: show utilities
- $env{'form.folderpath'} = &unescape($env{'form.folderpath'});
- my $supplementalflag=($env{'form.folderpath'}=~/^supplemental/);
- if (($env{'form.folderpath'}=~/^default/) || ($env{'form.folderpath'} eq "")) {
+ my $unesc_folderpath = &unescape($env{'form.folderpath'});
+ my $supplementalflag=($unesc_folderpath=~/^supplemental/);
+ if (($unesc_folderpath=~/^default/) || ($unesc_folderpath eq "")) {
$supplementalflag=0;
}
if ($env{'form.forcesupplement'}) { $supplementalflag=1; }
@@ -4107,6 +4851,7 @@ sub handler {
my $container;
my $containertag;
my $pathitem;
+ my %ltitools;
# Do we directly jump somewhere?
@@ -4123,7 +4868,7 @@ sub handler {
}
} elsif ($env{'form.command'} eq 'editdocs') {
$env{'form.folderpath'} = 'default&'.
- &escape(&mt('Main '.$crstype.' Content').':::::');
+ &escape(&mt('Main Content').':::::');
&Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => $env{'form.command'}});
} elsif ($env{'form.command'} eq 'editsupp') {
$env{'form.folderpath'} = 'supplemental&'.
@@ -4168,7 +4913,7 @@ sub handler {
if ($supplementalflag) {
$env{'form.folderpath'}=&supplemental_base();
} else {
- $env{'form.folderpath'}='default'.&escape(&mt('Main '.$crstype.' Content').
+ $env{'form.folderpath'}='default&'.&escape(&mt('Main Content').
':::::');
}
}
@@ -4194,7 +4939,7 @@ sub handler {
if ($env{'form.folder'} eq '' ||
$env{'form.folder'} eq 'supplemental') {
$folderpath='default&'.
- &escape(&mt('Main '.$crstype.' Content').':::::');
+ &escape(&mt('Main Content').':::::');
}
}
$containertag = ' ';
@@ -4231,9 +4976,11 @@ sub handler {
$script .= &dump_switchserver_js(@hosts);
}
} else {
+ my $tid = 1;
my @tabids;
if ($supplementalflag) {
@tabids = ('002','ee2','ff2');
+ $tid = 2;
} else {
@tabids = ('aa1','bb1','cc1','ff1');
unless ($env{'form.folderpath'} =~ /\:1$/) {
@@ -4242,11 +4989,14 @@ sub handler {
}
}
my $tabidstr = join("','",@tabids);
- $script .= &editing_js($udom,$uname,$supplementalflag).
+ %ltitools = &Apache::lonnet::get_domain_ltitools($coursedom);
+ my $posslti = keys(%ltitools);
+ my $exttoolurl = "/adm/$coursedom/$coursenum/new/exttool";
+ $script .= &editing_js($udom,$uname,$supplementalflag,$posslti).
&history_tab_js().
&inject_data_js().
- &Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr).
- &Apache::lonextresedit::extedit_javascript();
+ &Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr,$tid).
+ &Apache::lonextresedit::extedit_javascript(\%ltitools);
$addentries = {
onload => "javascript:resize_scrollbox('contentscroll','1','1');",
};
@@ -4262,7 +5012,9 @@ sub handler {
.'// '."\n"
- .''."\n";
+ .''."\n"
+ .''."\n";
# Breadcrumbs
&Apache::lonhtmlcommon::clear_breadcrumbs();
@@ -4270,6 +5022,14 @@ sub handler {
if ($showdoc) {
$r->print(&Apache::loncommon::start_page("$crstype documents",undef,
{'force_register' => $showdoc,}));
+ } elsif ($toolsflag) {
+ &Apache::lonhtmlcommon::add_breadcrumb({
+ href=>"/adm/coursedocs",text=>"$crstype Contents"});
+ $r->print(&Apache::loncommon::start_page("$crstype Contents", $script)
+ .&Apache::loncommon::help_open_menu('','',273,'RAT')
+ .&Apache::lonhtmlcommon::breadcrumbs(
+ 'Editing Course Contents')
+ );
} elsif ($r->uri eq '/adm/supplemental') {
my $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype);
$r->print(&Apache::loncommon::start_page("Supplemental $crstype Content",undef,
@@ -4297,7 +5057,7 @@ sub handler {
# Process file upload - phase one - upload and parse primary file.
undef($hadchanges);
$uploadphase = &process_file_upload(\$upload_output,$coursenum,$coursedom,
- \%allfiles,\%codebase,$context);
+ \%allfiles,\%codebase,$context,$crstype);
if ($hadchanges) {
&mark_hash_old();
}
@@ -4349,11 +5109,13 @@ sub handler {
my %lt=&Apache::lonlocal::texthash(
'copm' => 'All documents out of a published map into this folder',
'upfi' => 'Upload File',
- 'upld' => 'Import Content',
+ 'upld' => 'Upload Content',
'srch' => 'Search',
'impo' => 'Import',
'lnks' => 'Import from Stored Links',
'impm' => 'Import from Assembled Map',
+ 'extr' => 'External Resource',
+ 'extt' => 'External Tool',
'selm' => 'Select Map',
'load' => 'Load Map',
'newf' => 'New Folder',
@@ -4370,19 +5132,44 @@ sub handler {
'grpo' => 'Group Portfolio',
'rost' => 'Course Roster',
'abou' => 'Personal Information Page for a User',
- 'imsf' => 'IMS Import',
- 'imsl' => 'Import IMS package',
+ 'imsf' => 'IMS Upload',
+ 'imsl' => 'Upload IMS package',
'cms' => 'Origin of IMS package',
'se' => 'Select',
'file' => 'File',
'title' => 'Title',
'comment' => 'Comment',
'parse' => 'Upload embedded images/multimedia files if HTML file',
- );
+ 'bb5' => 'Blackboard 5',
+ 'bb6' => 'Blackboard 6',
+ 'angel5' => 'ANGEL 5.5',
+ 'webctce4' => 'WebCT 4 Campus Edition',
+ );
# -----------------------------------------------------------------------------
+
+ # Calculate free quota space for a user or course. A javascript function checks
+ # file size to determine if upload should be allowed.
+ my $quotatype = 'unofficial';
+ if ($crstype eq 'Community') {
+ $quotatype = 'community';
+ } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.coursecode'}) {
+ $quotatype = 'official';
+ } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.textbook'}) {
+ $quotatype = 'textbook';
+ }
+ my $disk_quota = &Apache::loncommon::get_user_quota($coursenum,$coursedom,
+ 'course',$quotatype); # expressed in MB
+ my $current_disk_usage = 0;
+ foreach my $subdir ('docs','supplemental') {
+ $current_disk_usage += &Apache::lonnet::diskusage($coursedom,$coursenum,
+ "userfiles/$subdir",1); # expressed in kB
+ }
+ my $free_space = 1024 * ((1024 * $disk_quota) - $current_disk_usage);
+
my $fileupload=(<
-
+
+
FIUP
my $checkbox=(<
$lt{'se'}
- Blackboard 5
- Blackboard 6
- ANGEL 5.5
- WebCT 4 Campus Edition
+ $lt{'bb5'}
+ $lt{'bb6'}
+ $lt{'angel5'}
+ $lt{'webctce4'}
@@ -4429,7 +5216,7 @@ IMSFORM
$lt{'upfi'}
- $fileupload
+ $fileupload
$lt{'title'}:
@@ -4472,6 +5259,11 @@ SEDFFORM
my $extresourcesform =
&Apache::lonextresedit::extedit_form(0,0,undef,undef,$pathitem,
$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) {
my $folder = $env{'form.folder'};
if ($folder eq '') {
@@ -4519,7 +5311,7 @@ HIDDENFORM
if ($folder eq '' || $supplementalflag) {
$folder='default';
$savefolderpath = $env{'form.folderpath'};
- $env{'form.folderpath'}='default&'.&escape(&mt('Content'));
+ $env{'form.folderpath'}='default&'.&escape(&mt('Main Content'));
$pathitem = ' ';
}
@@ -4540,7 +5332,7 @@ HIDDENFORM
my $newnavform=(<
-
+
$pathitem
@@ -4550,7 +5342,7 @@ HIDDENFORM
NNFORM
my $newsmppageform=(<
-
+
$pathitem
@@ -4564,7 +5356,7 @@ NSPFORM
$pathitem
- $help{'Simple Problem'}
+ $help{'Simple_Problem'}
NSPROBFORM
@@ -4575,6 +5367,7 @@ NSPROBFORM
$pathitem
+ $help{'Dropbox'}
NDBFORM
@@ -4590,7 +5383,7 @@ NEXUFORM
my $newbulform=(<
-
+
$pathitem
@@ -4600,7 +5393,7 @@ NBFORM
my $newaboutmeform=(<
-
+
$pathitem
@@ -4611,7 +5404,7 @@ NAMFORM
my $newaboutsomeoneform=(<
-
+
$pathitem
@@ -4620,12 +5413,12 @@ NASOFORM
my $newrosterform=(<
-
+
$pathitem
- $help{'Course Roster'}
+ $help{'Course_Roster'}
NROSTFORM
@@ -4641,11 +5434,11 @@ NROSTFORM
}
my $newwebpageform =(<
-
+
$pathitem
- $help{'Web Page'}
+ $help{'Web_Page'}
NWEBFORM
@@ -4665,7 +5458,7 @@ my $newfolderb;
@@ -4676,14 +5469,14 @@ NPFORM
NFFORM
my $newsylform=(<
-
+
$pathitem
@@ -4695,7 +5488,7 @@ NSYLFORM
my $newgroupfileform=(<
-
+
$pathitem
@@ -4716,13 +5509,18 @@ NGFFORM
my @importdoc = (
{' '=>$extresourcesform}
);
+ if (keys(%ltitools)) {
+ push(@importdoc,
+ {' '=>$exttoolform},
+ );
+ }
unless ($container eq 'page') {
push(@importdoc,
{' '=>$imspform}
);
}
push(@importdoc,
- {' '=>$fileuploadform}
+ {' '=>$fileuploadform}
);
$fileuploadform = &create_form_ul(&create_list_elements(@importdoc));
@@ -4744,20 +5542,20 @@ NGFFORM
$communityform = &create_form_ul(&create_list_elements(@communityforma));
my %orderhash = (
- 'aa' => ['Import Content',$fileuploadform],
- 'bb' => ['Published Content',$importpubform],
- 'cc' => ['Grading Resources',$gradingform],
+ 'aa' => ['Upload',$fileuploadform],
+ 'bb' => ['Import',$importpubform],
+ 'cc' => ['Grading',$gradingform],
);
unless ($container eq 'page') {
$orderhash{'00'} = ['Newfolder',$newfolderform];
$orderhash{'dd'} = ['Collaboration',$communityform];
- $orderhash{'ee'} = ['Special Pages',$specialdocumentsform];
+ $orderhash{'ee'} = ['Other',$specialdocumentsform];
}
$hadchanges=0;
unless (($supplementalflag || $toolsflag)) {
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
- $supplementalflag,\%orderhash,$iconpath,$pathitem);
+ $supplementalflag,\%orderhash,$iconpath,$pathitem,\%ltitools);
if ($error) {
$r->print(''.$error.'
');
}
@@ -4812,7 +5610,7 @@ SUPDOCFORM
my $supnewfolderform=(<
-
+
$pathitem
@@ -4824,6 +5622,12 @@ SNFFORM
&Apache::lonextresedit::extedit_form(1,0,undef,undef,$pathitem,
$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=(<
@@ -4862,7 +5666,7 @@ SNAMFORM
$pathitem
- $help{'Web Page'}
+ $help{'Web_Page'}
SWEBFORM
@@ -4877,23 +5681,42 @@ my @specialdocs = (
);
my @supimportdoc = (
{' '
- =>$supextform},
- {' '
+ =>$supextform});
+ if (keys(%ltitools)) {
+ push(@supimportdoc,
+ {' '
+ =>$supexttoolform});
+ }
+ push(@supimportdoc,
+ {' '
=>$supupdocform},
- );
+ );
$supupdocform = &create_form_ul(&create_list_elements(@supimportdoc));
my %suporderhash = (
'00' => ['Supnewfolder', $supnewfolderform],
- 'ee' => ['Import Content',$supupdocform],
- 'ff' => ['Special Pages',&create_form_ul(&create_list_elements(@specialdocs))]
+ 'ee' => ['Upload',$supupdocform],
+ 'ff' => ['Other',&create_form_ul(&create_list_elements(@specialdocs))]
);
if ($supplementalflag) {
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
- $supplementalflag,\%suporderhash,$iconpath,$pathitem);
+ $supplementalflag,\%suporderhash,$iconpath,$pathitem,\%ltitools);
if ($error) {
$r->print(''.$error.'
');
- }
+ } else {
+ if ($suppchanges) {
+ my %servers = &Apache::lonnet::internet_dom_servers($coursedom);
+ my @ids=&Apache::lonnet::current_machine_ids();
+ foreach my $server (keys(%servers)) {
+ next if (grep(/^\Q$server\E$/,@ids));
+ my $hashid=$coursenum.':'.$coursedom;
+ my $cachekey = &escape('suppcount').':'.&escape($hashid);
+ &Apache::lonnet::remote_devalidate_cache($server,[$cachekey]);
+ }
+ &Apache::lonnet::get_numsuppfiles($coursenum,$coursedom,1);
+ undef($suppchanges);
+ }
+ }
}
} elsif ($supplementalflag) {
my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
@@ -4971,7 +5794,7 @@ sub decompression_info {
my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'};
my $container='sequence';
my ($pathitem,$hiddenelem);
- my @hiddens = ('newidx','comment','position','folderpath');
+ my @hiddens = ('newidx','comment','position','folderpath','archiveurl');
if ($env{'form.folderpath'} =~ /\:1$/) {
$container='page';
}
@@ -4979,7 +5802,7 @@ sub decompression_info {
foreach my $item (@hiddens) {
if ($env{'form.'.$item}) {
$hiddenelem .= ' '."\n";
+ &HTML::Entities::encode($env{'form.'.$item},'<>&"').'" />'."\n";
}
}
return ($destination,$dir_root,$londocroot,$docudom,$docuname,$container,
@@ -5036,25 +5859,34 @@ sub remove_archive {
} else {
$delwarning = &mt('An error occurred retrieving the contents of the current folder.');
}
- $delwarning .= &mt('As a result the archive file has not been removed.');
+ $delwarning .= ' '.&mt('As a result the archive file has not been removed.');
} else {
my $currcmd = $env{'form.cmd'};
my $position = $env{'form.position'};
- if ($position > 0) {
- $env{'form.cmd'} = 'del_'.$position;
- my ($title,$url,@rrest) =
- split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$position]]);
- if (&handle_edit_cmd($docuname,$docudom)) {
- ($errtext,$fatal) = &storemap($docuname,$docudom,$map,1);
- if ($fatal) {
- if ($container eq 'page') {
- $delwarning = &mt('An error occurred updating the contents of the current page.');
+ my $archiveidx = $position;
+ if ($position > 0) {
+ if (($env{'form.autoextract_camtasia'}) && (scalar(@LONCAPA::map::order) == 2)) {
+ $archiveidx = $position-1;
+ }
+ $env{'form.cmd'} = 'remove_'.$archiveidx;
+ my ($title,$url,@rrest) =
+ split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$archiveidx]]);
+ if ($url eq $env{'form.archiveurl'}) {
+ if (&handle_edit_cmd($docuname,$docudom)) {
+ ($errtext,$fatal) = &storemap($docuname,$docudom,$map,1);
+ if ($fatal) {
+ if ($container eq 'page') {
+ $delwarning = &mt('An error occurred updating the contents of the current page.');
+ } else {
+ $delwarning = &mt('An error occurred updating the contents of the current folder.');
+ }
} else {
- $delwarning = &mt('An error occurred updating the contents of the current folder.');
+ $delresult = &mt('Archive file removed.');
}
- } else {
- $delresult = &mt('Archive file removed.');
}
+ } else {
+ $delwarning .= &mt('Archive file had unexpected item number in folder.').
+ ' '.&mt('As a result the archive file has not been removed.');
}
}
$env{'form.cmd'} = $currcmd;
@@ -5076,13 +5908,13 @@ sub generate_admin_menu {
my ($crstype) = @_;
my $lc_crstype = lc($crstype);
my ($home,$other,%outhash)=&authorhosts();
- my %lt=&Apache::lonlocal::texthash (
+ my %lt= ( # do not translate here
'vc' => 'Verify Content',
'cv' => 'Check/Set Resource Versions',
'ls' => 'List Resource Identifiers',
'imse' => 'Export contents to IMS Archive',
- 'dcd' => "Dump $crstype Content to Authoring Space",
- );
+ 'dcd' => "Copy $crstype Content to Authoring Space",
+ );
my ($candump,$dumpurl);
if ($home + $other > 0) {
$candump = 'F';
@@ -5112,14 +5944,14 @@ sub generate_admin_menu {
{ linktext => $lt{'vc'},
url => "javascript:injectData(document.courseverify,'dummy','verify','$lt{'vc'}')",
permission => 'F',
- help => 'Verify_Content',
+ help => 'Docs_Verify_Content',
icon => 'verify.png',
linktitle => 'Verify contents can be retrieved/rendered',
},
{ linktext => $lt{'cv'},
url => "javascript:injectData(document.courseverify,'dummy','versions','$lt{'cv'}')",
permission => 'F',
- help => 'Check_Resource_Versions',
+ help => 'Docs_Check_Resource_Versions',
icon => 'resversion.png',
linktitle => "View version information for resources in your $lc_crstype, and fix/unfix use of specific versions",
},
@@ -5144,7 +5976,7 @@ sub generate_admin_menu {
{ linktext => $lt{'dcd'},
url => $dumpurl,
permission => $candump,
- #help => '',
+ help => 'Docs_Dump_Course_Docs',
icon => 'dump.png',
linktitle => $lt{'dcd'},
},
@@ -5164,7 +5996,7 @@ sub generate_edit_table {
my $form;
my $activetab;
my $active;
- if (($env{'form.active'} ne '') && ($env{'form.active'} ne 'aa')) {
+ if (($env{'form.active'} ne '') && ($env{'form.active'} ne '00')) {
$activetab = $env{'form.active'};
}
my $backicon = $iconpath.'clickhere.gif';
@@ -5172,7 +6004,7 @@ sub generate_edit_table {
$form = ''.
'
'."\n".
''.
- ''.
+ ' '.
' '.$backtext.' '."\n".
''.
@@ -5199,7 +6031,7 @@ sub generate_edit_table {
$form .= ' '.&mt(${$orderhash{$name}}[0]).' '."\n";
} else {
- $form .= ''.${$orderhash{$name}}[1].' '."\n";
+ $form .= ''.${$orderhash{$name}}[1].' '."\n";
}
}
@@ -5256,8 +6088,8 @@ END
}
sub editing_js {
- my ($udom,$uname,$supplementalflag) = @_;
- my %lt = &Apache::lonlocal::texthash(
+ my ($udom,$uname,$supplementalflag,$posslti) = @_;
+ my %js_lt = &Apache::lonlocal::texthash(
p_mnf => 'Name of New Folder',
t_mnf => 'New Folder',
p_mnp => 'Name of New Page',
@@ -5276,10 +6108,14 @@ sub editing_js {
p_rmr1 => 'WARNING: Removing a resource makes associated grades and scores inaccessible!',
p_rmr2a => 'Remove[_99]',
p_rmr2b => '?[_99]',
+ p_rmr3a => 'Remove those [_2]',
+ p_rmr3b => 'items?[_2]',
p_ctr1a => 'WARNING: Cutting a resource makes associated grades and scores inaccessible!',
p_ctr1b => 'Grades remain inaccessible if resource is pasted into another folder.',
p_ctr2a => 'Cut[_98]',
p_ctr2b => '?[_98]',
+ p_ctr3a => 'Cut those[_2]',
+ p_ctr3b => 'items?[_2]',
rpck => 'Enter number to pick (e.g., 3)',
imsfile => 'You must choose an IMS package for import',
imscms => 'You must select which Course Management System was the source of the IMS package',
@@ -5287,8 +6123,11 @@ sub editing_js {
titbl => 'Title is blank',
more => '(More ...)',
less => '(Less ...)',
+ noor => 'No actions selected or changes to settings specified.',
+ noch => 'No changes to settings specified.',
+ noac => 'No actions selected.',
);
-
+ &js_escape(\%js_lt);
my $crstype = &Apache::loncommon::course_type();
my $docs_folderpath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'},'<>&"');
my $main_container_page;
@@ -5296,7 +6135,7 @@ sub editing_js {
$main_container_page = 1;
}
my $toplevelmain =
- &escape(&mt('Main '.$crstype.' Content').':::::');
+ &escape(&mt('Main Content').':::::');
my $toplevelsupp = &supplemental_base();
my $backtourl;
@@ -5310,6 +6149,9 @@ sub editing_js {
if (&Apache::lonnet::is_on_map($res)) {
$backtourl = &HTML::Entities::encode(&Apache::lonnet::clutter($res),'<>&"').'?symb='.
&HTML::Entities::encode($caller,'<>&"');
+ $backtourl = &Apache::loncommon::escape_single($backtourl);
+ } else {
+ $backtourl = '/adm/navmaps';
}
}
} elsif ($env{'docs.exit.'.$env{'request.course.id'}} eq '/adm/menu') {
@@ -5321,16 +6163,22 @@ sub editing_js {
}
my $fieldsets = "'ext','doc'";
+ if ($posslti) {
+ $fieldsets .= ",'tool'";
+ }
unless ($main_container_page) {
$fieldsets .=",'ims'";
}
if ($supplementalflag) {
$fieldsets = "'suppext','suppdoc'";
+ if ($posslti) {
+ $fieldsets .= ",'supptool'";
+ }
}
return <$lt{'more'}';
+ document.getElementById('more'+caller).innerHTML = ' $js_lt{'more'} ';
} else {
document.getElementById('more'+caller).innerHTML = '';
}
@@ -5877,10 +6754,10 @@ function togglePick(caller,value) {
function toggleCheckUncheck(caller,more) {
if (more == 1) {
- document.getElementById('more'+caller).innerHTML = ' $lt{'less'} ';
+ document.getElementById('more'+caller).innerHTML = ' $js_lt{'less'} ';
document.getElementById('allfields'+caller).style.display='block';
} else {
- document.getElementById('more'+caller).innerHTML = ' $lt{'more'} ';
+ document.getElementById('more'+caller).innerHTML = ' $js_lt{'more'} ';
document.getElementById('allfields'+caller).style.display='none';
}
resize_scrollbox('contentscroll','1','1');
@@ -5920,6 +6797,8 @@ function checkSubmits() {
var numchanges = 0;
var form = document.saveactions;
var doactions = multiActions();
+ var cutwarnings = 0;
+ var remwarnings = 0;
if (doactions == 1) {
var remidxlist = document.cumulativeactions.allremoveidx.value;
if ((remidxlist != '') && (remidxlist != null)) {
@@ -5929,6 +6808,11 @@ function checkSubmits() {
if (document.getElementById('remove_'+remidxs[i]).checked) {
form.multiremove.value += remidxs[i]+',';
numchanges ++;
+ if (document.getElementById('skip_remove_'+remidxs[i])) {
+ if (document.getElementById('skip_remove_'+remidxs[i]).value == 0) {
+ remwarnings ++;
+ }
+ }
}
}
}
@@ -5941,6 +6825,11 @@ function checkSubmits() {
if (document.getElementById('cut_'+cutidxs[i]).checked == true) {
form.multicut.value += cutidxs[i]+',';
numchanges ++;
+ if (document.getElementById('skip_cut_'+cutidxs[i])) {
+ if (document.getElementById('skip_cut_'+cutidxs[i]).value == 0) {
+ cutwarnings ++;
+ }
+ }
}
}
}
@@ -5962,10 +6851,12 @@ function checkSubmits() {
}
}
var dosettings = multiSettings();
+ var haschanges = 0;
if (dosettings == 1) {
form.allencrypturl.value = '';
form.allhiddenresource.value = '';
- form.changeparms.value = 'all';
+ form.changeparms.value = 'all';
+ var patt=new RegExp(",\$");
var allidxlist = document.cumulativesettings.allidx.value;
if ((allidxlist != '') && (allidxlist != null)) {
var allidxs = allidxlist.split(',');
@@ -5982,6 +6873,8 @@ function checkSubmits() {
}
}
}
+ form.allhiddenresource.value = form.allhiddenresource.value.replace(patt,"");
+ form.allencrypturl.value = form.allencrypturl.value.replace(patt,"");
}
}
form.allrandompick.value = '';
@@ -6000,12 +6893,55 @@ function checkSubmits() {
form.allrandomorder.value += allmapidxs[i]+',';
}
}
+ form.allrandompick.value = form.allrandompick.value.replace(patt,"");
+ form.allrandomorder.value = form.allrandomorder.value.replace(patt,"");
+ }
+ if (document.cumulativesettings.currhiddenresource.value != form.allhiddenresource.value) {
+ haschanges = 1;
+ }
+ if (document.cumulativesettings.currencrypturl.value != form.allencrypturl.value) {
+ haschanges = 1;
+ }
+ if (document.cumulativesettings.currrandomorder.value != form.allrandomorder.value) {
+ haschanges = 1;
+ }
+ if (document.cumulativesettings.currrandompick.value != form.allrandompick.value) {
+ haschanges = 1;
+ }
+ }
+ if (doactions == 1) {
+ if (numchanges > 0) {
+ if ((cutwarnings > 0) || (remwarnings > 0)) {
+ if (remwarnings > 0) {
+ if (!confirm('$js_lt{"p_rmr1"}\\n\\n$js_lt{"p_rmr3a"} '+remwarnings+' $js_lt{"p_rmr3b"}')) {
+ return false;
+ }
+ }
+ if (cutwarnings > 0) {
+ if (!confirm('$js_lt{"p_ctr1a"}\\n$js_lt{"p_ctr1b"}\\n\\n$js_lt{"p_ctr3a"} '+cutwarnings+' $js_lt{"p_ctr3b"}')) {
+ return false;
+ }
+ }
+ }
+ form.submit();
+ return true;
+ }
+ }
+ if (dosettings == 1) {
+ if (haschanges == 1) {
+ form.submit();
+ return true;
+ }
+ }
+ if ((dosettings == 1) && (doactions == 1)) {
+ alert("$js_lt{'noor'}");
+ } else {
+ if (dosettings == 1) {
+ alert("$js_lt{'noch'}");
+ } else {
+ alert("$js_lt{'noac'}");
}
}
- if ((numchanges > 0) || (dosettings == 1)) {
- form.submit();
- return true;
- }
return false;
}
@@ -6118,13 +7054,19 @@ ENDINJECT
sub dump_switchserver_js {
my @hosts = @_;
- my %lt = &Apache::lonlocal::texthash(
- dump => 'Dumping to Authoring Space requires switching server.',
+ my %js_lt = &Apache::lonlocal::texthash(
+ dump => 'Copying content to Authoring Space requires switching server.',
+ swit => 'Switch server?',
+ );
+ my %html_js_lt = &Apache::lonlocal::texthash(
swit => 'Switch server?',
- duco => 'Dump content to Authoring Space',
+ duco => 'Copying Content to Authoring Space',
yone => 'You need to switch to a server housing an Authoring Space for which you are author or co-author.',
chos => 'Choose server',
);
+ &js_escape(\%js_lt);
+ &html_escape(\%html_js_lt);
+ &js_escape(\%html_js_lt);
my $role = $env{'request.role'};
my $js = <<"ENDSWJS";