[LON-CAPA-cvs] cvs: loncom(version_2_10_X) /xml londefdef.pm

raeburn raeburn@source.lon-capa.org
Sat, 25 Dec 2010 00:10:16 -0000


raeburn		Sat Dec 25 00:10:16 2010 EDT

  Modified files:              (Branch: version_2_10_X)
    /loncom/xml	londefdef.pm 
  Log:
  - Backport 1.426, 1.427.
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.415.4.2 loncom/xml/londefdef.pm:1.415.4.3
--- loncom/xml/londefdef.pm:1.415.4.2	Tue Nov  9 21:28:20 2010
+++ loncom/xml/londefdef.pm	Sat Dec 25 00:10:16 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.415.4.2 2010/11/09 21:28:20 raeburn Exp $
+# $Id: londefdef.pm,v 1.415.4.3 2010/12/25 00:10:16 raeburn Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -48,6 +48,7 @@
 use Apache::lonmenu();
 use Apache::lonmeta();
 use Apache::lonlocal;
+use Apache::loncommon();
 use Apache::Constants qw(:common);
 use File::Basename;
 use LONCAPA();
@@ -589,7 +590,7 @@
 sub edit_controls {
     my ($nochgview) = @_;
     my $result .= '
-<form method="post">
+<form method="post" action="">
 <div class="LC_edit_problem_header">';
     unless ($nochgview) {
         $result .= '
@@ -601,7 +602,12 @@
     $result .= '
 <div><input type="submit" name="editmode" accesskey="e" value="'.&mt('Edit').'" />';
     if (($env{'request.course.id'}) && ($env{'form.forceedit'})) {
-        $result .= ('&nbsp;' x 3).'<input type="button" value="'.&mt('Course View').'" onclick="javascript:location.href=currentURL" />';
+        my $viewtext = &mt('Course View');
+        if (&Apache::loncommon::course_type() eq 'Community') {
+            $viewtext = &mt('Community View');
+        }
+        $result .= ('&nbsp;' x 3).'<input type="button" value="'.
+                   $viewtext.'" onclick="javascript:location.href=currentURL" />';
     }
     $result .= '</div>
 </div>
@@ -2733,14 +2739,20 @@
 
 sub cell_config_hash {
     my ($align, $rowspan, $colspan, $width) = @_;
+    if ($rowspan ne '') {
+        $rowspan =~ s/^\s+|\s+$//g;
+    }
+    if ($colspan ne '') {
+        $colspan =~ s/^\s+|\s+$//g;
+    }
     my %config;
     if ($align ne '') {
 	$config{'halign'} = $align;
     }
-    if ($colspan ne "") {
+    if (($colspan =~ /^\d+$/) && ($colspan > 0)) {
 	$config{'colspan'} = $colspan;
     }
-    if ($rowspan ne '') {
+    if (($rowspan =~ /^\d+$/) && ($rowspan > 0)) {
 	$config{'rowspan'} = $rowspan;
     }
     if ($width ne '') {