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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 21 Mar 2006 18:37:25 -0000


This is a MIME encoded message

--albertel1142966245
Content-Type: text/plain

albertel		Tue Mar 21 13:37:25 2006 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  - start_page
  -elimintate Continue links in favor of the auto-generated ones
  
  
  
--albertel1142966245
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20060321133725.txt"

Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.186 loncom/interface/lonfeedback.pm:1.187
--- loncom/interface/lonfeedback.pm:1.186	Sun Mar 19 16:43:21 2006
+++ loncom/interface/lonfeedback.pm	Tue Mar 21 13:37:25 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.186 2006/03/19 21:43:21 albertel Exp $
+# $Id: lonfeedback.pm,v 1.187 2006/03/21 18:37:25 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1253,7 +1253,7 @@
         }
     }
     if ($type eq 'allversions') {
-        $discussion.=('</ul></body></html>');
+        $discussion.='</ul>';
         return $discussion;
     } else {
         return;
@@ -1613,11 +1613,8 @@
     my $function = &Apache::loncommon::get_users_function();
     my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg',
                                                     $env{'user.domain'});
-    my $bodytag=&Apache::loncommon::bodytag('Discussion options',
-                                          '','');
 
     my %lt = &Apache::lonlocal::texthash(
-        'dido' => 'Discussion display options',
         'pref' => 'Display Preference',
         'curr' => 'Current setting ',
         'actn' => 'Action',
@@ -1675,13 +1672,9 @@
         $currtogg = $lt{'toggon'};
         $disctogg = 'toggon';
     }
-    my $html=&Apache::lonxml::xmlbegin();
-    $r->print(<<END);
-$html
-<head>
-<title>$lt{'dido'}</title>
-<meta http-equiv="pragma" content="no-cache" />
-<script>
+
+    my $js = <<END;
+<script type="text/javascript">
 function discdispChk(caller) {
     var disctogg = '$toggchg'
     if (caller == 0) {
@@ -1748,9 +1741,15 @@
     }
 }
 </script>
-</head>
-$bodytag
-<form name="modifydisp" method="post" action="/adm/feedback">
+END
+
+
+    my $start_page =
+	&Apache::loncommon::start_page('Discussion display options',$js);
+    my $end_page =
+	&Apache::loncommon::end_page();
+    $r->print(<<END);
+<form name="modifydisp" method="POSTx" action="/adm/feedback">
 $lt{'sdpf'}<br/> $lt{'prca'}  <ol><li>$lt{'whpo'}</li><li>$lt{'unwh'}</li><li>$lt{'wipa'}</li></ol>
 <br />
 <table border="0" cellpadding="0" cellspacing="0">
@@ -1800,8 +1799,7 @@
 <br />
 <br />
 </form>
-</body>
-</html>
+$end_page
 END
     return;
 }
@@ -1838,10 +1836,7 @@
     my $function = &Apache::loncommon::get_users_function();
     my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg',
                                                     $env{'user.domain'});
-    my $bodytag=&Apache::loncommon::bodytag('Discussion options',
-                                          '','');
     my %lt = &Apache::lonlocal::texthash(
-        'diso' => 'Discussion sorting and filtering options',
         'diop' => 'Display Options',
         'curr' => 'Current setting ',
         'actn' => 'Action',
@@ -1858,12 +1853,8 @@
     my %role_types = ();
     my %status_types = ();
     &sort_filter_names(\%sort_types,\%role_types,\%status_types);
-    my $html=&Apache::lonxml::xmlbegin();
-    $r->print(<<END);
-$html
-<head>
-<title>$lt{'diso'}</title>
-<meta http-equiv="pragma" content="no-cache" />
+
+    my $js = <<END;
 <script type="text/javascript">
 function verifyFilter() {
     var rolenum = 0
@@ -1888,9 +1879,16 @@
     document.modifyshown.submit();
 }
 </script>
-</head>
-$bodytag
-<form name="modifyshown" method="post" action="/adm/feedback">
+END
+
+    my $start_page=
+	&Apache::loncommon::start_page('Discussion options',$js);
+    my $end_page=
+	&Apache::loncommon::end_page();
+
+    $r->print(<<END);
+$start_page
+<form name="modifyshown" method="POST" action="/adm/feedback">
 <b>$lt{'diso'}</b><br/> $lt{'prca'}
 <br /><br />
 <table border="0">
@@ -1955,8 +1953,7 @@
 <br />
 <br />
 </form>
-</body>
-</html>
+$end_page
 END
 }
 
@@ -2129,7 +2126,6 @@
   $r->print(<<ENDFAILREDIR);
 <img align="right" src="$logo" />
 <b>Sorry, no recipients  ...</b>
-<br /><a href="$feedurl">Continue</a>
 ENDFAILREDIR
   $r->print(&Apache::loncommon::end_page());
 }
@@ -2228,7 +2224,6 @@
 $sectag
 $userpicktag
 </form>
-<br /><a href="$feedurl">Continue</a>
 $end_page
 ENDREDIR
 }
