Diff for /loncom/imspackages/imsimportdocs.pm between versions 1.25 and 1.29

version 1.25, 2009/11/20 11:16:59 version 1.29, 2009/11/20 18:25:34
Line 218  sub display_one { Line 218  sub display_one {
     $r->print(      $r->print(
         '<form action="/adm/imsimportdocs" method="post"'          '<form action="/adm/imsimportdocs" method="post"'
        .' enctype="multipart/form-data" name="pickcms">'         .' enctype="multipart/form-data" name="pickcms">'
        .&Apache::lonhtmlcommon::topic_bar(      );
   
       # Step 1
       $r->print(
          &Apache::lonhtmlcommon::topic_bar(
             1,&mt('Specify the Course Management system used to create the package'))              1,&mt('Specify the Course Management system used to create the package'))
        .&mt('Please choose the CMS used to create your IMS content package:').' '         .&mt('Please choose the CMS used to create your IMS content package:').' '
        .'<select name="source">'         .'<select name="source">'
Line 229  sub display_one { Line 233  sub display_one {
        .'<option value="webctce4">WebCT 4 Campus Edition</option>'         .'<option value="webctce4">WebCT 4 Campus Edition</option>'
        .'</select>'         .'</select>'
     );      );
   
       # Step 2
     $r->print(      $r->print(
        &Apache::lonhtmlcommon::topic_bar(         &Apache::lonhtmlcommon::topic_bar(
            2,&mt('Locate the IMS content package you wish to upload'))             2,&mt('Locate the IMS content package you wish to upload'))
Line 237  sub display_one { Line 243  sub display_one {
       .&mt('File:')        .&mt('File:')
       .' <input type="file" name="uploadname" size="40" />'        .' <input type="file" name="uploadname" size="40" />'
     );      );
   
       # Buttons
     $r->print(      $r->print(
        '<hr />'         '<hr />'
       .'<p>'        .'<p>'
Line 247  sub display_one { Line 255  sub display_one {
       .' onclick="javascript:nextPage()" />'        .' onclick="javascript:nextPage()" />'
       .'</p>'        .'</p>'
     );      );
   
       $r->print('</form>');
 }  }
   
   
Line 269  sub display_two { Line 279  sub display_two {
     my %hrefs = ();      my %hrefs = ();
     my %resinfo = ();      my %resinfo = ();
     my %count = ();      my %count = ();
     my @bgcolors = ("#eeeeee","#dddddd");  
   
     my $counter = 0;      my $counter = 0;
     my $iter = 0;  
     my %count = (      my %count = (
                 announce => 0,                  announce => 0,
                 board => 0,                  board => 0,
Line 337  sub display_two { Line 344  sub display_two {
         }          }
     }      }
   
             $r->print(<<ENDBLOCK);  
 <form name="pickoptions" method="post">      # Start output: Step 3 and step 4
   <table border='0' bgcolor='#F6F6F6'' cellspacing='0' cellpadding ='0' width='100%'>  
    <tr>      $r->print(
     <td colspan='2'>          '<form name="pickoptions" method="post" action="">'
      <table border='0' cellspacing='0' cellpadding='0'>         .&Apache::lonhtmlcommon::topic_bar(
       <tr>              3,&mt('Choose which content types you wish to import'))
        <td colspan='2'  align='left'>&nbsp;         .'<p>'
        </td>         .&mt('Check the checkboxes for all areas you wish to import from the IMS package:')
       </tr>         .'</p>'
       <tr bgcolor='#CCCCFF'>      );
        <td valign="middle"><img src="/res/adm/pages/bl_step3.gif" alt="3" />  
        </td>      $r->print(
        <td width='100%' align='left'>&nbsp;&nbsp;          &Apache::loncommon::start_data_table()
         <font face='arial,helvetica,sans-serif'><b>Choose which content types you wish to import</b></font>         .&Apache::loncommon::start_data_table_header_row()
        </td>         .'<th>'.&mt('Import?').'</th>'
       </tr>         .'<th>'.&mt('Content type').'</th>'
       <tr>         .'<th>'.&mt('Additional options').'</th>'
        <td colspan='2'>&nbsp;</td>         .&Apache::loncommon::end_data_table_header_row()
       </tr>      );
       <tr>  
        <td>&nbsp;</td>      # Display import row for each area/content type
        <td>      foreach my $area (@{$areasref}) {
         <table border='0' cellspacing='0' cellpadding='1' bgcolor='#000000'>          unless ($count{$area} > 0) { next };
          <tr>  
           <td>          my $count_tag = 'flag_'.$counter;
            <table border='0' cellspacing='0' cellpadding='0' bgcolor='#ffffff' width='100%'>  
             <tr>          # Checkbox: Import?
              <td>          $r->print(
               <table border='0' cellspacing='1' cellpadding='1' bgcolor='#ffffff' width='100%'>              &Apache::loncommon::start_data_table_row()
                <tr bgcolor='#CCCCFF'>             .'<td><input name="'.$area.'" type="checkbox"'
                 <td align='center'><font face='arial,helvetica,sans-serif'><b>Import?</b></font></td>                     );
                 <td align='center'><font face='arial,helvetica,sans-serif'><b>Content type</b></font></td>          if ($area eq 'board' || $area eq 'users') {
                 <td align='center'><font face='arial,helvetica,sans-serif'><b>Additional options</b></font></td>              $r->print(qq| onclick='javascript:setOptions("$area","$counter")'|);
                </tr>          }
 ENDBLOCK  
             foreach my $area (@{$areasref}) {          $r->print(' /></td>');
                 if ($count{$area} > 0) {  
                     my $count_tag = 'flag_'.$counter;          # Content Type
                     $r->print("               <tr bgcolor='@bgcolors[$iter]'>          $r->print(
                 <td align='left'><font face='arial,helvetica,sans-serif'><input name='$area' type='checkbox' ");              '<td>'
                     if ($area eq 'board' || $area eq 'users') {             .$$areaname{$area}.'&nbsp;&nbsp; - '
                         $r->print(qq|onClick='javascript:setOptions("$area","$counter")'|);             .&mt('[quant,_1,item]',$count{$area})
                     }             .'</td>'
                     $r->print("/></font></td>          );
                 <td align='left'><font face='arial,helvetica,sans-serif'>&nbsp;&nbsp;$$areaname{$area}&nbsp;&nbsp; - $count{$area} item(s)</font></td>");  
                     if ($area eq 'board') {          # Additional Options
                         $r->print("            <td align='left'><font face='arial,helvetica,sans-serif'>&nbsp;&nbsp;          $r->print('<td>');
                  <select name='db_handling'>          if ($area eq 'board') {
                   <option value='-2'>&lt;-- Check Import first</option>              $r->print(
                  </select></font>                  '<select name="db_handling">'
                 </td>");                 .'<option value="-2">&lt;-- '.&mt('Check Import first').'</option>'
                     } elsif ($area eq 'users') {                 .'</select>'
                         $r->print("            <td align='left'><font face='arial,helvetica,sans-serif'>&nbsp;&nbsp;              );
                  <select name='user_handling'>          } elsif ($area eq 'users') {
                   <option value='-2'>&lt;-- Check Import first</option>              $r->print(
                  </select>                  '<select name="user_handling">'
                  </font>                         .'<option value="-2">&lt;-- '.&mt('Check Import first').'</option>'
                 </td>");                 .'</select>'
                     } else {              );
                         $r->print("            <td align='left'><font face='arial,helvetica,sans-serif'>&nbsp;&nbsp;None<input type='hidden' name='$count_tag' /></font></td>");          } else {
                     }              $r->print(
                     $counter ++;                  &mt('None')
                     $iter = $counter%2;                 .'<input type="hidden" name="'.$count_tag.'" />'
                 }              );
             }          }
             $r->print(<<ENDDOCUMENT);          $r->print('</td>');
                </tr>  
               </table>          $r->print(&Apache::loncommon::end_data_table_row());
              </td>          $counter ++;
             </tr>      }
            </table>  
           </td>      $r->print(&Apache::loncommon::end_data_table());
          </tr>  
         </table>      $r->print(
        </td>          &Apache::lonhtmlcommon::topic_bar(
       </tr>              4,&mt('Choose display options for listing of contents of top level of package'))
       <tr>         .'<p>'
        <td colspan='2'>&nbsp;<br /><br /></td>         .&mt('Select a display option for the package content:')
       </tr>         .'</p>'
       <tr bgcolor='#CCCCFF'>      );
        <td valign="middle"><img src="/res/adm/pages/bl_step4.gif" alt="4" />      $r->print(
        </td>          '<label>'
        <td width='100%' align='left'>&nbsp;&nbsp;         .'<input type="radio" name="toplevel" value="newfolder" />'
         <font face='arial,helvetica,sans-serif'><b>Choose display options for listing of contents of top level of package</b></font>         .&mt('Display listing of contents in a new folder, with folder name:')
        </td>         .'</label>'
       </tr>         .' <input type="text" name="foldername" size="15" value="'.&mt('Type Name Here').'" />'
       <tr>         .'<br />'
        <td colspan='2'>&nbsp;</td>         .'<label>'
       </tr>         .'<input type="radio" name="toplevel" value="oldfolder" checked="checked" />'
       <tr>         .&mt('Append listing of contents of top level of package to contents list for the current folder.')
        <td>&nbsp;</td>         .'</label>'
        <td>      );
         <table border='0'>  
          <tr>      # Buttons
           <td><font face='arial,helvetica,sans-serif'><label><input type="radio" name="toplevel" value="newfolder" />Display listing of contents in a new folder, with folder name:</label>&nbsp;&nbsp;&nbsp;<input type="text" name="foldername" size="15" value="Type Name Here" /></font></td>      $r->print(
          </tr>          '<input type="hidden" name="folder" value="'.$env{'form.folder'}.'" />'
          <tr>         .'<input type="hidden" name="source" value="'.$cms.'" />'
           <td><font face='arial,helvetica,sans-serif'><label><input type="radio" name="toplevel" value="oldfolder" />Append listing of contents of top level of package to contents list for the current folder.</label></font></td>         .'<input type="hidden" name="tempdir" value="'.$tempdir.'" />'
          </tr>         .'<input type="hidden" name="phase" value="three" />'
         </table>      );
        </td>      $r->print(
       </tr>          '<hr />'
       <tr>         .'<p>'
        <td colspan='2'>&nbsp;</td>         .'<input type="button" name="exitpage" value="'.&mt('Cancel').'"'
       </tr>         .' onclick="javascript:self.close()" />'
       <tr>         .' '
        <td>&nbsp;</td>         .'<input type="button" name="nextpage" value="'.&mt('Finish Import').'"'
        <td><font face='arial,helvetica,sans-serif'>Once you have checked the checkboxes for all areas you wish to import from the IMS package, selected options (if available), and selected a display option for the package contents you should click the 'Complete Import' button.</font></td>         .' onclick="javascript:nextPage('.$counter.')" />'
       </tr>         .'</p>'
       <tr>      );
        <td colspan='2'>&nbsp;  
           <input type="hidden" name="folder" value="$env{'form.folder'}" />     $r->print('</form>');
           <input type="hidden" name="source" value="$cms" />  
           <input type="hidden" name="tempdir" value="$tempdir" />  
           <input type="hidden" name="phase" value="three" />  
        </td>  
       </tr>  
       <tr>  
        <td colspan='2'>  
         <table border='0' cellspacing='0' cellpadding='0' width="100%">  
          <tr>  
           <td align='left'>  
            <input type='button' name='exitpage' value='Cancel' onClick="javascript:self.close()" />  
           </td>  
           <td align='right'>  
            <input type="button" name="nextpage" value="Complete Import" onClick="javascript:nextPage($counter)" />  
           </td>  
          </tr>  
         </table>  
        </td>  
       </tr>  
      </table>  
     </td>  
    </tr>  
   </table>  
 ENDDOCUMENT  
 }  }
   
   
Line 636  sub display_three { Line 619  sub display_three {
     if ($tempdir =~ m/^\/home\/httpd\/perl\/tmp\/$crs\/\d{10}/) {      if ($tempdir =~ m/^\/home\/httpd\/perl\/tmp\/$crs\/\d{10}/) {
         system("rm -r -f $tempdir");          system("rm -r -f $tempdir");
     }      }
     $r->print(<<ENDBLOCK);  
   <table border='0' bgcolor='#F6F6F6'' cellspacing='0' cellpadding ='0' width='100%'>      # All done, display success message
    <tr>      $r->print(
     <td colspan='2'>          '<p class="LC_success">'
      <table border='0' cellspacing='0' cellpadding='0'>         .&mt('Your import is complete.')
       <tr>         .'</p>'
        <td colspan='2'  align='left'>&nbsp;      );
        </td>      # Re-initialize Button
       </tr>      my $initbutton =
       <tr bgcolor='#CCCCFF'>             '<input type="button" value="'
        <td valign="middle"><img src="/res/adm/pages/bl_step5.gif" alt="5" />            .&mt('re-initializing course')
        </td>            .'" onclick="javascript:init(this.form)" />';
        <td width='100%' align='left'>&nbsp;&nbsp;      $r->print(
         <font face='arial,helvetica,sans-serif'><b>Your import is complete</b></font>          '<form method="post" action="/adm/roles" target="loncapaclient" name="importDone">'
        </td>         .'<input type="hidden" name="orgurl" value="/adm/coursedocs" />'
       </tr>         .'<input type="hidden" name="selectrole" value="1" />'
       <tr>         .'<input type="hidden" name="'.$env{'request.role'}.'" value="1" />'
        <td colspan='2'>&nbsp;</td>         .'<p class="LC_warning">'
       </tr>         .&mt('Changes will become active for your current session after [_1]'
       <tr>             .', or the next time you log in.'
        <td>&nbsp;</td>              ,$initbutton)
        <td>         .'</p>'
 ENDBLOCK         .'</form>'
     my $initblock = qq|        );
          <form method="post" action="/adm/roles" target="loncapaclient" name="importDone">  
            <input type="hidden" name="orgurl" value="/adm/coursedocs" />  
            <input type="hidden" name="selectrole" value="1" />  
            <h3><font color="red">Changes will become active for your current session after  
            <input type="hidden" name="$env{'request.role'}" value="1" />  
            <input type="button" value="|;  
     $initblock .= &mt('re-initializing course');  
     $initblock .= qq|" onClick="javascript:init(this.form)" />|;  
     $initblock .= ', '.&mt('or the next time you log in.');  
     $initblock .= qq|</font></h3></form>|;    
     $r->print($initblock);  
     $r->print(<<ENDBLOCKTWO);  
      </table>  
     </td>  
    </tr>  
   </table>  
 ENDBLOCKTWO  
 }  }
   
 1;  1;

Removed from v.1.25  
changed lines
  Added in v.1.29


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