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

ehlerst ehlerst@source.lon-capa.org
Wed, 17 Dec 2008 09:44:04 -0000


ehlerst		Wed Dec 17 09:44:04 2008 EDT

  Modified files:              
    /loncom/interface	lonsimplepage.pm 
  Log:
  added the "Delete Photo" button.
  
  
Index: loncom/interface/lonsimplepage.pm
diff -u loncom/interface/lonsimplepage.pm:1.61 loncom/interface/lonsimplepage.pm:1.62
--- loncom/interface/lonsimplepage.pm:1.61	Wed Dec 17 00:44:53 2008
+++ loncom/interface/lonsimplepage.pm	Wed Dec 17 09:44:04 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Page Editor
 #
-# $Id: lonsimplepage.pm,v 1.61 2008/12/17 00:44:53 ehlerst Exp $
+# $Id: lonsimplepage.pm,v 1.62 2008/12/17 09:44:04 ehlerst Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -253,6 +253,13 @@
 	$syllabus{'uploaded.lastmodified'}=time;
 	&Apache::lonnet::put($db_name,\%syllabus,$dom,$crs);
     }
+    if ($allowed && $env{'form.delupl'}) {
+        if ($syllabus{'uploaded.photourl'}) {
+            &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
+            delete($syllabus{'uploaded.photourl'});
+            &Apache::lonnet::del('simplepage',['uploaded.photourl']);
+        }
+    }
     if (($allowed) && ($env{'form.storesyl'})) {
 	foreach my $syl_field (keys(%syllabusfields)) {
 	    my $field=$env{'form.'.$syl_field};
@@ -290,7 +297,8 @@
 		      '<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" />');
+                      '<input type="hidden" name="forceedit" value="edit" />
+		      <form method="post"><input type="submit" name="delupl" value="'.&mt('Delete Photo').'" /> </form>');
 	}
 	&Apache::lontemplate::start_columnSection($r);
 	if($allowed){