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

ehlerst ehlerst@source.lon-capa.org
Tue, 03 Feb 2009 18:31:59 -0000


This is a MIME encoded message

--ehlerst1233685919
Content-Type: text/plain

ehlerst		Tue Feb  3 18:31:59 2009 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  implemented a tab style to select between Main Course Documents and Supplemental Course Documents.
  
  
--ehlerst1233685919
Content-Type: text/plain
Content-Disposition: attachment; filename="ehlerst-20090203183159.txt"

Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.334 loncom/interface/londocs.pm:1.335
--- loncom/interface/londocs.pm:1.334	Tue Feb  3 14:16:39 2009
+++ loncom/interface/londocs.pm	Tue Feb  3 18:31:59 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.334 2009/02/03 14:16:39 muellerd Exp $
+# $Id: londocs.pm,v 1.335 2009/02/03 18:31:59 ehlerst Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2874,11 +2874,35 @@
        }
 
        $r->print(&generate_admin_options($containertag,$uploadtag,\%lt,\%help,\%env));
-       $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
-		     &mt('Editing the Table of Contents for your '.$type)));
     }
+# --------------------------------------------------------- Main tab structure
+    my $activeClass = 1;
+    $r->print('<div class="LC_ContentBoxSpecial"><ul class="LC_TabContent" id="mainnav">');
+    if (($standard) && ($allowed) && (!$forcesupplement)) {
+	my $active = '';
+        if($activeClass == 1){
+           $active = 'class="active"';
+	   $activeClass = 0;
+	}
+	$r->print('<li '.$active.'onclick="javascript:showPage(this,\'Main Course Documents\',\'mainnav\',\'maincoursedoc\');">'.&mt('Main Course Documents').'</li>');
+    }
+    if (!$forcestandard) {
+	my $active = '';
+        if($activeClass == 1){
+           $active = 'class="active"';
+        }
+	$r->print('<li '.$active.'onclick="javascript:showPage(this,\'Supplemental Course Documents\',\'mainnav\',\'maincoursedoc\');">'.&mt('Supplemental Course Documents').'</li>');
+    }
+    $r->print('</ul><div id="maincoursedoc" style="margin:0 0;padding:0 0;">');
 # --------------------------------------------------------- Standard documents
     if (($standard) && ($allowed) && (!$forcesupplement)) {
+       my $active = 'style="display: none;"';
+       if($activeClass == 0){
+          $active = 'style="display: block;"';
+       }
+       $r->print('<div class="LC_ContentBox" id="Main Course Documents" '.$active.'>');
+        $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
+                     &mt('Editing the Table of Contents for your '.$type)));
        my $folder=$env{'form.folder'};
        if ($folder eq '' || $folder eq 'supplemental') {
            $folder='default';
@@ -2893,11 +2917,6 @@
            #$postexec='self.close();';
        }
        $hadchanges=0;
-       my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,
-			   $upload_output,$type);
-       if ($error) {
-	   $r->print('<p><span class="LC_error">'.$error.'</span></p>');
-       }
        if ($hadchanges) {
 	   &mark_hash_old();
        }
@@ -3119,12 +3138,22 @@
 my $navigation='navigation';
 my $varcd = 'Main Course Documents';
 $r->print(&generate_edit_table($tid,$content,$navigation,$varcd,\%namehash,\%orderhash)); 
+my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
+       if ($error) {
+           $r->print('<p><span class="LC_error">'.$error.'</span></p>');
+       }
+$r->print('</div>');
       }
        if ($env{'form.pagepath'}) {
        }
     }
 # ----------------------------------------------------- Supplemental documents
     if (!$forcestandard) {
+       my $active = 'style="display: none;"';
+       if($activeClass == 1){
+          $active = 'style="display: block;"';
+       }
+       $r->print('<div class="LC_ContentBox" id="Supplemental Course Documents" '.$active.'>');
        my $folder=$env{'form.folder'};
        unless ($folder=~/^supplemental/) {
 	   $folder='supplemental';
@@ -3134,10 +3163,6 @@
           $env{'form.folderpath'} = 'supplemental&'.
                                     &escape(&mt('Supplemental '.$type.' Documents'));
        }
-       my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
-       if ($error) {
-	   $r->print('<p><span class="LC_error">'.$error.'</span></p>');
-       }
        if ($allowed) {
 	   my $folderseq=
 	       '/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time.
@@ -3235,9 +3260,14 @@
 my $varscd = 'Supplemental Course Documents';
 
 $r->print(&generate_edit_table($tid,$content,$navigation,$varscd,\%supnamehash,\%suporderhash));
-
+my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$type);
+       if ($error) {
+           $r->print('<p><span class="LC_error">'.$error.'</span></p>');
+       }
+$r->print('</div)');
 	} 
    }