@@ -2236,19 +2231,19 @@
 sub no_redirect_back {
   my ($r,$feedurl) = @_;
   my $nofeed=&mt('Sorry, no feedback possible on this resource  ...');
-  my $continue=&mt('Continue');
-  my $html=&Apache::lonxml::xmlbegin();
-  $r->print (<<ENDNOREDIR);
-$html
-<head>
-<title>Feedback not sent</title>
-<meta http-equiv="pragma" content="no-cache" />
-ENDNOREDIR
-
-  if ($feedurl!~/^\/adm\/feedback/) { 
-      $r->print('<meta HTTP-EQUIV="Refresh" CONTENT="2; url='.
-		&Apache::lonenc::check_encrypt($feedurl).'">');
+ 
+  my %body_options = ('only_body'   => 1,
+		      'add_entries' =>  'onLoad=\'if (window.name!="loncapaclient") { self.window.close(); }\'');
+
+  if ($feedurl !~ m{^/adm/feedback}) { 
+      $body_options{'rediect'} = [2,$feedurl];
   }
+  my $start_page=
+      &Apache::loncommon::start_page('Feedback not sent',undef,
+				     \%body_options);
+				      
+  my $end_page = &Apache::loncommon::end_page();
+
   $feedurl=&Apache::lonenc::check_encrypt($feedurl);
   my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
   $r->print (<<ENDNOREDIRTWO);
@@ -2256,9 +2251,8 @@
 <body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { self.window.close(); }'>
 <img align="right" src="$logo" />
 <b>$nofeed</b>
-<br /><a href="$feedurl">$continue</a>
-</body>
-</html>
+<br />
+$end_page
 ENDNOREDIRTWO
 }
 
@@ -2607,7 +2601,7 @@
 # ----------------------------------------------------------- Preview function
 
 sub show_preview {
-    my $r=shift;
+    my ($r) = @_;
     &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;
     my $message=&clear_out_html($env{'form.comment'});
@@ -2617,11 +2611,15 @@
     my $subject=&clear_out_html($env{'form.subject'});
     $subject=~s/\n/\<br \/\>/g;
     $subject=&Apache::lontexconvert::msgtexconverted($subject);
-    my $html=&Apache::lonxml::xmlbegin();
-    $r->print($html.'<head>'.
-	      '</head><body><table border="2"><tr><td>'.
+    my $start_page=
+	&Apache::loncommon::start_page('Preview',undef,
+				       {'only_body'   => 1,});
+					
+    my $end_page = &Apache::loncommon::end_page();
+
+    $r->print($start_page.'<table border="2"><tr><td>'.
 	      '<b>Subject:</b> '.$subject.'<br /><br />'.
-	      $message.'</td></tr></table></body></html>');
+	      $message.'</td></tr></table>'.$end_page);
 }
 
 
@@ -2669,8 +2667,7 @@
     $subject=&Apache::lontexconvert::msgtexconverted($subject);
     my $timestamp=$env{'form.timestamp'};
     my $numoldver=$env{'form.numoldver'};
-    my $bodytag=&Apache::loncommon::bodytag('Discussion Post Attachments',
-                                          '','');
+
     my $msg = '';
     my %attachments = ();
     my %currattach = ();
@@ -2678,19 +2675,21 @@
         &extract_attachments($attachmenturls,$idx,$numoldver,\$msg,\%attachments,\%currattach,$currdelold);
     }
     &Apache::lonenc::check_encrypt(\$symb);
-    my $html=&Apache::lonxml::xmlbegin();
-    $r->print(<<END);
-$html
-<head>
-<title>Managing Attachments</title>
-<script>
+    my $js = <<END;
+<script type="text/javascript">
  function setAction () {
    document.modattachments.action = document.modattachments.origpage.value;
    document.modattachments.submit();
  }
 </script> 
-</head>
-$bodytag
+END
+
+    my $start_page = 
+	&Apache::loncommon::start_page('Discussion Post Attachments',$js);
+    my $end_page = 
+	&Apache::loncommon::end_page();
+				       
+    $r->print(<<END);
 <form name="modattachments" method="post" enctype="multipart/form-data" action="/adm/feedback?attach=$symb">
  <table border="2">
   <tr>
@@ -2743,8 +2742,7 @@
     $r->print(<<END);
  <input type="button" name="rtntoedit" value="Store Changes" onClick="setAction()"/>
 </form>
-</body>
-</html>
+$end_page
 END
     return;
 }
@@ -3015,17 +3013,11 @@
   }
   if ($env{'form.allversions'}) {
       &Apache::loncommon::content_type($r,'text/html');
+      &Apache::loncommon::no_cache($r);
       $r->send_http_header;
-      my $html=&Apache::lonxml::xmlbegin();
-      my $bodytag=&Apache::loncommon::bodytag('Discussion Post Versions');
-      $r->print(<<END);
-$html
-<head>
-<title>Post Versions</title>
-<meta http-equiv="pragma" content="no-cache" />
-</head>
-$bodytag
-END
+
+      $r->print(&Apache::loncommon::start_page('Discussion Post Versions'));
+
       my $crs='/'.$env{'request.course.id'};
       if ($env{'request.course.sec'}) {
           $crs.='_'.$env{'request.course.sec'};
@@ -3046,6 +3038,7 @@
                            $env{'course.'.$env{'request.course.id'}.'.num'});
           $r->print(&get_post_contents(\%contrib,$idx,$seeid,'allversions',\%messages,\%subjects,\%allattachments,\%attachmsgs,\%imsfiles,\$screenname,\$plainname));
       }
+      $r->print(&Apache::loncommon::end_page());
       return OK;
   }
   if ($env{'form.posterlist'}) {
@@ -3127,7 +3120,7 @@
 $textline
 <form name="reldt" action="$feedurl" target="loncapaclient">
 </form>
-<br /><a href="$feedurl">Continue</a>
+<br />
 $end_page
 ENDREDIR
       return OK;

--albertel1142966245--