[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm londocs.pm lonextresedit.pm lonhtmlcommon.pm /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Mon Dec 3 09:47:38 EST 2012


raeburn		Mon Dec  3 14:47:38 2012 EDT

  Modified files:              
    /loncom/interface	londocs.pm loncommon.pm lonextresedit.pm 
                     	lonhtmlcommon.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Eliminate use of pagepath and pagesymb.
  - Information about current map hierarchy found in $env{'form.folderpath'} 
    for both .page and .sequence in /uploaded.
  - Container type (.sequence or .page) appears in additional fifth colon 
    separated field appended to map title. (1 if page, blank otherwise). 
  
  
-------------- next part --------------
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.518 loncom/interface/londocs.pm:1.519
--- loncom/interface/londocs.pm:1.518	Sun Dec  2 22:40:09 2012
+++ loncom/interface/londocs.pm	Mon Dec  3 14:47:30 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.518 2012/12/02 22:40:09 raeburn Exp $
+# $Id: londocs.pm,v 1.519 2012/12/03 14:47:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -391,18 +391,15 @@
     my %orderhash;
     my $container='sequence';
     my $pathitem;
-    if ($env{'form.pagepath'}) {
+    if ($env{'form.folderpath'} =~ /\:1$/) {
         $container='page';
-        $pathitem = '<input type="hidden" name="pagepath" value="'.
-                    &HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />';
-    } else {
-        my $folderpath=$env{'form.folderpath'};
-        if ($folderpath eq '') {
-            $folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Documents'));
-        }
-        $pathitem = '<input type="hidden" name="folderpath" value="'.
-                    &HTML::Entities::encode($folderpath,'<>&"').'" />';
     }
+    my $folderpath=$env{'form.folderpath'};
+    if ($folderpath eq '') {
+        $folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Documents').':::::');
+    }
+    $pathitem = '<input type="hidden" name="folderpath" value="'.
+                &HTML::Entities::encode($folderpath,'<>&"').'" />';
     my $readfile="/uploaded/$coursedom/$coursenum/$folder.$container";
     my $jumpto = $readfile;
     $jumpto =~ s{^/}{};
@@ -761,16 +758,9 @@
             }
         }
         $r->print('<br /><input type="submit" name="pastemarked" value="'.&mt('Paste').'" />'.$othercrs);
-        if ($container eq 'page') {
-            $r->print('
-        <input type="hidden" name="pagepath" value="'.&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />
-        <input type="hidden" name="pagesymb" value="'.&HTML::Entities::encode($env{'form.pagesymb'},'<>&"').'" />
-');
-        } else {
-            $r->print('
+        $r->print('
         <input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />
 ');
-        }
         $r->print('</form>');
     } else {
         $r->print(&mt('Paste buffer contains:').' '.$buffer.
@@ -1692,13 +1682,16 @@
 sub editor {
     my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype,
         $supplementalflag,$orderhash,$iconpath,$pathitem)=@_;
-    my $container= ($env{'form.pagepath'}) ? 'page'
-		                           : 'sequence';
-    my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order);
+    my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container);
     if ($allowed) {
-        (my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,$is_random_order) =
+        (my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,
+         $is_random_order,$container) =
             &Apache::lonhtmlcommon::docs_breadcrumbs($allowed,$crstype,1);
         $r->print($breadcrumbtrail);
+    } elsif ($env{'form.folderpath'} =~ /\:1$/) {
+        $container = 'page'; 
+    } else {
+        $container = 'sequence';
     }
 
     my $jumpto = "uploaded/$coursedom/$coursenum/$folder.$container";
@@ -1862,7 +1855,7 @@
         unless ($name) { $idx++; next; }
         $output .= &entryline($idx,$name,$url,$folder,$allowed,$res,
                               $coursenum,$coursedom,$crstype,
-                              $pathitem,$supplementalflag);
+                              $pathitem,$supplementalflag,$container);
         $idx++;
         $shown++;
     }
@@ -1948,7 +1941,7 @@
         my $errtext='';
         my $fatal=0;
         my $container='sequence';
