[LON-CAPA-cvs] cvs: loncom /publisher lonpublisher.pm

bisitz lon-capa-cvs-allow@mail.lon-capa.org
Fri, 27 Jun 2008 18:52:36 -0000


This is a MIME encoded message

--bisitz1214592756
Content-Type: text/plain

bisitz		Fri Jun 27 14:52:36 2008 EDT

  Modified files:              
    /loncom/publisher	lonpublisher.pm 
  Log:
  - Wrapped main part of publication screen into standard LON-CAPA pick box table
  - Removed hardcoded styles
  - Moved grade level selections into one row
  - Made some attributes XHTML conform
  
  ToDo:
  - Tidy up upper part of the screen
  - Find better solution for help links
  
  
--bisitz1214592756
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20080627145236.txt"

Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.237 loncom/publisher/lonpublisher.pm:1.238
--- loncom/publisher/lonpublisher.pm:1.237	Wed May 28 18:22:35 2008
+++ loncom/publisher/lonpublisher.pm	Fri Jun 27 14:52:35 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.237 2008/05/28 22:22:35 www Exp $
+# $Id: lonpublisher.pm,v 1.238 2008/06/27 18:52:35 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -331,9 +331,9 @@
     $value=~s/\s+/ /gs;
     $title=&mt($title);
     $env{'form.'.$name}=$value;
-    return "\n<p><font color=\"#800000\" face=\"helvetica\"><b>$title:".
-           "</b></font></p><br />".
-           '<input type="text" name="'.$name.'" size=80 value="'.$value.'" />';
+    return "\n".&Apache::lonhtmlcommon::row_title($title)
+           .'<input type="text" name="'.$name.'" size="80" value="'.$value.'" />'
+           .&Apache::lonhtmlcommon::row_closure();
 }
 
 sub text_with_browse_field {
@@ -343,12 +343,16 @@
     $value=~s/\s+/ /gs;
     $title=&mt($title);
     $env{'form.'.$name}=$value;
-    return "\n<p><font color=\"#800000\" face=\"helvetica\"><b>$title:".
-           "</b></font></p><br />".
-           '<input type="text" name="'.$name.'" size=80 value="'.$value.'" />'.
-	   '<a href="javascript:openbrowser(\'pubform\',\''.$name.'\',\''.$restriction.'\');">'.&mt('Select').'</a>&nbsp;'.
-	   '<a href="javascript:opensearcher(\'pubform\',\''.$name.'\');">'.&mt('Search').'</a>';
-	   
+    return "\n".&Apache::lonhtmlcommon::row_title($title)
+          .'<input type="text" name="'.$name.'" size="80" value="'.$value.'" />'
+          .'<br />'
+	  .'<a href="javascript:openbrowser(\'pubform\',\''.$name.'\',\''.$restriction.'\');">'
+          .&mt('Select')
+          .'</a>&nbsp;'
+	  .'<a href="javascript:opensearcher(\'pubform\',\''.$name.'\');">'
+          .&mt('Search')
+          .'</a>'
+          .&Apache::lonhtmlcommon::row_closure();
 }
 
 sub hiddenfield {
@@ -372,8 +376,8 @@
     } else {
 	$env{'form.'.$name}=$idlist[0];
     }
-    my $selout="\n<p><font color=\"#800000\" face=\"helvetica\"><b>$title:".
-	'</b></font></p><br /><select name="'.$name.'">';
+    my $selout="\n".&Apache::lonhtmlcommon::row_title($title)
+              .'<select name="'.$name.'">';
     foreach (@idlist) {
         $selout.='<option value=\''.$_.'\'';
         if ($_ eq $value) {
@@ -381,7 +385,8 @@
 	}
         else {$selout.='>'.&{$functionref}($_).'</option>';}
     }
