Diff for /loncom/interface/londocs.pm between versions 1.223 and 1.224

version 1.223, 2006/03/06 17:15:29 version 1.224, 2006/03/17 00:06:54
Line 140  sub clean { Line 140  sub clean {
 # -------------------------------------------------------- Actually dump course  # -------------------------------------------------------- Actually dump course
   
 sub dumpcourse {  sub dumpcourse {
     my $r=shift;      my ($r) = @_;
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print($html.'<head><title>Dump DOCS</title></head>'.      $r->print(&Apache::loncommon::start_page('Dump Course DOCS to Construction Space').
         &Apache::loncommon::bodytag('Dump Course DOCS to Construction Space').  
       '<form name="dumpdoc" method="post">');        '<form name="dumpdoc" method="post">');
     my ($home,$other,%outhash)=&authorhosts();      my ($home,$other,%outhash)=&authorhosts();
     unless ($home) { return ''; }      unless ($home) { return ''; }
Line 308  sub exportcourse { Line 307  sub exportcourse {
                 $outcome = '<br />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.<br />';                  $outcome = '<br />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.<br />';
             }              }
         }          }
  my $html=&Apache::lonxml::xmlbegin();          $r->print(&Apache::loncommon::start_page('Export course to IMS content package'));
         $r->print($html.'<head><title>Export Course</title></head>'.  
             &Apache::loncommon::bodytag('Export course to IMS content package'));  
         $r->print($outcome);          $r->print($outcome);
         $r->print('</body></html>');          $r->print(&Apache::loncommon::end_page());
     } else {      } else {
         my $display;          my $display;
         $display = '<form name="exportdoc" method="post">'."\n";          $display = '<form name="exportdoc" method="post">'."\n";
Line 450  function containerCheck(item) { Line 447  function containerCheck(item) {
   
 </script>  </script>
         |;          |;
  my $html=&Apache::lonxml::xmlbegin();   $r->print(&Apache::loncommon::start_page('Export course to IMS content package',
         $r->print($html.'<head><title>Export Course</title>'.$scripttag.'</head>'.   $scripttag));
             &Apache::loncommon::bodytag('Export course to IMS content package'   $r->print($display.'</table>'.
 ));  
   
         $r->print($display.'</table>'.  
                   '<p><input type="hidden" name="finishexport" value="1">'.                    '<p><input type="hidden" name="finishexport" value="1">'.
                   '<input type="submit" name="exportcourse" value="'.                    '<input type="submit" name="exportcourse" value="'.
                   &mt('Export Course DOCS').'" /></p></form></body></html>');                    &mt('Export Course DOCS').'" /></p></form>'.
     &Apache::loncommon::end_page());
     }      }
 }  }
   
