[LON-CAPA-cvs] cvs: loncom /interface lonbulletin.pm lonsimplepage.pm lonsyllabus.pm

www lon-capa-cvs@mail.lon-capa.org
Fri, 13 Feb 2004 15:01:29 -0000


This is a MIME encoded message

--www1076684489
Content-Type: text/plain

www		Fri Feb 13 10:01:29 2004 EDT

  Modified files:              
    /loncom/interface	lonsyllabus.pm lonbulletin.pm lonsimplepage.pm 
  Log:
  Bug #1730: only come up in Edit-mode if nothing stored yet, otherwise student
  view with Edit link.
  
  
--www1076684489
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20040213100129.txt"

Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.26 loncom/interface/lonsyllabus.pm:1.27
--- loncom/interface/lonsyllabus.pm:1.26	Wed Jan 14 23:46:36 2004
+++ loncom/interface/lonsyllabus.pm	Fri Feb 13 10:01:29 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Syllabus
 #
-# $Id: lonsyllabus.pm,v 1.26 2004/01/15 04:46:36 albertel Exp $
+# $Id: lonsyllabus.pm,v 1.27 2004/02/13 15:01:29 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -76,7 +76,7 @@
 
 # ------------------------------------------------------------ Get query string
     &Apache::loncommon::get_unprocessed_cgi
-                        ($ENV{'QUERY_STRING'},['forcestudent','register']);
+                        ($ENV{'QUERY_STRING'},['forcestudent','register','forceedit']);
 # ----------------------------------------------------- Force menu registration
     my $addentries='';
     if ($ENV{'form.register'}) {
@@ -87,6 +87,8 @@
 # --------------------------------------------------------------- Force Student
     my $forcestudent='';
     if ($ENV{'form.forcestudent'}) { $forcestudent='student'; };
+    my $forceedit='';
+    if ($ENV{'form.forceedit'}) { $forceedit='edit'; }
        
 # ------------------------------------- There is such a course, get environment
     my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum);
@@ -114,6 +116,7 @@
 # ---------------------------------------------------------- Load syllabus info
     my %syllabus=&Apache::lonnet::dump('syllabus',$cdom,$cnum);
     my $allowed=0;
+    my $privileged=0;
 
 # This handler might be called anonymously ...
 # ----------------------------------------------------- Only if not public call
@@ -121,6 +124,10 @@
 # does this user have privileges to post, etc?
        if ($ENV{'request.course.id'}) {
           $allowed=&Apache::lonnet::allowed('mdc',$ENV{'request.course.id'});
+	  $privileged=$allowed;
+	  if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) {
+	      $forcestudent='student';
+	  }
           if ($forcestudent) { $allowed=0; }
        }
        if ($allowed) {
@@ -129,9 +136,13 @@
 		    .' <tt>http://'.
 		    $Apache::lonnet::hostname{$homeserver}.$r->uri.'</tt>'.
                &Apache::loncommon::help_open_topic('Syllabus_ExtLink').'</p>'.
-	  '<p><a href="'.$r->uri.'?forcestudent=1"><font size="+1">Show Public View</font></a>'.
+	  '<p><a href="'.$r->uri.'?forcestudent=1"><font size="+1">'.
+&mt('Show Public View').'</font></a>'.
           &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').
           '</p>');
