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

bisitz bisitz at source.lon-capa.org
Fri May 3 13:53:02 EDT 2013


bisitz		Fri May  3 17:53:02 2013 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  - Portfolio - Improved navigation, layout, and feedback (Part 2 of rev. 1.241):
  Apply improvements to: overwrite a file
  (warning style, confirm_success, actionbox, explicit done message, consistent back link)
  - XHTML (form closure)
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.244 loncom/interface/portfolio.pm:1.245
--- loncom/interface/portfolio.pm:1.244	Tue Apr 30 14:27:51 2013
+++ loncom/interface/portfolio.pm	Fri May  3 17:53:02 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # portfolio browser
 #
-# $Id: portfolio.pm,v 1.244 2013/04/30 14:27:51 raeburn Exp $
+# $Id: portfolio.pm,v 1.245 2013/05/03 17:53:02 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2101,21 +2101,24 @@
 }
 // ]]>
 </script>
+<p>
 $msg
-<br /><div class="LC_warning"><form method="post" action="$url" name="existingfile" onsubmit="return confirmOverwrite();">
-<span class="LC_nobreak">$lt{'over'}
+</p>
+<form method="post" action="$url" name="existingfile" onsubmit="return confirmOverwrite();">
+<p class="LC_nobreak">$lt{'over'}
 <label><input type="radio" name="overwrite" value="1" />
 $lt{'yes'}</label> 
-<label><input type="radio" name="overwrite" value="0" checked="checked" />$lt{'no'}</label></span>
+<label><input type="radio" name="overwrite" value="0" checked="checked" />$lt{'no'}</label></p>
+<p>
 <input type="hidden" name="action" value="cancel_overwrite" />
 <input type="hidden" name="filename" value="$showfname" />
 <input type="hidden" name="timestamp" value="$timestamp" />
 $hidden
 $parserflag
 $group_elem
-<br /><br />
 <input type="submit" name="process" value="$lt{'cont'}" />
-</form></div>
+</p>
+</form>
 END
         } else {
         $r->print(
@@ -2213,10 +2216,13 @@
         }
     }
     if ($fname eq '') {
-        my $msg = &mt('Invalid filename: [_1]; the name of the uploaded file did not contain any letters, '.
+        $r->print(
+            &Apache::loncommon::confirmwrapper(
+                &Apache::lonhtmlcommon::confirm_success(
+                    &mt('Invalid filename: [_1]; the name of the uploaded file did not contain any letters, '.
                       'so after eliminating special characters there was nothing left.',
-                      '<span class="LC_filename">'.$env{'form.filename'}.'</span>');
-        $r->print($msg.&done(undef,$url));
+                      '<span class="LC_filename">'.$env{'form.filename'}.'</span>'),1)));
+        $r->print(&done(undef,$url));
         return;
     }
     $env{'form.'.$formname.'.filename'} = $fname;
@@ -2227,9 +2233,11 @@
                                         \%allfiles,\%codebase,undef,undef,undef,
                                         undef,undef,undef,\$mimetype);
     if ($result !~ m|^/uploaded/|) {
-        $r->print('<p class="LC_error">'.&mt('An error occurred ([_1]) while trying to overwrite [_2].'
-                  ,$result,&display_file(undef,$fname)).'</p>');
-        $r->print(&after_overwrite(&mt('Back'),$url));
+        $r->print(
+            &Apache::loncommon::confirmwrapper(
+                &Apache::lonhtmlcommon::confirm_success(
+                    &mt('An error occurred ([_1]) while trying to overwrite [_2].'
+                       ,$result,&display_file(undef,$fname)),1)));
     } else {
         if ($mode eq 'parse') {
             if ($mimetype eq 'text/html') {
@@ -2237,18 +2245,21 @@
                     &print_dependency_form($r,$url,\%allfiles,\%codebase,$result);
                     return;
                 } else {
-                    $r->print('<p>'.&mt('Overwriting completed.').'<br />'.
-                              &mt('No embedded items identified.').'</p>');
+                    $r->print(
+                        &Apache::loncommon::confirmwrapper(
+                            &Apache::lonhtmlcommon::confirm_success(
+                                &mt('Overwriting completed.'))
+                           .'<br />'.&mt('No embedded items identified.')));
                 }
             }
+        } else {
+            $r->print(
+                &Apache::loncommon::confirmwrapper(
+                    &Apache::lonhtmlcommon::confirm_success(
+                        &mt('Overwriting completed.'))));
         }
-        $r->print(&after_overwrite(undef,$url));
     }
-    return;
-}
 
-sub after_overwrite {
-    my ($text,$url) = @_;
     my $group_elem;
     if (defined($env{'form.group'})) {
         $group_elem = '<input type="hidden" name="group" value="'.$env{'form.group'}.'" />';
@@ -2256,18 +2267,18 @@
             $group_elem .= '<input type="hidden" name="ref" value="'.$env{'form.ref'}.'" />'."\n";
         }
     }
-    if ($text eq '') {
-        $text = &mt('Done');
-    }
     my $hidden = &hidden_elems();
-    return <<END;
-
-<h3><a href="javascript:document.overwritedone.submit();">$text</a></h3>
-<form name="overwritedone" method="post" action="$url" />
-$hidden
-$group_elem
-</form>
-END
+    $r->print(
+        &Apache::lonhtmlcommon::actionbox(
+            ['<a href="javascript:document.overwritedone.submit();">'
+            .&mt('Return to directory')
+            .'</a>'])
+       .'<form name="overwritedone" method="post" action="'.$url.'">'
+       .$hidden
+       .$group_elem
+       .'</form>'
+    );
+    return;
 }
 
 sub lock_info {




More information about the LON-CAPA-cvs mailing list