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

www www@source.lon-capa.org
Tue, 07 Dec 2010 01:15:34 -0000


This is a MIME encoded message

--www1291684534
Content-Type: text/plain

www		Mon Dec  6 20:15:34 2010 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  Work in progress: content navigation
  
--www1291684534
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20101206201534.txt"

Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.441 loncom/interface/londocs.pm:1.442
--- loncom/interface/londocs.pm:1.441   Sat Dec  4 16:17:27 2010
+++ loncom/interface/londocs.pm Tue Dec  7 01:15:39 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.441 2010/12/04 16:17:27 www Exp $
+# $Id: londocs.pm,v 1.442 2010/12/07 01:15:39 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2238,6 +2238,7 @@ sub list_symbs {
     my $crstype = &Apache::loncommon::course_type();
     $r->print(&Apache::loncommon::start_page('Symb List'));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Symb List'));
+    &startContentScreen($r,'tools');
     my $navmap = Apache::lonnavmaps::navmap->new();
     if (!defined($navmap)) {
         $r->print('<h2>'.&mt('Retrieval of List Failed').'</h2>'.
@@ -2252,7 +2253,6 @@ sub list_symbs {
         }
         $r->print("\n</pre>\n");
     }
-    $r->print('<hr /><a href="/adm/coursedocs">'.&mt('Back to Course Editor').'</a>');
 }
 
 
@@ -2261,6 +2261,7 @@ sub verifycontent {
     my $crstype = &Apache::loncommon::course_type();
    $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Documents'));
    $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Documents'));
+   &startContentScreen($r,'tools');
    $hashtied=0;
    undef %alreadyseen;
    %alreadyseen=();
@@ -2279,13 +2280,7 @@ sub verifycontent {
        }
    }
    &untiehash();
-   $r->print(
-       '<p class="LC_success">'.&mt('Done').'</p>'
-      .'<hr />'
-      .'<p><a href="/adm/coursedocs">'
-	  .&mt('Back to Course Editor')
-      .'</a></p>'
-   );
+   $r->print('<p class="LC_success">'.&mt('Done').'</p>');
 }
 
 
