Diff for /loncom/interface/londocs.pm between versions 1.484.2.44 and 1.484.2.56

version 1.484.2.44, 2013/12/19 14:51:21 version 1.484.2.56, 2014/10/24 00:25:12
Line 46  use Apache::lonsimplepage(); Line 46  use Apache::lonsimplepage();
 use HTML::Entities;  use HTML::Entities;
 use HTML::TokeParser;  use HTML::TokeParser;
 use GDBM_File;  use GDBM_File;
   use File::MMagic;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Cwd;  use Cwd;
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
Line 301  ENDJS Line 302  ENDJS
                 if ($contents{content}) {                  if ($contents{content}) {
                     $content .= '                      $content .= '
 <div class="LC_Box">  <div class="LC_Box">
 <h4 class="LC_hcell">Content</h4>'.  <h4 class="LC_hcell">'.&mt('Content').'</h4>'.
 $contents{content}.'  $contents{content}.'
 </div>';  </div>';
                 }                  }
                 if ($contents{webreferences}) {                  if ($contents{webreferences}) {
                     $content .= '                      $content .= '
 <div class="LC_Box">  <div class="LC_Box">
 <h4 class="LC_hcell">Web References</h4>'.  <h4 class="LC_hcell">'.&mt('Web References').'</h4>'.
 $contents{webreferences}.'  $contents{webreferences}.'
 </div>';  </div>';
                 }                  }
