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

wenzelju wenzelju@source.lon-capa.org
Wed, 27 Jan 2010 13:08:01 -0000


This is a MIME encoded message

--wenzelju1264597681
Content-Type: text/plain

wenzelju		Wed Jan 27 13:08:01 2010 EDT

  Modified files:              
    /loncom/interface	courseprefs.pm lonconfigsettings.pm 
                     	loncoursegroups.pm lonwhatsnew.pm 
  Log:
  Inserted confirm-success-boxes due to consistent screen layout.
  
  
--wenzelju1264597681
Content-Type: text/plain
Content-Disposition: attachment; filename="wenzelju-20100127130801.txt"

Index: loncom/interface/courseprefs.pm
diff -u loncom/interface/courseprefs.pm:1.21 loncom/interface/courseprefs.pm:1.22
--- loncom/interface/courseprefs.pm:1.21	Mon Jan 18 20:14:25 2010
+++ loncom/interface/courseprefs.pm	Wed Jan 27 13:08:01 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set configuration settings for a course
 #
-# $Id: courseprefs.pm,v 1.21 2010/01/18 20:14:25 raeburn Exp $
+# $Id: courseprefs.pm,v 1.22 2010/01/27 13:08:01 wenzelju Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -862,16 +862,16 @@
             $output .= '<h3>'.&mt($prefs->{$item}{'text'}).'</h3>';
             if (ref($changes->{$item}) eq 'HASH') {
                 if (keys(%{$changes->{$item}}) > 0) {
-                    $output .= &mt('Changes made:').'<ul>';
+                    $output .= &mt('Changes made:').'<ul style="list-style:none;">';
                     if ($item eq 'other') {
                         foreach my $key (sort(keys(%{$changes->{$item}}))) {
                             $storehash{$key} = $changes->{$item}{$key};
                             if ($changes->{$item}{$key} eq '') {
                                 push(@delkeys,$key);
-                                $output .= '<li>'.&mt('Deleted setting for [_1]','<i>'.$key.'</i>').'</li>';
+                                $output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Deleted setting for [_1]','<i>'.$key.'</i>')).'</li>';
                             } else {
-                                $output .= '<li>'.&mt('[_1] set to [_2]','<i>'.$key.'</i>',
-                                           "'$storehash{$key}'").'</li>';
+                                $output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('[_1] set to [_2]','<i>'.$key.'</i>',
+                                           "'$storehash{$key}'")).'</li>';
                             }
                         }
                     } else {
@@ -903,7 +903,7 @@
                                                 "'<b>".$newname."</b>'").'</li>';
                                     }
                                     if ($msg ne '') {
-                                        $output .= '<li>'.&mt($displayname).'<ul>'.$msg.'</ul></li>';
+                                        $output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt($displayname)).'<ul class="LC_success">'.$msg.'</ul></li>';
                                     }
                                 } else {
                                     next if (!exists($changes->{$item}{$key}));
@@ -978,12 +978,12 @@
                                     }
                                     if ($changes->{$item}{$key} eq '') {
                                         push(@delkeys,$key);
-                                        $output .= '<li>'.&mt('Deleted setting for [_1]',
-                                                   '<i>'.$displayname.'</i>').'</li>';
+                                        $output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('Deleted setting for [_1]',
+                                                   '<i>'.$displayname.'</i>')).'</li>';
                                     } else {
-                                        $output .= '<li>'.&mt('[_1] set to [_2]',
+                                        $output .= '<li>'.&Apache::lonhtmlcommon::confirm_success(&mt('[_1] set to [_2]',
                                                    '<i>'.$displayname.'</i>',
-                                                   "'<b>$displayval</b>'");
+                                                   "'<b>$displayval</b>'"));
                                         if ($key eq 'url') {
                                             my $bkuptime=time;
                                             $output .= ('&nbsp;'x2).&mt('(Previous URL backed up)').': '.
Index: loncom/interface/lonconfigsettings.pm
diff -u loncom/interface/lonconfigsettings.pm:1.10 loncom/interface/lonconfigsettings.pm:1.11
--- loncom/interface/lonconfigsettings.pm:1.10	Fri Jan  8 00:52:06 2010
+++ loncom/interface/lonconfigsettings.pm	Wed Jan 27 13:08:01 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: lonconfigsettings.pm,v 1.10 2010/01/08 00:52:06 faziophi Exp $
+# $Id: lonconfigsettings.pm,v 1.11 2010/01/27 13:08:01 wenzelju Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -212,13 +212,14 @@
     }
     if ($context eq 'course') {
         if ($numchanged) {
-            $r->print(&Apache::courseprefs::store_changes($dom,$confname,$prefs_order,\@actions,
-                                                          $prefs,$values,\%changes,$crstype));
+            my $message = &Apache::courseprefs::store_changes($dom,$confname,$prefs_order,\@actions,
+                                                          $prefs,$values,\%changes,$crstype);
+            $r->print(&Apache::loncommon::confirmwrapper($message));
         } else {
             if ($crstype eq 'Community') {
-                $r->print(&mt("No changes made to community configuration."));
+                $r->print(&Apache::loncommon::confirmwrapper(&mt("No changes made to community configuration.")));
             } else {
-                $r->print(&mt("No changes made to course configuration."));
+                $r->print(&Apache::loncommon::confirmwrapper(&mt("No changes made to course configuration.")));
             }
         }
         if (keys(%disallowed) > 0) {
Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.108 loncom/interface/loncoursegroups.pm:1.109
--- loncom/interface/loncoursegroups.pm:1.108	Tue Jan 26 02:40:32 2010
+++ loncom/interface/loncoursegroups.pm	Wed Jan 27 13:08:01 2010
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursegroups.pm,v 1.108 2010/01/26 02:40:32 raeburn Exp $
+# $Id: loncoursegroups.pm,v 1.109 2010/01/27 13:08:01 wenzelju Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1210,9 +1210,9 @@
         if ($result eq 'ok') {
             my $outcome = &modify_folders($cdom,$cnum,$groupname,$crstype);
             if ($outcome eq '') {
-                $r->print('<div class="LC_success">'
-                         .&mt('Group successfully deleted.')
-                         .'</div>');
+                my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Group successfully deleted.'));
+                $message = &Apache::loncommon::confirmwrapper($message);
+                $r->print($message);
             } else {
                 $r->print('<div class="LC_error">');
                 if ($crstype eq 'Community') {
@@ -1223,9 +1223,9 @@
                 $r->print('</div>');
             }
         } else {
-            $r->print('<div class="LC_error">'
-                     .&mt('Group deletion failed.')
-                     .'</div>');
+            my $msg = &Apache::lonhtmlcommon::confirm_success(&mt('Group deletion failed.'),1);
+            $msg = &Apache::loncommon::confirmwrapper($msg);
+            $r->print($msg);
         }
     }
     return;
@@ -1437,9 +1437,9 @@
         }
         my $outcome = &reenable_folder($cdom,$cnum,$groupname,$description,$crstype);
         if ($outcome eq '') {
-            $r->print('<div class="LC_success">'
-                     .&mt('Group successfully re-enabled.')
-                     .'</div>');
+            my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Group successfully re-enabled.'));
+            $message = &Apache::loncommon::confirmwrapper($message);
+            $r->print($message);
         } else {
             $r->print('<div class="LC_error">');
             if ($crstype eq 'Community') {
@@ -1450,9 +1450,9 @@
             $r->print('</div>');
         }
     } else {
-        $r->print('<div class="LC_error">'
-                 .&mt('Re-enabling group failed.')
-                 .'</div>');
+        my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Re-enabling group failed.'),1);
+        $message = &Apache::loncommon::confirmwrapper($message);
+        $r->print($message);
     }
     return;
 }
@@ -3243,15 +3243,15 @@
                                            $description,$tools,\%groupinfo,
                                            $gpterm,$ucgpterm,$crstype);
             if ($result eq 'ok') {
-                $r->print('<div class="LC_success">'
-                         .&mt($ucgpterm.' [_1] was created.','<i>'.$groupname.'</i>')
-                         .'</div>');
+                my $msg = &Apache::lonhtmlcommon::confirm_success(&mt($ucgpterm.' [_1] was created.','<i>'.$groupname.'</i>'));
+                $msg = &Apache::loncommon::confirmwrapper($msg);
+                $r->print($msg);
             } else {
-                $r->print('<div class="LC_error">'
-                         .&mt('A problem occurred when creating folders for the new '.$gpterm.' [_1]:'
-                             ,'<i>'.$groupname.'</i>')
-                         .'<br />'.$result
-                         .'</div>');
+                my $msg = &Apache::lonhtmlcommon::confirm_success(&mt('A problem occurred when creating folders for the new '.$gpterm.' [_1]:'
+                                                                     ,'<i>'.$groupname.'</i>')
+                                                                     .'<br />'.$result,1);
+                $msg = &Apache::loncommon::confirmwrapper($msg);
+                $r->print($msg);
             }
         } elsif ($action eq 'modify') {
             my (@oldtools,@newtools); 
@@ -3322,9 +3322,9 @@
                     $r->print('<div class="LC_error">'.$error.'</div>');
                 }
             }
