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

bisitz bisitz@source.lon-capa.org
Mon, 16 Feb 2009 11:09:01 -0000


This is a MIME encoded message

--bisitz1234782541
Content-Type: text/plain

bisitz		Mon Feb 16 11:09:01 2009 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  Removed unneccessary trailing tabs and white spaces from script code
  
  
--bisitz1234782541
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20090216110901.txt"

Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.343 loncom/interface/londocs.pm:1.344
--- loncom/interface/londocs.pm:1.343	Mon Feb 16 10:33:32 2009
+++ loncom/interface/londocs.pm	Mon Feb 16 11:09:01 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.343 2009/02/16 10:33:32 biermanm Exp $
+# $Id: londocs.pm,v 1.344 2009/02/16 11:09:01 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -133,7 +133,7 @@
 sub clean {
     my ($title)=@_;
     $title=~s/[^\w\/\!\$\%\^\*\-\_\=\+\;\:\,\\\|\`\~]+/\_/gs;
-    return $title;	
+    return $title;
 }
 
 
@@ -175,8 +175,8 @@
 	    my $fail=0;
 	    for (my $i=0;$i<$#dirs;$i++) {
 		$makepath.='/'.$dirs[$i];
-		unless (-e $makepath) { 
-		    unless(mkdir($makepath,0777)) { $fail=1; } 
+		unless (-e $makepath) {
+		    unless(mkdir($makepath,0777)) { $fail=1; }
 		}
 	    }
 	    $r->print('<br /><tt>'.$item.'</tt> => <tt>'.$newfilename.'</tt>: ');
@@ -759,7 +759,7 @@
     if ($caller eq 'templateupload') {
         $url = $symb;
         $url =~ s#//#/#g;
-    } else { 
+    } else {
         ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);
     }
     my $content;
@@ -799,9 +799,9 @@
                     $$message = 'Could not render '.$url.' server message - '.$rtncode."<br />\n";
                 }
             } elsif ($caller eq 'noedit') {
-# Need to render the resource without the LON-CAPA Internal header and the Post discussion footer, and then set $content equal to this. 
+# Need to render the resource without the LON-CAPA Internal header and the Post discussion footer, and then set $content equal to this.
                 $repstatus = 'ok';
-                $content = 'Not the owner of this resource'; 
+                $content = 'Not the owner of this resource';
             }
             if ($repstatus eq 'ok') {
                 print $copiedfile $content;
@@ -852,8 +852,8 @@
             }
         }
         if ($caller eq 'resource') {
-            my $respath =  $Apache::lonnet::perlvar{'lonDocRoot'}.'/res';  
-            my $embed_path = &Apache::lonnet::filelocation($respath,$embed_url); 
+            my $respath =  $Apache::lonnet::perlvar{'lonDocRoot'}.'/res';
+            my $embed_path = &Apache::lonnet::filelocation($respath,$embed_url);
             $embed_content = &Apache::lonnet::getfile($embed_path);
             unless ($embed_content eq -1) {
                 $repstatus = 'ok';
@@ -921,7 +921,7 @@
 
     while (@files) {
 	my ($name, $url, $residx) = @{ shift(@files) };
-        if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) 
+        if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$})
 	     && ($caller eq 'londocs')
 	     && (!&Apache::lonnet::stat_file($url))) {
 	    
@@ -944,7 +944,7 @@
             }
         }
 	if ($url) {
-	    if (!$residx 
+	    if (!$residx
 		|| defined($LONCAPA::map::zombies[$residx])) {
 		$residx = &LONCAPA::map::getresidx($url,$residx);
 		push(@LONCAPA::map::order, $residx);
@@ -953,7 +953,7 @@
 	    if ($url=~m{^http://} || $url=~m{^https://}) { $ext = 'true'; }
 	    $url  = &LONCAPA::map::qtunescape($url);
 	    $name = &LONCAPA::map::qtunescape($name);
-	    $LONCAPA::map::resources[$residx] = 
+	    $LONCAPA::map::resources[$residx] =
 		join(':', ($name, $url, $ext, 'normal', 'res'));
 	}
     }
@@ -984,9 +984,9 @@
 	my $url='/adm/coursedocs?folderpath='.
 	    &escape($folderpath);
 	    my $name=&unescape($foldername);
-# randompick number, hidden, encrypted, random order, is appended with ":"s to the foldername	
+# randompick number, hidden, encrypted, random order, is appended with ":"s to the foldername
  	    $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//;
-	    if ($1 ne '') { 
+	    if ($1 ne '') {
                $randompick=$1;
             } else {
                $randompick=-1;
@@ -1125,7 +1125,7 @@
 	    foreach my $key (@changes) {
 		$wholeentry.=':'.$docslog{$id}{'logentry'}{$key};
 	    }
-	    if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; }         
+	    if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; }
 	}
         my $count = 0;
         my $time =
@@ -1338,7 +1338,7 @@
 	    $db_name =~ s{_\d*$ }{_$now}x;
 	    my $result=&Apache::lonnet::put($db_name,\%contents,
 					    $coursedom,$coursenum);
-	    $url =~ s{/(\d*)/smppg$ }{/$now/smppg}x; 
+	    $url =~ s{/(\d*)/smppg$ }{/$now/smppg}x;
 	    $title=&mt('Copy of').' '.$title;
 	}
     }
@@ -1352,7 +1352,7 @@
         if ($folder =~ /^supplemental/) {
             $title = $env{'docs.markedcopy_supplemental'};
         } else {
-            (undef,undef,$title) = 
+            (undef,undef,$title) =
                 &parse_supplemental_title($env{'docs.markedcopy_supplemental'});
         }
     } else {
@@ -1376,7 +1376,7 @@
         $url=&LONCAPA::map::qtescape($url);
         if ($newurl eq $url) {
             $unique = 0;
-            last;    
+            last;
         }
     }
     return $unique;
@@ -1430,7 +1430,7 @@
 	&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]);
 	splice(@LONCAPA::map::order, $idx, 1);
 
-    } elsif ($cmd eq 'up' 
+    } elsif ($cmd eq 'up'
 	     && ($idx) && (defined($LONCAPA::map::order[$idx-1]))) {
 	@LONCAPA::map::order[$idx-1,$idx] = @LONCAPA::map::order[$idx,$idx-1];
 
@@ -1497,7 +1497,7 @@
 	}
 	    
 	if ($env{'form.pastemarked'}) {
-            my $paste_res = 
+            my $paste_res =
                 &do_paste_from_buffer($coursenum,$coursedom,$folder);
             if ($paste_res eq 'ok') {
                 ($errtext,$fatal) = &storemap($coursenum,$coursedom,$folder.'.'.$container);
@@ -1660,7 +1660,7 @@
    <input type="hidden" name="phasetwo" value="'.$total_embedded.'" />';
 		    $phase_status = 'phasetwo';
 
-                    $$upload_output .= 
+                    $$upload_output .=
 			'This file contains embedded multimedia objects, which need to be uploaded to LON-CAPA.<br />'.
 			&Apache::loncommon::ask_for_embedded_content(
                             '/adm/coursedocs',$state,$allfiles,$codebase);
@@ -1763,12 +1763,12 @@
 	my $incindex=$index+1;
 	my $selectbox='';
 	if (($folder!~/^supplemental/) &&
-	    ($#LONCAPA::map::order>0) && 
+	    ($#LONCAPA::map::order>0) &&
 	    ((split(/\:/,
-	     $LONCAPA::map::resources[$LONCAPA::map::order[0]]))[1] 
-	     ne '') && 
+	     $LONCAPA::map::resources[$LONCAPA::map::order[0]]))[1]
+	     ne '') &&
 	    ((split(/\:/,
-	     $LONCAPA::map::resources[$LONCAPA::map::order[1]]))[1] 
+	     $LONCAPA::map::resources[$LONCAPA::map::order[1]]))[1]
 	     ne '')) {
 	    $selectbox=
 		'<input type="hidden" name="currentpos" value="'.$incindex.'" />'.
@@ -1805,8 +1805,8 @@
 		}
 	    }
 	}
-        if ($url=~/^\/res\/lib\/templates\//) { 
-           $nocopy=1; 
+        if ($url=~/^\/res\/lib\/templates\//) {
+           $nocopy=1;
            $nocut=1;
         }
         my $copylink='&nbsp;';
@@ -1921,7 +1921,7 @@
 	    } elsif ($url!~/\.(sequence|page)$/) {
 		$url='/adm/coursedocs/showdoc'.$url;
 	    }
-	} elsif ($url=~m|^/ext/|) { 
+	} elsif ($url=~m|^/ext/|) {
 	    $url='/adm/wrapper'.$url;
 	    $external = 1;
 	}
@@ -1942,7 +1942,7 @@
 	my $foldername=&escape($foldertitle);
 	my $folderpath=$env{'form.folderpath'};
 	if ($folderpath) { $folderpath.='&' };
-# Append randompick number, hidden, and encrypted with ":" to foldername, 
+# Append randompick number, hidden, and encrypted with ":" to foldername,
 # so it gets transferred between levels
 	$folderpath.=$folderarg.'&'.$foldername.':'.(&LONCAPA::map::getparameter($orderidx,
                                               'parameter_randompick'))[0]
@@ -1962,7 +1962,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);
@@ -2253,7 +2253,7 @@
     if ($haschanged) {
         if (&Apache::lonnet::put('resourceversions',\%newsetversions,
 			  $env{'course.'.$env{'request.course.id'}.'.domain'},
-			  $env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') {		
+			  $env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') {
 	    $r->print('<h1>'.&mt('Your Version Settings have been Saved').'</h1>');
 	} else {
 	    $r->print('<h1><span class="LC_error">'.&mt('An Error Occured while Attempting to Save your Version Settings').'</span></h1>');
@@ -2405,7 +2405,7 @@
                 $entries_per_col = $num_entries/4 + 1;
             }
             my $entries_count = 0;
-            $r->print('<td valign="top"><font size="-2">'); 
+            $r->print('<td valign="top"><font size="-2">');
             my $cols_output = 1;
             for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
 		my $url=$root.'.'.$prevvers.'.'.$extension;
@@ -2484,7 +2484,7 @@
 	$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">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">'.
@@ -2616,15 +2616,15 @@
        $showdoc='/'.$1;
     }
     unless ($showdoc) { # got called from remote
-       if (($env{'form.folder'}=~/^(?:group|default)_/) || 
+       if (($env{'form.folder'}=~/^(?:group|default)_/) ||
           ($env{'form.folder'} =~ m:^\d+/(pages|sequences)/:)) {
            $forcestandard = 1;
        } 
        $forcesupplement=($env{'form.folder'}=~/^supplemental_/);
 
-       if ($allowed) { 
+       if ($allowed) {
          &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']);
-         $script=&Apache::lonratedt::editscript('simple'); 
+         $script=&Apache::lonratedt::editscript('simple');
        }
     } else { # got called in sequence from course
        $allowed=0;
@@ -2634,7 +2634,7 @@
     my $coursenum=$env{'course.'.$env{'request.course.id'}.'.num'};
     my $coursedom=$env{'course.'.$env{'request.course.id'}.'.domain'};
 
-# get personal data 
+# get personal data
     my $uname=$env{'user.name'};
     my $udom=$env{'user.domain'};
     my $plainname=&escape(&Apache::loncommon::plainname($uname,$udom));
@@ -2660,7 +2660,7 @@
   if ($allowed) {
       if (($env{'form.uploaddoc.filename'}) &&
 	  ($env{'form.cmd'}=~/^upload_(\w+)/)) {
-# Process file upload - phase one - upload and parse primary file.  
+# Process file upload - phase one - upload and parse primary file.
 	  undef($hadchanges);
           $upload_result = &process_file_upload(\$upload_output,$coursenum,
 						$coursedom,\%allfiles,
@@ -2685,8 +2685,8 @@
                   $newname{$i} = &process_secondary_uploads(\$upload_output,$coursedom,$coursenum,'embedded_item_',$i,$residx);
                   $origname{$i} = &unescape($env{'form.embedded_orig_'.$i});
                   if (exists($env{'form.embedded_codebase_'.$i})) {
-                      $javacodebase =  &unescape($env{'form.embedded_codebase_'.$i});  
-                      $origname{$i} =~ s#^\Q$javacodebase\E/##; 
+                      $javacodebase =  &unescape($env{'form.embedded_codebase_'.$i});
+                      $origname{$i} =~ s#^\Q$javacodebase\E/##;
                   }
                   my @attributes = ();
                   if ($env{'form.embedded_attrib_'.$i} =~ /:/) {
@@ -2723,7 +2723,7 @@
                           }
                           if ($content =~ m#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#) {
                           } 
-                          $content =~ s#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#$1$newname{$item}$2#gi; 
+                          $content =~ s#($attrib_regexp\s*=\s*['"]?)\Q$origname{$item}\E(['"]?)#$1$newname{$item}$2#gi;
                       }
                       if (exists($codebase{$item})) {
                           $content =~ s/(codebase\s*=\s*["']?)\Q$codebase{$item}\E(["']?)/$1.$2/i; #' stupid emacs
@@ -2735,7 +2735,7 @@
                   my $docudom=$env{'course.'.$env{'request.course.id'}.'.domain'};
                   my $url = &Apache::lonnet::store_edited_file($primary_url,$content,$docudom,$docuname,\$saveresult);
               } else {
-                  &Apache::lonnet::logthis('retrieval of uploaded file - '.$primary_url.' - for editing, failed: '.$getstatus); 
+                  &Apache::lonnet::logthis('retrieval of uploaded file - '.$primary_url.' - for editing, failed: '.$getstatus);
               }
           }
       }
@@ -2833,7 +2833,7 @@
 	<p>
 	$lt{'copm'}<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','')"
 	value="$lt{'selm'}" /> <input type="submit" name="loadmap" value="$lt{'load'}" />
 	$help{'Load_Map'}</span>
@@ -2990,13 +2990,13 @@
 
 	my $newdropboxform=(<<NDBFORM);
 	<form action="/adm/coursedocs" method="post" name="newdropbox">
-	$uploadtag      
+	$uploadtag
 	<input type="hidden" name="importdetail" value="" />
-	<span class="LC_nobreak">          
+	<span class="LC_nobreak">
 	<input name="newdropbox" type="button" value="$lt{'drbx'}"
 	onClick="javascript:makedropbox();" />
-	</span>         
-	</form> 
+	</span>
+	</form>
 NDBFORM
 
 	my $newexuploadform=(<<NEXUFORM);
@@ -3348,7 +3348,7 @@
     my ($tid,$content,$navigation,$varcd,$namehash_ref,$orderhash_ref) = @_;
     my %namehash = %{$namehash_ref};
     my %orderhash = %{$orderhash_ref};
-    my $form;    
+    my $form;
 
     $form = '<div class="LC_ContentBoxSpecial"><h4 class="LC_hcell">'.&mt($varcd).'</h4>';
     $form .= '<ul id="'.$navigation.$tid.'" class="LC_TabContent">';
@@ -3431,7 +3431,7 @@
 
 function makeexamupload() {
    var title=prompt('$lt{"p_mxu"}');
-   if (title) { 
+   if (title) {
     this.document.forms.newexamupload.importdetail.value=
 	escape(title)+'=/res/lib/templates/examupload.problem';
     this.document.forms.newexamupload.submit();
@@ -3440,7 +3440,7 @@
 
 function makesmppage() {
    var title=prompt('$lt{"p_msp"}');
-   if (title) { 
+   if (title) {
     this.document.forms.newsmppg.importdetail.value=
 	escape(title)+'=/adm/$udom/$uname/$now/smppg';
     this.document.forms.newsmppg.submit();
@@ -3449,7 +3449,7 @@
 
 function makesmpproblem() {
    var title=prompt('$lt{"p_msb"}');
-   if (title) { 
+   if (title) {
     this.document.forms.newsmpproblem.importdetail.value=
 	escape(title)+'=/res/lib/templates/simpleproblem.problem';
     this.document.forms.newsmpproblem.submit();
@@ -3458,7 +3458,7 @@
 
 function makedropbox() {
    var title=prompt('$lt{"p_mdb"}');
-   if (title) { 
+   if (title) {
     this.document.forms.newdropbox.importdetail.value=
         escape(title)+'=/res/lib/templates/DropBox.problem';
     this.document.forms.newdropbox.submit();
@@ -3624,7 +3624,7 @@
 
 =item mapread()
 
-Mapread read maps into LONCAPA::map:: global arrays 
+Mapread read maps into LONCAPA::map:: global arrays
 @order and @resources, determines status
 sets @order - pointer to resources in right order
 sets @resources - array with the resources with correct idx

--bisitz1234782541--