Diff for /loncom/interface/londocs.pm between versions 1.456 and 1.457

version 1.456, 2011/07/21 03:31:12 version 1.457, 2011/08/15 16:31:55
Line 1759  sub editor { Line 1759  sub editor {
     &Apache::loncommon::end_data_table_count();      &Apache::loncommon::end_data_table_count();
           
     if ($shown) {      if ($shown) {
         $r->print(&Apache::loncommon::start_scrollbox('900px','880px','400px')          $r->print(&Apache::loncommon::start_scrollbox('900px','880px','400px','contentscroll')
                  .&Apache::loncommon::start_data_table());                   .&Apache::loncommon::start_data_table(undef,'contentlist'));
         if ($allowed) {          if ($allowed) {
             $r->print(&Apache::loncommon::start_data_table_header_row()              $r->print(&Apache::loncommon::start_data_table_header_row()
                      .'<th colspan="2">'.&mt('Move').'</th>'                       .'<th colspan="2">'.&mt('Move').'</th>'
Line 1812  sub process_file_upload { Line 1812  sub process_file_upload {
             $LONCAPA::map::resources[1]='';              $LONCAPA::map::resources[1]='';
         }          }
         if ($fatal) {          if ($fatal) {
             $$upload_output = '<p><span class="LC_error">'.&mt('The uploaded file has not been stored as an error occurred reading the contents of the current folder.').'</span></p>';              $$upload_output = '<div class="LC_error" id="uploadfileresult">'.&mt('The uploaded file has not been stored as an error occurred reading the contents of the current folder.').'</div>';
             return;              return;
         }          }
         my $destination = 'docs/';          my $destination = 'docs/';
Line 1838  sub process_file_upload { Line 1838  sub process_file_upload {
         } else {          } else {
             my ($filename) = ($env{'form.uploaddoc.filename'} =~ m{([^/]+)$});              my ($filename) = ($env{'form.uploaddoc.filename'} =~ m{([^/]+)$});
                           
             $$upload_output = '<p><span class="LC_error">'.&mt('Unable to save file [_1].','<span class="LC_filename">'.$filename.'</span>').'</span></p>';              $$upload_output = '<div class="LC_error" id="uploadfileresult">'.&mt('Unable to save file [_1].','<span class="LC_filename">'.$filename.'</span>').'</div>';
             return;              return;
         }          }
         my $ext='false';          my $ext='false';
Line 1857  sub process_file_upload { Line 1857  sub process_file_upload {
         ($errtext,$fatal)=&storemap($coursenum,$coursedom,          ($errtext,$fatal)=&storemap($coursenum,$coursedom,
     $folder.'.'.$container);      $folder.'.'.$container);
         if ($fatal) {          if ($fatal) {
             $$upload_output = '<p><span class="LC_error">'.$errtext.'</span></p>';              $$upload_output = '<div class="LC_error" id="uploadfileresult">'.$errtext.'</div>';
             return;              return;
         } else {          } else {
             if ($parseaction eq 'parse' && $mimetype eq 'text/html') {              if ($parseaction eq 'parse' && $mimetype eq 'text/html') {
Line 1884  sub process_file_upload { Line 1884  sub process_file_upload {
                 } else {                  } else {
                     $$upload_output .= &mt('No embedded items identified').'<br />';                      $$upload_output .= &mt('No embedded items identified').'<br />';
                 }                  }
                   $$upload_output = '<div id="uploadfileresult">'.$$upload_output.'</div>';
             }              }
         }          }
     }      }
Line 2752  sub startContentScreen { Line 2753  sub startContentScreen {
   
     if ($allowed) {      if ($allowed) {
         $r->print('<li '.(($mode eq 'docs')?' class="active"':'').          $r->print('<li '.(($mode eq 'docs')?' class="active"':'').
                '><a href="/adm/coursedocs?forcestandard=1"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Editor').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');                 ' id="tabbededitor"><a href="/adm/coursedocs?forcestandard=1"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Editor').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');
     }      }
     $r->print('<li'.(($mode eq 'coursesearch')?' class="active"':'').'><a href="/adm/searchcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Search').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');      $r->print('<li'.(($mode eq 'coursesearch')?' class="active"':'').'><a href="/adm/searchcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Search').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');
     $r->print('<li'.(($mode eq 'courseindex')?' class="active"':'').'><a href="/adm/indexcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Index').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');      $r->print('<li'.(($mode eq 'courseindex')?' class="active"':'').'><a href="/adm/indexcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Index').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');
     $r->print('<li '.(($mode eq 'supdocs')?' class="active"':'').      $r->print('<li '.(($mode eq 'supdocs')?' class="active"':'').
            '><a href="/adm/coursedocs?forcesupplement=1"><b>'.&mt('Supplemental Documents').'</b></a></li>');             '><a href="/adm/coursedocs?forcesupplement=1"><b>'.&mt('Supplemental Documents').'</b></a></li>');
     $r->print('</ul>');      $r->print('</ul>');
     $r->print('<div class="LC_Box" style="clear:both;margin:0;">'      $r->print('<div class="LC_Box" style="clear:both;margin:0;" id="contenteditor">'
              .'<div id="maincoursedoc" style="margin:0 0;padding:0 0;">');               .'<div id="maincoursedoc" style="margin:0 0;padding:0 0;">');
     $r->print('<div class="LC_ContentBox" id="mainCourseDocuments" style="display: block;">');      $r->print('<div class="LC_ContentBox" id="mainCourseDocuments" style="display: block;">');
 }  }
Line 2859  sub handler { Line 2860  sub handler {
   
     my $script='';      my $script='';
     my $showdoc=0;      my $showdoc=0;
       my $addentries = {};
     my $containertag;      my $containertag;
     my $uploadtag;      my $uploadtag;
   
Line 2959  sub handler { Line 2961  sub handler {
     $iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/");      $iconpath = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL') . "/");
   
     if ($allowed) {      if ($allowed) {
  $script .= &editing_js($udom,$uname);   $script .= &editing_js($udom,$uname).
                      &resize_contentdiv_js();
           $addentries = {
                           onload   => "javascript:resize_contentdiv('contentscroll');",
                           onresize => "javascript:resize_contentdiv('contentscroll');",
                         };
     }      }
 # -------------------------------------------------------------------- Body tag  # -------------------------------------------------------------------- Body tag
     $script = '<script type="text/javascript">'."\n"      $script = '<script type="text/javascript">'."\n"
Line 2975  sub handler { Line 2982  sub handler {
             href=>"/adm/coursedocs",text=>"$crstype Contents"});              href=>"/adm/coursedocs",text=>"$crstype Contents"});
   
         $r->print(&Apache::loncommon::start_page("$crstype Contents", $script,          $r->print(&Apache::loncommon::start_page("$crstype Contents", $script,
                                                  {'force_register' => $showdoc,})                                                   {'force_register' => $showdoc,
                                                     'add_entries'    => $addentries,
                                                    })
                  .&Apache::loncommon::help_open_menu('','',273,'RAT')                   .&Apache::loncommon::help_open_menu('','',273,'RAT')
                  .&Apache::lonhtmlcommon::breadcrumbs(                   .&Apache::lonhtmlcommon::breadcrumbs(
                      'Editing the Table of Contents for your '.$crstype,                       'Editing the Table of Contents for your '.$crstype,
Line 3113  SEDFFORM Line 3122  SEDFFORM
  $simpleeditdefaultform .= &create_form_ul(&create_list_elements(@simpleeditdefaultforma));   $simpleeditdefaultform .= &create_form_ul(&create_list_elements(@simpleeditdefaultforma));
  $simpleeditdefaultform .=(<<SEDFFORM);   $simpleeditdefaultform .=(<<SEDFFORM);
  <hr />   <hr />
  <p>  
  $lt{'copm'}<br />   $lt{'copm'}<br />
  <input type="text" size="40" name="importmap" /><br />   <input type="text" size="40" name="importmap" /><br />
  <span class="LC_nobreak"><input type="button"   <span class="LC_nobreak"><input type="button"
  onclick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')"   onclick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')"
  value="$lt{'selm'}" /> <input type="submit" name="loadmap" value="$lt{'load'}" />   value="$lt{'selm'}" /> <input type="submit" name="loadmap" value="$lt{'load'}" />
  $help{'Load_Map'}</span>   $help{'Load_Map'}</span>
  </p>  
  </form>   </form>
 SEDFFORM  SEDFFORM
   
Line 3943  function showPage(current, pageId, nav, Line 3950  function showPage(current, pageId, nav,
  current.className = 'active';   current.className = 'active';
  currentData = document.getElementById(pageId);   currentData = document.getElementById(pageId);
  currentData.style.display = 'block';   currentData.style.display = 'block';
           resize_contentdiv('contentscroll');
         if (nav == 'mainnav') {          if (nav == 'mainnav') {
             var storedpath = "$docs_folderpath";              var storedpath = "$docs_folderpath";
             if (storedpath == '') {              if (storedpath == '') {
Line 3989  function injectData(current, hiddenField Line 3997  function injectData(current, hiddenField
   
 ENDNEWSCRIPT  ENDNEWSCRIPT
 }  }
   
   sub resize_contentdiv_js {
       my $viewport_js = &Apache::loncommon::viewport_geometry_js();
       return <<ENDRESIZESCRIPT;
   
   $viewport_js
   
   function resize_contentdiv(scrollboxid) {
       if (document.getElementById("contenteditor") == null) {
           return;
       }
       init_geometry();
       var vph = Geometry.getViewportHeight();
   
       var primaryheight = document.getElementById("LC_nav_bar").offsetHeight;
       var secondaryheight = document.getElementById("LC_secondary_menu").offsetHeight;
       var crumbsheight = document.getElementById("LC_breadcrumbs").offsetHeight;
       var dccidheight = document.getElementById("dccid").offsetHeight;
   
       var uploadresultheight = 0;
       if (document.getElementById("uploadfileresult") != null) {
           uploadresultheight = document.getElementById("uploadfileresult").offsetHeight;
       }
       var tabbedheight = document.getElementById("tabbededitor").offsetHeight;
       var contenteditorheight = document.getElementById("contenteditor").offsetHeight;
       if (document.getElementById(scrollboxid) != null) {
           var scrollbox =  document.getElementById(scrollboxid);
           var scrollboxheight = scrollbox.offsetHeight;
           var scrollboxscrollheight = scrollbox.scrollHeight;
   
           var freespace = vph-(primaryheight+secondaryheight+crumbsheight+dccidheight+uploadresultheight+tabbedheight+contenteditorheight);
   
           var minscrollbox = 60;
           var offset = 20;
           var newscrollboxheight;
           if (freespace < 0) {
               newscrollboxheight = scrollboxheight+freespace-offset;
               if (newscrollboxheight < minscrollbox) {
                   newscrollboxheight = minscrollbox;
               }
               scrollbox.style.height = newscrollboxheight + "px";
           } else {
               if (scrollboxscrollheight > scrollboxheight) {
                   if (freespace > offset) {
                       newscrollboxheight = scrollboxheight+freespace-offset;
                       if (newscrollboxheight < minscrollbox) {
                           newscrollboxheight = minscrollbox;
                       }
                       scrollbox.style.height = newscrollboxheight+"px";
                   }
               }
           }
           scrollboxheight = scrollbox.offsetHeight;
   
           if (scrollboxscrollheight <= scrollboxheight) {
               var contentlistheight = document.getElementById("contentlist").offsetHeight;
               if ((contentlistheight+offset)<scrollboxheight) {
                   newscrollheight = contentlistheight;
                   scrollbox.style.height = newscrollheight+"px";
               }
           }
       }
   }
   
   ENDRESIZESCRIPT
       return;
   }
   
 1;  1;
 __END__  __END__
   

Removed from v.1.456  
changed lines
  Added in v.1.457


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