+      } elsif ($privileged) {
+	  $r->print('<p><a href="'.$r->uri.'?forceedit=1"><font size="+1">'.
+&mt('Edit').'</font></a>');
       }
        if (($allowed) && ($ENV{'form.storesyl'})) {
 	   foreach (keys %syllabusfields) {
@@ -185,7 +196,8 @@
 		 $lastmod.'</td><td>'.&mt('by').' '.$who.
 		 '</td></tr></table><p>');
        if ($allowed) {
-	   $r->print('<form method="post">');
+	   $r->print('<form method="post">'.
+		     '<input type="hidden" name="forceedit" value="edit" />');
        }
        foreach (sort keys %syllabusfields) {
           if (($syllabus{$_}) || ($allowed)) {
@@ -210,7 +222,7 @@
                   if ($allowed) {
                      $r->print('<h3>'.$syllabusfields{$_}.
           &Apache::loncommon::help_open_topic('Syllabus_URLs').'</h3>'.
-	  '<p><a href="'.$r->uri.'?forcestudent=1"><font size="+1">Show Public View</font></a>'.
+	  '<p><a href="'.$r->uri.'?forcestudent=1"><font size="+1">'.&mt('Show Public View').'</font></a>'.
  &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'</p>');
 		 } else {
                   $r->print($message);
Index: loncom/interface/lonbulletin.pm
diff -u loncom/interface/lonbulletin.pm:1.18 loncom/interface/lonbulletin.pm:1.19
--- loncom/interface/lonbulletin.pm:1.18	Mon Nov 24 11:00:45 2003
+++ loncom/interface/lonbulletin.pm	Fri Feb 13 10:01:29 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Bulletin Board Handler
 #
-# $Id: lonbulletin.pm,v 1.18 2003/11/24 16:00:45 www Exp $
+# $Id: lonbulletin.pm,v 1.19 2004/02/13 15:01:29 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -73,7 +73,7 @@
 
 # ------------------------------------------------------------ Get Query String
     &Apache::loncommon::get_unprocessed_cgi
-                         ($ENV{'QUERY_STRING'},['forcestudent','register']);
+                ($ENV{'QUERY_STRING'},['forcestudent','forceedit','register']);
 # ----------------------------------------------------- Force menu registration
     my $addentries='';
     if ($ENV{'form.register'}) {
@@ -83,7 +83,10 @@
     }
 # --------------------------------------------------------------- Force Student
     my $forcestudent='';
-    if ($ENV{'form.forcestudent'}) { $forcestudent='student'; };
+    if ($ENV{'form.forcestudent'}) { $forcestudent='student'; }
+
+    my $forceedit='';
+    if ($ENV{'form.forceedit'}) { $forceedit='edit'; }
 
     my %syllabus=&Apache::lonnet::dump('bulletinpage_'.$marker,$dom,$crs);
        
@@ -95,14 +98,23 @@
 
     my $allowed=&Apache::lonnet::allowed('mdc',$ENV{'request.course.id'});
 
+    my $privileged=$allowed;
+    if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) {
+ 	$forcestudent='student';
+    }
+
        if ($forcestudent) { $allowed=0; }
  
        if ($allowed) {
           $r->print(
 	  '<p>'.
-&Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'<br /><a href="'.$r->uri.'?forcestudent=1"><font size="+1">Show Student View</font></a>'.
+&Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'<br /><a href="'.$r->uri.'?forcestudent=1"><font size="+1">'.&mt('Show Student View').'</font></a>'.
  &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'</p>');
-      }
+      }  elsif ($privileged) {
+	  $r->print('<a href="'.$r->uri.'?forceedit=edit"><font size="+1">'
+		    .&mt('Edit').'</font></a>');
+      } 
+
       if (($ENV{'form.uploaddoc.filename'}) &&
           ($ENV{'form.storeupl'}) && ($allowed)) {
  	  if ($ENV{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) {
@@ -133,9 +145,10 @@
        if ($allowed) {
            $r->print(
 	 '<form method="post" enctype="multipart/form-data">'.
-         '<h3>Upload a Photo</h3>'.
+ 	 '<input type="hidden" name="forceedit" value="edit" />'.
+         '<h3>'.&mt('Upload a Photo').'</h3>'.
          '<input type="file" name="uploaddoc" size="50">'.
-         '<input type="submit" name="storeupl" value="Upload">'.
+         '<input type="submit" name="storeupl" value="'.&mt('Upload').'">'.
 	 '</form><form method="post">');
        }
        foreach (sort keys %syllabusfields) {
@@ -154,15 +167,15 @@
                  if ($allowed) {
                 $r->print('<br /><textarea cols="80" rows="10" name="'.$_.'">'.
 			   $syllabus{$_}.
-           '</textarea><input type="submit" name="storesyl" value="Store" />');
+           '</textarea><input type="submit" name="storesyl" value="'.&mt('Store').'" />');
 	        }
 	    } else {
 		$r->print('<h1>'.$message.'</h1>');
                 if ($allowed) {
                  $r->print(
-                '<br />Topic<br /><textarea cols="80" rows="2" name="'.$_.'">'.
+                '<br />'.&mt('Topic').'<br /><textarea cols="80" rows="2" name="'.$_.'">'.
 			   $syllabus{$_}.
-           '</textarea><input type="submit" name="storesyl" value="Store" />');
+           '</textarea><input type="submit" name="storesyl" value="'.&mt('Store').'" />');
                 }
             }
 	  }
@@ -172,7 +185,7 @@
        }
        $r->print('</p>');
     } else {
-       $r->print('<p>No page information provided.</p>');
+       $r->print('<p>'.&mt('No page information provided.').'</p>');
     }
     $r->print(&Apache::lonfeedback::list_discussion
 	      ('board','OPEN','bulletin___'.$marker.'___'.
Index: loncom/interface/lonsimplepage.pm
diff -u loncom/interface/lonsimplepage.pm:1.15 loncom/interface/lonsimplepage.pm:1.16
--- loncom/interface/lonsimplepage.pm:1.15	Tue Feb 10 19:22:21 2004
+++ loncom/interface/lonsimplepage.pm	Fri Feb 13 10:01:29 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Page Editor
 #
-# $Id: lonsimplepage.pm,v 1.15 2004/02/11 00:22:21 albertel Exp $
+# $Id: lonsimplepage.pm,v 1.16 2004/02/13 15:01:29 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -84,7 +84,7 @@
 
 # ------------------------------------------------------------ Get query string
     &Apache::loncommon::get_unprocessed_cgi
-                        ($ENV{'QUERY_STRING'},['forcestudent','register']);
+                        ($ENV{'QUERY_STRING'},['forcestudent','forceedit','register']);
 # ----------------------------------------------------- Force menu registration
     my $addentries='';
     if ($ENV{'form.register'}) {
@@ -95,6 +95,8 @@
 # --------------------------------------------------------------- Force Student
     my $forcestudent='';
     if ($ENV{'form.forcestudent'} ||$ENV{'form.grade_target'} eq 'tex' ) { $forcestudent='student'; };
+     my $forceedit='';
+     if ($ENV{'form.forceedit'}) { $forceedit='edit'; }
 
 
     my %syllabus=&Apache::lonnet::dump('smppage_'.$marker,$dom,$crs);
@@ -107,15 +109,21 @@
     }
 
     my $allowed=&Apache::lonnet::allowed('mdc',$ENV{'request.course.id'});
+    my $privileged=$allowed;
+    if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) {
+	$forcestudent='student';
+    }
 
        if ($forcestudent) { $allowed=0; }
  
-       if ($allowed) {
-	   if ($ENV{'form.grade_target'} ne 'tex') {
-	       $r->print('<p>'.
-                   &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'<br /><a href="'.$r->uri.'?forcestudent=1"><font size="+1">Show Student View</font></a>'.
+    if ($ENV{'form.grade_target'} ne 'tex') {
+	if ($allowed) {
+	    $r->print('<p>'.
+                   &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'<br /><a href="'.$r->uri.'?forcestudent=1"><font size="+1">'.&mt('Show Student View').'</font></a>'.
                    &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'</p>');
-	   } 
+	   } elsif ($privileged) {
+	       $r->print('<a href="'.$r->uri.'?forceedit=edit"><font size="+1">'.&mt('Edit').'</font></a>');
+           } 
        }
       if (($ENV{'form.uploaddoc.filename'}) &&
           ($ENV{'form.storeupl'}) && ($allowed)) {
@@ -149,6 +157,7 @@
        if ($allowed && ($ENV{'form.grade_target'} ne 'tex')) {
            $r->print(
 	 '<form method="post" enctype="multipart/form-data">'.
+	 '<input type="hidden" name="forceedit" value="edit" />'.
          '<h3>Upload a Photo</h3>'.
          '<input type="file" name="uploaddoc" size="50">'.
          '<input type="submit" name="storeupl" value="Upload">'.

--www1076684489--