';
}
sub exportcourse {
my $r=shift;
+ my $type = &Apache::loncommon::course_type();
my %discussiontime = &Apache::lonnet::dump('discussiontimes',
$env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
my $numdisc = keys %discussiontime;
@@ -299,7 +307,7 @@ sub exportcourse {
open(OUTPUT, "zip -r $imszip * 2> /dev/null |");
close(OUTPUT);
chdir $cwd;
- $outcome .= 'Download the zip file from IMS course archive ';
+ $outcome .= &mt('Download the zip file from IMS '.lc($type).' archive ',$imszipfile,);
if ($copyresult) {
$outcome .= 'The following errors occurred during export - '.$copyresult;
}
@@ -307,13 +315,14 @@ sub exportcourse {
$outcome = ' Unfortunately you will not be able to retrieve an IMS archive of this posts at this time, because there was a problem creating a manifest file. ';
}
}
- $r->print(&Apache::loncommon::start_page('Export course to IMS content package'));
+ $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package'));
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package'));
$r->print($outcome);
$r->print(&Apache::loncommon::end_page());
} else {
my $display;
$display = ''.
+ &mt('Export '.$type.' DOCS').'" />'.
&Apache::loncommon::end_page());
}
}
@@ -603,7 +613,7 @@ sub build_package {
if (grep/^$count$/,@$discussions) {
my $ressymb = $symb;
my $mode;
- if ($ressymb =~ m|adm/(\w+)/(\w+)/(\d+)/bulletinboard$|) {
+ if ($ressymb =~ m|adm/($match_domain)/($match_username)/(\d+)/bulletinboard$|) {
unless ($ressymb =~ m|adm/wrapper/adm|) {
$ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard';
}
@@ -688,7 +698,7 @@ sub process_content {
}
} elsif ($symb =~ m-lib/templates/examupload\.problem$-) {
$content_type = 'examupload';
- } elsif ($symb =~ m-adm/(\w+)/(\w+)/(\d+)/bulletinboard$-) {
+ } elsif ($symb =~ m-adm/($match_domain)/($match_username)/(\d+)/bulletinboard$-) {
$content_type = 'bulletinboard';
my $contents = &Apache::imsexport::templatedpage($content_type,$3,$count,\@uploads,$1,$2);
if ($contents) {
@@ -895,15 +905,14 @@ sub store_template {
# Imports the given (name, url) resources into the course
# coursenum, coursedom, and folder must precede the list
sub group_import {
- my $coursenum = shift;
- my $coursedom = shift;
- my $folder = shift;
- my $container = shift;
- my $caller = shift;
- while (@_) {
- my $name = shift;
- my $url = shift;
- if (($url =~ m#^/uploaded/$coursedom/$coursenum/(default_\d+\.)(page|sequence)$#) && ($caller eq 'londocs')) {
+ my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_;
+
+ while (@files) {
+ my ($name, $url, $residx) = @{ shift(@files) };
+ if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$})
+ && ($caller eq 'londocs')
+ && (!&Apache::lonnet::stat_file($url))) {
+
my $errtext = '';
my $fatal = 0;
my $newmapstr = '
'.
- '
Most Recent: '.
+ '
Most Recent: '.
''.$currentversion.''.
- '
'.
- '
In Course: '.
+ '
'.
+ '
In '.$type.': '.
'');
# Used in course
my $usedversion=$hash{'version_'.$linkurl};
@@ -1972,8 +2297,8 @@ ENDHEADERS
} else {
$r->print($currentversion);
}
- $r->print('
');
my $lastold=1;
for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
my $url=$root.'.'.$prevvers.'.'.$extension;
@@ -2006,7 +2331,7 @@ ENDHEADERS
my $cols_output = 1;
for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
my $url=$root.'.'.$prevvers.'.'.$extension;
- $r->print(''.&mt('Version').' '.$prevvers.' ('.
&Apache::lonlocal::locallocaltime(
&Apache::lonnet::metadata($url,
@@ -2019,7 +2344,7 @@ ENDHEADERS
'&versionone='.$prevvers.
'">'.&mt('Diffs').'');
}
- $r->print(' ');
+ $r->print(' ');
if (++$entries_count % $entries_per_col == 0) {
$r->print('');
if ($cols_output != 4) {
@@ -2067,27 +2392,44 @@ sub changewarning {
my ($r,$postexec,$message,$url)=@_;
if (!&is_hash_old()) { return; }
my $pathvar='folderpath';
- my $path=&Apache::lonnet::escape($env{'form.folderpath'});
+ my $path=&escape($env{'form.folderpath'});
if (!defined($url)) {
if (defined($env{'form.pagepath'})) {
$pathvar='pagepath';
- $path=&Apache::lonnet::escape($env{'form.pagepath'});
- $path.='&pagesymb='.&Apache::lonnet::escape($env{'form.pagesymb'});
+ $path=&escape($env{'form.pagepath'});
+ $path.='&pagesymb='.&escape($env{'form.pagesymb'});
}
$url='/adm/coursedocs?'.$pathvar.'='.$path;
}
+ my $course_type = &Apache::loncommon::course_type();
if (!defined($message)) {
$message='Changes will become active for your current session after [_1], or the next time you log in.';
}
$r->print("\n\n".
-''."\n".
+''."\n".
''."\n\n");
+ &mt('re-initializing '.$course_type).'" onClick="reinit(this.form)" />').
+$help{'Caching'}.''."\n\n");
+}
+
+# =========================================== Breadcrumbs for special functions
+
+sub init_breadcrumbs {
+ my ($form,$text)=@_;
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs",
+ text=>&Apache::loncommon::course_type()." Documents",
+ faq=>273,
+ bug=>'Instructor Interface',
+ help => 'Docs_Adding_Course_Doc'});
+ &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?".$form.'=1',
+ text=>$text,
+ faq=>273,
+ bug=>'Instructor Interface'});
}
# ================================================================ Main Handler
@@ -2096,6 +2438,7 @@ sub handler {
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
return OK if $r->header_only;
+ my $type = &Apache::loncommon::course_type();
# --------------------------------------------- Initialize help topics for this
foreach ('Adding_Course_Doc','Main_Course_Documents',
@@ -2117,20 +2460,28 @@ sub handler {
'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages');
$help{'My Personal Info'} = &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{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
# does this user have privileges to modify docs
my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
-
if ($allowed && $env{'form.verify'}) {
+ &init_breadcrumbs('verify','Verify Content');
&verifycontent($r);
} elsif ($allowed && $env{'form.listsymbs'}) {
+ &init_breadcrumbs('listsymbs','List Symbs');
&list_symbs($r);
+ } elsif ($allowed && $env{'form.docslog'}) {
+ &init_breadcrumbs('docslog','Show Log');
+ &docs_change_log($r);
} elsif ($allowed && $env{'form.versions'}) {
+ &init_breadcrumbs('versions','Check/Set Resource Versions');
&checkversions($r);
} elsif ($allowed && $env{'form.dumpcourse'}) {
+ &init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' DOCS to Construction Space');
&dumpcourse($r);
} elsif ($allowed && $env{'form.exportcourse'}) {
+ &init_breadcrumbs('exportcourse','Export '.&Apache::loncommon::course_type().' to IMS');
&exportcourse($r);
} else {
# is this a standard course?
@@ -2144,27 +2495,26 @@ sub handler {
my $uploadtag;
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['folderpath','pagepath',
- 'pagesymb','markedcopy_url',
- 'markedcopy_title']);
+ 'pagesymb']);
if ($env{'form.folderpath'}) {
my (@folderpath)=split('&',$env{'form.folderpath'});
- $env{'form.foldername'}=&Apache::lonnet::unescape(pop(@folderpath));
+ $env{'form.foldername'}=&unescape(pop(@folderpath));
$env{'form.folder'}=pop(@folderpath);
}
if ($env{'form.pagepath'}) {
my (@pagepath)=split('&',$env{'form.pagepath'});
- $env{'form.pagename'}=&Apache::lonnet::unescape(pop(@pagepath));
+ $env{'form.pagename'}=&unescape(pop(@pagepath));
$env{'form.folder'}=pop(@pagepath);
$containertag = ''.
'';
- $uploadtag = ''.
- '';
+ $uploadtag = ''.
+ '';
}
if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
$showdoc='/'.$1;
}
unless ($showdoc) { # got called from remote
- if (($env{'form.folder'}=~/^default_/) ||
+ if (($env{'form.folder'}=~/^(?:group|default)_/) ||
($env{'form.folder'} =~ m:^\d+/(pages|sequences)/:)) {
$forcestandard = 1;
}
@@ -2185,8 +2535,7 @@ sub handler {
# get personal data
my $uname=$env{'user.name'};
my $udom=$env{'user.domain'};
- my $plainname=&Apache::lonnet::escape(
- &Apache::loncommon::plainname($uname,$udom));
+ my $plainname=&escape(&Apache::loncommon::plainname($uname,$udom));
# graphics settings
@@ -2197,15 +2546,16 @@ sub handler {
}
# -------------------------------------------------------------------- Body tag
$script = '';
- $r->print(&Apache::loncommon::start_page('Course Documents', $script,
+ $r->print(&Apache::loncommon::start_page("$type Documents", $script,
{'force_register' => $showdoc,}).
- &Apache::loncommon::help_open_menu('','','','',273,'RAT'));
+ &Apache::loncommon::help_open_menu('','',273,'RAT'));
my %allfiles = ();
my %codebase = ();
my ($upload_result,$upload_output);
if ($allowed) {
- if (($env{'form.uploaddoc.filename'}) && ($env{'form.cmd'}=~/^upload_(\w+)/)) {
+ if (($env{'form.uploaddoc.filename'}) &&
+ ($env{'form.cmd'}=~/^upload_(\w+)/)) {
# Process file upload - phase one - upload and parse primary file.
$upload_result = &process_file_upload(\$upload_output,$coursenum,
$coursedom,\%allfiles,
@@ -2219,15 +2569,15 @@ sub handler {
my %attribs = ();
my $updateflag = 0;
my $residx = $env{'form.newidx'};
- my $primary_url = &Apache::lonnet::unescape($env{'form.primaryurl'});
+ my $primary_url = &unescape($env{'form.primaryurl'});
# Process file upload - phase two - gather secondary files.
for (my $i=0; $i<$env{'form.phasetwo'}; $i++) {
if ($env{'form.embedded_item_'.$i.'.filename'}) {
my $javacodebase;
$newname{$i} = &process_secondary_uploads(\$upload_output,$coursedom,$coursenum,'embedded_item_',$i,$residx);
- $origname{$i} = &Apache::lonnet::unescape($env{'form.embedded_orig_'.$i});
+ $origname{$i} = &unescape($env{'form.embedded_orig_'.$i});
if (exists($env{'form.embedded_codebase_'.$i})) {
- $javacodebase = &Apache::lonnet::unescape($env{'form.embedded_codebase_'.$i});
+ $javacodebase = &unescape($env{'form.embedded_codebase_'.$i});
$origname{$i} =~ s#^\Q$javacodebase\E/##;
}
my @attributes = ();
@@ -2237,7 +2587,7 @@ sub handler {
@attributes = ($env{'form.embedded_attrib_'.$i});
}
foreach (@attributes) {
- push(@{$attribs{$i}},&Apache::lonnet::unescape($_));
+ push(@{$attribs{$i}},&unescape($_));
}
if ($javacodebase) {
$codebase{$i} = $javacodebase;
@@ -2286,8 +2636,8 @@ sub handler {
unless ($showdoc || $upload_result eq 'phasetwo') {
# -----------------------------------------------------------------------------
my %lt=&Apache::lonlocal::texthash(
- 'uplm' => 'Upload a new main course document',
- 'upls' => 'Upload a new supplemental course document',
+ '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',
@@ -2295,6 +2645,7 @@ sub handler {
'upld' => 'Upload Document',
'srch' => 'Search',
'impo' => 'Import',
+ 'book' => 'Import Bookmarks',
'selm' => 'Select Map',
'load' => 'Load Map',
'reco' => 'Recover Deleted Resources',
@@ -2309,6 +2660,8 @@ sub handler {
'scuf' => 'Score Upload Form',
'bull' => 'Bulletin Board',
'mypi' => 'My Personal Info',
+ 'grpo' => 'Group Files',
+ 'rost' => 'Course Roster',
'abou' => 'About User',
'imsf' => 'Import IMS package',
'file' => 'File',
@@ -2318,12 +2671,14 @@ sub handler {
);
# -----------------------------------------------------------------------------
if ($allowed) {
+ &update_paste_buffer($coursenum,$coursedom);
my $dumpbut=&dumpbutton();
my $exportbut=&exportbutton();
my %lt=&Apache::lonlocal::texthash(
'vc' => 'Verify Content',
'cv' => 'Check/Set Resource Versions',
'ls' => 'List Symbs',
+ 'sl' => 'Show Log'
);
my $folderpath=$env{'form.folderpath'};
@@ -2331,60 +2686,77 @@ sub handler {
if ($env{'form.folder'} eq '' ||
$env{'form.folder'} eq 'supplemental') {
$folderpath='default&'.
- &Apache::lonnet::escape(&mt('Main Course Documents'));
+ &escape(&mt('Main '.$type.' Documents'));
}
}
unless ($env{'form.pagepath'}) {
$containertag = '';
- $uploadtag = '';
+ $uploadtag = '';
}
$r->print(<
-
-
-
-$containertag
+
+
+
+
+ $containertag
+
ENDCOURSEVERIFY
$r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
- &mt('Editing the Table of Contents for your Course')));
+ &mt('Editing the Table of Contents for your '.$type)));
}
# --------------------------------------------------------- Standard documents
- $r->print('
'.
-&mt('It is recommended that you use an up-to-date virus scanner before handling this file.')."
".
- &entryline(0,&mt("Click to download or use your browser's Save Link function"),$showdoc).'
');
+&mt('It is recommended that you use an up-to-date virus scanner before handling this file.')."
".
+ &entryline(0,&mt("Click to download or use your browser's Save Link function"),$showdoc).'
');
}
}
}
@@ -2711,7 +3116,7 @@ sub editing_js {
function makenewfolder(targetform,folderseq) {
var foldername=prompt('Name of New Folder','New Folder');
if (foldername) {
- targetform.importdetail.value=foldername+"="+folderseq;
+ targetform.importdetail.value=escape(foldername)+"="+folderseq;
targetform.submit();
}
}
@@ -2719,13 +3124,24 @@ function makenewfolder(targetform,folder
function makenewpage(targetform,folderseq) {
var pagename=prompt('Name of New Page','New Page');
if (pagename) {
- targetform.importdetail.value=pagename+"="+folderseq;
+ targetform.importdetail.value=escape(pagename)+"="+folderseq;
targetform.submit();
}
}
function makenewext(targetname) {
this.document.forms.extimport.useform.value=targetname;
+ this.document.forms.extimport.title.value='';
+ this.document.forms.extimport.url.value='';
+ this.document.forms.extimport.residx.value='';
+ window.open('/adm/rat/extpickframe.html');
+}
+
+function edittext(targetname,residx,title,url) {
+ this.document.forms.extimport.useform.value=targetname;
+ this.document.forms.extimport.residx.value=residx;
+ this.document.forms.extimport.url.value=url;
+ this.document.forms.extimport.title.value=title;
window.open('/adm/rat/extpickframe.html');
}
@@ -2733,7 +3149,7 @@ function makeexamupload() {
var title=prompt('Listed Title for the Uploaded Score');
if (title) {
this.document.forms.newexamupload.importdetail.value=
- title+'=/res/lib/templates/examupload.problem';
+ escape(title)+'=/res/lib/templates/examupload.problem';
this.document.forms.newexamupload.submit();
}
}
@@ -2742,7 +3158,7 @@ function makesmppage() {
var title=prompt('Listed Title for the Page');
if (title) {
this.document.forms.newsmppg.importdetail.value=
- title+'=/adm/$udom/$uname/$now/smppg';
+ escape(title)+'=/adm/$udom/$uname/$now/smppg';
this.document.forms.newsmppg.submit();
}
}
@@ -2751,7 +3167,7 @@ function makesmpproblem() {
var title=prompt('Listed Title for the Problem');
if (title) {
this.document.forms.newsmpproblem.importdetail.value=
- title+'=/res/lib/templates/simpleproblem.problem';
+ escape(title)+'=/res/lib/templates/simpleproblem.problem';
this.document.forms.newsmpproblem.submit();
}
}
@@ -2760,7 +3176,7 @@ function makedropbox() {
var title=prompt('Listed Title for the Drop Box');
if (title) {
this.document.forms.newdropbox.importdetail.value=
- title+'=/res/lib/templates/DropBox.problem';
+ escape(title)+'=/res/lib/templates/DropBox.problem';
this.document.forms.newdropbox.submit();
}
}
@@ -2769,26 +3185,26 @@ function makebulboard() {
var title=prompt('Listed Title for the Bulletin Board');
if (title) {
this.document.forms.newbul.importdetail.value=
- title+'=/adm/$udom/$uname/$now/bulletinboard';
+ escape(title)+'=/adm/$udom/$uname/$now/bulletinboard';
this.document.forms.newbul.submit();
}
}
function makeabout() {
- var user=prompt("Enter user\@domain for User's 'About Me' Page");
+ var user=prompt("Enter user:domain for User's 'About Me' Page");
if (user) {
var comp=new Array();
- comp=user.split('\@');
+ comp=user.split(':');
if ((typeof(comp[0])!=undefined) && (typeof(comp[1])!=undefined)) {
if ((comp[0]) && (comp[1])) {
this.document.forms.newaboutsomeone.importdetail.value=
- 'About '+user+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';
+ 'About '+escape(user)+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';
this.document.forms.newaboutsomeone.submit();
} else {
- alert("Not a valid user\@domain");
+ alert("Not a valid user:domain");
}
} else {
- alert("Please enter both user and domain in the format user\@domain");
+ alert("Please enter both user and domain in the format user:domain");
}
}
}
@@ -2805,14 +3221,14 @@ function finishpick() {
var title=this.document.forms.extimport.title.value;
var url=this.document.forms.extimport.url.value;
var form=this.document.forms.extimport.useform.value;
- eval
- ('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+
- '";this.document.forms.'+form+'.submit();');
+ var residx=this.document.forms.extimport.residx.value;
+ eval('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+'='+residx+'";this.document.forms.'+form+'.submit();');
}
function changename(folderpath,index,oldtitle,container,pagesymb) {
var title=prompt('New Title',oldtitle);
if (title) {
+ this.document.forms.renameform.markcopy.value=-1;
this.document.forms.renameform.title.value=title;
this.document.forms.renameform.cmd.value='rename_'+index;
if (container == 'sequence') {
@@ -2826,8 +3242,9 @@ function changename(folderpath,index,old
}
}
-function removeres(folderpath,index,oldtitle,container,pagesymb) {
- if (confirm('WARNING: Removing a resource makes associated grades and scores inaccessible!\\nRemove "'+oldtitle+'"?')) {
+function removeres(folderpath,index,oldtitle,container,pagesymb,skip_confirm) {
+ if (skip_confirm || confirm('WARNING: Removing a resource makes associated grades and scores inaccessible!\\nRemove "'+oldtitle+'"?')) {
+ this.document.forms.renameform.markcopy.value=-1;
this.document.forms.renameform.cmd.value='del_'+index;
if (container == 'sequence') {
this.document.forms.renameform.folderpath.value=folderpath;
@@ -2840,10 +3257,11 @@ function removeres(folderpath,index,oldt
}
}
-function cutres(folderpath,index,oldtitle,container,pagesymb) {
- if (confirm('WARNING: Cutting a resource makes associated grades and scores inaccessible!\\nGrades remain inaccessible if resource is pasted into another folder.\\nCut "'+oldtitle+'"?')) {
+function cutres(folderpath,index,oldtitle,container,pagesymb,folder,skip_confirm) {
+ if (skip_confirm || confirm('WARNING: Cutting a resource makes associated grades and scores inaccessible!\\nGrades remain inaccessible if resource is pasted into another folder.\\nCut "'+oldtitle+'"?')) {
this.document.forms.renameform.cmd.value='cut_'+index;
this.document.forms.renameform.markcopy.value=index;
+ this.document.forms.renameform.copyfolder.value=folder+'.'+container;
if (container == 'sequence') {
this.document.forms.renameform.folderpath.value=folderpath;
}
@@ -2855,8 +3273,9 @@ function cutres(folderpath,index,oldtitl
}
}
-function markcopy(folderpath,index,oldtitle,container,pagesymb) {
+function markcopy(folderpath,index,oldtitle,container,pagesymb,folder) {
this.document.forms.renameform.markcopy.value=index;
+ this.document.forms.renameform.copyfolder.value=folder+'.'+container;
if (container == 'sequence') {
this.document.forms.renameform.folderpath.value=folderpath;
}