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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 30 Apr 2004 23:13:52 -0000


albertel		Fri Apr 30 19:13:52 2004 EDT

  Modified files:              
    /loncom/interface	lonaboutme.pm lonbulletin.pm lonsimplepage.pm 
  Log:
  - transitioning the tokenwrapper calls to the new mechainsm
  - add in code to delete old images off the server
  - put relevant images into subdris named after the handler that is creating them
  
  
Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.20 loncom/interface/lonaboutme.pm:1.21
--- loncom/interface/lonaboutme.pm:1.20	Thu Apr 29 13:25:11 2004
+++ loncom/interface/lonaboutme.pm	Fri Apr 30 19:13:52 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # "About Me" Personal Information
 #
-# $Id: lonaboutme.pm,v 1.20 2004/04/29 17:25:11 albertel Exp $
+# $Id: lonaboutme.pm,v 1.21 2004/04/30 23:13:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -108,8 +108,11 @@
       if (($ENV{'form.uploaddoc.filename'}) &&
           ($ENV{'form.storeupl'}) && ($allowed)) {
  	  if ($ENV{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) {
-             $syllabus{'uploaded.photourl'}=
-                 &Apache::lonnet::userfileupload('uploaddoc');
+	      if ($syllabus{'uploaded.photourl'}) {
+		  &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
+	      }
+	      $syllabus{'uploaded.photourl'}=
+                 &Apache::lonnet::userfileupload('uploaddoc',undef,'aboutme');
  	  }
           $syllabus{'uploaded.lastmodified'}=time;
           &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum);
@@ -132,7 +135,6 @@
        $lastmod=($lastmod?&Apache::lonlocal::locallocaltime($lastmod):&mt('never'));
        $r->print(&mt('Last updated').': '.$lastmod);
        if ($syllabus{'uploaded.photourl'}) {
-	   
 	   &Apache::lonnet::allowuploaded('/adm/aboutme',
 					  $syllabus{'uploaded.photourl'});
 	   $r->print('<img src="'.$syllabus{'uploaded.photourl'}.
Index: loncom/interface/lonbulletin.pm
diff -u loncom/interface/lonbulletin.pm:1.19 loncom/interface/lonbulletin.pm:1.20
--- loncom/interface/lonbulletin.pm:1.19	Fri Feb 13 10:01:29 2004
+++ loncom/interface/lonbulletin.pm	Fri Apr 30 19:13:52 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Bulletin Board Handler
 #
-# $Id: lonbulletin.pm,v 1.19 2004/02/13 15:01:29 www Exp $
+# $Id: lonbulletin.pm,v 1.20 2004/04/30 23:13:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -118,8 +118,11 @@
       if (($ENV{'form.uploaddoc.filename'}) &&
           ($ENV{'form.storeupl'}) && ($allowed)) {
  	  if ($ENV{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) {
-             $syllabus{'uploaded.photourl'}=
-                 &Apache::lonnet::userfileupload('uploaddoc',1);
+	      if ($syllabus{'uploaded.photourl'}) {
+		  &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
+	      }
+	      $syllabus{'uploaded.photourl'}=
+		  &Apache::lonnet::userfileupload('uploaddoc',1,'bulletin');
  	  }
           $syllabus{'uploaded.lastmodified'}=time;
           &Apache::lonnet::put('bulletinpage_'.$marker,\%syllabus,$dom,$crs);
@@ -138,9 +141,10 @@
 # ---------------------------------------------------------------- Get syllabus
     if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) {
        if ($syllabus{'uploaded.photourl'}) {
-	   $r->print('<img src="'.
-             &Apache::lonnet::tokenwrapper($syllabus{'uploaded.photourl'}).
-             '" align="right" />');
+	   &Apache::lonnet::allowuploaded('/adm/syllabus',
+					  $syllabus{'uploaded.photourl'});
+	   $r->print('<img src="'.$syllabus{'uploaded.photourl'}.
+	       '" align="right" />');
        }
        if ($allowed) {
            $r->print(
Index: loncom/interface/lonsimplepage.pm
diff -u loncom/interface/lonsimplepage.pm:1.16 loncom/interface/lonsimplepage.pm:1.17
--- loncom/interface/lonsimplepage.pm:1.16	Fri Feb 13 10:01:29 2004
+++ loncom/interface/lonsimplepage.pm	Fri Apr 30 19:13:52 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Page Editor
 #
-# $Id: lonsimplepage.pm,v 1.16 2004/02/13 15:01:29 www Exp $
+# $Id: lonsimplepage.pm,v 1.17 2004/04/30 23:13:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -128,8 +128,11 @@
       if (($ENV{'form.uploaddoc.filename'}) &&
           ($ENV{'form.storeupl'}) && ($allowed)) {
  	  if ($ENV{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) {
-             $syllabus{'uploaded.photourl'}=
-                 &Apache::lonnet::userfileupload('uploaddoc',1);
+	      if ($syllabus{'uploaded.photourl'}) {
+		  &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
+	      }
+	      $syllabus{'uploaded.photourl'}=
+		  &Apache::lonnet::userfileupload('uploaddoc',1,'simplepage');
  	  }
           $syllabus{'uploaded.lastmodified'}=time;
           &Apache::lonnet::put('smppage_'.$marker,\%syllabus,$dom,$crs);
@@ -149,8 +152,9 @@
     if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) {
        if ($syllabus{'uploaded.photourl'}) {
 	   if ($ENV{'form.grade_target'} ne 'tex') {
-	       $r->print('<img src="'.
-			 &Apache::lonnet::tokenwrapper($syllabus{'uploaded.photourl'}).
+	       &Apache::lonnet::allowuploaded('/adm/smppg',
+					      $syllabus{'uploaded.photourl'});
+	       $r->print('<img src="'.$syllabus{'uploaded.photourl'}.
 			 '" align="right" />');
 	   }
        }