[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /interface londocs.pm

raeburn raeburn@source.lon-capa.org
Thu, 21 Jan 2010 23:42:55 -0000


This is a MIME encoded message

--raeburn1264117375
Content-Type: text/plain

raeburn		Thu Jan 21 23:42:55 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	londocs.pm 
  Log:
  - Backport 1.369, 1.413, 1.414, 1.415, 1.416.
  
  
--raeburn1264117375
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20100121234255.txt"

Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.325.2.1 loncom/interface/londocs.pm:1.325.2.2
--- loncom/interface/londocs.pm:1.325.2.1	Thu May 21 02:47:48 2009
+++ loncom/interface/londocs.pm	Thu Jan 21 23:42:55 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.325.2.1 2009/05/21 02:47:48 raeburn Exp $
+# $Id: londocs.pm,v 1.325.2.2 2010/01/21 23:42:55 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -145,7 +145,7 @@
     my ($r) = @_;
     my $type = &Apache::loncommon::course_type();
     $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space').
-	      '<form name="dumpdoc" method="post">');
+	      '<form name="dumpdoc" action="" method="post">');
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$type.' DOCS to Construction Space'));
     my ($home,$other,%outhash)=&authorhosts();
     unless ($home) { return ''; }
@@ -281,12 +281,22 @@
     my $numdisc = keys(%discussiontime);
     my $navmap = Apache::lonnavmaps::navmap->new();
     if (!defined($navmap)) {
-        $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package').
-                  '<h2>IMS Export Failed</h2>'.
-                  '<div class="LC_error">'.
-                  &mt('Unable to retrieve information about course contents').
-                  '</div><a href="/adm/coursedocs">'.&mt('Return to Course Editor').'</a>');
-        &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($type).':'.$env{'request.course.id'});
+        $r->print(&Apache::loncommon::start_page('Export '.$crstype.' to IMS Package').
+                  '<h2>'.&mt('IMS Export Failed').'</h2>'.
+                  '<div class="LC_error">');
+        if ($crstype eq 'Community') {
+            $r->print(&mt('Unable to retrieve information about community contents'));
+        } else {
+            $r->print(&mt('Unable to retrieve information about course contents'));
+        }
+        $r->print('</div><a href="/adm/coursedocs">');
+        if ($crstype eq 'Community') {
+            $r->print(&mt('Return to Community Editor'));
+        } else {
+            $r->print(&mt('Return to Course Editor'));
+        }
+        $r->print('</a>');
+        &Apache::lonnet::logthis('IMS export failed - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'});
         return;
     }
     my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);
@@ -325,12 +335,18 @@
                 open(OUTPUT, "zip -r $imszip *  2> /dev/null |");
                 close(OUTPUT);
                 chdir $cwd;
-                $outcome .= &mt('Download the zip file from <a href="[_1]">IMS '.lc($type).' archive</a><br />',$imszipfile,);
+                $outcome .= '<p>'
+                           .&mt('[_1]Your IMS package[_2] is ready for download.'
+                               ,'<a href="'.$imszipfile.'">','</a>')
+                           .'</p>';
                 if ($copyresult) {
-                    $outcome .= &mt('The following errors occurred during export - [_1]',$copyresult);
+                    $outcome .= '<p class="LC_error">'
+                               .&mt('The following errors occurred during export - [_1]'
+                                   ,$copyresult)
+                               .'</p>';
                 }
             } else {
-                $outcome = '<br />'.&mt('Unfortunately you will not be able to retrieve an IMS archive of this posts at this time, because there was a problem creating a manifest file.').'<br />';
+                $outcome = '<br />'.&mt('Unfortunately you will not be able to retrieve an IMS archive of your course at this time, because there was a problem creating a manifest file.').'<br />';
             }
         }
         $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package'));