Line 1750  sub checkonthis { Line 1745  sub checkonthis {
 # ----------------------------------------------------------------- List Symbs  # ----------------------------------------------------------------- List Symbs
 #   # 
 sub list_symbs {  sub list_symbs {
    my $r=shift;       my ($r) = @_;
    my $html=&Apache::lonxml::xmlbegin();  
    $r->print($html.'<head><title>Symb List</title></head>'.      $r->print(&Apache::loncommon::start_page('Symb List'));
               &Apache::loncommon::bodytag('Symb List'));      my $navmap = Apache::lonnavmaps::navmap->new();
    my $navmap = Apache::lonnavmaps::navmap->new();      $r->print("<pre>\n");
    $r->print("<pre>\n");      foreach my $res ($navmap->retrieveResources()) {
    foreach my $res ($navmap->retrieveResources()) {   $r->print($res->compTitle()."\t".$res->symb()."\n");
        $r->print($res->compTitle()."\t".$res->symb()."\n");      }
    }      $r->print("\n</pre>\n");
    $r->print("\n</pre>\n");      $r->print('<a href="/adm/coursedocs">'.&mt('Return to DOCS').'</a>');
    $r->print('<a href="/adm/coursedocs">'.&mt('Return to DOCS').'</a>');  
 }  }
   
   
Line 1768  sub list_symbs { Line 1762  sub list_symbs {
 # -------------------------------------------------------------- Verify Content  # -------------------------------------------------------------- Verify Content
 #   # 
 sub verifycontent {  sub verifycontent {
    my $r=shift;       my ($r) = @_;
    my $loaderror=&Apache::lonnet::overloaderror($r);     my $loaderror=&Apache::lonnet::overloaderror($r);
    if ($loaderror) { return $loaderror; }     if ($loaderror) { return $loaderror; }
    my $html=&Apache::lonxml::xmlbegin();     $r->print(&Apache::loncommon::start_page('Verify Course Documents'));
    $r->print($html.'<head><title>Verify Content</title></head>'.  
               &Apache::loncommon::bodytag('Verify Course Documents'));  
    $hashtied=0;     $hashtied=0;
    undef %alreadyseen;     undef %alreadyseen;
    %alreadyseen=();     %alreadyseen=();
Line 1806  sub devalidateversioncache { Line 1798  sub devalidateversioncache {
 }  }
   
 sub checkversions {  sub checkversions {
     my $r=shift;      my ($r) = @_;
     my $html=&Apache::lonxml::xmlbegin();      $r->print(&Apache::loncommon::start_page('Check Course Document Versions'));
     $r->print($html.'<head><title>Check Versions</title></head>'.  
               &Apache::loncommon::bodytag('Check Course Document Versions'));  
     my $header='';      my $header='';
     my $startsel='';      my $startsel='';
     my $monthsel='';      my $monthsel='';
Line 2154  sub handler { Line 2144  sub handler {
     my $containertag;      my $containertag;
     my $uploadtag;      my $uploadtag;
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &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'}) {      if ($env{'form.folderpath'}) {
  my (@folderpath)=split('&',$env{'form.folderpath'});   my (@folderpath)=split('&',$env{'form.folderpath'});
  $env{'form.foldername'}=&Apache::lonnet::unescape(pop(@folderpath));   $env{'form.foldername'}=&Apache::lonnet::unescape(pop(@folderpath));
Line 2186  sub handler { Line 2178  sub handler {
     } else { # got called in sequence from course      } else { # got called in sequence from course
        $allowed=0;         $allowed=0;
        $script='</script>'.&Apache::lonmenu::registerurl(1,undef).'<script>';         $script='</script>'.&Apache::lonmenu::registerurl(1,undef).'<script>';
        $events='onLoad="'.&Apache::lonmenu::loadevents.         $events='onLoad="'.&Apache::lonmenu::loadevents().
            '" onUnload="'.&Apache::lonmenu::unloadevents.'"';             '" onUnload="'.&Apache::lonmenu::unloadevents().'"';
     }      }
   
 # get course data  # get course data
Line 2205  sub handler { Line 2197  sub handler {
   
     $iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/");      $iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/");
   
     my $now=time;      if ($allowed) {
    $script .= &editing_js($udom,$uname);
 # print screen  
        my $html=&Apache::lonxml::xmlbegin();  
     $r->print(<<ENDDOCUMENT);  
 $html  
 <head>  
 <title>The LearningOnline Network with CAPA</title>  
 <script>  
 $script  
 </script>  
 ENDDOCUMENT  
    if ($allowed) {  
     $r->print(<<ENDNEWSCRIPT);  
 <script>  
 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;  
     }      }
     this.document.forms.renameform.submit();  
 }  
   
 </script>  
   
 ENDNEWSCRIPT  
   }  
 # -------------------------------------------------------------------- Body tag  # -------------------------------------------------------------------- Body tag
   $r->print('</head>'.      $script = '<script type="text/javascript">'."\n".$script."\n".'</script>';
             &Apache::loncommon::bodytag('Course Documents','',$events,      $r->print(&Apache::loncommon::start_page('Course Documents', $script,
  '','',$showdoc).       {'add_entries'    => $events,
     &Apache::loncommon::help_open_menu('','','','',273,'RAT'));        'force_register' => $showdoc,}).
         &Apache::loncommon::help_open_menu('','','','',273,'RAT'));
     
   my %allfiles = ();    my %allfiles = ();
   my %codebase = ();    my %codebase = ();
   my ($upload_result,$upload_output);    my ($upload_result,$upload_output);
Line 2455  ENDNEWSCRIPT Line 2274  ENDNEWSCRIPT
                           $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})) {                        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.  # Save edited file.
Line 2885  ENDSUPFORM Line 2704  ENDSUPFORM
       }        }
   }    }
  }   }
  $r->print('</body></html>');   $r->print(&Apache::loncommon::end_page());
  return OK;   return OK;
 }   } 
   
   
   sub editing_js {
       my ($udom,$uname) = @_;
       my $now = time();
   
       return <<ENDNEWSCRIPT;
   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;
       }
       this.document.forms.renameform.submit();
   }
   
   ENDNEWSCRIPT
   }
 1;  1;
 __END__  __END__

Removed from v.1.223  
changed lines
  Added in v.1.224


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>