Diff for /loncom/interface/londocs.pm between versions 1.333 and 1.335

version 1.333, 2009/02/02 11:23:56 version 1.335, 2009/02/03 18:31:59
Line 2874  ERFORM Line 2874  ERFORM
        }         }
   
        $r->print(&generate_admin_options($containertag,$uploadtag,\%lt,\%help,\%env));         $r->print(&generate_admin_options($containertag,$uploadtag,\%lt,\%help,\%env));
        $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',  
      &mt('Editing the Table of Contents for your '.$type)));  
     }      }
   # --------------------------------------------------------- Main tab structure
       my $activeClass = 1;
       $r->print('<div class="LC_ContentBoxSpecial"><ul class="LC_TabContent" id="mainnav">');
       if (($standard) && ($allowed) && (!$forcesupplement)) {
    my $active = '';
           if($activeClass == 1){
              $active = 'class="active"';
      $activeClass = 0;
    }
    $r->print('<li '.$active.'onclick="javascript:showPage(this,\'Main Course Documents\',\'mainnav\',\'maincoursedoc\');">'.&mt('Main Course Documents').'</li>');
       }
       if (!$forcestandard) {
    my $active = '';
           if($activeClass == 1){
              $active = 'class="active"';
           }
    $r->print('<li '.$active.'onclick="javascript:showPage(this,\'Supplemental Course Documents\',\'mainnav\',\'maincoursedoc\');">'.&mt('Supplemental Course Documents').'</li>');
       }
       $r->print('</ul><div id="maincoursedoc" style="margin:0 0;padding:0 0;">');
 # --------------------------------------------------------- Standard documents  # --------------------------------------------------------- Standard documents
     if (($standard) && ($allowed) && (!$forcesupplement)) {      if (($standard) && ($allowed) && (!$forcesupplement)) {
          my $active = 'style="display: none;"';
          if($activeClass == 0){
             $active = 'style="display: block;"';
          }
          $r->print('<div class="LC_ContentBox" id="Main Course Documents" '.$active.'>');
           $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
                        &mt('Editing the Table of Contents for your '.$type)));
        my $folder=$env{'form.folder'};         my $folder=$env{'form.folder'};
        if ($folder eq '' || $folder eq 'supplemental') {         if ($folder eq '' || $folder eq 'supplemental') {
            $folder='default';             $folder='default';
Line 2893  ERFORM Line 2917  ERFORM
            #$postexec='self.close();';             #$postexec='self.close();';
        }         }
        $hadchanges=0;         $hadchanges=0;
        my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,  
    $upload_output,$type);  
        if ($error) {  
    $r->print('<p><span class="LC_error">'.$error.'</span></p>');  
        }  
        if ($hadchanges) {         if ($hadchanges) {
    &mark_hash_old();     &mark_hash_old();
        }         }
