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

wenzelju wenzelju@source.lon-capa.org
Mon, 07 Dec 2009 14:23:43 -0000


wenzelju		Mon Dec  7 14:23:43 2009 EDT

  Modified files:              
    /loncom/interface	lonbulletin.pm 
  Log:
  - Added functionboxes.
  - Added standard template screen layout.
  - 'Task' now has a heading in Studen view (like 'Web References'). 
  
  
Index: loncom/interface/lonbulletin.pm
diff -u loncom/interface/lonbulletin.pm:1.52 loncom/interface/lonbulletin.pm:1.53
--- loncom/interface/lonbulletin.pm:1.52	Thu Dec  3 02:13:28 2009
+++ loncom/interface/lonbulletin.pm	Mon Dec  7 14:23:43 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Bulletin Board Handler
 #
-# $Id: lonbulletin.pm,v 1.52 2009/12/03 02:13:28 www Exp $
+# $Id: lonbulletin.pm,v 1.53 2009/12/07 14:23:43 wenzelju Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -177,7 +177,6 @@
     if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) {
         $forcestudent='student';
     }
-    if ($target ne 'tex') { $r->print('<table><tr><td>'); }
     if ($forcestudent or $target eq 'tex') { $allowed=0; }
 
     if ($allowed) {
@@ -185,17 +184,24 @@
         if (($group ne '') && ($env{'form.group'} eq $group)) {
             $query_str.='&amp;group='.$group.'&amp;'.$refarg;
         }
-        $r->print(
-            '<p>'.
-            &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes')).'<br /><a href="'.$r->uri.'?'.$query_str.'"><font size="+1">'.&mt('Show Student View').'</font></a>'.
-             &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'</p>');
-    }  elsif ($privileged and $target ne 'tex') {
+        #Function Box for Edit Mode.
+        my $functionbox = &Apache::lonhtmlcommon::start_funclist();
+        $functionbox .=  &Apache::lonhtmlcommon::add_item_funclist(
+                             '<a href="'.$r->uri.'?'.$query_str.'">'.&mt('Show Student View').'</a>'.
+                              &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView'));
+        $functionbox.=&Apache::lonhtmlcommon::end_funclist();
+        $r->print(&Apache::loncommon::head_subbox($functionbox).&Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes')));
+    } elsif ($privileged and $target ne 'tex') {
         my $query_str = 'forceedit=edit';
         if (($group ne '') && ($env{'form.group'} eq $group)) {
             $query_str.='&amp;group='.$group.'&amp;'.$refarg;
         }
-        $r->print('<a href="'.$r->uri.'?'.$query_str.'"><font size="+1">'
-                     .&mt('Edit').'</font></a>');
+        #Functionbox for Student view.
+        my $functionbox = &Apache::lonhtmlcommon::start_funclist();
+        $functionbox .=  &Apache::lonhtmlcommon::add_item_funclist(
+                             "<a href='".$r->uri.'?'.$query_str."'>".&mt('Edit')."</a>");
+        $functionbox.=&Apache::lonhtmlcommon::end_funclist();
+        $r->print(&Apache::loncommon::head_subbox($functionbox));
     }
 
     if (($env{'form.uploaddoc.filename'}) &&
@@ -233,19 +239,22 @@
         if ($syllabus{'uploaded.photourl'}) {
             &Apache::lonnet::allowuploaded('/adm/syllabus',
                                            $syllabus{'uploaded.photourl'});
-            $r->print('<img src="'.$syllabus{'uploaded.photourl'}.
-            '" align="right" />');
         }
+        #Outputbox and Inputbox for Image upload
         if ($allowed) {
+            &Apache::lontemplate::print_template($r, &mt('Upload a Photo'), '<img src="'.$syllabus{'uploaded.photourl'}.'"/>',$allowed,'LC_Box');
             $r->print(
                 '<form method="post" enctype="multipart/form-data">'.
                 '<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="'.&mt('Upload').'" />'.
                 '</form><form method="post">'.
                 '<input type="hidden" name="forceedit" value="edit" />');
         }
+        #Image in Student view.
+        elsif($syllabus{'uploaded.photourl'} && $target ne 'tex'){
+            $r->print('<img src="'.$syllabus{'uploaded.photourl'}.'"/>');
+        }
         foreach my $field (sort(keys(%syllabusfields))) {
             if (($syllabus{$field}) || ($allowed)) {
                 my $message=$syllabus{$field};
@@ -258,35 +267,27 @@
                 }
                 $message=&Apache::lontexconvert::msgtexconverted($message);
                 unless ($field eq 'aaa_title') {
-                    if (($field ne 'bbb_content') || ($allowed)) {
-                        if ($target ne 'tex') {
-                            $r->print('<h3>'.$syllabusfields{$field}.'</h3>');
-                        } else {
-                            $r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\');
-                        }
-                    }
+                    #Outputbox
                     if ($target ne 'tex') {
-                        $r->print('<blockquote>'.
-                                  $message.'</blockquote>');
+                        &Apache::lontemplate::print_template($r, $syllabusfields{$field}, $message,$allowed,'LC_Box');
                     } else {
-                        $r->print(' '.&Apache::lonxml::xmlparse($r,'tex',$message).' ');
+                        $r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\'.&Apache::lonxml::xmlparse($r,'tex',$message));
                     }
+                    #Inputbox
                     if ($allowed) {
-                        $r->print('<br /><textarea cols="80" rows="10" name="'.$field.'">'.
-                                  &HTML::Entities::encode($syllabus{$field},'&"<>').
-                                  '</textarea><input type="submit" name="storesyl" value="'.&mt('Save').'" />');
+                         &Apache::lontemplate::print_editbox_template($r, $syllabus{$field}, $field);
                     }
                 } else {
+                    #Print Topic as Heading
                     if ($target ne 'tex') {
                         $r->print('<h1>'.$message.'</h1>');
                     } else {
                         $r->print('\\\\\textbf{'.&Apache::lonxml::xmlparse($r,'tex',$message).'}\\\\');
                     }
+                    #Outputbox and Inputbox for Topic
                     if ($allowed) {
-                        $r->print(
-                            '<br />'.&mt('Topic').'<br /><textarea cols="80" rows="2" name="'.$field.'">'.
-                            &HTML::Entities::encode($syllabus{$field},'&"<>').
-                            '</textarea><input type="submit" name="storesyl" value="'.&mt('Save').'" />');
+                             &Apache::lontemplate::print_template($r, $syllabusfields{$field}, $message,$allowed,'LC_Box');
+                             &Apache::lontemplate::print_editbox_template($r, $syllabus{$field}, $field);
                     }
                 }
             }
@@ -294,11 +295,10 @@
         if ($allowed) {
             $r->print('</form>');
         }
-        if ($target ne 'tex') {$r->print('</p>');} else {$r->print('\\\\');}
     } else {
         $r->print('<p>'.&mt('No page information provided.').'</p>');
     }
-    if ($target ne 'tex') { $r->print('</td></tr></table>'); }
+    #Lists discussion posts and box for a new discussion post.
     if ($target ne 'tex') {
         $r->print(&Apache::lonfeedback::list_discussion
                       ('board','OPEN','bulletin___'.$marker.'___'.