'
+ 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 +2961,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 +2977,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 +3025,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 +3038,7 @@ sub editor {
.'';
} else {
$to_show = ''
- .&mt('Currently no documents.')
+ .&mt('Currently empty')
.' '
}
}
@@ -2744,7 +3105,11 @@ sub multiple_check_form {
'';
if ($caller eq 'settings') {
$output .=
- '';
+ ''."\n".
+ ''."\n".
+ ''."\n".
+ ''."\n".
+ ''."\n";
} elsif ($caller eq 'actions') {
$output .=
''.
@@ -2758,8 +3123,30 @@ 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.instcode'}) {
+ $quotatype = 'official';
+ }
+ 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');
+ return if ($$upload_output);
+ }
my ($parseaction,$showupload,$nextphase,$mimetype);
if ($env{'form.parserflag'}) {
$parseaction = 'parse';
@@ -3027,7 +3414,7 @@ END
}
if ($denied{'copy'}) {
- $copylink=(<$lt{'cp'}
ENDCOPY
} else {
@@ -3053,6 +3440,7 @@ ENDCUT
$cutlink=(<
$form_common
+
$lt{'ct'}
$form_end
ENDCUT
@@ -3070,6 +3458,7 @@ ENDREM
$removelink=(<
$form_common
+
$lt{'rm'}
$form_end
ENDREM
@@ -3077,11 +3466,9 @@ ENDREM
push(@{$filtersref->{'canremove'}},$orderidx);
}
}
- unless ($isexternal) {
- $renamelink=(<$lt{'rn'}
ENDREN
- }
$line.=(<
@@ -3192,6 +3579,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 +3594,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 =
' ';
}
@@ -3588,8 +3993,8 @@ sub list_symbs {
sub verifycontent {
my ($r) = @_;
my $crstype = &Apache::loncommon::course_type();
- $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Documents'));
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Documents'));
+ $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Content'));
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Content'));
$r->print(&startContentScreen('tools'));
$r->print(''.&mt($crstype.' content verification').'');
$hashtied=0;
@@ -3691,7 +4096,7 @@ sub checkversions {
&changewarning($r,'');
if ($env{'form.timerange'} eq 'all') {
# show all documents
- $header=&mt('All Documents in '.$crstype);
+ $header=&mt('All content in '.$crstype);
$allsel=' selected="selected"';
foreach my $key (keys(%hash)) {
if ($key=~/^ids\_(\/res\/.+)$/) {
@@ -3969,7 +4374,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 +4395,7 @@ sub endContentScreen {
}
sub supplemental_base {
- return 'supplemental&'.&escape(&mt('Supplemental '.&Apache::loncommon::course_type().' Content'));
+ return 'supplemental&'.&escape(&mt('Supplemental Content'));
}
sub handler {
@@ -4015,7 +4420,8 @@ sub handler {
'Supplemental','Score_Upload_Form','Adding_Pages',
'Importing_LON-CAPA_Resource','Importing_IMS_Course',
'Uploading_From_Harddrive',
- 'Check_Resource_Versions','Verify_Content') {
+ 'Check_Resource_Versions','Verify_Content',
+ 'Course_Roster','Web_Page','Dropbox') {
$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);
}
# Composite help files
@@ -4031,8 +4437,6 @@ sub handler {
'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.
@@ -4063,7 +4467,7 @@ sub handler {
&init_breadcrumbs('versions','Check/Set 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 +4493,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; }
@@ -4123,7 +4527,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 +4572,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 +4598,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 = '';
@@ -4297,7 +4701,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,7 +4753,7 @@ 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',
@@ -4370,8 +4774,8 @@ 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',
@@ -4519,7 +4923,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 = '';
}
@@ -4575,6 +4979,7 @@ NSPROBFORM
$pathitem
+ $help{'Dropbox'}
NDBFORM
@@ -4625,7 +5030,7 @@ NASOFORM
- $help{'Course Roster'}
+ $help{'Course_Roster'}
NROSTFORM
@@ -4645,7 +5050,7 @@ NROSTFORM
$pathitem
- $help{'Web Page'}
+ $help{'Web_Page'}
NWEBFORM
@@ -4722,7 +5127,7 @@ NGFFORM
);
}
push(@importdoc,
- {' '=>$fileuploadform}
+ {' '=>$fileuploadform}
);
$fileuploadform = &create_form_ul(&create_list_elements(@importdoc));
@@ -4744,14 +5149,14 @@ 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;
@@ -4862,7 +5267,7 @@ SNAMFORM
$pathitem
- $help{'Web Page'}
+ $help{'Web_Page'}
SWEBFORM
@@ -4885,15 +5290,28 @@ my @supimportdoc = (
$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);
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,
@@ -5040,8 +5458,8 @@ sub remove_archive {
} else {
my $currcmd = $env{'form.cmd'};
my $position = $env{'form.position'};
- if ($position > 0) {
- $env{'form.cmd'} = 'del_'.$position;
+ if ($position > 0) {
+ $env{'form.cmd'} = 'remove_'.$position;
my ($title,$url,@rrest) =
split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$position]]);
if (&handle_edit_cmd($docuname,$docudom)) {
@@ -5076,13 +5494,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';
@@ -5172,7 +5590,7 @@ sub generate_edit_table {
$form = ''.
' '."\n".
'- '.
- ''.
+ ''.
'
'.$backtext.' '."\n".
'- '.
@@ -5276,10 +5694,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,6 +5709,9 @@ 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.',
);
my $crstype = &Apache::loncommon::course_type();
@@ -5296,7 +5721,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 +5735,8 @@ sub editing_js {
if (&Apache::lonnet::is_on_map($res)) {
$backtourl = &HTML::Entities::encode(&Apache::lonnet::clutter($res),'<>&"').'?symb='.
&HTML::Entities::encode($caller,'<>&"');
+ } else {
+ $backtourl = '/adm/navmaps';
}
}
} elsif ($env{'docs.exit.'.$env{'request.course.id'}} eq '/adm/menu') {
@@ -5920,6 +6347,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 +6358,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 +6375,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 +6401,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 +6423,8 @@ function checkSubmits() {
}
}
}
+ form.allhiddenresource.value = form.allhiddenresource.value.replace(patt,"");
+ form.allencrypturl.value = form.allencrypturl.value.replace(patt,"");
}
}
form.allrandompick.value = '';
@@ -6000,12 +6443,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('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr3a"} '+remwarnings+' $lt{"p_rmr3b"}')) {
+ return false;
+ }
+ }
+ if (cutwarnings > 0) {
+ if (!confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr3a"} '+cutwarnings+' $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("$lt{'noor'}");
+ } else {
+ if (dosettings == 1) {
+ alert("$lt{'noch'}");
+ } else {
+ alert("$lt{'noac'}");
}
}
- if ((numchanges > 0) || (dosettings == 1)) {
- form.submit();
- return true;
- }
return false;
}
@@ -6119,9 +6605,9 @@ ENDINJECT
sub dump_switchserver_js {
my @hosts = @_;
my %lt = &Apache::lonlocal::texthash(
- dump => 'Dumping to Authoring Space requires switching server.',
+ dump => 'Copying Content to Authoring Space requires switching server.',
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',
);
|