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

raeburn raeburn at source.lon-capa.org
Wed Jun 18 12:34:39 EDT 2014


raeburn		Wed Jun 18 16:34:39 2014 EDT

  Modified files:              
    /loncom/interface	loncoursegroups.pm 
  Log:
  - Use complete phrases to facilitate translation.
  - 'syllabus' may not be used as a group name
  - before displaying message containing invalid group name, convert characters 
    in proposed name which could be mark-up to entities.
  
  
Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.125 loncom/interface/loncoursegroups.pm:1.126
--- loncom/interface/loncoursegroups.pm:1.125	Fri Feb 28 19:20:06 2014
+++ loncom/interface/loncoursegroups.pm	Wed Jun 18 16:34:39 2014
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursegroups.pm,v 1.125 2014/02/28 19:20:06 bisitz Exp $
+# $Id: loncoursegroups.pm,v 1.126 2014/06/18 16:34:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4188,43 +4188,40 @@
     }
     my %lt = &Apache::lonlocal::texthash (
                       igna => "Invalid $gpterm name",
-                      tgne => "The $gpterm name entered ",
                       grna => "$ucgpterm names and section names used in a ".
                                "$crstype must be unique.",
-                      isno => "is not a valid name.",
                       gnmo => "$ucgpterm names may only contain letters, ". 
                               "numbers or underscores.",
-                      cnnb => "can not be used as it is the name of ",
-                      inth => " in this $crstype", 
-                      thgr => "- does not correspond to the name of an ".
-                              "existing $gpterm",    
     );
 
-    my $exitmsg = '<span class="LC_error">'.$lt{'igna'}.'</span><br /><br />'.
-	$lt{'tgne'}.' "'.$groupname.'" ';
-    my $dupmsg = $lt{'grna'};
-    my $earlyout;
+    my $exitmsg = '<span class="LC_error">'.$lt{'igna'}.'</span><br /><br />';
+    my $nameshown = &Apache::loncommon::cleanup_html($groupname);
     if (($groupname eq '') || ($groupname =~ /\W/)) {
-        $earlyout = $exitmsg.$lt{'isno'}.'<br />'.$lt{'gnmo'};
-        return $earlyout;
+        return $exitmsg.
+               &mt("The $gpterm name entered '[_1]' is not a valid name.",$nameshown).
+               '<br />'.$lt{'gnmo'};
+    } elsif ($groupname eq 'syllabus') {
+        return $exitmsg.
+               &mt("The $gpterm name entered '[_1]' is reserved for use by LON-CAPA.",$nameshown);
     }
     if (exists($sectioncount{$groupname})) {
-	return $exitmsg.$lt{'cnnb'}.&mt('a section').$lt{'inth'}.
-	    '<br />'.$lt{'grna'};
+	return  $exitmsg.
+                &mt("The $gpterm name entered '[_1]' can not be used as it is the name of a section in this $crstype.",$nameshown).
+	        '<br />'.$lt{'grna'};
     }
     if ($action eq 'create') { 
 	if (exists($curr_groups{$groupname})) {
-	    return $exitmsg.$lt{'cnnb'}.&mt("an existing $gpterm").
-	           $lt{'inth'}.'.<br />'.$lt{'grna'};
+	    return $exitmsg.
+                   &mt("The $gpterm name entered '[_1]' can not be used as it is the name of an existing $gpterm in this $crstype.",$nameshown).
+                  '<br />'.$lt{'grna'};
         } elsif (exists($deleted_groups{$groupname})) {
-            return $exitmsg.$lt{'cnnb'}.&mt("a $gpterm which previously existed").
-                   $lt{'inth'}.'.<br />'.$lt{'grna'};
+            return $exitmsg.
+                   &mt("The $gpterm name entered '[_1]' can not be used as it is the name of a $gpterm which previously existed in this $crstype.",$nameshown).
+                   '<br />'.$lt{'grna'};
         }
     } elsif ($action eq 'modify') {
         unless(exists($curr_groups{$groupname})) {
-            $earlyout = &mt("$ucgpterm name:").' '.$groupname.$lt{'thgr'}.
-                        $lt{'inth'};
-            return $earlyout;
+            return &mt("$ucgpterm name: [_1] does not correspond to the name of an existing $gpterm in this $crstype.",$nameshown);
         }
     }
     return;




More information about the LON-CAPA-cvs mailing list