Diff for /loncom/interface/londocs.pm between versions 1.388 and 1.393

version 1.388, 2009/10/04 10:27:55 version 1.393, 2009/10/16 19:00:44
Line 1032  sub breadcrumbs { Line 1032  sub breadcrumbs {
             if ($3) { $isencrypted=1; }              if ($3) { $isencrypted=1; }
     if ($4 ne '') { $is_random_order = 1; }      if ($4 ne '') { $is_random_order = 1; }
             if ($folder eq 'supplemental') {              if ($folder eq 'supplemental') {
                 if ($allowed) {                  $name = &mt('Supplemental '.$type.' Documents');
                     $name = &mt('Supplemental '.$type.' Documents');  
                 } else {  
                     $name = &mt($type.' Documents');  
                 }  
             }              }
     &Apache::lonhtmlcommon::add_breadcrumb(      &Apache::lonhtmlcommon::add_breadcrumb(
       {'href'=>$url.$cpinfo,        {'href'=>$url.$cpinfo,
Line 1493  sub handle_edit_cmd { Line 1489  sub handle_edit_cmd {
   
 sub editor {  sub editor {
     my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$type)=@_;      my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$type)=@_;
   
     my $container= ($env{'form.pagepath'}) ? 'page'      my $container= ($env{'form.pagepath'}) ? 'page'
                            : 'sequence';                             : 'sequence';
   
Line 1632  sub editor { Line 1627  sub editor {
         $shown++;          $shown++;
     }      }
     if ($shown) {      if ($shown) {
     $r->print(&Apache::loncommon::start_data_table()          $r->print(&Apache::loncommon::start_data_table());
              .&Apache::loncommon::start_data_table_header_row()          if ($allowed) {
              .'<th colspan="2">'.&mt('Move').'</th>'              $r->print(&Apache::loncommon::start_data_table_header_row()
              .'<th>'.&mt('Actions').'</th>'                       .'<th colspan="2">'.&mt('Move').'</th>'
              .'<th colspan="2">'.&mt('Document').'</th>'                       .'<th>'.&mt('Actions').'</th>'
              .'<th colspan="4">'.&mt('Settings').'</th>'                       .'<th colspan="2">'.&mt('Document').'</th>');
              .&Apache::loncommon::end_data_table_header_row()              if ($folder !~ /^supplemental/) {
              .$output                  $->print('<th colspan="4">'.&mt('Settings').'</th>');
              .&Apache::loncommon::end_data_table()              }
     )              $r->print(&Apache::loncommon::end_data_table_header_row());
     }           }
     unless($shown) {          $r->print($output
                    .&Apache::loncommon::end_data_table()
           );
       } else {
         $r->print('<p class="LC_info">'          $r->print('<p class="LC_info">'
                  .&mt('Currently no documents.')                   .&mt('Currently no documents.')
                  .'</p>'                   .'</p>'
Line 1793  sub parse_supplemental_title { Line 1791  sub parse_supplemental_title {
   
 sub entryline {  sub entryline {
     my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_;      my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_;
   
     my ($foldertitle,$pagetitle,$renametitle);      my ($foldertitle,$pagetitle,$renametitle);
     if (&is_supplemental_title($title)) {      if (&is_supplemental_title($title)) {
  ($title,$foldertitle,$renametitle) = &parse_supplemental_title($title);   ($title,$foldertitle,$renametitle) = &parse_supplemental_title($title);
Line 2747  sub create_form_ul { Line 2744  sub create_form_ul {
   
     # Breadcrumbs      # Breadcrumbs
     &Apache::lonhtmlcommon::clear_breadcrumbs();      &Apache::lonhtmlcommon::clear_breadcrumbs();
     &Apache::lonhtmlcommon::add_breadcrumb({      if ($allowed) {
         href=>"/adm/createuser",text=>"$type Documents"});          &Apache::lonhtmlcommon::add_breadcrumb({
               href=>"/adm/coursedocs",text=>"$type Editor"});
   
     $r->print(&Apache::loncommon::start_page("$type Documents", $script,          $r->print(&Apache::loncommon::start_page("$type Editor", $script,
     {'force_register' => $showdoc,})                                                   {'force_register' => $showdoc,})
              .&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 '.$type,                       'Editing the Table of Contents for your '.$type,
                   'Docs_Adding_Course_Doc')                       'Docs_Adding_Course_Doc')
     );          );
       } else {
           my $lc_type = lc($type);
           &Apache::lonhtmlcommon::add_breadcrumb({
               href=>"/adm/coursedocs",text=>"Supplemental $lc_type documents"});
   
           $r->print(&Apache::loncommon::start_page("Supplemental documents").
                     &Apache::lonhtmlcommon::breadcrumbs());
       }
   
   my %allfiles = ();    my %allfiles = ();
   my %codebase = ();    my %codebase = ();
Line 2999  HIDDENFORM Line 3005  HIDDENFORM
    $activeClass = 0;     $activeClass = 0;
  }   }
     }      }
     if($env{'request.role'}=~/^cc/){      if ($allowed){
     $r->print('<li '.$active.' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');"><a href="#"><b>'.&mt('Main Course Documents').'</b></a></li>');          $r->print('<li '.$active.' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');"><a href="#"><b>'.&mt('Main Course Documents').'</b></a></li>');
     }      }
     $active = '';      $active = '';
     if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {      if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {
Line 3018  HIDDENFORM Line 3024  HIDDENFORM
        if($activeClass == 0){         if($activeClass == 0){
           $active = 'style="display: block;"';            $active = 'style="display: block;"';
        }         }
        if($env{'request.role'}=~/^cc/){         if ($allowed) {
        $r->print('<div class="LC_ContentBox" id="mainCourseDocuments" '.$active.'>');         $r->print('<div class="LC_ContentBox" id="mainCourseDocuments" '.$active.'>');
        my $folder=$env{'form.folder'};         my $folder=$env{'form.folder'};
        if ($folder eq '' || $folder=~/^supplemental/) {         if ($folder eq '' || $folder=~/^supplemental/) {
Line 3159  NROSTFORM Line 3165  NROSTFORM
 my $specialdocumentsform;  my $specialdocumentsform;
 my @specialdocumentsforma;  my @specialdocumentsforma;
 my $newfolderform;  my $newfolderform;
   my $newfolderb;
   
        unless ($env{'form.pagepath'}) {         unless ($env{'form.pagepath'}) {
    my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');     my $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
Line 3172  my $newfolderform; Line 3179  my $newfolderform;
  $help{'Adding_Pages'}   $help{'Adding_Pages'}
  </form>   </form>
 NPFORM  NPFORM
   
   
  $newfolderform=(<<NFFORM);   $newfolderform=(<<NFFORM);
  <form action="/adm/coursedocs" method="post" name="newfolder">   <form action="/adm/coursedocs" method="post" name="newfolder">
  <input type="hidden" name="folderpath" value="$path" />   <input type="hidden" name="folderpath" value="$path" />
Line 3181  NPFORM Line 3189  NPFORM
  <a onclick="javascript:makenewfolder(document.newfolder,'$folderseq');">$lt{'newf'}</a>$help{'Adding_Folders'}   <a onclick="javascript:makenewfolder(document.newfolder,'$folderseq');">$lt{'newf'}</a>$help{'Adding_Folders'}
  </form>   </form>
 NFFORM  NFFORM
  my @newfolderforma= (  
  { '<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic02" />' => "$newfolderform" }  
         );  
   
   
  $newfolderform = create_form_ul(create_list_elements(@newfolderforma));  
   
  my $newsylform=(<<NSYLFORM);   my $newsylform=(<<NSYLFORM);
  <form action="/adm/coursedocs" method="post" name="newsyl">   <form action="/adm/coursedocs" method="post" name="newsyl">
Line 3245  my @tools = ( Line 3247  my @tools = (
  );   );
   
 my %orderhash = (  my %orderhash = (
                 'aa' => ['Upload Document',$fileuploadform.''.$newfolderform],   '00' => ['Newfolder',$newfolderform],
                   'aa' => ['Upload Document',$fileuploadform],
                 'bb' => ['Published Resources',$simpleeditdefaultform],                  'bb' => ['Published Resources',$simpleeditdefaultform],
                 'cc' => ['Special Documents',$specialdocumentsform],                  'cc' => ['Special Documents',$specialdocumentsform],
  'dd' => ['Tools', create_form_ul(create_list_elements(@tools)).&generate_admin_options($containertag,$uploadtag,\%help,\%env)],   'dd' => ['Tools', create_form_ul(create_list_elements(@tools)).&generate_admin_options($containertag,$uploadtag,\%help,\%env)],
                 'zz' => ['Hide'],  
                 );                  );
 my $tid='1';  my $tid='1';
 my $varcd = 'Main Course Documents';  my $varcd = 'Main Course Documents';
 $r->print(&generate_edit_table($tid,$varcd,\%orderhash));  
  $hadchanges=0;   $hadchanges=0;
         my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);          my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
        if ($error) {         if ($error) {
Line 3264  $r->print(&generate_edit_table($tid,$var Line 3265  $r->print(&generate_edit_table($tid,$var
        }         }
   
        &changewarning($r,'');         &changewarning($r,'');
   $r->print(&generate_edit_table($tid,$varcd,\%orderhash));
   
 $r->print('</div>');  $r->print('</div>');
  }   }
        if ($env{'form.pagepath'}) {         if ($env{'form.pagepath'}) {
Line 3282  $r->print('</div>'); Line 3285  $r->print('</div>');
    (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) {     (($env{'form.folderpath'} =~ /^default\&/) || ($env{'form.folderpath'} eq ''))) {
           $env{'form.folderpath'} = 'supplemental&'.            $env{'form.folderpath'} = 'supplemental&'.
                                     &escape(&mt('Supplemental '.$type.' Documents'));                                      &escape(&mt('Supplemental '.$type.' Documents'));
        }else{         } elsif ($allowed) {
   $env{'form.folderpath'} = $savefolderpath;    $env{'form.folderpath'} = $savefolderpath;
        }         }
        $env{'form.pagepath'} = '';         $env{'form.pagepath'} = '';
Line 3324  SUPDOCFORM Line 3327  SUPDOCFORM
  </form>   </form>
 SNFFORM  SNFFORM
   
  my @supnewfolderforma = ({'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic28" />'=>$supnewfolderform});  
  $supnewfolderform = create_form_ul(create_list_elements(@supnewfolderforma));  
   
   
  my $supnewextform=(<<SNEFORM);   my $supnewextform=(<<SNEFORM);
  <form action="/adm/coursedocs" method="post" name="supnewext">   <form action="/adm/coursedocs" method="post" name="supnewext">
Line 3366  my @specialdocs = ( Line 3366  my @specialdocs = (
  {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic31" />'=>$supnewaboutmeform},   {'<img class="LC_noBorder LC_middle" align="left" src="/res/adm/pages/docspacer.gif" alt="pic31" />'=>$supnewaboutmeform},
  );   );
 my %suporderhash = (  my %suporderhash = (
                 'ee' => ['Upload Document',$supupdocform.' '.$supnewfolderform],   '00' => ['Supnewfolder', $supnewfolderform],
                 'ff' => ['Special Documents',create_form_ul(create_list_elements(@specialdocs))],                  'ee' => ['Upload Document',$supupdocform],
                 'zz' => ['Hide'],                  'ff' => ['Special Documents',create_form_ul(create_list_elements(@specialdocs))]
                 );                  );
   
 my $tid='2';          my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
 my $varscd = 'Supplemental Course Documents';          if ($error) {
               $r->print('<p><span class="LC_error">'.$error.'</span></p>');
           }
           my $tid='2';
           my $varscd = 'Supplemental Course Documents';
           $r->print(&generate_edit_table($tid,$varscd,\%suporderhash));
       } else {
           my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
           if ($error) {
               $r->print('<p><span class="LC_error">'.$error.'</span></p>');
           }
       }
   
 $r->print(&generate_edit_table($tid,$varscd,\%suporderhash));  
 }  
   
 my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);  
        if ($error) {  
            $r->print('<p><span class="LC_error">'.$error.'</span></p>');  
         }  
 $r->print('</div>');  $r->print('</div>');
 $r->print('</div></div>');  $r->print('</div></div>');
   
Line 3448  sub generate_edit_table { Line 3453  sub generate_edit_table {
     $form = '<div class="LC_Box">';      $form = '<div class="LC_Box">';
     $form .= '<ul id="navigation'.$tid.'" class="LC_TabContent">';      $form .= '<ul id="navigation'.$tid.'" class="LC_TabContent">';
     foreach my $name (sort(keys(%orderhash))){      foreach my $name (sort(keys(%orderhash))){
         if($name ne 'zz'){          if($name ne '00'){
             if($activetab eq '' || $activetab ne $name){              if($activetab eq '' || $activetab ne $name){
                $active = '';                 $active = '';
             }elsif($activetab eq $name){              }elsif($activetab eq $name){
                $active = 'class="active"';                 $active = 'class="active"';
             }              }
             $form .= '<li '.$active.' onclick="javascript:showPage(this, \''.$name.$tid.'\', \'navigation'.$tid.'\',\'content'.$tid.'\');">'.&mt(${$orderhash{$name}}[0]).'</li>';              $form .= '<li '.$active.' onclick="javascript:showPage(this, \''.$name.$tid.'\', \'navigation'.$tid.'\',\'content'.$tid.'\');">'.&mt(${$orderhash{$name}}[0]).'</li>';
         }          } else {
       $form .= '<li '.$active.'>'.${$orderhash{$name}}[1].'</li>';
   
    }
     }      }
     $form .= '</ul>';      $form .= '</ul>';
     $form .= '<div id="content'.$tid.'" style="padding: 0 0; margin: 0 0;">';      $form .= '<div id="content'.$tid.'" style="padding: 0 0; margin: 0 0;">';
     foreach my $field (keys(%orderhash)){      foreach my $field (keys(%orderhash)){
  if($field ne 'zz'){   if($field ne '00'){
         if($activetab eq '' || $activetab ne $field){          if($activetab eq '' || $activetab ne $field){
                 $active = 'style="display: none;"';                  $active = 'style="display: none;"';
         }elsif($activetab eq $field){          }elsif($activetab eq $field){
Line 3708  for (i = 0; i < currentDivs.length; i++) Line 3716  for (i = 0; i < currentDivs.length; i++)
 function openTabs(pageId) {  function openTabs(pageId) {
  tabnav = document.getElementById(pageId).getElementsByTagName('UL');   tabnav = document.getElementById(pageId).getElementsByTagName('UL');
  if(tabnav.length > 2 ){   if(tabnav.length > 2 ){
  currentNav = document.getElementById(tabnav[0].id);   currentNav = document.getElementById(tabnav[1].id);
  currentLis = currentNav.getElementsByTagName('LI');   currentLis = currentNav.getElementsByTagName('LI');
  for(i = 0; i< currentLis.length; i++){   for(i = 0; i< currentLis.length; i++){
  if(currentLis[i].className == 'active') {   if(currentLis[i].className == 'active') {

Removed from v.1.388  
changed lines
  Added in v.1.393


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