[LON-CAPA-cvs] cvs: loncom /publisher lonpubdir.pm lonpublisher.pm

www lon-capa-cvs@mail.lon-capa.org
Thu, 19 May 2005 03:22:06 -0000


www		Wed May 18 23:22:06 2005 EDT

  Modified files:              
    /loncom/publisher	lonpubdir.pm lonpublisher.pm 
  Log:
  Saving my work: force publication of directories
  
  
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.79 loncom/publisher/lonpubdir.pm:1.80
--- loncom/publisher/lonpubdir.pm:1.79	Mon May 16 20:46:36 2005
+++ loncom/publisher/lonpubdir.pm	Wed May 18 23:22:04 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construction Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.79 2005/05/17 00:46:36 www Exp $
+# $Id: lonpubdir.pm,v 1.80 2005/05/19 03:22:04 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -279,7 +279,7 @@
       if (activity == 'obsolete') {
           var pubform = document.pubresource
           pubform.filename.value = theform.filename.value
-          alert("You will be taken to the publication page.\\nCheck the 'Obsolete' checkbox at the bottom of the page, and click 'Finalize Publication'.")
+          pubform.makeobsolete.value=1;
           pubform.submit()
       }
       if (activity == 'print') {
@@ -396,6 +396,7 @@
        </form>
        <form name="pubresource" action="/adm/publish" target="_parent" method="post">
          <input type="hidden" name="filename" value="" />
+         <input type="hidden" name="makeobsolete" value="0" />
        </form>
        <form name="printresource" action="/adm/printout" target="_parent" method="post">
            <input type="hidden" name="postdata" value="" />
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.193 loncom/publisher/lonpublisher.pm:1.194
--- loncom/publisher/lonpublisher.pm:1.193	Mon May 16 20:46:36 2005
+++ loncom/publisher/lonpublisher.pm	Wed May 18 23:22:04 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.193 2005/05/17 00:46:36 www Exp $
+# $Id: lonpublisher.pm,v 1.194 2005/05/19 03:22:04 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -355,7 +355,7 @@
 
 sub checkbox {
     my ($name,$text)=@_;
-    return "\n<br /><input type='checkbox' name='$name' /> $text";
+    return "\n<br /><input type='checkbox' name='$name' /> ".&mt($text);
 }
 
 sub selectbox {
@@ -1151,16 +1151,17 @@
 
     my $intr_scrout.=
 	'<form name="pubform" action="/adm/publish" method="post">'.
-	'<p><input type="submit" value="'.&mt('Finalize Publication').'" /></p>'.
+	'<p>'.($env{'form.makeobsolete'}?'':'<input type="submit" value="'.&mt('Finalize Publication').'" />').'</p>'.
 	&hiddenfield('phase','two').
 	&hiddenfield('filename',$env{'form.filename'}).
 	&hiddenfield('allmeta',&Apache::lonnet::escape($allmeta)).
-	&hiddenfield('dependencies',join(',',keys %allow)).
+	&hiddenfield('dependencies',join(',',keys %allow));
+    unless ($env{'form.makeobsolete'}) {
+       $intr_scrout.=
 	&textfield('Title','title',$metadatafields{'title'}).
 	&textfield('Author(s)','author',$metadatafields{'author'}).
 	&textfield('Subject','subject',$metadatafields{'subject'});
-
-# --------------------------------------------------- Scan content for keywords
+ # --------------------------------------------------- Scan content for keywords
 
     my $keywords_help = Apache::loncommon::help_open_topic("Publishing_Keywords");
     my $KEYWORDS=&mt('Keywords');
@@ -1315,9 +1316,32 @@
     } else {
 	$intr_scrout.=&hiddenfield('copyright','private');
     }
+   } else {
+       $intr_scrout.=
+	&hiddenfield('title',$metadatafields{'title'}).
+	&hiddenfield('author',$metadatafields{'author'}).
+	&hiddenfield('subject',$metadatafields{'subject'}).
+	&hiddenfield('keywords',$metadatafields{'keywords'}).
+	&hiddenfield('abstract',$metadatafields{'abstract'}).
+	&hiddenfield('notes',$metadatafields{'notes'}).
+	&hiddenfield('mime',$metadatafields{'mime'}).
+	&hiddenfield('creationdate',$metadatafields{'creationdate'}).
+	&hiddenfield('lastrevisiondate',time).
+	&hiddenfield('owner',$metadatafields{'owner'}).
+	&hiddenfield('lowestgradelevel',$metadatafields{'lowestgradelevel'}).
+	&hiddenfield('standards',$metadatafields{'standards'}).
+	&hiddenfield('highestgradelevel',$metadatafields{'highestgradelevel'}).
+	&hiddenfield('language',$metadatafields{'language'}).
+	&hiddenfield('copyright',$metadatafields{'copyright'}).
+	&hiddenfield('sourceavail',$metadatafields{'sourceavail'}).
+	&hiddenfield('customdistributionfile',$metadatafields{'customdistributionfile'}).
+	&text_with_browse_field('Suggested Replacement for Obsolete File',
+				    'obsoletereplacement',
+				    $metadatafields{'obsoletereplacement'});
+   }
     if (!$batch) {
 	$scrout.=$intr_scrout.'<p><input type="submit" value="'.
-	    &mt('Finalize Publication').'" /></p></form>';
+	    &mt($env{'form.makeobsolete'}?'Make Obsolete':'Finalize Publication').'" /></p></form>';
     }
     return($scrout,0);
 }
@@ -1714,8 +1738,18 @@
 		  &hiddenfield('phase','two').
 		  &hiddenfield('filename',$env{'form.filename'}).
 		  &checkbox('pubrec','include subdirectories').
-		  &checkbox('forcerepub','force republication of previously published files'));
-        $r->print('<input type="submit" value="'.&mt('Publish Directory').'" /></form>');
+		  &checkbox('forcerepub','force republication of previously published files').
+                  &checkbox('forceobsolete','make file(s) obsolete'));
+        my %allcopyrights=('keep','Keep current copyright');
+        my %ratcopyrights=%allcopyrights;
+        foreach (&Apache::loncommon::copyrightids) {
+            $allcopyrights{$_}=&Apache::loncommon::copyrightdescription($_);
+            unless ($_ eq 'public') { $ratcopyrights{$_}=$allcopyrights{$_}; }
+	}
+        $r->print('<br >'.&mt('Copyright for all files:').&Apache::loncommon::select_form('keep','forceallcopy',%allcopyrights));
+        $r->print('<br >'.&mt('Copyright for pages/sequences:').&Apache::loncommon::select_form('keep','forceratcopy',%ratcopyrights));
+	$r->print(&text_with_browse_field('Custom Distribution File','forcecustomfile'));
+        $r->print('<br /><input type="submit" value="'.&mt('Publish Directory').'" /></form>');
     } else {
 # actually publish things
 	opendir(DIR,$fn);