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

raeburn raeburn at source.lon-capa.org
Sun Dec 2 17:40:09 EST 2012


raeburn		Sun Dec  2 22:40:09 2012 EDT

  Modified files:              
    /loncom/interface	londocs.pm lonextresedit.pm 
  Log:
  - lonextresedit:::extedit_form() can return array or scalar.
  - Edit form for "External Resource" below content item, instead of edit link.
  - separate rename link not needed for "External Resource" items
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.517 loncom/interface/londocs.pm:1.518
--- loncom/interface/londocs.pm:1.517	Sun Dec  2 18:54:40 2012
+++ loncom/interface/londocs.pm	Sun Dec  2 22:40:09 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.517 2012/12/02 18:54:40 raeburn Exp $
+# $Id: londocs.pm,v 1.518 2012/12/02 22:40:09 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2279,9 +2279,11 @@
 <a href='javascript:removeres("$esc_path","$index","$renametitle","$container","$symb",$skip_confirm);' class="LC_docs_remove">$lt{'rm'}</a>
 ENDREM
         }
-        $renamelink=(<<ENDREN);
+        unless ($isexternal) {
+            $renamelink=(<<ENDREN);
 <a href='javascript:changename("$esc_path","$index","$renametitle","$container","$symb");' class="LC_docs_rename">$lt{'rn'}</a>
 ENDREN
+        }
 	$form_start = '
    <form action="/adm/coursedocs" method="post">
 ';
@@ -2352,7 +2354,7 @@
 	}
     }
 
-    my $editlink;
+    my ($editlink,$extresform);
     my $orig_url = $url;
     $orig_url=~s{http(:|:)//https(:|:)//}{https$2//};
     $url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/};
@@ -2450,7 +2452,7 @@
         my $fileloc = 
             &Apache::lonnet::declutter(&Apache::lonnet::filelocation('',$orig_url));
         if ($isexternal) {
-            $editlink = 
+            ($editlink,$extresform) = 
                 &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem);
         } elsif (!$isfolder && !$ispage) {
             my ($cfile,$home,$switchserver,$forceedit,$forceview) = 
@@ -2464,8 +2466,8 @@
                                                             &escape($env{'form.folderpath'}),
                                                             $renametitle);
                 if ($jscall) {
-                    $editlink = ' <a class="LC_docs_ext_edit" href="javascript:'.
-                                $jscall.'" >'.&mt('Edit').'</a> ';
+                    $editlink = '<a class="LC_docs_ext_edit" href="javascript:'.
+                                $jscall.'" >'.&mt('Edit').'</a> '."\n";
                 }
             }
         }
@@ -2494,7 +2496,7 @@
     } else {
        $line.=$title.' <span class="LC_docs_reinit_warn">'.$reinit.'</span>';
     }
-    $line.='</td>';
+    $line.="$extresform</td>";
     $rand_pick_text = ' ' if ($rand_pick_text eq '');
     $rand_order_text = ' ' if ($rand_order_text eq '');
     if (($allowed) && ($folder!~/^supplemental/)) {
Index: loncom/interface/lonextresedit.pm
diff -u loncom/interface/lonextresedit.pm:1.2 loncom/interface/lonextresedit.pm:1.3
--- loncom/interface/lonextresedit.pm:1.2	Sun Dec  2 18:25:11 2012
+++ loncom/interface/lonextresedit.pm	Sun Dec  2 22:40:09 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: lonextresedit.pm,v 1.2 2012/12/02 18:25:11 raeburn Exp $
+# $Id: lonextresedit.pm,v 1.3 2012/12/02 22:40:09 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -211,7 +211,7 @@
         $urlid = 'suppexturl';
     }
     my ($link,$legend,$active,$srcclass,$extsrc,$preview,$title,$save,
-        $fieldsetstyle,$action,$hiddenelem);
+        $fieldsetstyle,$action,$hiddenelem,$form);
     $fieldsetstyle = 'display: none;';
     $action = '/adm/coursedocs';
     if ($residx) {
@@ -228,9 +228,9 @@
                               &HTML::Entities::encode(&escape($orig_title),'<>&"').'" />';
             }
         } else {        
-            $link = '<a class="LC_docs_ext_edit" href="javascript:editext('."'$residx'".');">'.$lt{'ed'}.'</a>';
+            $link = '<a class="LC_docs_ext_edit" href="javascript:editext('."'$residx'".');">'.$lt{'ed'}.'</a> '."\n";
             $size = 40;
-            $active = '<input type="hidden" name="active" value="'.$tabid.'" />'; 
+            $active = '<input type="hidden" name="active" value="'.$tabid.'" />';
         }
         $formname = "editext_$residx";
         $fieldsetid = "uploadext$residx";
@@ -252,8 +252,7 @@
         $save = $lt{'al'};
         $pathitem .= '<br />';
     }
-    return <<ENDFORM
-$link
+    $form = <<ENDFORM;
 <form action="$action" method="post" name="$formname">
 <fieldset id="$fieldsetid" style="$fieldsetstyle">
 $legend
@@ -275,7 +274,11 @@
 </fieldset>
 </form>
 ENDFORM
-
+    if (wantarray) {
+        return ($link,$form);
+    } else {
+        return $link.$form;
+    }
 }
 
 sub display_editor {




More information about the LON-CAPA-cvs mailing list