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

amueller amueller@source.lon-capa.org
Tue, 08 Dec 2009 12:20:50 -0000


amueller		Tue Dec  8 12:20:50 2009 EDT

  Modified files:              
    /loncom/interface	lonsimplepage.pm 
  Log:
  -changed the order of upload a photo and title
  -title and image in student view can be displayed independent from each other
  
  
Index: loncom/interface/lonsimplepage.pm
diff -u loncom/interface/lonsimplepage.pm:1.87 loncom/interface/lonsimplepage.pm:1.88
--- loncom/interface/lonsimplepage.pm:1.87	Mon Dec  7 19:47:56 2009
+++ loncom/interface/lonsimplepage.pm	Tue Dec  8 12:20:49 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Page Editor
 #
-# $Id: lonsimplepage.pm,v 1.87 2009/12/07 19:47:56 amueller Exp $
+# $Id: lonsimplepage.pm,v 1.88 2009/12/08 12:20:49 amueller Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -299,6 +299,31 @@
     if ((($syllabus{'uploaded.lastmodified'}) &&
          (($group ne '' && ($group_home_view || $group_edit_perm ||
            $group_view_perm)) || ($group eq ''))) || ($allowed)) {
+        #Print the title
+        my $titletext=$syllabus{'aaa_title'};
+        if ($target ne 'tex') {
+            if ($allowed) {
+                $r->print('<p>');
+            }
+            $r->print('<h2>'.$titletext.'</h2>');
+        } else {
+            my $safeinit;
+            $r->print(&Apache::lonxml::xmlparse($r,'tex','<h1>'.$titletext.'</h1>'));
+        }
+        if ($allowed) {
+            if ($env{'form.grade_target'} ne 'tex') {
+                #editbox for title
+                $r->print('<form method="post" action="" enctype="multipart/form-data">');
+                &Apache::lontemplate::print_template($r, &mt('Title'), $titletext, $allowed, 'LC_Box');
+                &Apache::lontemplate::print_editbox_template($r,$syllabus{'aaa_title'},'aaa_title');
+                $r->print('</p>');
+            } else {
+                my $safeinit;
+                $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{'aaa_title'},$safeinit));
+            }
+        }
+
+        #print the image
         my $image;
         if ($syllabus{'uploaded.photourl'}) {
             &Apache::lonnet::allowuploaded('/adm/smppg',
@@ -313,12 +338,10 @@
 
         if ($allowed) {
             $r->print(
-                  '<form method="post" action="" 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" action="">'.
                   '<input type="hidden" name="forceedit" value="edit" />');
 #            if ($syllabus{'uploaded.photourl'}) {
 #                $r->print('<input type="submit" name="delupl"'
@@ -328,6 +351,7 @@
         if ($allowed) {
             $r->print($image.'<div class="LC_footer_clear">&nbsp;</div>');
         }
+        if (!$allowed) {$r->print($image); }
 
         foreach my $field (sort(keys(%syllabusfields))) {
             if (($syllabus{$field}) || ($allowed) ||
@@ -350,26 +374,7 @@
                                     %groupinfo);
                     $r->print('<br />');
                 } elsif ($field eq 'aaa_title') {
-                    if ($target ne 'tex') {
-                        if ($allowed) {
-                            $r->print('<p>');
-                        }
-                        $r->print('<h2>'.$message.'</h2>');
-                    } else {
-                        my $safeinit;
-                        $r->print(&Apache::lonxml::xmlparse($r,'tex','<h1>'.$message.'</h1>'));
-                    }
-                    if ($allowed) {
-                        if ($env{'form.grade_target'} ne 'tex') {
-                            &Apache::lontemplate::print_template($r, &mt('Title'), $message, $allowed, 'LC_Box');
-                            &Apache::lontemplate::print_editbox_template($r,$syllabus{$field},$field);
-                            $r->print('</p>');
-                        } else {
-                            my $safeinit;
-                            $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{$field},$safeinit));
-                        }
-                    }
-                    if (!$allowed) {$r->print($image); }
+                    next;
                 } else {
                     if ($target ne 'tex') {
                         if ($allowed) {