--- loncom/interface/londocs.pm 2006/03/06 17:15:29 1.223 +++ loncom/interface/londocs.pm 2006/03/17 00:06:54 1.224 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.223 2006/03/06 17:15:29 www Exp $ +# $Id: londocs.pm,v 1.224 2006/03/17 00:06:54 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -140,10 +140,9 @@ sub clean { # -------------------------------------------------------- Actually dump course sub dumpcourse { - my $r=shift; - my $html=&Apache::lonxml::xmlbegin(); - $r->print($html.'Dump DOCS'. - &Apache::loncommon::bodytag('Dump Course DOCS to Construction Space'). + my ($r) = @_; + + $r->print(&Apache::loncommon::start_page('Dump Course DOCS to Construction Space'). '
'); my ($home,$other,%outhash)=&authorhosts(); unless ($home) { return ''; } @@ -308,11 +307,9 @@ 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.
'; } } - my $html=&Apache::lonxml::xmlbegin(); - $r->print($html.'Export Course'. - &Apache::loncommon::bodytag('Export course to IMS content package')); + $r->print(&Apache::loncommon::start_page('Export course to IMS content package')); $r->print($outcome); - $r->print(''); + $r->print(&Apache::loncommon::end_page()); } else { my $display; $display = ''."\n"; @@ -450,15 +447,13 @@ function containerCheck(item) { |; - my $html=&Apache::lonxml::xmlbegin(); - $r->print($html.'Export Course'.$scripttag.''. - &Apache::loncommon::bodytag('Export course to IMS content package' -)); - - $r->print($display.''. + $r->print(&Apache::loncommon::start_page('Export course to IMS content package', + $scripttag)); + $r->print($display.''. '

'. '

'); + &mt('Export Course DOCS').'" />