-            $r->print('<div class="LC_success">'
-                     .&mt($ucgpterm.' [_1] was updated.','<i>'.$groupname.'</i>')
-                     .'</div>');
+            my $message = &Apache::lonhtmlcommon::confirm_success(&mt($ucgpterm.' [_1] was updated.','<i>'.$groupname.'</i>'));
+            $message = &Apache::loncommon::confirmwrapper($message);
+            $r->print($message);
         }
     } else {
         my %actiontype = (
@@ -3502,12 +3502,13 @@
     my $roster_result = &Apache::lonnet::modify_coursegroup_membership($cdom,
                                                        $cnum,\%usersettings);
     if ($num_ok) {
-        foreach my $type (sort(keys(%added))) { 
-            $r->print(&mt('The following users were successfully [_1]',$type));
+        my $msgall ='';
+        foreach my $type (sort(keys(%added))) {
+            my $message = &mt('The following users were successfully [_1]',$type); 
             if (!($type eq 'deleted' || $type eq 'expired')) {   
-                $r->print(&mt(' with the following privileges'));
+                $message .= &mt(' with the following privileges');
             }
-            $r->print(':<br />');
+            $message .= ':<br/>';
             foreach my $user (@{$added{$type}}) {
                 my $privlist = '';
                 if (!($type eq 'deleted' ||  $type eq 'expired')) {
@@ -3523,10 +3524,14 @@
                     }
                     $privlist =~ s/, $//;
                 }
-                $r->print($$userdata{$user}[$$idx{fullname}].'&nbsp;-&nbsp;'.$user.$privlist.'<br />');
+                $message .= $$userdata{$user}[$$idx{fullname}].'&nbsp;-&nbsp;'.$user.$privlist.'<br />';
             }
-            $r->print('<br />');
+            $message .= '<br/>';
+            $message = &Apache::lonhtmlcommon::confirm_success($message);
+            $msgall .= $message;
         }
+        $msgall = &Apache::loncommon::confirmwrapper($msgall);
+        $r->print($msgall);
     }
     if ($num_fail) {
         foreach my $type (sort(keys(%failed))) {
@@ -3539,13 +3544,15 @@
         }
         $r->print('<br />');
     }
-    if (@unchanged > 0) {
-        $r->print(&mt('No change occurred for the following users:').'<br />');
-        foreach my $user (sort(@unchanged)) {
-            $r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />');
-        }
-        $r->print('<br />');
-    }
+# Is that really needed?
+#
+#    if (@unchanged > 0) {
+#        $r->print(&mt('No change occurred for the following users:').'<br />');
+#        foreach my $user (sort(@unchanged)) {
+#            $r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />');
+#        }
+#        $r->print('<br />');
+#    }
     if ($roster_result eq 'ok') {
         $r->print('<div class="LC_success">'
                  .&mt($ucgpterm.' membership list updated.')
Index: loncom/interface/lonwhatsnew.pm
diff -u loncom/interface/lonwhatsnew.pm:1.98 loncom/interface/lonwhatsnew.pm:1.99
--- loncom/interface/lonwhatsnew.pm:1.98	Tue Nov 24 02:43:45 2009
+++ loncom/interface/lonwhatsnew.pm	Wed Jan 27 13:08:01 2010
@@ -1,5 +1,5 @@
 #
-# $Id: lonwhatsnew.pm,v 1.98 2009/11/24 02:43:45 raeburn Exp $
+# $Id: lonwhatsnew.pm,v 1.99 2010/01/27 13:08:01 wenzelju Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1130,7 +1130,7 @@
 
 sub process_update {
     my ($uname,$udom,$threshold_titles) = @_;
-    my $setoutput = '<b>'.&mt('Changes to threshold(s) for problem tracking:').'</b><br />';
+    my $setoutput = '<b>'.&mt('Changes to threshold(s) for problem tracking:').'</b><br/><br />';
     foreach (keys %env) {
         next if ($_!~/^form\.(.+)\_setparmval$/);
         my $name  = $1;
@@ -1141,17 +1141,17 @@
            
             my ($shortname) = ($name =~ /^\Q$env{'request.course.id'}\E:threshold_(.+)$/);
             if ($put_result eq 'ok') {
-                $setoutput.=&mt('Set threshold for [_1] to [_2]',
+                $setoutput.= &Apache::lonhtmlcommon::confirm_success(&mt('Set threshold for [_1] to [_2]',
 				'<b>'.$$threshold_titles{$shortname}.'</b>',
-				'<b>'.$value.'</b>').'<br />';
+				'<b>'.$value.'</b>').'<br />');
 	    } else {
-                $setoutput.=&mt('Unable to set threshold for [_1] to [_2] due to [_3].',
+                $setoutput.= &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set threshold for [_1] to [_2] due to [_3].',
 				'<b>'.$name.'</b>','<b>'.$value.'</b>',
-				'<tt>'.$put_result.'</tt>').'<br />';
+				'<tt>'.$put_result.'</tt>').'<br />',1);
             }
         }
     }
-    return $setoutput;
+    return &Apache::loncommon::confirmwrapper($setoutput);
 }
 
 sub getnormalmail {
@@ -1841,19 +1841,19 @@
                                              \%interval_settings,$udom,$uname);
         if ($outcome eq 'ok') {
             if (ref($interval_titles->{$context}) eq 'HASH') {
-                $result = &mt('New filter setting: [_1].','<b>'. 
-                              $interval_titles->{$context}->{$env{'form.interval'}}.'</b>').'<br />';
+                $result = &Apache::lonhtmlcommon::confirm_success(&mt('New filter setting: [_1].','<b>'. 
+                              $interval_titles->{$context}->{$env{'form.interval'}}.'</b>').'<br />');
             }
         } else {
 	    my $lctype = lc(&Apache::loncommon::course_type());
             &Apache::lonnet::logthis('Error saving whatsnew '.$context.' interval setting'.
                 ' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
-            $result = &mt('Unable to set interval to [_1] due to [_2].',
+            $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set interval to [_1] due to [_2].',
                          '<b>'.$interval_titles->{$context}->{$env{'form.interval'}}.'</b>',
-                         '<tt>'.$outcome.'</tt>.<br />');
+                         '<tt>'.$outcome.'</tt>'),1);
         }
     }