Line 3106  my %orderhash = ( Line 3125  my %orderhash = (
                 'bb' => 'Published Documents',                  'bb' => 'Published Documents',
                 'cc' => 'Special Documents',                  'cc' => 'Special Documents',
  'dd' => 'More Options',   'dd' => 'More Options',
                 'zz' => 'Hide all Option',                  'zz' => 'Hide all Options',
                 );                  );
 my %namehash = (  my %namehash = (
                 'New Document' => $fileuploadform,                  'New Document' => $fileuploadform,
                 'Published Documents' => $simpleeditdefaultform,                  'Published Documents' => $simpleeditdefaultform,
                 'Special Documents' => $specialdocumentsform,                  'Special Documents' => $specialdocumentsform,
  'More Options' => $extresourcesform.'<br />'.$imspform.'<br />'.$recoverform,   'More Options' => $extresourcesform.'<br />'.$imspform.'<br />'.$recoverform,
                 'drei' => 'dr',  
                 );                  );
 my $tid = '1';  my $tid='1';
 my $varcd = 'Course Documents';  my $content='content';
 $r->print(&generate_edit_table($varcd,\%namehash,\%orderhash));   my $navigation='navigation';
   my $varcd = 'Main Course Documents';
   $r->print(&generate_edit_table($tid,$content,$navigation,$varcd,\%namehash,\%orderhash)); 
   my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
          if ($error) {
              $r->print('<p><span class="LC_error">'.$error.'</span></p>');
          }
   $r->print('</div>');
       }        }
        if ($env{'form.pagepath'}) {         if ($env{'form.pagepath'}) {
        }         }
     }      }
 # ----------------------------------------------------- Supplemental documents  # ----------------------------------------------------- Supplemental documents
     if (!$forcestandard) {      if (!$forcestandard) {
          my $active = 'style="display: none;"';
          if($activeClass == 1){
             $active = 'style="display: block;"';
          }
          $r->print('<div class="LC_ContentBox" id="Supplemental Course Documents" '.$active.'>');
        my $folder=$env{'form.folder'};         my $folder=$env{'form.folder'};
        unless ($folder=~/^supplemental/) {         unless ($folder=~/^supplemental/) {
    $folder='supplemental';     $folder='supplemental';
Line 3133  $r->print(&generate_edit_table($varcd,\% Line 3163  $r->print(&generate_edit_table($varcd,\%
           $env{'form.folderpath'} = 'supplemental&'.            $env{'form.folderpath'} = 'supplemental&'.
                                     &escape(&mt('Supplemental '.$type.' Documents'));                                      &escape(&mt('Supplemental '.$type.' Documents'));
        }         }
        my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);  
        if ($error) {  
    $r->print('<p><span class="LC_error">'.$error.'</span></p>');  
        }  
        if ($allowed) {         if ($allowed) {
    my $folderseq=     my $folderseq=
        '/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time.         '/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time.
Line 3227  my %supnamehash = ( Line 3253  my %supnamehash = (
                 'New Document' => $supupdocform,                  'New Document' => $supupdocform,
                 'Special Documents' => $supnewfolderform.'<br />'.$supnewextform.'<br />'.$supnewsylform.'<br />'.$supnewaboutmeform,                  'Special Documents' => $supnewfolderform.'<br />'.$supnewextform.'<br />'.$supnewsylform.'<br />'.$supnewaboutmeform,
                 );                  );
 my $tid='2';  
 my $varscd = 'Supplemented Course Documents';  
   
 $r->print(<<FORM);  
 <ul class="LC_TabContent">  
  <li>New Document</li>  
  <li>Special Documents</li>  
 </ul>  
 FORM  
   
 #$r->print(&generate_edit_table($varscd,\%supnamehash,\%suporderhash));  my $tid='2';
   my $content='content';
   my $navigation='navigation';
   my $varscd = 'Supplemental Course Documents';
   
   $r->print(&generate_edit_table($tid,$content,$navigation,$varscd,\%supnamehash,\%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>');
     if ($allowed) {      if ($allowed) {
  $r->print('   $r->print('
 <form method="post" name="extimport" action="/adm/coursedocs">  <form method="post" name="extimport" action="/adm/coursedocs">
Line 3313  ENDOPTIONFORM Line 3340  ENDOPTIONFORM
   
   
 sub generate_edit_table {  sub generate_edit_table {
     my ($varcd,$namehash_ref,$orderhash_ref) = @_;      my ($tid,$content,$navigation,$varcd,$namehash_ref,$orderhash_ref) = @_;
     my %namehash = %{$namehash_ref};             #name verlinkt mit id      my %namehash = %{$namehash_ref};             #name verlinkt mit id
     my %orderhash = %{$orderhash_ref};           #name mit kürzel verlinkt mit name      my %orderhash = %{$orderhash_ref};           #name mit kürzel verlinkt mit name
     my $form;      my $form;
   
     {      
   
     $form = '<div class="LC_ContentBoxSpecial"><h4 class="LC_hcell">'.&mt('Upload '.$varcd).'</h4>';      $form = '<div class="LC_ContentBoxSpecial"><h4 class="LC_hcell">'.&mt($varcd).'</h4>';
     $form .= '<ul id="navigation" 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 eq 'zz'){          if($name eq 'zz'){
             $form .= '<li onclick="javascript:hideAll(this);" class="active">'.&mt($orderhash{$name}).'</li>';              $form .= '<li onclick="javascript:hideAll(this, \''.$navigation.$tid.'\' ,\''.$content.$tid.'\');" class="active">'.&mt($orderhash{$name}).'</li>';
         }else{          }else{
             $form .= '<li onclick="javascript:showPage(this, \''.$orderhash{$name}.'\');">'.&mt($orderhash{$name}).'</li>';              $form .= '<li onclick="javascript:showPage(this, \''.$tid.$orderhash{$name}.'\', \''.$navigation.$tid.'\',\''.$content.$tid.'\');">'.&mt($orderhash{$name}).'</li>';
         }          }
     }      }
     $form .= '<div id="content" style="padding: 0 0; margin: 0 0;">';      $form .= '<div id="'.$content.$tid.'" style="padding: 0 0; margin: 0 0;">';
     foreach my $field (keys(%namehash)){      foreach my $field (keys(%namehash)){
         $form .= '<div id="'.$field.'" class="LC_ContentBox" style="display: none;">'.$namehash{$field}.'</div>';          $form .= '<div id="'.$tid.$field.'" class="LC_ContentBox" style="display: none;">'.$namehash{$field}.'</div>';
       }        }
     $form .= '</div></div>';      $form .= '</div></div>';
     }      
     return $form;      return $form;
 }  }
   
Line 3452  function makeabout() { Line 3479  function makeabout() {
    if ((comp[0]) && (comp[1])) {     if ((comp[0]) && (comp[1])) {
        this.document.forms.newaboutsomeone.importdetail.value=         this.document.forms.newaboutsomeone.importdetail.value=
    '$lt{"p_mab2"}'+escape(user)+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';     '$lt{"p_mab2"}'+escape(user)+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';
        this.document.forms.newaboutsomeone.submit();         this.document.forms.newaboutsomeone.submit();
    } else {     } else {
                alert("$lt{'p_mab_alrt1'}");         alert("$lt{'p_mab_alrt1'}");
            }  
        } else {  
            alert("$lt{'p_mab_alrt2'}");  
        }  
    }     }
   } else {
      alert("$lt{'p_mab_alrt2'}");
   }
   }
 }  }
   
 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;
 }  }
   
   
 function finishpick() {  function finishpick() {
     var title=this.document.forms.extimport.title.value;  var title=this.document.forms.extimport.title.value;
     var url=this.document.forms.extimport.url.value;  var url=this.document.forms.extimport.url.value;
     var form=this.document.forms.extimport.useform.value;  var form=this.document.forms.extimport.useform.value;
     var residx=this.document.forms.extimport.residx.value;  var residx=this.document.forms.extimport.residx.value;
     eval('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+'='+residx+'";this.document.forms.'+form+'.submit();');  eval('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+'='+residx+'";this.document.forms.'+form+'.submit();');
 }  }
   
 function changename(folderpath,index,oldtitle,container,pagesymb) {  function changename(folderpath,index,oldtitle,container,pagesymb) {
     var title=prompt('$lt{"p_chn"}',oldtitle);  var title=prompt('$lt{"p_chn"}',oldtitle);
     if (title) {  if (title) {
  this.document.forms.renameform.markcopy.value=-1;  this.document.forms.renameform.markcopy.value=-1;
  this.document.forms.renameform.title.value=title;  this.document.forms.renameform.title.value=title;
  this.document.forms.renameform.cmd.value='rename_'+index;  this.document.forms.renameform.cmd.value='rename_'+index;
         if (container == 'sequence') {  if (container == 'sequence') {
     this.document.forms.renameform.folderpath.value=folderpath;      this.document.forms.renameform.folderpath.value=folderpath;
         }  }
         if (container == 'page') {  if (container == 'page') {
             this.document.forms.renameform.pagepath.value=folderpath;      this.document.forms.renameform.pagepath.value=folderpath;
             this.document.forms.renameform.pagesymb.value=pagesymb;      this.document.forms.renameform.pagesymb.value=pagesymb;
         }  }
         this.document.forms.renameform.submit();  this.document.forms.renameform.submit();
     }  }
 }  }
   
 function removeres(folderpath,index,oldtitle,container,pagesymb,skip_confirm) {  function removeres(folderpath,index,oldtitle,container,pagesymb,skip_confirm) {
     if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) {  if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) {
  this.document.forms.renameform.markcopy.value=-1;  this.document.forms.renameform.markcopy.value=-1;
  this.document.forms.renameform.cmd.value='del_'+index;  this.document.forms.renameform.cmd.value='del_'+index;
         if (container == 'sequence') {  if (container == 'sequence') {
             this.document.forms.renameform.folderpath.value=folderpath;      this.document.forms.renameform.folderpath.value=folderpath;
         }  }
         if (container == 'page') {  if (container == 'page') {
             this.document.forms.renameform.pagepath.value=folderpath;      this.document.forms.renameform.pagepath.value=folderpath;
             this.document.forms.renameform.pagesymb.value=pagesymb;      this.document.forms.renameform.pagesymb.value=pagesymb;
         }  }
         this.document.forms.renameform.submit();  this.document.forms.renameform.submit();
     }  }
 }  }
   
 function cutres(folderpath,index,oldtitle,container,pagesymb,folder,skip_confirm) {  function cutres(folderpath,index,oldtitle,container,pagesymb,folder,skip_confirm) {
     if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) {  if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) {
  this.document.forms.renameform.cmd.value='cut_'+index;  this.document.forms.renameform.cmd.value='cut_'+index;
  this.document.forms.renameform.markcopy.value=index;  this.document.forms.renameform.markcopy.value=index;
  this.document.forms.renameform.copyfolder.value=folder+'.'+container;  this.document.forms.renameform.copyfolder.value=folder+'.'+container;
         if (container == 'sequence') {  if (container == 'sequence') {
             this.document.forms.renameform.folderpath.value=folderpath;      this.document.forms.renameform.folderpath.value=folderpath;
         }  }
         if (container == 'page') {  if (container == 'page') {
             this.document.forms.renameform.pagepath.value=folderpath;      this.document.forms.renameform.pagepath.value=folderpath;
             this.document.forms.renameform.pagesymb.value=pagesymb;      this.document.forms.renameform.pagesymb.value=pagesymb;
         }  }
         this.document.forms.renameform.submit();  this.document.forms.renameform.submit();
     }  }
 }  }
   
 function markcopy(folderpath,index,oldtitle,container,pagesymb,folder) {  function markcopy(folderpath,index,oldtitle,container,pagesymb,folder) {
     this.document.forms.renameform.markcopy.value=index;  this.document.forms.renameform.markcopy.value=index;
     this.document.forms.renameform.copyfolder.value=folder+'.'+container;  this.document.forms.renameform.copyfolder.value=folder+'.'+container;
     if (container == 'sequence') {  if (container == 'sequence') {
  this.document.forms.renameform.folderpath.value=folderpath;  this.document.forms.renameform.folderpath.value=folderpath;
     }  }
     if (container == 'page') {  if (container == 'page') {
  this.document.forms.renameform.pagepath.value=folderpath;  this.document.forms.renameform.pagepath.value=folderpath;
  this.document.forms.renameform.pagesymb.value=pagesymb;  this.document.forms.renameform.pagesymb.value=pagesymb;
     }  }
     this.document.forms.renameform.submit();  this.document.forms.renameform.submit();
 }  }
   
 function unselectInactive() {  function unselectInactive(nav) {
  currentTable = document.getElementById('tableId');  currentNav = document.getElementById(nav);
  currentNav = document.getElementById('navigation');  currentLis = currentNav.getElementsByTagName('LI');
  currentLis = currentNav.getElementsByTagName('LI');  for (i = 0; i < currentLis.length; i++) {
  for (i = 0; i < currentLis.length; i++) {   currentLis[i].className = 'i';
  currentLis[i].className = 'i';  }
  }  
 }  }
   
 function hideAll(current) {  function hideAll(current, nav, data) {
  unselectInactive();  unselectInactive(nav);
  current.className = 'active';  current.className = 'active';
  currentData = document.getElementById('content');  currentData = document.getElementById(data);
  currentDivs = currentData.getElementsByTagName('DIV');  currentDivs = currentData.getElementsByTagName('DIV');
  for (i = 0; i < currentDivs.length; i++) {  for (i = 0; i < currentDivs.length; i++) {
    if(currentDivs[i].className == 'LC_ContentBox'){
  currentDivs[i].style.display = 'none';   currentDivs[i].style.display = 'none';
  }   }
 }  }
   }
   
 function showPage(current, pageId) {  function showPage(current, pageId, nav, data) {
  hideAll(current);   hideAll(current, nav, data);
  unselectInactive();   unselectInactive(nav);
  current.className = 'active';   current.className = 'active';
  currentData = document.getElementById(pageId);   currentData = document.getElementById(pageId);
  currentData.style.display = 'block';   currentData.style.display = 'block';

Removed from v.1.333  
changed lines
  Added in v.1.335


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