[LON-CAPA-cvs] cvs: loncom /html/res/adm/pages copy.png rename.png /interface lonmenu.pm /localize/localize de.pm doc/loncapafiles loncapafiles.lpml

raeburn raeburn at source.lon-capa.org
Fri May 6 15:36:10 EDT 2022


raeburn		Fri May  6 19:36:10 2022 EDT

  Added files:                 
    /loncom/html/res/adm/pages	copy.png rename.png 

  Modified files:              
    /loncom/interface	lonmenu.pm 
    /doc/loncapafiles	loncapafiles.lpml 
    /loncom/localize/localize	de.pm 
  Log:
  - Bug 6069
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.514 loncom/interface/lonmenu.pm:1.515
--- loncom/interface/lonmenu.pm:1.514	Tue Nov 30 15:55:37 2021
+++ loncom/interface/lonmenu.pm	Fri May  6 19:36:09 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.514 2021/11/30 15:55:37 raeburn Exp $
+# $Id: lonmenu.pm,v 1.515 2022/05/06 19:36:09 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1056,6 +1056,13 @@
                 $currdir =~ s|[^/]+$||;
 		my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);
 		my $esc_currdir = &Apache::loncommon::escape_single($currdir);
+                my $pubfile = "/res/$udom/$uname/$thisdisfn";
+                my $candelete = 1;
+                if (-e $londocroot.$pubfile) {
+                    unless (&Apache::lonnet::metadata($pubfile,'obsolete')) {
+                        undef($candelete);
+                    }
+                }
 #
 # Probably should be in mydesk.tab
 #
@@ -1063,7 +1070,18 @@
 s&6&1&list.png&Directory&dir[_1]&golist('$esc_currdir')&List current directory
 s&6&2&rtrv.png&Retrieve&version[_1]&gocstr('/adm/retrieve','/priv/$udom/$uname/$cleandisfn')&Retrieve old version
 s&6&3&pub.png&Publish&resource[_3]&gocstr('/adm/publish','/priv/$udom/$uname/$cleandisfn')&Publish this resource
+s&7&3&copy.png&Copy&resource[_4]&gocstr('/adm/cfile?action=copy','/priv/$udom/$uname/$cleandisfn')&Copy this resource
+ENDMENUITEMS
+#
+# Rename and Delete only available if obsolete or unpublished
+#
+                if ($candelete) {
+                    $menuitems .= (<<ENDMENUITEMS);
+s&7&4&rename.png&Rename&resource[_5]&gocstr('/adm/cfile?action=rename','/priv/$udom/$uname/$cleandisfn')&Rename this resource
 s&7&1&del.png&Delete&resource[_2]&gocstr('/adm/cfile?action=delete','/priv/$udom/$uname/$cleandisfn')&Delete this resource
+ENDMENUITEMS
+                }
+                $menuitems .= (<<ENDMENUITEMS);
 s&7&2&prt.png&Print&printout[_1]&gocstr('/adm/printout','/priv/$udom/$uname/$cleandisfn')&Prepare a printable document
 ENDMENUITEMS
             }
@@ -1566,8 +1584,13 @@
         &Apache::lonhtmlcommon::add_breadcrumb_tool(
             'advtools', @funcs[61,64,65,66,67,74]);
     } elsif ($env{'request.noversionuri'} !~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) {
-        &Apache::lonhtmlcommon::add_breadcrumb_tool(
-            'advtools', @funcs[61,71,72,73,74,92]);
+        if ($env{'request.state'} eq 'construct') {
+            &Apache::lonhtmlcommon::add_breadcrumb_tool(
+                'advtools', @funcs[61,73,74,71,72]);
+        } else {
+            &Apache::lonhtmlcommon::add_breadcrumb_tool(
+                'advtools', @funcs[61,71,72,73,74,92]);
+        }
     } elsif ($env{'request.noversionuri'} eq '/adm/viewclasslist') {
         &Apache::lonhtmlcommon::add_breadcrumb_tool(
             'advtools', $funcs[61]);
@@ -2208,6 +2231,7 @@
 
     my $esc_url=&escape($currenturl);
     my $esc_symb=&escape($currentsymb);
+    my $newname = &mt('New Name');
 
     my $countdown = &countdown_toggle_js();
 
@@ -2278,6 +2302,22 @@
         this.document.cstrdelete.submit();
         return;
     }
+    if ((url == '/adm/cfile?action=copy') || (url == '/adm/cfile?action=rename')) {
+        this.document.cstrcopy.filename.value = filename;
+        var oldname = filename.substring(filename.lastIndexOf("/") + 1);
+        var newname=prompt('$newname',oldname);
+        if (newname == "" || !newname || newname == oldname)  {
+            return;
+        }
+        if (url == '/adm/cfile?action=rename') {
+            this.document.cstrcopy.action.value = 'rename';
+        } else {
+            this.document.cstrcopy.action.value = 'copy';
+        }
+        this.document.cstrcopy.newfilename.value = newname;
+        this.document.cstrcopy.submit();
+        return;
+    }
     if (url == '/adm/printout') {
         this.document.cstrprint.postdata.value = filename
         this.document.cstrprint.curseed.value = 0;
@@ -2444,6 +2484,11 @@
 <input type="hidden" name="curseed" value="" />
 <input type="hidden" name="problemtype" value="" />
 </form>
+<form name="cstrcopy" action="/adm/cfile" method="post"$target>
+<input type="hidden" name="action" value="copy" />
+<input type="hidden" name="filename" value="" />
+<input type="hidden" name="newfilename" value="" />
+</form>
 
 ENDCONSTSPACEFORM
 }
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.1027 doc/loncapafiles/loncapafiles.lpml:1.1028
--- doc/loncapafiles/loncapafiles.lpml:1.1027	Tue Feb 22 16:04:04 2022
+++ doc/loncapafiles/loncapafiles.lpml	Fri May  6 19:36:10 2022
@@ -2,7 +2,7 @@
  "http://lpml.sourceforge.net/DTD/lpml.dtd">
 <!-- loncapafiles.lpml -->
 
-<!-- $Id: loncapafiles.lpml,v 1.1027 2022/02/22 16:04:04 raeburn Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.1028 2022/05/06 19:36:10 raeburn Exp $ -->
 
 <!--
 
@@ -8385,6 +8385,7 @@
 anot2.png;
 blog.png;
 chrt.png;
+copy.png;
 cprv.png;
 del.png;
 egrd.png;
@@ -8396,6 +8397,7 @@
 port.png;
 prt.png;
 rcrs.png;
+rename.png;
 rsrv.png;
 src.png;
 srvr.png;
Index: loncom/localize/localize/de.pm
diff -u loncom/localize/localize/de.pm:1.625 loncom/localize/localize/de.pm:1.626
--- loncom/localize/localize/de.pm:1.625	Mon Mar  8 18:29:56 2021
+++ loncom/localize/localize/de.pm	Fri May  6 19:36:10 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # German Localization Lexicon
 #
-# $Id: de.pm,v 1.625 2021/03/08 18:29:56 raeburn Exp $
+# $Id: de.pm,v 1.626 2022/05/06 19:36:10 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -32343,6 +32343,12 @@
    'Domain Access'
 => 'Domänen-Zugriff',
 
+   'Copy this resource'
+=> 'Kopieren',
+
+   'Rename this resource'
+=> 'Umbenennen',
+
    ''
 => ''
 




More information about the LON-CAPA-cvs mailing list