-        if ($env{'form.pagepath'}) {
+        if ($env{'form.folderpath'} =~ /:1$/) {
             $container='page';
         }
         ($errtext,$fatal)=
@@ -2038,7 +2031,6 @@
                 my $archiveurl = &HTML::Entities::encode($url,'<>&"');
                 my %archiveitems = (
                     folderpath => $env{'form.folderpath'},
-                    pagepath   => $env{'form.pagepath'},
                     cmd        => $nextphase,
                     newidx     => $newidx,
                     position   => $position,
@@ -2093,16 +2085,14 @@
 
 sub entryline {
     my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,
-        $crstype,$pathitem,$supplementalflag)=@_;
-    my ($foldertitle,$pagetitle,$renametitle);
+        $crstype,$pathitem,$supplementalflag,$container)=@_;
+    my ($foldertitle,$renametitle);
     if (&is_supplemental_title($title)) {
 	($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);
-	$pagetitle = $foldertitle;
     } else {
 	$title=&HTML::Entities::encode($title,'"<>&\'');
 	$renametitle=$title;
 	$foldertitle=$title;
-	$pagetitle=$title;
     }
 
     my $orderidx=$LONCAPA::map::order[$index];
@@ -2113,19 +2103,17 @@
     my $line=&Apache::loncommon::start_data_table_row();
     my ($form_start,$form_end,$form_common);
 # Edit commands
-    my ($container, $type, $esc_path, $path, $symb);
+    my ($type, $esc_path, $path, $symb);
+    if ($container eq 'page') {
+        $type = 'page';
+    } else {
+        $type = 'folder';
+    }
     if ($env{'form.folderpath'}) {
-	$type = 'folder';
-        $container = 'sequence';
 	$esc_path=&escape($env{'form.folderpath'});
 	$path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
 	# $htmlfoldername=&HTML::Entities::encode($env{'form.foldername'},'<>&"');
     }
-    if ($env{'form.pagepath'}) {
-        $type = $container = 'page';
-        $esc_path=&escape($env{'form.pagepath'});
-	$path = &HTML::Entities::encode($env{'form.pagepath'},'<>&"');
-    }
     my $isexternal;
     if ($residx) {
         my $currurl = $url;
@@ -2258,7 +2246,7 @@
 ENDCOPY
         } else {
 	    $copylink=(<<ENDCOPY);
-<a href="javascript:markcopy('$esc_path','$index','$renametitle','$container','$symb','$folder');" class="LC_docs_copy">$lt{'cp'}</a>
+<a href="javascript:markcopy('$esc_path','$index','$renametitle','$container','$folder');" class="LC_docs_copy">$lt{'cp'}</a>
 ENDCOPY
         }
 	if ($nocut) {
@@ -2267,7 +2255,7 @@
 ENDCUT
         } else {
 	    $cutlink=(<<ENDCUT);
-<a href="javascript:cutres('$esc_path','$index','$renametitle','$container','$symb','$folder',$skip_confirm);" class="LC_docs_cut">$lt{'ct'}</a>
+<a href="javascript:cutres('$esc_path','$index','$renametitle','$container','$folder',$skip_confirm);" class="LC_docs_cut">$lt{'ct'}</a>
 ENDCUT
         }
         if ($noremove) {
@@ -2276,12 +2264,12 @@
 ENDREM
         } else {
             $removelink=(<<ENDREM);
-<a href='javascript:removeres("$esc_path","$index","$renametitle","$container","$symb",$skip_confirm);' class="LC_docs_remove">$lt{'rm'}</a>
+<a href='javascript:removeres("$esc_path","$index","$renametitle",$skip_confirm);' class="LC_docs_remove">$lt{'rm'}</a>
 ENDREM
         }
         unless ($isexternal) {
             $renamelink=(<<ENDREN);
-<a href='javascript:changename("$esc_path","$index","$renametitle","$container","$symb");' class="LC_docs_rename">$lt{'rn'}</a>
+<a href='javascript:changename("$esc_path","$index","$renametitle");' class="LC_docs_rename">$lt{'rn'}</a>
 ENDREN
         }
 	$form_start = '
@@ -2326,22 +2314,18 @@
     my ($extension)=($url=~/\.(\w+)$/);
     my $uploaded=($url=~/^\/*uploaded\//);
     my $icon=&Apache::loncommon::icon($url);
-    my $isfolder=0;
-    my $ispage=0;
-    my $folderarg;
-    my $pagearg;
-    my $pagefile;
+    my $isfolder;
+    my $ispage;
+    my $containerarg;
     if ($uploaded) {
         if (($extension eq 'sequence') || ($extension eq 'page')) {
             $url=~/\Q$coursenum\E\/([\/\w]+)\.\Q$extension\E$/;
-            my $containerarg = $1;
+            $containerarg = $1;
 	    if ($extension eq 'sequence') {
 	        $icon=$iconpath.'navmap.folder.closed.gif';
-                $folderarg=$containerarg;
                 $isfolder=1;
             } else {
                 $icon=$iconpath.'page.gif';
-                $pagearg=$containerarg;
                 $ispage=1;
             }
             if ($allowed) {
@@ -2359,10 +2343,6 @@
     $orig_url=~s{http(:|:)//https(:|:)//}{https$2//};
     $url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/};
     if (!$supplementalflag && $residx && $symb) {
-        if ($container eq 'page') {
-            $url=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($symb))[2]);
-            $url.=(($url=~/\?/)?'&':'?').'symb='.&escape($symb);
-        } 
         if ((!$isfolder) && (!$ispage)) {
 	    (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
 	    $url=&Apache::lonnet::clutter($url);
@@ -2387,17 +2367,17 @@
 	}
     }
     my ($rand_pick_text,$rand_order_text);
-    if ($isfolder || $extension eq 'sequence') {
+    if ($isfolder || $ispage || $extension eq 'sequence' || $extension eq 'page') {
 	my $foldername=&escape($foldertitle);
 	my $folderpath=$env{'form.folderpath'};
 	if ($folderpath) { $folderpath.='&' };
         if (!$allowed && $supplementalflag) {
-            $folderpath.=$folderarg.'&'.$foldername;
+            $folderpath.=$containerarg.'&'.$foldername;
             $url.='folderpath='.&escape($folderpath);
         } else {
 # Append randompick number, hidden, and encrypted with ":" to foldername,
 # so it gets transferred between levels
-	    $folderpath.=$folderarg.'&'.$foldername.
+	    $folderpath.=$containerarg.'&'.$foldername.
                                               ':'.(&LONCAPA::map::getparameter($orderidx,
                                               'parameter_randompick'))[0]
                                                .':'.((&LONCAPA::map::getparameter($orderidx,
@@ -2405,7 +2385,8 @@
                                                .':'.((&LONCAPA::map::getparameter($orderidx,
                                               'parameter_encrypturl'))[0]=~/^yes$/i)
                                                .':'.((&LONCAPA::map::getparameter($orderidx,
-                                              'parameter_randomorder'))[0]=~/^yes$/i);
+                                              'parameter_randomorder'))[0]=~/^yes$/i)
+                                               .':'.$ispage;
 	    $url.='folderpath='.&escape($folderpath);
             my $rpicknum = (&LONCAPA::map::getparameter($orderidx,
                                                         'parameter_randompick'))[0];
@@ -2439,15 +2420,7 @@
             $url .= '&idx='.$orderidx;
         }
     }
-    if ($ispage) {
-        my $pagename=&escape($pagetitle);
-        my $pagepath;
-        my $folderpath=$env{'form.folderpath'};
-        if ($folderpath) { $pagepath = $folderpath.'&' };
-        $pagepath.=$pagearg.'&'.$pagename;
-	$url.='pagepath='.&escape($pagepath).
-	    '&pagesymb='.&escape($symb);
-    }
+    my ($tdalign,$tdwidth);
     if ($allowed) {
         my $fileloc = 
             &Apache::lonnet::declutter(&Apache::lonnet::filelocation('',$orig_url));
@@ -2471,14 +2444,16 @@
                 }
             }
         }
+        $tdalign = ' align="right" valign="top"';
+        $tdwidth = ' width="80%"';
     }
     my $reinit;
     if ($crstype eq 'Community') {
         $reinit = &mt('(re-initialize community to access)');
     } else {
         $reinit = &mt('(re-initialize course to access)');
-    }  
-    $line.='<td class="LC_docs_entry_commands" align="right" valign="top"><span class="LC_nobreak">'.$editlink.$renamelink;
+    }
+    $line.='<td class="LC_docs_entry_commands"'.$tdalign.'><span class="LC_nobreak">'.$editlink.$renamelink;
     if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
        $line.='<a href="'.$url.'"><img src="'.$icon.'" alt="" class="LC_icon" /></a>';
     } elsif ($url) {
@@ -2487,7 +2462,7 @@
     } else {
        $line.='<img src="'.$icon.'" alt="" class="LC_icon" />';
     }
-    $line.='</span></td><td width="80%">';
+    $line.='</span></td><td'.$tdwidth.'>';
     if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
        $line.='<a href="'.$url.'">'.$title.'</a>';
     } elsif ($url) {
@@ -3038,11 +3013,6 @@
     my $pathvar='folderpath';
     my $path=&escape($env{'form.folderpath'});
     if (!defined($url)) {
-	if (defined($env{'form.pagepath'})) {
-	    $pathvar='pagepath';
-	    $path=&escape($env{'form.pagepath'});
-	    $path.='&pagesymb='.&escape($env{'form.pagesymb'});
-	}
 	$url='/adm/coursedocs?'.$pathvar.'='.$path;
     }
     my $course_type = &Apache::loncommon::course_type();
@@ -3216,8 +3186,8 @@
 # Get the parameters that may be needed
 #
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-                                            ['folderpath','pagepath',
-                                             'pagesymb','forcesupplement','forcestandard',
+                                            ['folderpath',
+                                             'forcesupplement','forcestandard',
                                              'tools','symb','command','supppath']);
 
 # standard=1: this is a "new-style" course with an uploaded map as top level
@@ -3232,7 +3202,7 @@
 
 
     my $supplementalflag=($env{'form.folderpath'}=~/^supplemental/);
-    if (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'} eq "" || ($env{'form.pagepath'})) {
+    if (($env{'form.folderpath'}=~/^default/) || ($env{'form.folderpath'} eq "")) {
        $supplementalflag=0;
     }
     if ($env{'form.forcesupplement'}) { $supplementalflag=1; }
@@ -3284,7 +3254,8 @@
                                     ':'.$res->randompick().
                                     ':'.$res->randomout().
                                     ':'.$res->encrypted().
-                                    ':'.$res->randomorder();
+                                    ':'.$res->randomorder().
+                                    ':'.$res->is_page();
                        }
                    }
                }
@@ -3299,38 +3270,33 @@
                     ':'.$mapresobj->randompick().
                     ':'.$mapresobj->randomout().
                     ':'.$mapresobj->encrypted().
-                    ':'.$mapresobj->randomorder();
+                    ':'.$mapresobj->randomorder().
+                    ':'.$mapresobj->is_page(); 
            } else {
                my $maptitle = &Apache::lonnet::gettitle($mapurl);
+               my $ispage = (($type eq 'page')? 1 : '');
                if ($mapurl eq 'default') {
                    $maptitle = 'Main Course Documents';
                }
                $path = &Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
-                       &Apache::lonhtmlcommon::entity_encode($maptitle).'::::';
+                       &Apache::lonhtmlcommon::entity_encode($maptitle).':::::'.$ispage;
            }
            unless ($mapurl eq 'default') {
                $path = 'default&'.
                        &Apache::lonhtmlcommon::entity_encode('Main Course Documents').
-                       '::::&'.$path;
-           }
-           if ($type eq 'sequence') {
-               $env{'form.folderpath'}=$path;
-               $env{'form.pagepath'}='';
-           } else {
-               $env{'form.pagepath'}=$path;
-               $env{'form.folderpath'}='';
+                       ':::::&'.$path;
            }
+           $env{'form.folderpath'}=$path;
        } elsif ($env{'form.supppath'} ne '') {
            $env{'form.folderpath'}=$env{'form.supppath'};
        }
    } elsif ($env{'form.command'} eq 'editdocs') {
         $env{'form.folderpath'} = 'default&'.
-                                  &Apache::lonhtmlcommon::entity_encode('Main Course Content');
-        $env{'form.pagepath'}='';
+                                  &Apache::lonhtmlcommon::entity_encode('Main Course Content').
+                                  ':::::';
    } elsif ($env{'form.command'} eq 'editsupp') {
         $env{'form.folderpath'} = 'default&'.
                                   &Apache::lonhtmlcommon::entity_encode('Supplemental Content');
-        $env{'form.pagepath'}='';
    }
 
 # Where do we store these for when we come back?
@@ -3339,24 +3305,18 @@
        $stored_folderpath='docs_sup_folderpath';
     }
 
-# No folderpath, no pagepath, and in edit mode, see if we have something stored
-    if ((!$env{'form.folderpath'}) && (!$env{'form.pagepath'}) && $allowed) {
+# No folderpath, and in edit mode, see if we have something stored
+    if ((!$env{'form.folderpath'}) && $allowed) {
         &Apache::loncommon::restore_course_settings($stored_folderpath,
                                           {'folderpath' => 'scalar'});
     }
    
 # If we are not allowed to make changes, all we can see are supplemental docs
     if (!$allowed) {
-        $env{'form.pagepath'}='';
         unless ($env{'form.folderpath'} =~ /^supplemental/) {
             $env{'form.folderpath'} = &supplemental_base();
         }
     }
-# If we still not have a folderpath, see if we can resurrect at pagepath
-    if (!$env{'form.folderpath'} && $allowed) {
-        &Apache::loncommon::restore_course_settings($stored_folderpath,
-                                              {'pagepath' => 'scalar'});
-    }
 # Make the zeroth entry in supplemental docs page paths, so we can get to top level
     if ($env{'form.folderpath'} =~ /^supplemental_\d+/) {
         $env{'form.folderpath'} = &supplemental_base()
@@ -3364,11 +3324,12 @@
                                   $env{'form.folderpath'};
     }
 # If after all of this, we still don't have any paths, make them
-    unless (($env{'form.pagepath'}) || ($env{'form.folderpath'})) {
+    unless ($env{'form.folderpath'}) {
        if ($supplementalflag) {
           $env{'form.folderpath'}=&supplemental_base();
        } else {
-          $env{'form.folderpath'}='default';
+          $env{'form.folderpath'}='default'.&escape(&mt('Main '.$crstype.' Documents')).
+                                  ':::::';
        }
     }
 
@@ -3376,38 +3337,29 @@
     unless ($toolsflag) {
         if ($allowed) {
             &Apache::loncommon::store_course_settings($stored_folderpath,
-                                                      {'pagepath' => 'scalar',
-                                                       'folderpath' => 'scalar'});
+                                                      {'folderpath' => 'scalar'});
         }
+        my $folderpath;
         if ($env{'form.folderpath'}) {
-	    my (@folderpath)=split('&',$env{'form.folderpath'});
-	    $env{'form.foldername'}=&unescape(pop(@folderpath));
-	    $env{'form.folder'}=pop(@folderpath);
-            $container='sequence';
-        }
-        if ($env{'form.pagepath'}) {
-            my (@pagepath)=split('&',$env{'form.pagepath'});
-            $env{'form.pagename'}=&unescape(pop(@pagepath));
-            $env{'form.folder'}=pop(@pagepath);
-            $container='page';
-            $containertag = '<input type="hidden" name="pagepath" value="" />'.
-	                    '<input type="hidden" name="pagesymb" value="" />';
-            $pathitem = 
-                '<input type="hidden" name="pagepath" value="'.&HTML::Entities::encode($env{'form.pagepath'},'<>&"').'" />'.
-	        '<input type="hidden" name="pagesymb" value="'.&HTML::Entities::encode($env{'form.pagesymb'},'<>&"').'" />'.
-                '<input type="hidden" name="folderpath" value="" />';
+            $folderpath = $env{'form.folderpath'};
+	    my (@folders)=split('&',$env{'form.folderpath'});
+	    $env{'form.foldername'}=&unescape(pop(@folders));
+            if ($env{'form.foldername'} =~ /\:1$/) {
+                $container = 'page';
+            } else {
+                $container = 'sequence';
+            }
+	    $env{'form.folder'}=pop(@folders);
         } else {
-            my $folderpath=$env{'form.folderpath'};
-            if (!$folderpath) {
-                if ($env{'form.folder'} eq '' ||
-                    $env{'form.folder'} eq 'supplemental') {
-                    $folderpath='default&'.
-                        &escape(&mt('Main '.$crstype.' Documents'));
-                }
+            if ($env{'form.folder'} eq '' ||
+                $env{'form.folder'} eq 'supplemental') {
+                $folderpath='default&'.
+                            &escape(&mt('Main '.$crstype.' Documents')).
+                            ':::::';
             }
-            $containertag = '<input type="hidden" name="folderpath" value="" />';
-            $pathitem = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />';
         }
+        $containertag = '<input type="hidden" name="folderpath" value="" />';
+        $pathitem = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />';
         if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
            $showdoc='/'.$1;
         }
@@ -3445,7 +3397,7 @@
                 @tabids = ('002','ee2','ff2');
             } else {
                 @tabids = ('aa1','bb1','cc1','ff1');
-                unless ($env{'form.pagepath'}) {
+                unless ($env{'form.folderpath'} =~ /\:1$/) {
                     unshift(@tabids,'001');
                     push(@tabids,('dd1','ee1'));
                 }
@@ -3752,10 +3704,6 @@
        }
        my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.sequence';
        my $pageseq = '/uploaded/'.$coursedom.'/'.$coursenum.'/default_new.page';
-	my $container='sequence';
-	if ($env{'form.pagepath'}) {
-	    $container='page';
-	}
 	my $readfile='/uploaded/'.$coursedom.'/'.$coursenum.'/'.$folder.'.'.$container;
 
 	my $newnavform=(<<NNFORM);
@@ -3913,10 +3861,16 @@
 
 
         my @importdoc = (
-        {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleUpload(\'ext\');" />'=>$extresourcesform},
-        {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/ims.png" alt="'.$lt{imsf}.'" onclick="javascript:toggleUpload(\'ims\');" />'=>$imspform},
-        {'<img class="LC_noBorder_LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'doc\');" />'=>$fileuploadform,
-        });
+        {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/extres.png" alt="'.$lt{extr}.'" onclick="toggleUpload(\'ext\');" />'=>$extresourcesform}
+        );
+        unless ($container eq 'page') {
+            push(@importdoc,
+                {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/ims.png" alt="'.$lt{imsf}.'" onclick="javascript:toggleUpload(\'ims\');" />'=>$imspform}
+            );
+        }
+        push(@importdoc,
+            {'<img class="LC_noBorder_LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'doc\');" />'=>$fileuploadform}
+        );
         $fileuploadform =  &create_form_ul(&create_list_elements(@importdoc));
 
         @gradingforma=(
@@ -3941,7 +3895,7 @@
                 'bb' => ['Published Content',$importpubform],
                 'cc' => ['Grading Resources',$gradingform],
                 );
-unless ($env{'form.pagepath'}) {
+unless ($container eq 'page') {
     $orderhash{'00'} = ['Newfolder',$newfolderform];
     $orderhash{'dd'} = ['Collaboration',$communityform];
     $orderhash{'ee'} = ['Special Pages',$specialdocumentsform];
@@ -3974,7 +3928,6 @@
        } elsif ($allowed) {
 	  $env{'form.folderpath'} = $savefolderpath;
        }
-       $env{'form.pagepath'} = '';
        $pathitem = '<input type="hidden" name="folderpath" value="'.
                     &HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';
        if ($allowed) {
@@ -4143,12 +4096,9 @@
     my $docuname=$env{'course.'.$env{'request.course.id'}.'.num'};
     my $container='sequence';
     my ($pathitem,$hiddenelem);
-    my @hiddens = ('newidx','comment','position');
-    if ($env{'form.pagepath'}) {
+    my @hiddens = ('newidx','comment','position','folderpath');
+    if ($env{'form.folderpath'} =~ /\:1$/) {
         $container='page';
-        $pathitem = 'pagepath';
-    } else {
-        $pathitem = 'folderpath';
     }
     unshift(@hiddens,$pathitem);
     foreach my $item (@hiddens) {
@@ -4435,14 +4385,11 @@
 
     my $crstype = &Apache::loncommon::course_type();
     my $docs_folderpath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'},'<>&"');
-    my $docs_pagepath = &HTML::Entities::encode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.pagepath'},'<>&"');
     my $main_container_page;
-    if ($docs_folderpath eq '') {
-        if ($docs_pagepath ne '') {
-            $main_container_page = 1;
-        }
+    if (&HTML::Entities::decode($env{'environment.internal.'.$env{'request.course.id'}.'.docs_folderpath.folderpath'}) =~ /\:1$/) {
+        $main_container_page = 1;
     }
-    my $toplevelmain = 'default&Main%20'.$crstype.'%20Documents';
+    my $toplevelmain = 'default&Main%20'.$crstype.'%20Documents%3A%3A%3A%3A%3A';
     my $toplevelsupp = &supplemental_base();
 
     my $backtourl = '/adm/navmaps';
@@ -4450,7 +4397,10 @@
         $backtourl = '/adm/supplemental';
     }
 
-    my $fieldsets = "'ext','doc','ims'";
+    my $fieldsets = "'ext','doc'";
+    unless ($main_container_page) {
+        $fieldsets .=",'ims'";
+    }
     if ($supplementalflag) {
         $fieldsets = "'suppext','suppdoc'";
     }
@@ -4580,64 +4530,40 @@
     imsform.submit();
 }
 
-function changename(folderpath,index,oldtitle,container,pagesymb) {
+function changename(folderpath,index,oldtitle) {
 var title=prompt('$lt{"p_chn"}',oldtitle);
 if (title) {
 this.document.forms.renameform.markcopy.value=-1;
 this.document.forms.renameform.title.value=title;
 this.document.forms.renameform.cmd.value='rename_'+index;
-if (container == 'sequence') {
-    this.document.forms.renameform.folderpath.value=folderpath;
-}
-if (container == 'page') {
-    this.document.forms.renameform.pagepath.value=folderpath;
-    this.document.forms.renameform.pagesymb.value=pagesymb;
-}
+this.document.forms.renameform.folderpath.value=folderpath;
 this.document.forms.renameform.submit();
 }
 }
 
-function removeres(folderpath,index,oldtitle,container,pagesymb,skip_confirm) {
+function removeres(folderpath,index,oldtitle,skip_confirm) {
 if (skip_confirm || confirm('$lt{"p_rmr1"}\\n\\n$lt{"p_rmr2a"} "'+oldtitle+'" $lt{"p_rmr2b"}')) {
 this.document.forms.renameform.markcopy.value=-1;
 this.document.forms.renameform.cmd.value='del_'+index;
-if (container == 'sequence') {
-    this.document.forms.renameform.folderpath.value=folderpath;
-}
-if (container == 'page') {
-    this.document.forms.renameform.pagepath.value=folderpath;
-    this.document.forms.renameform.pagesymb.value=pagesymb;
-}
+this.document.forms.renameform.folderpath.value=folderpath;
 this.document.forms.renameform.submit();
 }
 }
 
-function cutres(folderpath,index,oldtitle,container,pagesymb,folder,skip_confirm) {
+function cutres(folderpath,index,oldtitle,container,folder,skip_confirm) {
 if (skip_confirm || confirm('$lt{"p_ctr1a"}\\n$lt{"p_ctr1b"}\\n\\n$lt{"p_ctr2a"} "'+oldtitle+'" $lt{"p_ctr2b"}')) {
 this.document.forms.renameform.cmd.value='cut_'+index;
 this.document.forms.renameform.markcopy.value=index;
 this.document.forms.renameform.copyfolder.value=folder+'.'+container;
-if (container == 'sequence') {
-    this.document.forms.renameform.folderpath.value=folderpath;
-}
-if (container == 'page') {
-    this.document.forms.renameform.pagepath.value=folderpath;
-    this.document.forms.renameform.pagesymb.value=pagesymb;
-}
+this.document.forms.renameform.folderpath.value=folderpath;
 this.document.forms.renameform.submit();
 }
 }
 
-function markcopy(folderpath,index,oldtitle,container,pagesymb,folder) {
+function markcopy(folderpath,index,oldtitle,container,folder) {
 this.document.forms.renameform.markcopy.value=index;
 this.document.forms.renameform.copyfolder.value=folder+'.'+container;
-if (container == 'sequence') {
 this.document.forms.renameform.folderpath.value=folderpath;
-}
-if (container == 'page') {
-this.document.forms.renameform.pagepath.value=folderpath;
-this.document.forms.renameform.pagesymb.value=pagesymb;
-}
 this.document.forms.renameform.submit();
 }
 
@@ -4735,9 +4661,6 @@
         toggleMap();
         if (nav == 'mainnav') {
             var storedpath = "$docs_folderpath";
-            if (storedpath == '') {
-                storedpath = "$docs_pagepath";
-            }
             var storedpage = "$main_container_page";
             var reg = new RegExp("^supplemental");
             if (pageId == 'mainCourseDocuments') {
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1098 loncom/interface/loncommon.pm:1.1099
--- loncom/interface/loncommon.pm:1.1098	Fri Nov 30 11:28:51 2012
+++ loncom/interface/loncommon.pm	Mon Dec  3 14:47:30 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1098 2012/11/30 11:28:51 bisitz Exp $
+# $Id: loncommon.pm,v 1.1099 2012/12/03 14:47:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6284,7 +6284,6 @@
 
 table.LC_data_table tr > td.LC_docs_entry_commands,
 table.LC_data_table tr > td.LC_docs_entry_parameter {
-  background: #DDDDDD;
   font-size: x-small;
 }
 
@@ -11299,11 +11298,11 @@
     if ($env{'form.folderpath'}) {
         my @items = split('&',$env{'form.folderpath'});
         $folders{'0'} = $items[-2];
-        $containers{'0'}='sequence';
-    } elsif ($env{'form.pagepath'}) {
-        my @items = split('&',$env{'form.pagepath'});
-        $folders{'0'} = $items[-2];
-        $containers{'0'}='page';
+        if ($env{'form.folderpath'} =~ /\:1$/) {
+            $containers{'0'}='page';
+        } else {  
+            $containers{'0'}='sequence';
+        }
     }
     my @archdirs = &get_env_multiple('form.archive_directory');
     if ($numitems) {
Index: loncom/interface/lonextresedit.pm
diff -u loncom/interface/lonextresedit.pm:1.3 loncom/interface/lonextresedit.pm:1.4
--- loncom/interface/lonextresedit.pm:1.3	Sun Dec  2 22:40:09 2012
+++ loncom/interface/lonextresedit.pm	Mon Dec  3 14:47:30 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: lonextresedit.pm,v 1.3 2012/12/02 22:40:09 raeburn Exp $
+# $Id: lonextresedit.pm,v 1.4 2012/12/03 14:47:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -294,11 +294,7 @@
             &Apache::lonnet::decode_symb($symb);
         $title = &Apache::lonnet::gettitle($symb);
         my $path = &Apache::lonnet::getdocspath($symb);
-        if ($map =~ /\.page$/) {
-            $pathitem = '<input type="hidden" name="pagepath" value="'.&HTML::Entities::encode($path,'<>&"').'" />';
-        } else {
-            $pathitem = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($path,'<>&"').'" />';
-        }
+        $pathitem = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($path,'<>&"').'" />';
     }
     my $js = &Apache::lonhtmlcommon::scripttag(&extedit_javascript());
     my $args = { 'force_register' => $env{'form.register'} };
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.335 loncom/interface/lonhtmlcommon.pm:1.336
--- loncom/interface/lonhtmlcommon.pm:1.335	Fri Nov 30 11:28:51 2012
+++ loncom/interface/lonhtmlcommon.pm	Mon Dec  3 14:47:30 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.335 2012/11/30 11:28:51 bisitz Exp $
+# $Id: lonhtmlcommon.pm,v 1.336 2012/12/03 14:47:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1895,12 +1895,9 @@
 sub docs_breadcrumbs {
     my ($allowed,$crstype,$contenteditor,$title,$precleared)=@_;
     my ($folderpath, at folders);
-    if ($env{'form.pagepath'}) {
-        @folders = split('&',$env{'form.pagepath'});
-    } else {
-        @folders = split('&',$env{'form.folderpath'});
-    }
+    my @folders = split('&',$env{'form.folderpath'});
     my $plain='';
+    my $container = 'sequence';
     my ($randompick,$isencrypted,$ishidden,$is_random_order) = (-1,0,0,0);
     my @docs_crumbs;
     while (@folders) {
@@ -1916,9 +1913,9 @@
         }
         $url .= &escape($folderpath);
         my $name=&unescape($foldername);
-# each of randompick number, hidden, encrypted, random order are 
-# appended with ":"s to the foldername
-        $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)$//;
+# each of randompick number, hidden, encrypted, random order, is_page 
+# are appended with ":"s to the foldername
+        $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)\:?(\d*)$//;
         if ($contenteditor) { 
             if ($1 ne '') {
                 $randompick=$1;
@@ -1928,6 +1925,7 @@
             if ($2) { $ishidden=1; }
             if ($3) { $isencrypted=1; }
             if ($4 ne '') { $is_random_order = 1; }
+            if ($5 == 1) {$container = 'page'; }
         }
         if ($folder eq 'supplemental') {
             $name = &mt('Supplemental '.$crstype.' Contents');
@@ -1964,7 +1962,7 @@
         return (&breadcrumbs(undef,undef,$menulink,'nohelp',undef,undef,
                              $contenteditor),
                              $randompick,$ishidden,$isencrypted,$plain,
-                             $is_random_order);
+                             $is_random_order,$container);
     } else {
         return \@docs_crumbs;
     }
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1204 loncom/lonnet/perl/lonnet.pm:1.1205
--- loncom/lonnet/perl/lonnet.pm:1.1204	Fri Nov 30 20:48:34 2012
+++ loncom/lonnet/perl/lonnet.pm	Mon Dec  3 14:47:37 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1204 2012/11/30 20:48:34 raeburn Exp $
+# $Id: lonnet.pm,v 1.1205 2012/12/03 14:47:37 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -10324,7 +10324,8 @@
                                  ':'.$res->randompick().
                                  ':'.$res->randomout().
                                  ':'.$res->encrypted().
-                                 ':'.$res->randomorder();
+                                 ':'.$res->randomorder().
+                                 ':'.$res->is_page();
                     }
                 }
             }
@@ -10339,19 +10340,24 @@
                     ':'.$mapresobj->randompick().
                     ':'.$mapresobj->randomout().
                     ':'.$mapresobj->encrypted().
-                    ':'.$mapresobj->randomorder();
+                    ':'.$mapresobj->randomorder().
+                    ':'.$mapresobj->is_page();
         } else {
             my $maptitle = &gettitle($mapurl);
+            my $ispage;
+            if ($mapurl =~ /\.page$/) {
+                $ispage = 1;
+            }
             if ($mapurl eq 'default') {
                 $maptitle = 'Main Course Documents';
             }
             $path = &Apache::lonhtmlcommon::entity_encode($mapurl).'&'.
-                    &Apache::lonhtmlcommon::entity_encode($maptitle).'::::';
+                    &Apache::lonhtmlcommon::entity_encode($maptitle).':::::'.$ispage;
         }
         unless ($mapurl eq 'default') {
             $path = 'default&'.
                     &Apache::lonhtmlcommon::entity_encode('Main Course Documents').
-                    '::::&'.$path;
+                    ':::::&'.$path;
         }
     }
     return $path;


More information about the LON-CAPA-cvs mailing list