Diff for /loncom/interface/londocs.pm between versions 1.163 and 1.167

version 1.163, 2005/01/08 06:34:30 version 1.167, 2005/02/17 08:29:42
Line 132  sub dumpbutton { Line 132  sub dumpbutton {
     }      }
 }  }
   
   sub clean {
       my ($title)=@_;
       $title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs;
       return $title;
   }
 # -------------------------------------------------------- Actually dump course  # -------------------------------------------------------- Actually dump course
   
 sub dumpcourse {  sub dumpcourse {
     my $r=shift;      my $r=shift;
     $r->print('<html><head><title>Dump DOCS</title></head>'.      my $html=&Apache::lonxml::xmlbegin();
       $r->print($html.'<head><title>Dump DOCS</title></head>'.
         &Apache::loncommon::bodytag('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();
Line 149  sub dumpcourse { Line 155  sub dumpcourse {
  my ($ca,$cd)=split(/\@/,$ENV{'form.authorspace'});   my ($ca,$cd)=split(/\@/,$ENV{'form.authorspace'});
  $r->print('<h3>'.&mt('Copying Files').'</h3>');   $r->print('<h3>'.&mt('Copying Files').'</h3>');
  my $title=$ENV{'form.authorfolder'};   my $title=$ENV{'form.authorfolder'};
  $title=~s/[^\w\/]+/\_/g;   $title=&clean($title);
  my %replacehash=();   my %replacehash=();
  foreach (keys %ENV) {   foreach (keys %ENV) {
     if ($_=~/^form\.namefor\_(.+)/) {      if ($_=~/^form\.namefor\_(.+)/) {
Line 160  sub dumpcourse { Line 166  sub dumpcourse {
  $crs=~s/\_/\//g;   $crs=~s/\_/\//g;
  foreach (keys %replacehash) {   foreach (keys %replacehash) {
     my $newfilename=$title.'/'.$replacehash{$_};      my $newfilename=$title.'/'.$replacehash{$_};
     $newfilename=~s/[^\w\/\.\/]+/\_/g;      $newfilename=&clean($newfilename);
     my @dirs=split(/\//,$newfilename);      my @dirs=split(/\//,$newfilename);
     my $path='/home/'.$ca.'/public_html';      my $path='/home/'.$ca.'/public_html';
     my $makepath=$path;      my $makepath=$path;
Line 214  sub dumpcourse { Line 220  sub dumpcourse {
  }   }
  my $title=$origcrsdata{'description'};   my $title=$origcrsdata{'description'};
  $title=~s/\s+/\_/gs;   $title=~s/\s+/\_/gs;
  $title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs;   $title=&clean($title);
  $r->print('<h3>'.&mt('Folder in Construction Space').'</h3><input type="text" size="50" name="authorfolder" value="'.$title.'" /><br />');   $r->print('<h3>'.&mt('Folder in Construction Space').'</h3><input type="text" size="50" name="authorfolder" value="'.$title.'" /><br />');
  &tiehash();   &tiehash();
  $r->print('<h3>'.&mt('Filenames in Construction Space').'</h3><table border="2"><tr><th>'.&mt('Internal Filename').'</th><th>'.&mt('Title').'</th><th>'.&mt('Save as ...').'</th></tr>');   $r->print('<h3>'.&mt('Filenames in Construction Space').'</h3><table border="2"><tr><th>'.&mt('Internal Filename').'</th><th>'.&mt('Title').'</th><th>'.&mt('Save as ...').'</th></tr>');
Line 229  sub dumpcourse { Line 235  sub dumpcourse {
  $title=$_;   $title=$_;
     }      }
     $title=~s/\.(\w+)$//;      $title=~s/\.(\w+)$//;
     $title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs;      $title=&clean($title);
     $title.='.'.$ext;      $title.='.'.$ext;
     $r->print("\n<td><input type='text' size='60' name='namefor_".$_."' value='".$title."' /></td></tr>\n");      $r->print("\n<td><input type='text' size='60' name='namefor_".$_."' value='".$title."' /></td></tr>\n");
  }   }
Line 320  sub exportcourse { Line 326  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('<html><head><title>Export Course</title></head>'.          $r->print($html.'<head><title>Export Course</title></head>'.
             &Apache::loncommon::bodytag('Export course to IMS content package'));              &Apache::loncommon::bodytag('Export course to IMS content package'));
         $r->print($outcome);          $r->print($outcome);
         $r->print('</body></html>');          $r->print('</body></html>');
Line 462  function containerCheck(item) { Line 468  function containerCheck(item) {
   
 </script>  </script>
         |;          |;
         $r->print('<html><head><title>Export Course</title>'.$scripttag.'</head>'.   my $html=&Apache::lonxml::xmlbegin();
           $r->print($html.'<head><title>Export Course</title>'.$scripttag.'</head>'.
             &Apache::loncommon::bodytag('Export course to IMS content package'              &Apache::loncommon::bodytag('Export course to IMS content package'
 ));  ));
   
Line 1001  sub editor { Line 1008  sub editor {
     if ( ($folder=~/^$1/) || ($1 eq 'default') ) {      if ( ($folder=~/^$1/) || ($1 eq 'default') ) {
 # this is for a course, not a user, so set coursedoc flag  # this is for a course, not a user, so set coursedoc flag
 # probably the only place in the system where this should be "1"  # probably the only place in the system where this should be "1"
       my $url=&Apache::lonnet::userfileupload('uploaddoc',1,'docs');                my $newidx=$#Apache::lonratedt::resources+1;
         my $url=&Apache::lonnet::userfileupload('uploaddoc',1,'docs/'.$newidx);
               my $ext='false';                my $ext='false';
               if ($url=~/^http\:\/\//) { $ext='true'; }                if ($url=~/^http\:\/\//) { $ext='true'; }
               $url=~s/\:/\&colon;/g;                $url=~s/\:/\&colon;/g;
Line 1013  sub editor { Line 1021  sub editor {
   $comment=time.'___&&&___'.$ENV{'user.name'}.'___&&&___'.    $comment=time.'___&&&___'.$ENV{'user.name'}.'___&&&___'.
       $ENV{'user.domain'}.'___&&&___'.$comment;        $ENV{'user.domain'}.'___&&&___'.$comment;
               }                }
               my $newidx=$#Apache::lonratedt::resources+1;  
               $Apache::lonratedt::resources[$newidx]=                $Apache::lonratedt::resources[$newidx]=
                   $comment.':'.$url.':'.$ext.':normal:res';                    $comment.':'.$url.':'.$ext.':normal:res';
               $Apache::lonratedt::order[$#Apache::lonratedt::order+1]=                $Apache::lonratedt::order[$#Apache::lonratedt::order+1]=
Line 1298  END Line 1305  END
  $folderpath.=$folderarg.'&'.$foldername;   $folderpath.=$folderarg.'&'.$foldername;
  $url.='folderpath='.&Apache::lonnet::escape($folderpath);   $url.='folderpath='.&Apache::lonnet::escape($folderpath);
  $parameterset='<label>'.&mt('Randomly Pick: ').   $parameterset='<label>'.&mt('Randomly Pick: ').
     '<input type="text" size="4" name="randpick_'.$orderidx.'" value="'.      '<input type="text" size="4" onChange="this.form.submit()" name="randpick_'.$orderidx.'" value="'.
     (&Apache::lonratedt::getparameter($orderidx,      (&Apache::lonratedt::getparameter($orderidx,
                                               'parameter_randompick'))[0].                                                'parameter_randompick'))[0].
                                               '" />'.'</label>';                                                '" />'.
   '<font size="-2"><a href="javascript:void(0)">'.&mt('Store').'</a></font></label>';
                 
     }      }
     if ($ispage) {      if ($ispage) {
Line 1328  END Line 1336  END
     if (($allowed) && ($folder!~/^supplemental/)) {      if (($allowed) && ($folder!~/^supplemental/)) {
   my %lt=&Apache::lonlocal::texthash(    my %lt=&Apache::lonlocal::texthash(
        'hd' => 'Hidden',         'hd' => 'Hidden',
        'ec' => 'URL hidden',         'ec' => 'URL hidden');
        'sp' => 'Store Parameters');  
  my $enctext=   my $enctext=
     ((&Apache::lonratedt::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':'');      ((&Apache::lonratedt::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':'');
  my $hidtext=   my $hidtext=
     ((&Apache::lonratedt::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':'');      ((&Apache::lonratedt::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':'');
  $line.=(<<ENDPARMS);   $line.=(<<ENDPARMS);
 <td bgcolor="#BBBBFF"><font size='-2'>  <td bgcolor="#BBBBFF"><font size='-2'>
 <nobr><label><input type="checkbox" name="hidprs_$orderidx" $hidtext/> $lt{'hd'}</label></nobr></td>  <nobr><label><input type="checkbox" name="hidprs_$orderidx" onClick="this.form.submit()" $hidtext /> $lt{'hd'}</label></nobr></td>
 <td bgcolor="#BBBBFF"><font size='-2'>  <td bgcolor="#BBBBFF"><font size='-2'>
 <nobr><label><input type="checkbox" name="encprs_$orderidx" $enctext/> $lt{'ec'}</label></nobr></td>  <nobr><label><input type="checkbox" name="encprs_$orderidx" onClick="this.form.submit()" $enctext /> $lt{'ec'}</label></nobr></td>
 <td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td>  <td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td>
 <td bgcolor="#BBBBFF"><font size='-2'>  
 <input type="submit" value="$lt{'sp'}" />  
 </font></td>  
 ENDPARMS  ENDPARMS
     }      }
     $line.="</form></tr>";      $line.="</form></tr>";
Line 1457  sub verifycontent { Line 1461  sub verifycontent {
    my $r=shift;      my $r=shift; 
    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('<html><head><title>Verify Content</title></head>'.     $r->print($html.'<head><title>Verify Content</title></head>'.
               &Apache::loncommon::bodytag('Verify Course Documents'));                &Apache::loncommon::bodytag('Verify Course Documents'));
    $hashtied=0;     $hashtied=0;
    undef %alreadyseen;     undef %alreadyseen;
Line 1486  sub verifycontent { Line 1490  sub verifycontent {
   
 sub checkversions {  sub checkversions {
     my $r=shift;      my $r=shift;
     $r->print('<html><head><title>Check Versions</title></head>'.      my $html=&Apache::lonxml::xmlbegin();
       $r->print($html.'<head><title>Check Versions</title></head>'.
               &Apache::loncommon::bodytag('Check Course Document Versions'));                &Apache::loncommon::bodytag('Check Course Document Versions'));
     my $header='';      my $header='';
     my $startsel='';      my $startsel='';
Line 1877  sub handler { Line 1882  sub handler {
     my $now=time;      my $now=time;
   
 # print screen  # print screen
          my $html=&Apache::lonxml::xmlbegin();
     $r->print(<<ENDDOCUMENT);      $r->print(<<ENDDOCUMENT);
 <html>  $html
 <head>  <head>
 <title>The LearningOnline Network with CAPA</title>  <title>The LearningOnline Network with CAPA</title>
 <script>  <script>
Line 1955  function makeabout() { Line 1961  function makeabout() {
        this.document.forms.newaboutsomeone.importdetail.value=         this.document.forms.newaboutsomeone.importdetail.value=
    'About '+user+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';     'About '+user+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';
        this.document.forms.newaboutsomeone.submit();         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() {  function makeims() {
     var caller = document.forms.ims.folder.value      var caller = document.forms.ims.folder.value;
     var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one"      var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one";
     newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes")      newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes");
     newWindow.location.href = newlocation      newWindow.location.href = newlocation;
 }  }
   
   

Removed from v.1.163  
changed lines
  Added in v.1.167


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