'.
&mt('Dump '.$type.
@@ -136,7 +134,7 @@ sub dumpbutton {
sub clean {
my ($title)=@_;
$title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs;
- return $title;
+ return $title;
}
@@ -178,8 +176,8 @@ sub dumpcourse {
my $fail=0;
for (my $i=0;$i<$#dirs;$i++) {
$makepath.='/'.$dirs[$i];
- unless (-e $makepath) {
- unless(mkdir($makepath,0777)) { $fail=1; }
+ unless (-e $makepath) {
+ unless(mkdir($makepath,0777)) { $fail=1; }
}
}
$r->print(' '.$item.' => '.$newfilename.': ');
@@ -265,9 +263,7 @@ sub dumpcourse {
sub exportbutton {
my $type = &Apache::loncommon::course_type();
- return ''.
+ return "".&mt('IMS Export')."".
&Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').' ';
}
@@ -283,20 +279,10 @@ sub exportcourse {
if (!defined($navmap)) {
$r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package').
'
'.&mt('IMS Export Failed').'
'.
- '
');
- if ($crstype eq 'Community') {
- $r->print(&mt('Unable to retrieve information about community contents'));
- } else {
- $r->print(&mt('Unable to retrieve information about course contents'));
- }
- $r->print('
'.
+ &mt('Unable to retrieve information about course contents').
+ '
'.&mt('Return to Course Editor').'');
+ &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'});
return;
}
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);
@@ -345,16 +331,16 @@ sub exportcourse {
open(OUTPUT, "zip -r $imszip * 2> /dev/null |");
close(OUTPUT);
chdir $cwd;
- $outcome .= '
'
- .&mt('[_1]Your IMS package[_2] is ready for download.'
- ,'','')
- .'
';
if ($copyresult) {
$outcome .= '
'
.&mt('The following errors occurred during export - [_1]'
,$copyresult)
.'
';
}
+ $outcome .= '
'
+ .&mt('[_1]Your IMS package[_2] is ready for download.'
+ ,'','')
+ .'
';
} else {
$outcome = '
'
.&mt('Unfortunately you will not be able to retrieve'
@@ -368,30 +354,28 @@ sub exportcourse {
}
}
$r->print(&Apache::loncommon::start_page('Export '.$type.' to IMS Package'));
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export'));
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('IMS Export'));
$r->print($outcome);
$r->print(&Apache::loncommon::end_page());
} else {
- my $display='
');
+ $r->print('');
}
sub do_paste_from_buffer {
@@ -1386,7 +1375,7 @@ sub do_paste_from_buffer {
$db_name =~ s{_\d*$ }{_$now}x;
my $result=&Apache::lonnet::put($db_name,\%contents,
$coursedom,$coursenum);
- $url =~ s{/(\d*)/smppg$ }{/$now/smppg}x;
+ $url =~ s{/(\d*)/smppg$ }{/$now/smppg}x;
$title=&mt('Copy of').' '.$title;
}
}
@@ -1400,7 +1389,7 @@ sub do_paste_from_buffer {
if ($folder =~ /^supplemental/) {
$title = $env{'docs.markedcopy_supplemental'};
} else {
- (undef,undef,$title) =
+ (undef,undef,$title) =
&parse_supplemental_title($env{'docs.markedcopy_supplemental'});
}
} else {
@@ -1424,7 +1413,7 @@ sub uniqueness_check {
$url=&LONCAPA::map::qtescape($url);
if ($newurl eq $url) {
$unique = 0;
- last;
+ last;
}
}
return $unique;
@@ -1450,7 +1439,7 @@ sub update_parameter {
&remember_parms($idx,$which,'set',$value);
} else {
&LONCAPA::map::delparameter($idx,'parameter_'.$which);
-
+
&remember_parms($idx,$which,'del');
}
return 1;
@@ -1478,7 +1467,7 @@ sub handle_edit_cmd {
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]);
splice(@LONCAPA::map::order, $idx, 1);
- } elsif ($cmd eq 'up'
+ } elsif ($cmd eq 'up'
&& ($idx) && (defined($LONCAPA::map::order[$idx-1]))) {
@LONCAPA::map::order[$idx-1,$idx] = @LONCAPA::map::order[$idx,$idx-1];
@@ -1518,11 +1507,11 @@ sub editor {
$LONCAPA::map::order[0]=$idx;
$LONCAPA::map::resources[$idx]='';
}
-
+
my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order)=
&breadcrumbs($folder,$allowed,$type);
$r->print($breadcrumbtrail);
-
+
# ------------------------------------------------------------ Process commands
# ---------------- if they are for this folder and user allowed to make changes
@@ -1543,9 +1532,9 @@ sub editor {
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container);
return $errtext if ($fatal);
}
-
+
if ($env{'form.pastemarked'}) {
- my $paste_res =
+ my $paste_res =
&do_paste_from_buffer($coursenum,$coursedom,$folder);
if ($paste_res eq 'ok') {
($errtext,$fatal) = &storemap($coursenum,$coursedom,$folder.'.'.$container);
@@ -1589,7 +1578,7 @@ sub editor {
return $errtext if ($fatal);
} else {
$r->print('
'.&mt('No map selected.').'
');
-
+
}
}
&log_differences($plain);
@@ -1599,34 +1588,67 @@ sub editor {
my $idx=0;
my $shown=0;
if (($ishidden) || ($isencrypted) || ($randompick>=0) || ($is_random_order)) {
- $r->print('
'.&mt('Caution: this folder is set to randomly pick a subset of resources. Adding or removing resources from this folder will change the set of resources that the students see, resulting in spurious or missing credit for completed problems, not limited to ones you modify. Do not modify the contents of this folder if it is in active student use.').'
');
- }
- if ($is_random_order) {
- $r->print('
'.&mt('Caution: this folder is set to randomly order its contents. Adding or removing resources from this folder will change the order of resources shown.').'
');
+ if ($randompick>=0) {
+ $r->print('
'
+ .&mt('Caution: this folder is set to randomly pick a subset'
+ .' of resources. Adding or removing resources from this'
+ .' folder will change the set of resources that the'
+ .' students see, resulting in spurious or missing credit'
+ .' for completed problems, not limited to ones you'
+ .' modify. Do not modify the contents of this folder if'
+ .' it is in active student use.')
+ .'
'
+ .&mt('Caution: this folder is set to randomly order its'
+ .' contents. Adding or removing resources from this folder'
+ .' will change the order of resources shown.')
+ .'
\n");
if ($allowed) {
&print_paste_buffer($r,$container);
}
@@ -1708,7 +1730,7 @@ sub process_file_upload {
';
$phase_status = 'phasetwo';
- $$upload_output .=
+ $$upload_output .=
'This file contains embedded multimedia objects, which need to be uploaded to LON-CAPA. '.
&Apache::loncommon::ask_for_embedded_content(
'/adm/coursedocs',$state,$allfiles,$codebase);
@@ -1763,7 +1785,7 @@ sub parse_supplemental_title {
}
if (wantarray) {
return ($title,$foldertitle,$renametitle);
- }
+ }
return $title;
}
@@ -1784,12 +1806,12 @@ sub entryline {
}
my $orderidx=$LONCAPA::map::order[$index];
-
+
$renametitle=~s/\\/\\\\/g;
$renametitle=~s/\"\;/\\\"/g;
$renametitle=~s/ /%20/g;
- my $line='
';
+ my $line=&Apache::loncommon::start_data_table_row();
my ($form_start,$form_end);
# Edit commands
my ($container, $type, $esc_path, $path, $symb);
@@ -1811,16 +1833,16 @@ sub entryline {
my $incindex=$index+1;
my $selectbox='';
if (($folder!~/^supplemental/) &&
- ($#LONCAPA::map::order>0) &&
+ ($#LONCAPA::map::order>0) &&
((split(/\:/,
- $LONCAPA::map::resources[$LONCAPA::map::order[0]]))[1]
- ne '') &&
+ $LONCAPA::map::resources[$LONCAPA::map::order[0]]))[1]
+ ne '') &&
((split(/\:/,
- $LONCAPA::map::resources[$LONCAPA::map::order[1]]))[1]
+ $LONCAPA::map::resources[$LONCAPA::map::order[1]]))[1]
ne '')) {
$selectbox=
''.
- '
";
+ $line.=&Apache::loncommon::end_data_table_row();
return $line;
}
@@ -2093,7 +2113,7 @@ sub tiehash {
$hashtied=1;
}
}
- }
+ }
}
sub untiehash {
@@ -2301,7 +2321,7 @@ sub checkversions {
if ($haschanged) {
if (&Apache::lonnet::put('resourceversions',\%newsetversions,
$env{'course.'.$env{'request.course.id'}.'.domain'},
- $env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') {
+ $env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') {
$r->print('
'.&mt('Your Version Settings have been Saved').'
');
} else {
$r->print('
'.&mt('An Error Occured while Attempting to Save your Version Settings').'
');
@@ -2442,7 +2462,7 @@ ENDHEADERS
$lastold=$prevvers;
}
}
- #
+ #
# Code to figure out how many version entries should go in
# each of the four columns
my $entries_per_col = 0;
@@ -2453,7 +2473,7 @@ ENDHEADERS
$entries_per_col = $num_entries/4 + 1;
}
my $entries_count = 0;
- $r->print('
');
+ $r->print('
');
my $cols_output = 1;
for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
my $url=$root.'.'.$prevvers.'.'.$extension;
@@ -2544,7 +2564,6 @@ sub changewarning {
$env{'request.role'}.'" value="1" />').
$help{'Caching'}.''."\n\n");
-
}
@@ -2552,7 +2571,7 @@ sub init_breadcrumbs {
my ($form,$text)=@_;
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs",
- text=>&Apache::loncommon::course_type().' Editor',
+ text=>"Edit ".&Apache::loncommon::course_type(),
faq=>273,
bug=>'Instructor Interface',
help => 'Docs_Adding_Course_Doc'});
@@ -2572,6 +2591,7 @@ sub handler {
return OK if $r->header_only;
my $type = &Apache::loncommon::course_type();
+
# --------------------------------------------- Initialize help topics for this
foreach my $topic ('Adding_Course_Doc','Main_Course_Documents',
'Adding_External_Resource','Navigate_Content',
@@ -2590,9 +2610,9 @@ sub handler {
'Option_Response_Simple');
$help{'Bulletin Board'} = &Apache::loncommon::help_open_topic(
'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages');
- $help{'My Personal Info'} = &Apache::loncommon::help_open_topic(
+ $help{'My Personal Information Page'} = &Apache::loncommon::help_open_topic(
'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages');
- $help{'Group Files'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files');
+ $help{'Group Portfolio'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files');
$help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
# does this user have privileges to modify docs
@@ -2625,6 +2645,8 @@ sub handler {
my $showdoc=0;
my $containertag;
my $uploadtag;
+
+
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['folderpath','pagepath',
'pagesymb']);
@@ -2666,25 +2688,45 @@ sub handler {
$showdoc='/'.$1;
}
unless ($showdoc) { # got called from remote
- if (($env{'form.folder'}=~/^(?:group|default)_/) ||
+ if (($env{'form.folder'}=~/^(?:group|default)_/) ||
($env{'form.folder'} =~ m:^\d+/(pages|sequences)/:)) {
$forcestandard = 1;
- }
+ }
$forcesupplement=($env{'form.folder'}=~/^supplemental_/);
- if ($allowed) {
+ if ($allowed) {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']);
- $script=&Apache::lonratedt::editscript('simple');
+ $script=&Apache::lonratedt::editscript('simple');
}
} else { # got called in sequence from course
$allowed=0;
}
+# subroutine to list form elements
+sub create_list_elements {
+ my @formarr = @_;
+ my $list = '';
+ for my $button (@formarr){
+ for my $picture(keys %$button) {
+ #my $link = Apache::lonhtmlcommon::htmltag('a' ,$button->{$picture}, {href => "test"});
+ $list .= Apache::lonhtmlcommon::htmltag('li', $picture.' '.$button->{$picture}, {class => 'LC_menubuttons_inline_text'});
+ }
+ }
+ return $list;
+}
+
+# subroutine to create ul from list elements
+sub create_form_ul {
+ my $list = shift;
+ my $ul = Apache::lonhtmlcommon::htmltag('ul',$list, {class => 'LC_ListStyleNormal'});
+ return $ul;
+}
+
# get course data
my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'};
my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'};
-# get personal data
+# get personal data
my $uname=$env{'user.name'};
my $udom=$env{'user.domain'};
my $plainname=&escape(&Apache::loncommon::plainname($uname,$udom));
@@ -2702,19 +2744,27 @@ sub handler {
.$script."\n"
.'// ]]>'."\n"
.''."\n";
- my $brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}];
+
+ # Breadcrumbs
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ &Apache::lonhtmlcommon::add_breadcrumb({
+ href=>"/adm/createuser",text=>"$type Documents"});
+
$r->print(&Apache::loncommon::start_page("$type Documents", $script,
- {'force_register' => $showdoc,
- 'bread_crumbs' => $brcrum}).
- &Apache::loncommon::help_open_menu('','',273,'RAT'));
-
+ {'force_register' => $showdoc,})
+ .&Apache::loncommon::help_open_menu('','',273,'RAT')
+ .&Apache::lonhtmlcommon::breadcrumbs(
+ 'Editing the Table of Contents for your '.$type,
+ 'Docs_Adding_Course_Doc')
+ );
+
my %allfiles = ();
my %codebase = ();
my ($upload_result,$upload_output);
if ($allowed) {
if (($env{'form.uploaddoc.filename'}) &&
($env{'form.cmd'}=~/^upload_(\w+)/)) {
-# Process file upload - phase one - upload and parse primary file.
+# Process file upload - phase one - upload and parse primary file.
undef($hadchanges);
$upload_result = &process_file_upload(\$upload_output,$coursenum,
$coursedom,\%allfiles,
@@ -2739,8 +2789,8 @@ sub handler {
$newname{$i} = &process_secondary_uploads(\$upload_output,$coursedom,$coursenum,'embedded_item_',$i,$residx);
$origname{$i} = &unescape($env{'form.embedded_orig_'.$i});
if (exists($env{'form.embedded_codebase_'.$i})) {
- $javacodebase = &unescape($env{'form.embedded_codebase_'.$i});
- $origname{$i} =~ s#^\Q$javacodebase\E/##;
+ $javacodebase = &unescape($env{'form.embedded_codebase_'.$i});
+ $origname{$i} =~ s#^\Q$javacodebase\E/##;
}
my @attributes = ();
if ($env{'form.embedded_attrib_'.$i} =~ /:/) {
@@ -2776,8 +2826,8 @@ sub handler {
$attrib_regexp = $attribs{$item}[0];
}
if ($content =~ m#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#) {
- }
- $content =~ s#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#$1$newname{$item}$2#gi;
+ }
+ $content =~ s#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#$1$newname{$item}$2#gi;
}
if (exists($codebase{$item})) {
$content =~ s/(codebase\s*=\s*["']?)\Q$codebase{$item}\E(["']?)/$1.$2/i; #' stupid emacs
@@ -2789,7 +2839,7 @@ sub handler {
my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'};
my $url = &Apache::lonnet::store_edited_file($primary_url,$content,$docudom,$docuname,\$saveresult);
} else {
- &Apache::lonnet::logthis('retrieval of uploaded file - '.$primary_url.' - for editing, failed: '.$getstatus);
+ &Apache::lonnet::logthis('retrieval of uploaded file - '.$primary_url.' - for editing, failed: '.$getstatus);
}
}
}
@@ -2801,9 +2851,7 @@ sub handler {
'uplm' => 'Upload a new main '.lc($type).' document',
'upls' => 'Upload a new supplemental '.lc($type).' document',
'impp' => 'Import a document',
- 'pubd' => 'Published documents',
'copm' => 'All documents out of a published map into this folder',
- 'spec' => 'Special documents',
'upld' => 'Upload Document',
'srch' => 'Search',
'impo' => 'Import',
@@ -2822,31 +2870,90 @@ sub handler {
'scuf' => 'Score Upload Form',
'bull' => 'Discussion Board',
'mypi' => 'My Personal Information Page',
- 'grpo' => 'Group Portfolios',
+ 'grpo' => 'Group Portfolio',
'rost' => 'Course Roster',
- 'abou' => 'About User',
+ 'abou' => 'Personal Information Page for a User',
'imsf' => 'IMS Import',
'imsl' => 'Import IMS package',
'file' => 'File',
'title' => 'Title',
'comment' => 'Comment',
- 'parse' => 'If HTML file, upload embedded images/multimedia files'
+ 'parse' => 'Upload embedded images/multimedia files if HTML file!',
+ 'nd' => 'Upload Document',
+ 'pm' => 'Published Map',
+ 'sd' => 'Special Document',
+ 'mo' => 'More Options',
);
# -----------------------------------------------------------------------------
- my %tabtitles = (
- main => {
- Course => &mt('Main Course Documents'),
- Community => &mt('Main Community Documents'),
- },
- supplemental => {
- Course => &mt('Supplemental Course Documents'),
- Community => &mt('Supplemental Community Documents'),
- },
- );
+ my $fileupload=(<
+
+FIUP
+
+ my $checkbox=(<$lt{'parse'}?
+
+ -->
+
+ $lt{'parse'}
+
+CHBO
+
+ my @fileuploada = (
+ { '' => " $help{'Uploading_From_Harddrive'}" },
+ );
+ my $fileuploadform=(<
+
+ $fileupload
+
+ $lt{'title'}:
+
+ $uploadtag
+
+
+
+ $checkbox
+
+FUFORM
+ $fileuploadform .= create_form_ul(create_list_elements(@fileuploada));
+ $fileuploadform .= (<
+FUFORM
+
+ my $simpleeditdefaultform=(<
+
+SEDFFORM
+ my @simpleeditdefaultforma = (
+ { '' => "$uploadtag$lt{'srch'}" },
+ { '' => "$lt{'impo'}$help{'Importing_LON-CAPA_Resource'}" },
+ { '' => "$lt{'book'}" },
+ );
+ $simpleeditdefaultform .= create_form_ul(create_list_elements(@simpleeditdefaultforma));
+ $simpleeditdefaultform .=(<
+
+HIDDENFORM
+ }
+# --------------------------------------------------------- Main tab structure
+
+ my $activeClass = 1;
+ my $active = '';
- $r->print(<
-
-
-
-
- $containertag
-
-
-
- $uploadtag
-
-
-
-
-
- $help{'Verify_Content'}
-
-
- $help{'Check_Resource_Versions'}
-
- $dumpbut
- $exportbut
-
-
-
-
-
-
-
-
-
-
-ENDCOURSEVERIFY
- $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
- &mt('Editing the Table of Contents for your '.$type)));
+ $r->print('