-    return $result;
+    return &Apache::loncommon::confirmwrapper($result);
 }
 
 sub store_discussion_setting {
@@ -1865,20 +1865,20 @@
         my $outcome = &Apache::lonnet::put('nohist_whatsnew',
                                              \%discussion_settings,$udom,$uname);
         if ($outcome eq 'ok') {
-            $result = &mt('Count unread posts in discussions display set to [_1]',
-                  '<b>'.&mt($env{'form.countunread'}).'</b>').'<br />';
+            $result = &Apache::lonhtmlcommon::confirm_success(&mt('Count unread posts in discussions display set to [_1]',
+                  '<b>'.&mt($env{'form.countunread'}).'</b>').'<br />');
                                                                                   
         } else {
 	    my $lctype = lc(&Apache::loncommon::course_type());
             &Apache::lonnet::logthis('Error saving whatsnew countunread setting'.
                 ' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
-            $result = &mt('Unable to set "number unread posts display" to [_1]'.
+            $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set "number unread posts display" to [_1]'.
                           ' due to [_2].',
                          '<b>'.&mt($env{'form.countunread'}).'</b>',
-                         '<tt>'.$outcome.'</tt>.<br />');
+                         '<tt>'.$outcome.'</tt>'),1);
         }
     }
-    return $result;
+    return &Apache::loncommon::confirmwrapper($result);
 }
 
 sub store_courseinit_setting {
@@ -1903,30 +1903,29 @@
                                            \%courseinit_settings,$udom,$uname);
             if ($outcome eq 'ok') {
                 if ($page_control eq 'global preferences') {
-                    $result = &mt("Page displayed after role selection in $lctype now set by [_1]user's global preferences[_2].",'<b>','</b>');
+                    $result = &Apache::lonhtmlcommon::confirm_success(&mt("Page displayed after role selection in $lctype now set by [_1]user's global preferences[_2].",'<b>','</b>'));
                 } else {
-                    $result = &mt('Page displayed after role selection in this '.$lctype.' set to [_1].'
-                                 ,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>');
+                    $result = &Apache::lonhtmlcommon::confirm_success(&mt('Page displayed after role selection in this '.$lctype.' set to [_1].'
+                                 ,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>'));
                 }
             } else {
                 &Apache::lonnet::logthis('Error saving whatsnew courseinit '.
                                          'setting: '.$outcome.' for '.$uname.
                                          ':'.$udom.' in '.$lctype.' '.$cid);
                 if ($page_control eq 'global preferences') {
-                    $result = &mt('Unable to set control of page display to [_1]'.
+                    $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set control of page display to [_1]'.
                           ' due to [_2].',
                          '<b>'.$page_control.'</b>',
-                         '<tt>'.$outcome.'</tt>.<br />');
+                         '<tt>'.$outcome.'</tt>'),1);
                 } else {
-                    $result = &mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].'
+                    $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].'
                                  ,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>'
-                                 ,'<tt>'.$outcome.'</tt>')
-                             .'<br />';
+                                 ,'<tt>'.$outcome.'</tt>'),1);
                 }
             }
         }
     }
-    return $result;
+    return &Apache::loncommon::confirmwrapper($result);
 }
 
 sub start_box {

--wenzelju1264597681--