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

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 13 Apr 2004 15:41:19 -0000


matthew		Tue Apr 13 11:41:19 2004 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  ununlessing.
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.64 loncom/interface/lonmeta.pm:1.65
--- loncom/interface/lonmeta.pm:1.64	Tue Apr 13 10:42:24 2004
+++ loncom/interface/lonmeta.pm	Tue Apr 13 11:41:19 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.64 2004/04/13 14:42:24 matthew Exp $
+# $Id: lonmeta.pm,v 1.65 2004/04/13 15:41:19 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -104,7 +104,9 @@
 # Pretty display
 sub evalgraph {
     my $value=shift;
-    unless ($value) { return ''; }
+    if (! $value) { 
+        return '';
+    }
     my $val=int($value*10.+0.5)-10;
     my $output='<table border=0 cellpadding=0 cellspacing=0><tr>';
     if ($val>=20) {
@@ -126,7 +128,9 @@
 
 sub diffgraph {
     my $value=shift;
-    unless ($value) { return ''; }
+    if (! $value) { 
+        return '';
+    }
     my $val=int(40.0*$value+0.5);
     my @colors=('#FF9933','#EEAA33','#DDBB33','#CCCC33',
                 '#BBDD33','#CCCC33','#DDBB33','#EEAA33');
@@ -200,7 +204,9 @@
 
 sub prettyprint {
     my ($type,$value)=@_;
-    unless (defined($value)) { return '&nbsp;'; }
+    if (! defined($value)) { 
+        return '&nbsp;'; 
+    }
     # Title
     if ($type eq 'title') {
 	return '<font size="+1" face="arial">'.$value.'</font>';
@@ -239,7 +245,9 @@
 	return &Apache::loncommon::gradeleveldescription($value);
     }
     # Only for advance users below
-    unless ($ENV{'user.adv'}) { return '<i>- '.&mt('not displayed').' -</i>' };
+    if (! $ENV{'user.adv'}) { 
+        return '<i>- '.&mt('not displayed').' -</i>';
+    }
     # File
     if (($type eq 'customdistributionfile') ||
 	($type eq 'obsoletereplacement') ||
@@ -284,7 +292,9 @@
 
 sub selectbox {
     my ($name,$value,$functionref,@idlist)=@_;
-    unless (defined($functionref)) { $functionref=\&direct; }
+    if (! defined($functionref)) {
+        $functionref=\&direct;
+    }
     my $selout='<select name="'.$name.'">';
     foreach (@idlist) {
         $selout.='<option value=\''.$_.'\'';
@@ -298,9 +308,15 @@
 
 sub relatedfield {
     my ($show,$relatedsearchflag,$relatedsep,$fieldname,$relatedvalue)=@_;
-    unless ($relatedsearchflag) { return ''; }
-    unless (defined($relatedsep)) { $relatedsep=' '; }
-    unless ($show) { return $relatedsep.'&nbsp;'; }
+    if (! $relatedsearchflag) { 
+        return '';
+    }
+    if (! defined($relatedsep)) {
+        $relatedsep=' ';
+    }
+    if (! $show) {
+        return $relatedsep.'&nbsp;';
+    }
     return $relatedsep.'<input type="checkbox" name="'.$fieldname.'_related"'.
 	($relatedvalue?' checked="1"':'').' />';
 }
@@ -551,10 +567,12 @@
                       '</h3>');
             foreach (sort keys %content) {
                 my $name=$_;
-                unless ($name=~/\.display$/) {
+                if ($name!~/\.display$/) {
                     my $display=&Apache::lonnet::metadata($uri,
                                                           $name.'.display');
-                    unless ($display) { $display=$name; };
+                    if (! $display) { 
+                        $display=$name;
+                    };
                     my $otherinfo='';
                     foreach ('name','part','type','default') {
                         if (defined(&Apache::lonnet::metadata($uri,
@@ -643,7 +661,7 @@
                     $Apache::lonpublisher::metadatafields{$_}=
                         $ENV{'form.new_'.$_};
                 }
-                unless ($Apache::lonpublisher::metadatafields{'copyright'}) {
+                if (! $Apache::lonpublisher::metadatafields{'copyright'}) {
                     $Apache::lonpublisher::metadatafields{'copyright'}=
                         'default';
                 }
@@ -654,13 +672,13 @@
             }
             if ($ENV{'form.store'}) {
                 my $mfh;
-                unless ($mfh=Apache::File->new('>'.$fn)) {
+                if (!  ($mfh=Apache::File->new('>'.$fn))) {
                     $r->print('<p><font color=red>'.
                               &mt('Could not write metadata').', '.
                               &mt('FAIL').'</font>');
                 } else {
                     foreach (sort keys %Apache::lonpublisher::metadatafields) {
-                        unless ($_=~/\./) {
+                        if ($_!~/\./) {
                             my $unikey=$_;
                             $unikey=~/^([A-Za-z]+)/;
                             my $tag=$1;