@@ -2300,6 +2295,8 @@ sub checkversions {
     my $crstype = &Apache::loncommon::course_type();
     $r->print(&Apache::loncommon::start_page("Check $crstype Document Versions"));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Document Versions"));
+    &startContentScreen($r,'tools');
+
     my $header='';
     my $startsel='';
     my $monthsel='';
@@ -2629,6 +2626,57 @@ sub create_form_ul {
    return $ul;
 }
 
+#
+# Start tabs
+#
+
+sub startContentScreen {
+    my ($r,$mode)=@_;
+    $r->print('<ul class="LC_TabContentBigger" id="mainnav">');
+    $r->print('<li'.(($mode eq 'navmaps')?' class="active"':'').'><a href="/adm/navmaps"><b>&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Overview').'&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');
+
+    my $active = '';
+# does this user have privileges to modify docs
+    my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
+
+    my $onclick;
+    my $href;
+
+    if ($allowed) {
+        if (($mode eq 'navmaps') || ($mode eq 'tools')) {
+           $href="/adm/coursedocs";
+           $onclick=''; 
+        } else {
+           $href='#';
+           $onclick=' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');"';
+        }
+        $r->print('<li '.(($mode eq 'docs')?' class="active"':'').$onclick.
+               '><a href="'.$href.'"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Editor').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>');
+    }
+    if (($mode eq 'navmaps') || ($mode eq 'tools')) {
+       $href="/adm/coursedocs";
+       $onclick='';
+    } else {
+       $href='#';
+       $onclick=' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');"';
+    }
+
+    $r->print('<li '.(($mode eq 'supdocs')?' class="active"':'').$onclick.
+           '><a href="'.$href.'"><b>'.&mt('Supplemental Documents').'</b></a></li>');
+    $r->print('</ul>');
+    $r->print('<div class="LC_Box" style="clear:both;margin:0;">'
+             .'<div id="maincoursedoc" style="margin:0 0;padding:0 0;">');
+    $r->print('<div class="LC_ContentBox" id="mainCourseDocuments" style="display: block;">');
+}
+
+#
+# End tabs
+#
+
+sub endContentScreen {
+   my ($r)=@_;
+   $r->print('</div></div></div>');
+}
 
 sub handler {
     my $r = shift;
@@ -2959,14 +3007,15 @@ SEDFFORM
 	</form>
 SEDFFORM
 
-	my $extresourcesform=(<<ERFORM);
-	<form action="/adm/coursedocs" method="post" name="newext">
-	$uploadtag
-	<input type="hidden" name="importdetail" value="" />
-	<a class="LC_menubuttons_link" href="javascript:makenewext('newext');">$lt{'extr'}</a>$help{'Adding_External_Resource'}
-	</form>
+      my $extresourcesform=(<<ERFORM);
+      <form action="/adm/coursedocs" method="post" name="newext">
+      $uploadtag
+      <input type="hidden" name="importdetail" value="" />
+      <a class="LC_menubuttons_link" href="javascript:makenewext('newext');">$lt{'extr'}</a>$help{'Adding_External_Resource'}
+      </form>
 ERFORM
 
+
     if ($allowed) {
 	&update_paste_buffer($coursenum,$coursedom);
        my %lt=&Apache::lonlocal::texthash(
@@ -2990,57 +3039,19 @@ ERFORM
  </form>
 HIDDENFORM
     }
-# --------------------------------------------------------- Main tab structure
- 
-    my $activeClass = 1;
-    my $active = '';
-    my %tabtitles = (
-                       main => {
-                                 Course => &mt('Main Course Documents'),
-                                 Community => &mt('Main Community Documents'),
-                               },
-                       supplemental => {
-                                 Course => &mt('Supplemental Course Documents'),        
-                                 Community => &mt('Supplemental Community Documents'),
-                               },
-                    );
+
+# Generate the tabs
+    &startContentScreen($r,'docs');
+#
+
+    my $savefolderpath;
+
     if ($allowed) {
-        $r->print('<ul class="LC_TabContentBigger" id="mainnav">');
-        if (($standard) && ($allowed) && (!$forcesupplement) && (($env{'form.folderpath'}=~/^default/) || $env{'form.folderpath'}eq"" || ($env{'form.pagepath'}))) {
-            if($activeClass == 1){
-                $active = 'class="active"';
-	        $activeClass = 0;
-	    }
-        }
-        $r->print('<li '.$active
-               . ' onclick="javascript:showPage(this,\'mainCourseDocuments\',\'mainnav\',\'maincoursedoc\');"><a href="#"><b>'.$tabtitles{'main'}{$crstype}.'</b></a></li>');
-        $active = '';
-        if (!$forcestandard || ($env{'form.folderpath'}=~/^supplemental/)) {
-            if($activeClass == 1){
-                $active = 'class="active"';
-            }
-        }
-        $r->print('<li '.$active
-            .' onclick="javascript:showPage(this,\'supplCourseDocuments\',\'mainnav\',\'maincoursedoc\');"><a href="#"><b>'.$tabtitles{'supplemental'}{$crstype}.'</b></a></li>');
-        $r->print('</ul>');
-    } else {
-        $r->print('<br />');
-    }
-    $r->print('<div class="LC_Box" style="clear:both;margin:0;">'
-             .'<div id="maincoursedoc" style="margin:0 0;padding:0 0;">');
-# --------------------------------------------------------- Standard documents
-       my $savefolderpath;
-       $active = 'style="display: none;"';
-       if($activeClass == 0){
-          $active = 'style="display: block;"';
-       }
-       if ($allowed) {
-       $r->print('<div class="LC_ContentBox" id="mainCourseDocuments" '.$active.'>');
        my $folder=$env{'form.folder'};
        if ($folder eq '' || $folder=~/^supplemental/) {
            $folder='default';
 	   $savefolderpath = $env{'form.folderpath'};
-	   $env{'form.folderpath'}='default&'.&escape($tabtitles{'main'}{$crstype});
+	   $env{'form.folderpath'}='default&'.&escape(&mt('Content'));
            $uploadtag = '<input type="hidden" name="folderpath" value="'.
 	       &HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';
        }
@@ -3286,12 +3297,7 @@ $r->print(&generate_edit_table($tid,\%or
 
 $r->print('</div>');
 	}
-# ----------------------------------------------------- Supplemental documents
-       $active = 'style="display: none;"';
-       if($activeClass == 1){
-          $active = 'style="display: block;"';
-       }
-       $r->print('<div class="LC_ContentBox" id="supplCourseDocuments" '.$active.'>');
+
        my $folder=$env{'form.folder'};
        unless ($folder=~/^supplemental/) {
 	   $folder='supplemental';
@@ -3403,10 +3409,7 @@ my %suporderhash = (
         }
     }
 
-
-$r->print('</div>');
-$r->print('</div></div>');
-
+    &endContentScreen($r);
 
     if ($allowed) {
 	$r->print('

--www1291684534--