+$r->print('</div>');
     if ($allowed) {
 	$r->print('
 <form method="post" name="extimport" action="/adm/coursedocs">
@@ -3449,110 +3479,112 @@
 	   if ((comp[0]) && (comp[1])) {
 	       this.document.forms.newaboutsomeone.importdetail.value=
 		   '$lt{"p_mab2"}'+escape(user)+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';
-	       this.document.forms.newaboutsomeone.submit();
-	   } else {
-               alert("$lt{'p_mab_alrt1'}");
-           }
-       } else {
-           alert("$lt{'p_mab_alrt2'}");
-       }
+       this.document.forms.newaboutsomeone.submit();
+   } else {
+       alert("$lt{'p_mab_alrt1'}");
    }
+} else {
+   alert("$lt{'p_mab_alrt2'}");
+}
+}
 }
 
 function makeims() {
-    var caller = document.forms.ims.folder.value;
-    var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one";
-    newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes");
-    newWindow.location.href = newlocation;
+var caller = document.forms.ims.folder.value;
+var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one";
+newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes");
+newWindow.location.href = newlocation;
 }
 
 
 function finishpick() {
-    var title=this.document.forms.extimport.title.value;
-    var url=this.document.forms.extimport.url.value;
-    var form=this.document.forms.extimport.useform.value;
-    var residx=this.document.forms.extimport.residx.value;
-    eval('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+'='+residx+'";this.document.forms.'+form+'.submit();');
+var title=this.document.forms.extimport.title.value;
+var url=this.document.forms.extimport.url.value;
+var form=this.document.forms.extimport.useform.value;
+var residx=this.document.forms.extimport.residx.value;
+eval('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+'='+residx+'";this.document.forms.'+form+'.submit();');
 }
 
 function changename(folderpath,index,oldtitle,container,pagesymb) {
-    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.submit();
-    }
+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.submit();
+}
 }
 
 function removeres(folderpath,index,oldtitle,container,pagesymb,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.submit();
-    }
+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.submit();
+}
 }
 
 function cutres(folderpath,index,oldtitle,container,pagesymb,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.submit();
-    }
+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.submit();
+}
 }
 
 function markcopy(folderpath,index,oldtitle,container,pagesymb,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();
+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();
 }
 
 function unselectInactive(nav) {
-	currentNav = document.getElementById(nav);
-	currentLis = currentNav.getElementsByTagName('LI');
-	for (i = 0; i < currentLis.length; i++) {
-		currentLis[i].className = 'i';
-	}
+currentNav = document.getElementById(nav);
+currentLis = currentNav.getElementsByTagName('LI');
+for (i = 0; i < currentLis.length; i++) {
+	currentLis[i].className = 'i';
+}
 }
 
 function hideAll(current, nav, data) {
-	unselectInactive(nav);
-	current.className = 'active';
-	currentData = document.getElementById(data);
-	currentDivs = currentData.getElementsByTagName('DIV');
-	for (i = 0; i < currentDivs.length; i++) {
+unselectInactive(nav);
+current.className = 'active';
+currentData = document.getElementById(data);
+currentDivs = currentData.getElementsByTagName('DIV');
+for (i = 0; i < currentDivs.length; i++) {
+	if(currentDivs[i].className == 'LC_ContentBox'){
 		currentDivs[i].style.display = 'none';
 	}
 }
+}
 
 function showPage(current, pageId, nav, data) {
 	hideAll(current, nav, data);

--ehlerst1233685919--