'. + &Apache::loncommon::end_page()); } } @@ -1750,17 +1745,16 @@ sub checkonthis { # ----------------------------------------------------------------- List Symbs # sub list_symbs { - my $r=shift; - my $html=&Apache::lonxml::xmlbegin(); - $r->print($html.'Symb List'. - &Apache::loncommon::bodytag('Symb List')); - my $navmap = Apache::lonnavmaps::navmap->new(); - $r->print("
\n");
-   foreach my $res ($navmap->retrieveResources()) {
-       $r->print($res->compTitle()."\t".$res->symb()."\n");
-   }
-   $r->print("\n
\n"); - $r->print(''.&mt('Return to DOCS').''); + my ($r) = @_; + + $r->print(&Apache::loncommon::start_page('Symb List')); + my $navmap = Apache::lonnavmaps::navmap->new(); + $r->print("
\n");
+    foreach my $res ($navmap->retrieveResources()) {
+	$r->print($res->compTitle()."\t".$res->symb()."\n");
+    }
+    $r->print("\n
\n"); + $r->print(''.&mt('Return to DOCS').''); } @@ -1768,12 +1762,10 @@ sub list_symbs { # -------------------------------------------------------------- Verify Content # sub verifycontent { - my $r=shift; + my ($r) = @_; my $loaderror=&Apache::lonnet::overloaderror($r); if ($loaderror) { return $loaderror; } - my $html=&Apache::lonxml::xmlbegin(); - $r->print($html.'Verify Content'. - &Apache::loncommon::bodytag('Verify Course Documents')); + $r->print(&Apache::loncommon::start_page('Verify Course Documents')); $hashtied=0; undef %alreadyseen; %alreadyseen=(); @@ -1806,10 +1798,8 @@ sub devalidateversioncache { } sub checkversions { - my $r=shift; - my $html=&Apache::lonxml::xmlbegin(); - $r->print($html.'Check Versions'. - &Apache::loncommon::bodytag('Check Course Document Versions')); + my ($r) = @_; + $r->print(&Apache::loncommon::start_page('Check Course Document Versions')); my $header=''; my $startsel=''; my $monthsel=''; @@ -2154,7 +2144,9 @@ sub handler { my $containertag; my $uploadtag; &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, - ['folderpath','pagepath','pagesymb','markedcopy_url','markedcopy_title']); + ['folderpath','pagepath', + 'pagesymb','markedcopy_url', + 'markedcopy_title']); if ($env{'form.folderpath'}) { my (@folderpath)=split('&',$env{'form.folderpath'}); $env{'form.foldername'}=&Apache::lonnet::unescape(pop(@folderpath)); @@ -2186,8 +2178,8 @@ sub handler { } else { # got called in sequence from course $allowed=0; $script=''.&Apache::lonmenu::registerurl(1,undef).' -ENDDOCUMENT - if ($allowed) { - $r->print(< -function makenewfolder(targetform,folderseq) { - var foldername=prompt('Name of New Folder','New Folder'); - if (foldername) { - targetform.importdetail.value=foldername+"="+folderseq; - targetform.submit(); - } -} - -function makenewpage(targetform,folderseq) { - var pagename=prompt('Name of New Page','New Page'); - if (pagename) { - targetform.importdetail.value=pagename+"="+folderseq; - targetform.submit(); - } -} - -function makenewext(targetname) { - this.document.forms.extimport.useform.value=targetname; - window.open('/adm/rat/extpickframe.html'); -} - -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'; - this.document.forms.newexamupload.submit(); - } -} - -function makesmppage() { - var title=prompt('Listed Title for the Page'); - if (title) { - this.document.forms.newsmppg.importdetail.value= - title+'=/adm/$udom/$uname/$now/smppg'; - this.document.forms.newsmppg.submit(); - } -} - -function makesmpproblem() { - var title=prompt('Listed Title for the Problem'); - if (title) { - this.document.forms.newsmpproblem.importdetail.value= - title+'=/res/lib/templates/simpleproblem.problem'; - this.document.forms.newsmpproblem.submit(); - } -} - -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'; - this.document.forms.newdropbox.submit(); - } -} - -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'; - this.document.forms.newbul.submit(); - } -} - -function makeabout() { - var user=prompt("Enter user\@domain for User's 'About Me' Page"); - if (user) { - var comp=new Array(); - 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'; - this.document.forms.newaboutsomeone.submit(); - } else { - alert("Not a valid user\@domain"); - } - } else { - alert("Please enter both user and domain in the format user\@domain"); - } - } -} - -function makeims() { - var caller = document.forms.ims.folder.value; - var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one"; - newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes"); - newWindow.location.href = newlocation; -} - - -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();'); -} - -function changename(folderpath,index,oldtitle,container,pagesymb) { - var title=prompt('New Title',oldtitle); - if (title) { - this.document.forms.renameform.title.value=title; - this.document.forms.renameform.cmd.value='rename_'+index; - if (container == 'sequence') { - this.document.forms.renameform.folderpath.value=folderpath; - } - if (container == 'page') { - this.document.forms.renameform.pagepath.value=folderpath; - this.document.forms.renameform.pagesymb.value=pagesymb; - } - this.document.forms.renameform.submit(); - } -} - -function removeres(folderpath,index,oldtitle,container,pagesymb) { - if (confirm('WARNING: Removing a resource makes associated grades and scores inaccessible!\\nRemove "'+oldtitle+'"?')) { - this.document.forms.renameform.cmd.value='del_'+index; - if (container == 'sequence') { - this.document.forms.renameform.folderpath.value=folderpath; - } - if (container == 'page') { - this.document.forms.renameform.pagepath.value=folderpath; - this.document.forms.renameform.pagesymb.value=pagesymb; - } - this.document.forms.renameform.submit(); - } -} - -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+'"?')) { - this.document.forms.renameform.cmd.value='cut_'+index; - this.document.forms.renameform.markcopy.value=index; - if (container == 'sequence') { - this.document.forms.renameform.folderpath.value=folderpath; - } - if (container == 'page') { - this.document.forms.renameform.pagepath.value=folderpath; - this.document.forms.renameform.pagesymb.value=pagesymb; - } - this.document.forms.renameform.submit(); - } -} - -function markcopy(folderpath,index,oldtitle,container,pagesymb) { - this.document.forms.renameform.markcopy.value=index; - if (container == 'sequence') { - this.document.forms.renameform.folderpath.value=folderpath; - } - if (container == 'page') { - this.document.forms.renameform.pagepath.value=folderpath; - this.document.forms.renameform.pagesymb.value=pagesymb; + if ($allowed) { + $script .= &editing_js($udom,$uname); } - this.document.forms.renameform.submit(); -} - - - -ENDNEWSCRIPT - } # -------------------------------------------------------------------- Body tag - $r->print(''. - &Apache::loncommon::bodytag('Course Documents','',$events, - '','',$showdoc). - &Apache::loncommon::help_open_menu('','','','',273,'RAT')); + $script = ''; + $r->print(&Apache::loncommon::start_page('Course Documents', $script, + {'add_entries' => $events, + 'force_register' => $showdoc,}). + &Apache::loncommon::help_open_menu('','','','',273,'RAT')); + my %allfiles = (); my %codebase = (); my ($upload_result,$upload_output); @@ -2455,7 +2274,7 @@ ENDNEWSCRIPT $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; + $content =~ s/(codebase\s*=\s*["']?)\Q$codebase{$item}\E(["']?)/$1.$2/i; #' stupid emacs } } # Save edited file. @@ -2885,9 +2704,176 @@ ENDSUPFORM } } } - $r->print(''); + $r->print(&Apache::loncommon::end_page()); return OK; } + +sub editing_js { + my ($udom,$uname) = @_; + my $now = time(); + + return <