@@ -338,22 +354,26 @@
         $r->print($outcome);
         $r->print(&Apache::loncommon::end_page());
     } else {
-        my $display;
-        $display = '<form name="exportdoc" method="post">'."\n";
-        $display .= &mt('Choose which items you wish to export from your '.$type.'.<br /><br />');
-        $display .= '<table border="0" cellspacing="0" cellpadding="3">'.
-                    '<tr><td><fieldset><legend>&nbsp;<b>Content items</b></legend>'.
-                    '<input type="button" value="check all" '.
+        my $display='<form name="exportdoc" action="" method="post">'."\n".
+                    '<p>'.
+                    &mt('Choose which items you wish to export from your '.$crstype.'.').
+                    '</p>'.
+                    '<div class="LC_columnSection"><fieldset>'.
+                    '<legend>'.&mt('Content items').'</legend>'.
+                    '<input type="button" value="'.&mt('check all').'" '.
                     'onclick="javascript:checkAll(document.exportdoc.archive)" />'.
-                    '&nbsp;&nbsp;<input type="button" value="uncheck all"'.
-                    ' onclick="javascript:uncheckAll(document.exportdoc.archive)" /></fieldset></td>'.
-                    '<td>&nbsp;</td><td>&nbsp;</td>'.
-                    '<td align="right"><fieldset><legend>&nbsp;<b>Discussion posts'.
-                    '</b></legend><input type="button" value="check all"'.
-                    ' onclick="javascript:checkAll(document.exportdoc.discussion)" />'.
-                    '&nbsp;&nbsp;<input type="button" value="uncheck all"'.
-                    ' onclick="javascript:uncheckAll(document.exportdoc.discussion)" /></fieldset></td>'.
-                    '</tr></table>';
+                    '&nbsp;&nbsp;<input type="button" value="'.&mt('uncheck all').'"'.
+                    ' onclick="javascript:uncheckAll(document.exportdoc.archive)" /></fieldset>';
+        if ($numdisc > 0) {
+            $display .= '<fieldset>'.
+                        '<legend>'.&mt('Discussion posts').'</legend>'.
+                        '<input type="button" value="'.&mt('check all').'"'.
+                        ' onclick="javascript:checkAll(document.exportdoc.discussion)" />'.
+                        '&nbsp;&nbsp;<input type="button" value="'.&mt('uncheck all').'"'.
+                        ' onclick="javascript:uncheckAll(document.exportdoc.discussion)" />'.
+                        '</fieldset>';
+        }
+        $display .= '</div>';
         my $curRes;
         my $depth = 0;
         my $count = 0;
@@ -362,13 +382,13 @@
         my %parent = ();
         my %children = ();
         my $lastcontainer = $startcount;
-        my @bgcolors = ('#F6F6F6','#FFFFFF');
-        $display .= '<table cellspacing="0"><tr>'.
-            '<td><b>Export content item?<br /></b></td><td>&nbsp;</td><td align="right">'."\n";
+        $display .= &Apache::loncommon::start_data_table()
+                   .&Apache::loncommon::start_data_table_header_row()
+                   .'<th>'.&mt('Export content item?').'</th>';
         if ($numdisc > 0) {
-            $display.='<b>Export&nbsp;discussion posts?</b>'."\n";
+            $display .= '<th>'.&mt('Export discussion posts?').'</th>';
         }
-        $display.='&nbsp;</td></tr>';
+        $display .= &Apache::loncommon::end_data_table_header_row();
         while ($curRes = $it->next()) {
             if (ref($curRes)) {
                 $count ++;
@@ -389,38 +409,43 @@
                         $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard';
                     }
                 }
-                my $color = $count%2;
-                $display .='<tr bgcolor='.$bgcolors[$color].'><td>'."\n".
-                    '<input type="checkbox" name="archive" value="'.$count.'" ';
+                my $currelem = $count+$boards+$startcount;
+                $display .= &Apache::loncommon::start_data_table_row()
+                           .'<td>'."\n"
+                           .'<input type="checkbox" name="archive" value="'.$count.'" ';
                 if (($curRes->is_sequence()) || ($curRes->is_page())) {
-                    my $checkitem = $count + $boards + $startcount;
-                    $display .= 'onClick="javascript:propagateCheck('."'$checkitem'".')"';
+                    $lastcontainer = $currelem;
+                    $display .= 'onclick="javascript:propagateCheck('."'$currelem'".')"';
                 }
                 $display .= ' />'."\n";
                 for (my $i=0; $i<$depth; $i++) {
-                    $display .= '<img src="/adm/lonIcons/whitespace1.gif" class="LC_docs_spacer" /><img src="/adm/lonIcons/whitespace1.gif" class="LC_docs_spacer" />'."\n";
+                    $display .= ('<img src="/adm/lonIcons/whitespace1.gif" class="LC_docs_spacer" />' x2)."\n";
                 }
                 if ($curRes->is_sequence()) {
                     $display .= '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />&nbsp;'."\n";
-                    $lastcontainer = $count + $startcount + $boards;
                 } elsif ($curRes->is_page()) {
                     $display .= '<img src="/adm/lonIcons/navmap.page.open.gif" alt="" />&nbsp;'."\n";
-                    $lastcontainer = $count + $startcount + $boards;
                 }
-                my $currelem = $count+$boards+$startcount;
                 $children{$parent{$depth}} .= $currelem.':';
-                $display .= '&nbsp;'.$curRes->title().'</td>';
+                $display .= '&nbsp;'.$curRes->title().'</td>'."\n";
+
+                # Existing discussion posts?
+
                 if ($discussiontime{$ressymb} > 0) {
                     $boards ++;
-                    $currelem = $count+$boards+$startcount;
-                    $display .= '<td>&nbsp;</td><td align="right"><input type="checkbox" name="discussion" value="'.$count.'" />&nbsp;</td>'."\n";
+                    $display .= '<td align="right">'
+                               .'<input type="checkbox" name="discussion" value="'.$count.'" />'
+                               .'</td>'."\n";
                 } else {
-                    $display .= '<td colspan="2">&nbsp;</td>'."\n";
+                    $display .= '<td>&nbsp;</td>'."\n";
                 }
+                $display .= &Apache::loncommon::end_data_table_row();
             }
         }