-    return $selout.'</select>';
+    $selout.='</select>'.&Apache::lonhtmlcommon::row_closure();
+    return $selout;
 }
 
 sub select_level_form {
@@ -1190,9 +1195,16 @@
 #   $env{'from.'..} so that it can be used by the phase two handler in
 #    batch mode
 
-    my $intr_scrout.=
-	'<form name="pubform" action="/adm/publish" method="post">'.
-	'<p>'.($env{'form.makeobsolete'}?'':'<input type="submit" value="'.&mt('Finalize Publication').'" />').'</p>'.
+    my $intr_scrout.=&Apache::lonhtmlcommon::start_pick_box()
+                    .'<form name="pubform" action="/adm/publish" method="post">';
+    unless ($env{'form.makeobsolete'}) {
+       $intr_scrout.=&Apache::lonhtmlcommon::row_title()
+                    .'<input type="submit" value="'
+                    .&mt('Finalize Publication')
+                    .'" />'
+                    .&Apache::lonhtmlcommon::row_closure()
+    }
+    $intr_scrout.=
 	&hiddenfield('phase','two').
 	&hiddenfield('filename',$env{'form.filename'}).
 	&hiddenfield('allmeta',&escape($allmeta)).
@@ -1204,10 +1216,7 @@
 	&textfield('Subject','subject',$metadatafields{'subject'});
  # --------------------------------------------------- Scan content for keywords
 
-    my $keywords_help = Apache::loncommon::help_open_topic("Publishing_Keywords");
-    my $KEYWORDS=&mt('Keywords');
-    my $CheckAll=&mt('check all');
-    my $UncheckAll=&mt('uncheck all');
+    my $keywords_help = &Apache::loncommon::help_open_topic("Publishing_Keywords");
     my $keywordout=<<"END";
 <script>
 function checkAll(field) {
@@ -1220,14 +1229,13 @@
         field[i].checked = false ;
 }
 </script>
-<p><font color="#800000" face="helvetica"><b>$KEYWORDS:</b></font>
- $keywords_help</b>
-<input type="button" value="$CheckAll" onclick="javascript:checkAll(document.pubform.keywords)" /> 
-<input type="button" value="$UncheckAll" onclick="javascript:uncheckAll(document.pubform.keywords)" /> 
-</p>
-<br />
 END
-    $keywordout.='<table border="2"><tr>';
+    $keywordout.="\n".&Apache::lonhtmlcommon::row_title(&mt('Keywords'))
+                .$keywords_help
+                .'<input type="button" value="'.&mt('check all').'" onclick="javascript:checkAll(document.pubform.keywords)" />'
+                .'<input type="button" value="'.&mt('uncheck all').'" onclick="javascript:uncheckAll(document.pubform.keywords)" />'
+                .'</p><br />'
+                .'<table border="2"><tr>';
     my $colcount=0;
 
     foreach (sort keys %keywords) {
@@ -1250,7 +1258,8 @@
     }
     $env{'form.keywords'}=~s/\,$//;
 
-    $keywordout.='</tr></table>';
+    $keywordout.='</tr></table>'
+                 .&Apache::lonhtmlcommon::row_closure();
 
     $intr_scrout.=$keywordout;
 
@@ -1258,28 +1267,24 @@
 
     $intr_scrout.=&textfield('Notes','notes',$metadatafields{'notes'});
 
-    $intr_scrout.=
-	"\n<p><font color=\"#800000\" face=\"helvetica\"><b>".&mt('Abstract').":".
-	"</b></font></p><br />".
-	'<textarea cols="80" rows="5" name="abstract">'.
-	$metadatafields{'abstract'}.'</textarea></p>';
+    $intr_scrout.="\n".&Apache::lonhtmlcommon::row_title(&mt('Abstract'))
+                 .'<textarea cols="80" rows="5" name="abstract">'
+                 .$metadatafields{'abstract'}
+                 .'</textarea>'
+                 .&Apache::lonhtmlcommon::row_closure();
 
     $source=~/\.(\w+)$/;
 
+    $intr_scrout.="\n".&Apache::lonhtmlcommon::row_title(&mt('Grade Levels'))
+                 .&mt('Lowest Grade Level:').'&nbsp;'
+                 .&select_level_form($metadatafields{'lowestgradelevel'},'lowestgradelevel')
+#                .&Apache::lonhtmlcommon::row_closure();
+#   $intr_scrout.="\n".&Apache::lonhtmlcommon::row_title(&mt('Highest Grade Level'))
+                 .' '.&mt('Highest Grade Level:').'&nbsp;'
+                 .&select_level_form($metadatafields{'highestgradelevel'},'highestgradelevel')
+                 .&Apache::lonhtmlcommon::row_closure();
 
-    $intr_scrout.=
-	"\n<p><font color=\"#800000\" face=\"helvetica\"><b>".
-	&mt('Lowest Grade Level').':'.
-	"</b></font></p><br />".
-	&select_level_form($metadatafields{'lowestgradelevel'},'lowestgradelevel').
-	"\n<p><font color=\"#800000\" face=\"helvetica\"><b>".
-	&mt('Highest Grade Level').':'.
-	"</b></font></p><br />".
-	&select_level_form($metadatafields{'highestgradelevel'},'highestgradelevel').
-	&textfield('Standards','standards',$metadatafields{'standards'});
-
-
-
+    $intr_scrout.=&textfield('Standards','standards',$metadatafields{'standards'});
 
     $intr_scrout.=&hiddenfield('mime',$1);
 
@@ -1338,23 +1343,22 @@
 				     (grep !/^priv$/,(&Apache::loncommon::copyrightids)));
 	}
 	my $copyright_help =