Line 1087  sub update_paste_buffer { Line 1088  sub update_paste_buffer {
     }      }
     &Apache::lonnet::appenv(\%addtoenv);      &Apache::lonnet::appenv(\%addtoenv);
     delete($env{'form.markcopy'});      delete($env{'form.markcopy'});
       return;
 }  }
   
 sub recurse_uploaded_maps {  sub recurse_uploaded_maps {
Line 1124  sub print_paste_buffer { Line 1126  sub print_paste_buffer {
   
     my @currpaste = split(/,/,$env{'docs.markedcopies'});      my @currpaste = split(/,/,$env{'docs.markedcopies'});
     my ($pasteitems,@pasteable);      my ($pasteitems,@pasteable);
       my $clipboardcount = 0;
   
 # Construct identifiers for current contents of user's paste buffer  # Construct identifiers for current contents of user's paste buffer
     foreach my $suffix (@currpaste) {      foreach my $suffix (@currpaste) {
Line 1132  sub print_paste_buffer { Line 1135  sub print_paste_buffer {
         my $url = $env{'docs.markedcopy_url_'.$suffix};          my $url = $env{'docs.markedcopy_url_'.$suffix};
         if (($cid =~ /^$match_domain\_$match_courseid$/) &&          if (($cid =~ /^$match_domain\_$match_courseid$/) &&
             ($url ne '')) {              ($url ne '')) {
               $clipboardcount ++;
             my ($is_external,$othercourse,$fromsupp,$is_uploaded_map,$parent,              my ($is_external,$othercourse,$fromsupp,$is_uploaded_map,$parent,
                 $canpaste,$nopaste,$othercrs,$areachange);                  $canpaste,$nopaste,$othercrs,$areachange);
             my $extension = (split(/\./,$env{'docs.markedcopy_url_'.$suffix}))[-1];              my $extension = (split(/\./,$env{'docs.markedcopy_url_'.$suffix}))[-1];
Line 1225  sub print_paste_buffer { Line 1229  sub print_paste_buffer {
         $pasteitems .= '<div style="padding:0;clear:both;margin:0;border:0"></div>';          $pasteitems .= '<div style="padding:0;clear:both;margin:0;border:0"></div>';
         $form_start = '<form name="pasteform" action="/adm/coursedocs" method="post" onsubmit="return validateClipboard();">';          $form_start = '<form name="pasteform" action="/adm/coursedocs" method="post" onsubmit="return validateClipboard();">';
         if (@pasteable) {          if (@pasteable) {
             $buttons = '<input type="submit" name="pastemarked" value="'.&mt('Paste selected').'" />'.('&nbsp;'x2);              my $value = &mt('Paste to current folder');
               if ($container eq 'page') {
                   $value = &mt('Paste to current page');
               }
               $buttons = '<input type="submit" name="pastemarked" value="'.$value.'" />'.('&nbsp;'x2);
           }
           $buttons .= '<input type="submit" name="clearmarked" value="'.&mt('Clear selected').'" />'.('&nbsp;'x2);
           if ($clipboardcount > 1) {
               $buttons .=
                   '<span style="text-decoration:line-through">'.('&nbsp;'x20).'</span>'.('&nbsp;'x2).
                   '<input type="button" name="checkallclip" value="'.&mt('Check all').'" style="height:20px;" onclick="checkClipboard();" />'.
                   ('&nbsp;'x2).
                   '<input type="button" name="uncheckallclip" value="'.&mt('Uncheck all').'" style="height:20px;" onclick="uncheckClipboard();" />'.
                   ('&nbsp;'x2);
         }          }
         $buttons .= '<input type="submit" name="clearmarked" value="'.&mt('Clear selected').'" />'.          $form_end = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />'.
                     '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';                      '</form>';
         $form_end = '</form>';  
     } else {      } else {
         $pasteitems = &mt('Clipboard is empty');          $pasteitems = &mt('Clipboard is empty');
     }      }
Line 1383  function validateClipboard() { Line 1399  function validateClipboard() {
     }      }
 }  }
   
   function checkClipboard() {
       if (document.pasteform.pasting.length > 1) {
           for (var i=0; i<document.pasteform.pasting.length; i++) {
               document.pasteform.pasting[i].checked = true;
           }
       }
       return;
   }
   
   function uncheckClipboard() {
       if (document.pasteform.pasting.length >1) {
           for (var i=0; i<document.pasteform.pasting.length; i++) {
               document.pasteform.pasting[i].checked = false;
           }
       }
       return;
   }
   
 END  END
   
 }  }
Line 3141  sub process_file_upload { Line 3175  sub process_file_upload {
     my $quotatype = 'unofficial';      my $quotatype = 'unofficial';
     if ($crstype eq 'Community') {      if ($crstype eq 'Community') {
         $quotatype = 'community';          $quotatype = 'community';
     } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.instcode'}) {      } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.coursecode'}) {
         $quotatype = 'official';          $quotatype = 'official';
       } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.textbook'}) {
           $quotatype = 'textbook';
     }      }
     if (&Apache::loncommon::get_user_quota($coursenum,$coursedom,'course',$quotatype)) {      if (&Apache::loncommon::get_user_quota($coursenum,$coursedom,'course',$quotatype)) {
         $filesize = int($filesize/1000); #expressed in kb          $filesize = int($filesize/1000); #expressed in kb
         $$upload_output = &Apache::loncommon::excess_filesize_warning($coursenum,$coursedom,'course',          $$upload_output = &Apache::loncommon::excess_filesize_warning($coursenum,$coursedom,'course',
                                                                       $env{'form.uploaddoc.filename'},$filesize,'upload');                                                                        $env{'form.uploaddoc.filename'},$filesize,
                                                                         'upload',$quotatype);
         return if ($$upload_output);          return if ($$upload_output);
     }      }
     my ($parseaction,$showupload,$nextphase,$mimetype);      my ($parseaction,$showupload,$nextphase,$mimetype);
Line 3245  sub process_file_upload { Line 3282  sub process_file_upload {
                     $$upload_output .= &mt('No embedded items identified').'<br />';                      $$upload_output .= &mt('No embedded items identified').'<br />';
                 }                  }
                 $$upload_output = '<div id="uploadfileresult">'.$$upload_output.'</div>';                  $$upload_output = '<div id="uploadfileresult">'.$$upload_output.'</div>';
             } elsif (&Apache::loncommon::is_archive_file($mimetype)) {              } elsif ((&Apache::loncommon::is_archive_file($mimetype)) &&
                        ($env{'form.uploaddoc.filename'} =~ /\.(zip|tar|bz2|gz|tar.gz|tar.bz2|tgz)$/i)) {
                 $nextphase = 'decompress_uploaded';                  $nextphase = 'decompress_uploaded';
                 my $position = scalar(@LONCAPA::map::order)-1;                  my $position = scalar(@LONCAPA::map::order)-1;
                 my $noextract = &return_to_editor();                  my $noextract = &return_to_editor();
Line 3307  sub is_supplemental_title { Line 3345  sub is_supplemental_title {
 sub entryline {  sub entryline {
     my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,      my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,
         $crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups)=@_;          $crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups)=@_;
     my ($foldertitle,$renametitle);      my ($foldertitle,$renametitle,$oldtitle);
     if (&is_supplemental_title($title)) {      if (&is_supplemental_title($title)) {
  ($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);   ($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);
     } else {      } else {
Line 3320  sub entryline { Line 3358  sub entryline {
   
     $renametitle=~s/\\/\\\\/g;      $renametitle=~s/\\/\\\\/g;
     $renametitle=~s/\&quot\;/\\\"/g;      $renametitle=~s/\&quot\;/\\\"/g;
       $renametitle=~s/"/%22/g;
     $renametitle=~s/ /%20/g;      $renametitle=~s/ /%20/g;
       $oldtitle = $renametitle;
       $renametitle=~s/\&#39\;/\\\'/g;
     my $line=&Apache::loncommon::start_data_table_row();      my $line=&Apache::loncommon::start_data_table_row();
     my ($form_start,$form_end,$form_common,$form_param);      my ($form_start,$form_end,$form_common,$form_param);
 # Edit commands  # Edit commands
Line 3470  ENDREM Line 3511  ENDREM
             }              }
         }          }
         $renamelink=(<<ENDREN);          $renamelink=(<<ENDREN);
 <a href='javascript:changename("$esc_path","$index","$renametitle");' class="LC_docs_rename">$lt{'rn'}</a>  <a href='javascript:changename("$esc_path","$index","$oldtitle");' class="LC_docs_rename">$lt{'rn'}</a>
 ENDREN  ENDREN
  $line.=(<<END);   $line.=(<<END);
 <td>  <td>
Line 3785  sub new_timebased_suffix { Line 3826  sub new_timebased_suffix {
     if ($type eq 'paste') {      if ($type eq 'paste') {
         $prefix = $type;          $prefix = $type;
         $namespace = 'courseeditor';          $namespace = 'courseeditor';
           $idtype = 'addcode';
     } elsif ($type eq 'map') {      } elsif ($type eq 'map') {
         $prefix = 'docs';          $prefix = 'docs';
         if ($area eq 'supplemental') {          if ($area eq 'supplemental') {
Line 3796  sub new_timebased_suffix { Line 3838  sub new_timebased_suffix {
         $prefix = $type;          $prefix = $type;
         $namespace = 'templated';          $namespace = 'templated';
     }      }
     $idtype = 'concat';  
     my ($suffix,$freedlock,$error) =      my ($suffix,$freedlock,$error) =
         &Apache::lonnet::get_timebased_id($prefix,'num',$namespace,$dom,$num);          &Apache::lonnet::get_timebased_id($prefix,'num',$namespace,$dom,$num,$idtype);
     if (!$suffix) {      if (!$suffix) {
         if ($type eq 'paste') {          if ($type eq 'paste') {
             $errtext = &mt('Failed to acquire a unique timestamp-based suffix when adding to the paste buffer.');              $errtext = &mt('Failed to acquire a unique timestamp-based suffix when adding to the paste buffer.');
Line 4465  sub handler { Line 4506  sub handler {
         $allowed = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});          $allowed = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});
     }      }
   
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['chooseserver',      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['inhibitmenu']);
                                             'inhibitmenu']);    if ($allowed && $env{'form.verify'}) {
   if ($allowed && $env{'form.chooseserver'}) {  
       &choose_dump_server($r);  
       return OK;  
   } elsif ($allowed && $env{'form.verify'}) {  
       &init_breadcrumbs('verify','Verify Content','Docs_Verify_Content');        &init_breadcrumbs('verify','Verify Content','Docs_Verify_Content');
       &verifycontent($r);        &verifycontent($r);
   } elsif ($allowed && $env{'form.listsymbs'}) {    } elsif ($allowed && $env{'form.listsymbs'}) {
Line 4812  sub handler { Line 4849  sub handler {
                 'title' => 'Title',                  'title' => 'Title',
                 'comment' => 'Comment',                  'comment' => 'Comment',
                 'parse' => 'Upload embedded images/multimedia files if HTML file',                  'parse' => 'Upload embedded images/multimedia files if HTML file',
   );                  'bb5'      => 'Blackboard 5',
                   'bb6'      => 'Blackboard 6',
                   'angel5'   => 'ANGEL 5.5',
                   'webctce4' => 'WebCT 4 Campus Edition',
           );
 # -----------------------------------------------------------------------------  # -----------------------------------------------------------------------------
  my $fileupload=(<<FIUP);   my $fileupload=(<<FIUP);
  $lt{'file'}:<br />   $lt{'file'}:<br />
Line 4843  CHBO Line 4884  CHBO
         $lt{'cms'}:&nbsp;           $lt{'cms'}:&nbsp; 
         <select name="source">          <select name="source">
         <option value="-1" selected="selected">$lt{'se'}</option>          <option value="-1" selected="selected">$lt{'se'}</option>
         <option value="bb5">Blackboard 5</option>          <option value="bb5">$lt{'bb5'}</option>
         <option value="bb6">Blackboard 6</option>          <option value="bb6">$lt{'bb6'}</option>
         <option value="angel5">ANGEL 5.5</option>          <option value="angel5">$lt{'angel5'}</option>
         <option value="webctce4">WebCT 4 Campus Edition</option>          <option value="webctce4">$lt{'webctce4'}</option>
         </select>          </select>
         <input type="hidden" name="folder" value="$imsfolder" />          <input type="hidden" name="folder" value="$imsfolder" />
         </p>          </p>
Line 5419  sub decompression_info { Line 5460  sub decompression_info {
     my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'};      my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'};
     my $container='sequence';      my $container='sequence';
     my ($pathitem,$hiddenelem);      my ($pathitem,$hiddenelem);
     my @hiddens = ('newidx','comment','position','folderpath');      my @hiddens = ('newidx','comment','position','folderpath','archiveurl');
     if ($env{'form.folderpath'} =~ /\:1$/) {      if ($env{'form.folderpath'} =~ /\:1$/) {
         $container='page';          $container='page';
     }      }
Line 5427  sub decompression_info { Line 5468  sub decompression_info {
     foreach my $item (@hiddens) {      foreach my $item (@hiddens) {
         if ($env{'form.'.$item}) {          if ($env{'form.'.$item}) {
             $hiddenelem .= '<input type="hidden" name="'.$item.'" value="'.              $hiddenelem .= '<input type="hidden" name="'.$item.'" value="'.
                            $env{'form.'.$item}.'" />'."\n";                             &HTML::Entities::encode($env{'form.'.$item},'<>&"').'" />'."\n";
         }          }
     }      }
     return ($destination,$dir_root,$londocroot,$docudom,$docuname,$container,      return ($destination,$dir_root,$londocroot,$docudom,$docuname,$container,
Line 5484  sub remove_archive { Line 5525  sub remove_archive {
         } else {          } else {
             $delwarning = &mt('An error occurred retrieving the contents of the current folder.');              $delwarning = &mt('An error occurred retrieving the contents of the current folder.');
         }          }
         $delwarning .= &mt('As a result the archive file has not been removed.');          $delwarning .= ' '.&mt('As a result the archive file has not been removed.');
     } else {      } else {
         my $currcmd = $env{'form.cmd'};          my $currcmd = $env{'form.cmd'};
         my $position = $env{'form.position'};          my $position = $env{'form.position'};
         if ($position > 0) {           my $archiveidx = $position;
             $env{'form.cmd'} = 'remove_'.$position;          if ($position > 0) {
             my ($title,$url,@rrest) =               if (($env{'form.autoextract_camtasia'}) && (scalar(@LONCAPA::map::order) == 2)) {
                 split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$position]]);                  $archiveidx = $position-1;
             if (&handle_edit_cmd($docuname,$docudom)) {              }
                 ($errtext,$fatal) = &storemap($docuname,$docudom,$map,1);              $env{'form.cmd'} = 'remove_'.$archiveidx;
                 if ($fatal) {              my ($title,$url,@rrest) =
                     if ($container eq 'page') {                  split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$archiveidx]]);
                         $delwarning = &mt('An error occurred updating the contents of the current page.');              if ($url eq $env{'form.archiveurl'}) {
                   if (&handle_edit_cmd($docuname,$docudom)) {
                       ($errtext,$fatal) = &storemap($docuname,$docudom,$map,1);
                       if ($fatal) {
                           if ($container eq 'page') {
                               $delwarning = &mt('An error occurred updating the contents of the current page.');
                           } else {
                               $delwarning = &mt('An error occurred updating the contents of the current folder.');
                           }
                     } else {                      } else {
                         $delwarning = &mt('An error occurred updating the contents of the current folder.');                          $delresult = &mt('Archive file removed.');
                     }                      }
                 } else {  
                     $delresult = &mt('Archive file removed.');  
                 }                  }
               } else {
                   $delwarning .=  &mt('Archive file had unexpected item number in folder.').
                                   ' '.&mt('As a result the archive file has not been removed.');
             }              }
         }          }
         $env{'form.cmd'} = $currcmd;          $env{'form.cmd'} = $currcmd;
Line 6651  ENDINJECT Line 6701  ENDINJECT
 sub dump_switchserver_js {  sub dump_switchserver_js {
     my @hosts = @_;      my @hosts = @_;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
         dump => 'Copying Content to Authoring Space requires switching server.',          dump => 'Copying content to Authoring Space requires switching server.',
         swit => 'Switch server?',          swit => 'Switch server?',
         duco => 'Copying Content to Authoring Space',          duco => 'Copying Content to Authoring Space',
         yone => 'You need to switch to a server housing an Authoring Space for which you are author or co-author.',          yone => 'You need to switch to a server housing an Authoring Space for which you are author or co-author.',

Removed from v.1.484.2.44  
changed lines
  Added in v.1.484.2.56


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