+        $display .= &Apache::loncommon::end_data_table();
         my $scripttag = qq|
-<script>
+<script type="text/javascript">
+// <![CDATA[
 
 function checkAll(field) {
     if (field.length > 0) {
@@ -472,12 +497,13 @@
      }   
 }
 
+// ]]>
 </script>
         |;
 	$r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package',
 						 $scripttag));
 	$r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package'));
-	$r->print($display.'</table>'.
+	$r->print($display.
                   '<p><input type="hidden" name="finishexport" value="1" />'.
                   '<input type="submit" name="exportcourse" value="'.
                   &mt('Export '.$type.' DOCS').'" /></p></form>');
@@ -507,7 +533,7 @@
     my $manifestfilename = $$tempexport.$manifest;
     if ($ims_manifest = Apache::File->new('>'.$manifestfilename)) {
         $$manifestok=1;
-        print $ims_manifest
+        print $ims_manifest 
 '<?xml version="1.0" encoding="UTF-8"?>'."\n".
 '<manifest xmlns="http://www.imsglobal.org/xsd/imscp_v1p1"'.
 ' xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2"'.
@@ -1966,7 +1992,7 @@
     	my $ro_set=
 	    ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':'');
 	$rand_order_text ='
-<span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" onClick="this.form.changeparms.value=\'randomorder\';this.form.submit()" '.$ro_set.' /> '.&mt('Random Order').' </label></span>';   
+<span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" onclick="this.form.changeparms.value=\'randomorder\';this.form.submit()" '.$ro_set.' /> '.&mt('Random Order').' </label></span>';   
     }
     if ($ispage) {
         my $pagename=&escape($pagetitle);
@@ -2010,12 +2036,12 @@
 	$line.=(<<ENDPARMS);
   <td class="LC_docs_entry_parameter">
     $form_start
-    <label><input type="checkbox" name="hiddenresource_$orderidx" onClick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label>
+    <label><input type="checkbox" name="hiddenresource_$orderidx" onclick="this.form.changeparms.value='hiddenresource';this.form.submit()" $hidtext /> $lt{'hd'}</label>
     $form_end
   </td>
   <td class="LC_docs_entry_parameter">
     $form_start
-    <label><input type="checkbox" name="encrypturl_$orderidx" onClick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label>
+    <label><input type="checkbox" name="encrypturl_$orderidx" onclick="this.form.changeparms.value='encrypturl';this.form.submit()" $enctext /> $lt{'ec'}</label>
     $form_end
   </td>
   <td class="LC_docs_entry_parameter">$form_start $rand_order_text $form_end</td>
@@ -2098,7 +2124,7 @@
                  if (($errorcount) ||
                      ($warningcount)) {
 		     if ($errorcount) {
-                        $r->print('<img src="/adm/lonMisc/bomb.gif" alt="" /><span class="LC_error">'.
+                        $r->print('<img src="/adm/lonMisc/bomb.gif" alt="'.&mt('bomb').'" /><span class="LC_error">'.
                           &mt('[quant,_1,error]',$errorcount).'</span>');
                      }
 		     if ($warningcount) {
@@ -2488,13 +2514,17 @@
 	$message='Changes will become active for your current session after [_1], or the next time you log in.';
     }
     $r->print("\n\n".
-'<script type="text/javascript">function reinit(tf) { tf.submit();'.$postexec.' }</script>'."\n". 
+'<script type="text/javascript">'.
+'// <![CDATA['.
+'function reinit(tf) { tf.submit();'.$postexec.' }'.
+'// ]]>'.
+'</script>'."\n".
 '<form name="reinitform" method="post" action="/adm/roles" target="loncapaclient">'.
 '<input type="hidden" name="orgurl" value="'.$url.
 '" /><input type="hidden" name="selectrole" value="1" /><h3><span class="LC_warning">'.
 &mt($message,' <input type="hidden" name="'.
     $env{'request.role'}.'" value="1" /><input type="button" value="'.
-    &mt('re-initializing '.$course_type).'" onClick="reinit(this.form)" />').
+    &mt('re-initializing '.$course_type).'" onclick="reinit(this.form)" />').
 $help{'Caching'}.'</span></h3></form>'."\n\n");
 }
 
@@ -2648,7 +2678,11 @@
 	$script .= &editing_js($udom,$uname);
     }
 # -------------------------------------------------------------------- Body tag
-    $script = '<script type="text/javascript">'."\n".$script."\n".'</script>';
+    $script = '<script type="text/javascript">'."\n"
+              .'// <![CDATA['
+              .$script
+              .'// ]]>'
+              ."\n".'</script>';
     my $brcrum = [{href=>"/adm/createuser",text=>"$type Documents"}];
     $r->print(&Apache::loncommon::start_page("$type Documents", $script,
 				    {'force_register' => $showdoc,
@@ -2856,7 +2890,12 @@
        }
        my $postexec='';
        if ($folder eq 'default') {
-	   $r->print('<script type="text/javascript">this.window.name="loncapaclient";</script>');
+           $r->print('<script type="text/javascript">'
+                    .'// <![CDATA['
+                    .'this.window.name="loncapaclient";'
+                    .'// ]]>'
+                    .'</script>'
+       );
        } else {
            #$postexec='self.close();';
        }
@@ -2914,27 +2953,27 @@
 <form action="/adm/coursedocs" method="post" name="simpleeditdefault">
 $lt{'pubd'}<br />
 $uploadtag
-<input type="button" onClick="javascript:groupsearch()" value="$lt{'srch'}" />
+<input type="button" onclick="javascript:groupsearch()" value="$lt{'srch'}" />
 <br />
 <span class="LC_nobreak">
-<input type="button" onClick="javascript:groupimport();" value="$lt{'impo'}" />
+<input type="button" onclick="javascript:groupimport();" value="$lt{'impo'}" />
 $help{'Importing_LON-CAPA_Resource'}
 </span>
 <br />
-<input type="button" onClick="javascript:groupopen(0,1,1);" value="$lt{'book'}" />
+<input type="button" onclick="javascript:groupopen(0,1,1);" value="$lt{'book'}" />
 <hr />
 <p>
 $lt{'copm'}<br />
 <input type="text" size="40" name="importmap" /><br />
 <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'}" />
 $help{'Load_Map'}</span>
 </p>
 </form>
 <hr />
 <form action="/adm/groupsort" method="post" name="recover">
-<input type="button" name="recovermap" onClick="javascript:groupopen('$readfile',1,0)" value="$lt{'reco'}" />
+<input type="button" name="recovermap" onclick="javascript:groupopen('$readfile',1,0)" value="$lt{'reco'}" />
 </form>
 ENDFORM
        unless ($env{'form.pagepath'}) {
@@ -2944,13 +2983,13 @@
 $uploadtag
 <input type="hidden" name="importdetail" value="" />
 <span class="LC_nobreak">
-<input name="newext" type="button" onClick="javascript:makenewext('newext');"
+<input name="newext" type="button" onclick="javascript:makenewext('newext');"
 value="$lt{'extr'}" /> $help{'Adding_External_Resource'}
 </span>
 </form>
 <br /><form action="/adm/imsimportdocs" method="post" name="ims">
 <input type="hidden" name="folder" value="$folder" />
-<input name="imsimport" type="button" value="$lt{'imsf'}" onClick="javascript:makeims();" />
+<input name="imsimport" type="button" value="$lt{'imsf'}" onclick="javascript:makeims();" />
 </form>
 ENDFORM
        }
@@ -2963,7 +3002,7 @@
 <input type="hidden" name="importdetail" value="" />
 <span class="LC_nobreak">
 <input name="newfolder" type="button"
-onClick="javascript:makenewfolder(this.form,'$folderseq');"
+onclick="javascript:makenewfolder(this.form,'$folderseq');"
 value="$lt{'newf'}" />$help{'Adding_Folders'}
 </span>
 </form>
@@ -2972,7 +3011,7 @@
 <input type="hidden" name="importdetail" value="" />
 <span class="LC_nobreak">
 <input name="newpage" type="button"
-onClick="javascript:makenewpage(this.form,'$pageseq');"
+onclick="javascript:makenewpage(this.form,'$pageseq');"
 value="$lt{'newp'}" />$help{'Adding_Pages'}
 </span>
 </form>
@@ -2999,7 +3038,7 @@
 <input type="hidden" name="importdetail" value="" />
 <span class="LC_nobreak">
 <input name="newsmppg" type="button" value="$lt{'sipa'}"
-onClick="javascript:makesmppage();" /> $help{'Simple Page'}
+onclick="javascript:makesmppage();" /> $help{'Simple Page'}
 </span>
 </form>
 <br /><form action="/adm/coursedocs" method="post" name="newsmpproblem">
@@ -3007,7 +3046,7 @@
 <input type="hidden" name="importdetail" value="" />
 <span class="LC_nobreak">
 <input name="newsmpproblem" type="button" value="$lt{'sipr'}"
-onClick="javascript:makesmpproblem();" />$help{'Simple Problem'}
+onclick="javascript:makesmpproblem();" />$help{'Simple Problem'}
 </span>
 </form>
 <br /><form action="/adm/coursedocs" method="post" name="newdropbox">
@@ -3015,7 +3054,7 @@
 <input type="hidden" name="importdetail" value="" />
 <span class="LC_nobreak">          
 <input name="newdropbox" type="button" value="$lt{'drbx'}"
-onClick="javascript:makedropbox();" />
+onclick="javascript:makedropbox();" />
 </span>         
 </form> 
 <br /><form action="/adm/coursedocs" method="post" name="newexamupload">
@@ -3023,7 +3062,7 @@
 <input type="hidden" name="importdetail" value="" />
 <span class="LC_nobreak">
 <input name="newexamupload" type="button" value="$lt{'scuf'}"
-onClick="javascript:makeexamupload();" />
+onclick="javascript:makeexamupload();" />
 $help{'Score_Upload_Form'}
 </span>
 </form>
@@ -3032,7 +3071,7 @@
 <input type="hidden" name="importdetail" value="" />
 <span class="LC_nobreak">
 <input name="newbulletin" type="button" value="$lt{'bull'}"
-onClick="javascript:makebulboard();" />
+onclick="javascript:makebulboard();" />
 $help{'Bulletin Board'}
 </span>
 </form>
@@ -3050,7 +3089,7 @@
 <input type="hidden" name="importdetail" value="" />
 <span class="LC_nobreak">
 <input name="newaboutsomeone" type="button" value="$lt{'abou'}" 
-onClick="javascript:makeabout();" />
+onclick="javascript:makeabout();" />
 </span>
 </form>
 <br /><form action="/adm/coursedocs" method="post" name="newgroupfiles">
@@ -3080,7 +3119,7 @@
 <input type="hidden" name="importdetail" value="" />
 <span class="LC_nobreak">
 <input name="newsmpproblem" type="button" value="$lt{'sipr'}"
-onClick="javascript:makesmpproblem();" />$help{'Simple Problem'}
+onclick="javascript:makesmpproblem();" />$help{'Simple Problem'}
 </span>
 </form>
 <br /><form action="/adm/coursedocs" method="post" name="newexamupload">
@@ -3088,7 +3127,7 @@
 <input type="hidden" name="importdetail" value="" />
 <span class="LC_nobreak">
 <input name="newexamupload" type="button" value="$lt{'scuf'}"
-onClick="javascript:makeexamupload();" />
+onclick="javascript:makeexamupload();" />
 $help{'Score_Upload_Form'}
 </span>
 </form>
@@ -3156,7 +3195,7 @@
 <input type="hidden" name="importdetail" value="" />
 <span class="LC_nobreak">
 <input name="newfolder" type="button"
-onClick="javascript:makenewfolder(this.form,'$folderseq');"
+onclick="javascript:makenewfolder(this.form,'$folderseq');"
 value="$lt{'newf'}" /> $help{'Adding_Folders'}
 </span>
 </form>
@@ -3165,7 +3204,7 @@
 <input type="hidden" name="importdetail" value="" />
 <span class="LC_nobreak">
 <input name="newext" type="button" 
-onClick="javascript:makenewext('supnewext');"
+onclick="javascript:makenewext('supnewext');"
 value="$lt{'extr'}" /> $help{'Adding_External_Resource'}
 </span>
 </form>

--raeburn1264117375--