-	    Apache::loncommon::help_open_topic('Publishing_Copyright');
-	$intr_scrout =~ s/Distribution:/'Distribution: ' . $copyright_help/ge;
-	$intr_scrout.=&text_with_browse_field('Custom Distribution File','customdistributionfile',$metadatafields{'customdistributionfile'},'rights').$copyright_help;
+	    &Apache::loncommon::help_open_topic('Publishing_Copyright');
+        my $replace=&mt('Copyright/Distribution:');
+	$intr_scrout =~ s/$replace/$replace.' '.$copyright_help/ge;
+
+	$intr_scrout.=&text_with_browse_field('Custom Distribution File','customdistributionfile',$metadatafields{'customdistributionfile'},'rights');
 	$intr_scrout.=&selectbox('Source Distribution','sourceavail',
 				 $defaultsourceoption,
 				 \&Apache::loncommon::source_copyrightdescription,
 				 (&Apache::loncommon::source_copyrightids));
 #	$intr_scrout.=&text_with_browse_field('Source Custom Distribution File','sourcerights',$metadatafields{'sourcerights'},'rights');
 	my $uctitle=&mt('Obsolete');
-	$intr_scrout.=
-	    "\n<p><label><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".
-	    '</b></font> <input type="checkbox" name="obsolete" ';
-	if ($metadatafields{'obsolete'}) {
-	    $intr_scrout.=' checked="1" ';
-	}
-	$intr_scrout.='/ ></label></p>'.
-	    &text_with_browse_field('Suggested Replacement for Obsolete File',
+        my $obsolete_checked=($metadatafields{'obsolete'})?' checked="1" ':'';
+        $intr_scrout.="\n".&Apache::lonhtmlcommon::row_title($uctitle)
+                     .'<input type="checkbox" name="obsolete" '.$obsolete_checked.'/ >'
+                     .&Apache::lonhtmlcommon::row_closure(1);
+        $intr_scrout.=&text_with_browse_field('Suggested Replacement for Obsolete File',
 				    'obsoletereplacement',
 				    $metadatafields{'obsoletereplacement'});
     } else {
@@ -1385,8 +1389,13 @@
 				    $metadatafields{'obsoletereplacement'});
    }
     if (!$batch) {
-	$scrout.=$intr_scrout.'<p><input type="submit" value="'.
-	    &mt($env{'form.makeobsolete'}?'Make Obsolete':'Finalize Publication').'" /></p></form>';
+	$scrout.=$intr_scrout
+            .&Apache::lonhtmlcommon::row_title()
+            .'<input type="submit" value="'
+	    .&mt($env{'form.makeobsolete'}?'Make Obsolete':'Finalize Publication')
+            .'" />'.&Apache::lonhtmlcommon::row_closure()
+            .'</form>'
+            .&Apache::lonhtmlcommon::end_pick_box();
     }
     return($scrout,0);
 }
@@ -1710,7 +1719,7 @@
         $r->print(
            '<hr /><a href="'.$thisdistarget.'"><font size="+2">'.
            &mt('View Published Version').'</font></a>'.
-           '<p><a href="'.$thissrc.'"><font size=+2>'.
+           '<p><a href="'.$thissrc.'"><font size="+2">'.
 		  &mt('Back to Source').'</font></a></p>'.
            '<p><a href="'.$thissrcdir.
                    '"><font size="+2">'.

--bisitz1214592756--