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

ehlerst ehlerst@source.lon-capa.org
Wed, 28 Jan 2009 12:56:09 -0000


ehlerst		Wed Jan 28 12:56:09 2009 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  prepared subroutines for upcoming layout changes.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.326 loncom/interface/londocs.pm:1.327
--- loncom/interface/londocs.pm:1.326	Wed Jan 28 11:51:22 2009
+++ loncom/interface/londocs.pm	Wed Jan 28 12:56:08 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.326 2009/01/28 11:51:22 muellerd Exp $
+# $Id: londocs.pm,v 1.327 2009/01/28 12:56:08 ehlerst Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -119,11 +119,9 @@
     my $type = &Apache::loncommon::course_type();
     if ($home+$other==0) { return ''; }
     if ($home) {
-	return '<div>'.
-	    '<input type="submit" name="dumpcourse" value="'.
+	return '<input type="submit" name="dumpcourse" value="'.
 	    &mt('Dump '.$type.' DOCS to Construction Space').'" />'.
-	    &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs').
-	    '</div>';
+	    &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs');
     } else {
 	return '<div>'.
      &mt('Dump '.$type.
@@ -264,10 +262,9 @@
 
 sub exportbutton {
     my $type = &Apache::loncommon::course_type();
-    return '<div>'.
-            '<input type="submit" name="exportcourse" value="'.
+    return '<input type="submit" name="exportcourse" value="'.
             &mt('Export '.$type.' to IMS').'" />'.
-    &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs').'</div>';
+    &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs');
 }
 
 
@@ -2877,41 +2874,7 @@
            $containertag = '<input type="hidden" name="folderpath" value="" />';
            $uploadtag = '<input type="hidden" name="folderpath" value="'.&HTML::Entities::encode($folderpath,'<>&"').'" />';
        }
-
-       $r->print(<<ENDCOURSEVERIFY);
-<form name="renameform" method="post" action="/adm/coursedocs">
-  <input type="hidden" name="title" />
-  <input type="hidden" name="cmd" />
-  <input type="hidden" name="markcopy" />
-  <input type="hidden" name="copyfolder" />
-  $containertag
-</form>
-<form name="simpleedit" method="post" action="/adm/coursedocs">
-  <input type="hidden" name="importdetail" value="" />
-  $uploadtag
-</form>
-<form action="/adm/coursedocs" method="post" name="courseverify">
-  <div class="LC_docs_course_commands">
-
-      <div>
-        <input type="submit" name="verify" value="$lt{'vc'}" />$help{'Verify_Content'}
-      </div>
-      <div>
-        <input type="submit" name="versions" value="$lt{'cv'}" />$help{'Check_Resource_Versions'}
-      </div>
-        $dumpbut
-        $exportbut
-      <div>
-        <input type="submit" name="listsymbs" value="$lt{'ls'}" />
-      </div>
-      <div>
-        <input type="hidden" name="folder" value="$env{'form.folder'}" />
-        <input type="submit" name="docslog" value="$lt{'sl'}" />
-      </div>
-  </div>
-</form>
-<div style="clear: both; height: 0px;">&nbsp;</div>
-ENDCOURSEVERIFY
+       $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)));
     }
@@ -3347,6 +3310,73 @@
  return OK;
 } 
 
+sub generate_admin_options {
+  my ($containertag,$uploadtag,$lt_ref,$help_ref,$env_ref) = @_;
+  my %lt = %{$lt_ref};
+  my %help = %{$help_ref};
+  my %env = %{$env_ref};
+  my $dumpbut=&dumpbutton();
+  my $exportbut=&exportbutton();
+  return (<<ENDOPTIONFORM);
+ <form name="renameform" method="post" action="/adm/coursedocs">
+   <input type="hidden" name="title" />
+   <input type="hidden" name="cmd" />
+   <input type="hidden" name="markcopy" />
+   <input type="hidden" name="copyfolder" />
+   $containertag
+ </form>
+ <form name="simpleedit" method="post" action="/adm/coursedocs">
+   <input type="hidden" name="importdetail" value="" />
+   $uploadtag
+ </form>
+ <form action="/adm/coursedocs" method="post" name="courseverify">
+   <ul style="list-style-type:none">
+       <li>
+           <input type="submit" name="verify" value="$lt{'vc'}" />$help{'Verify_Content'}
+       </li>
+       <li>
+           <input type="submit" name="versions" value="$lt{'cv'}" />$help{'Check_Resource_Versions'}
+       </li>
+       <li>
+           $dumpbut
+       </li>
+       <li>
+           $exportbut
+       </li>
+       <li>
+          <input type="submit" name="listsymbs" value="$lt{'ls'}" />
+        </li>
+        <li>
+          <input type="hidden" name="folder" value="$env{'form.folder'}" />
+          <input type="submit" name="docslog" value="$lt{'sl'}" />
+        </li>
+   </ul>
+ </form>
+ <div style="clear: both; height: 0px;">&nbsp;</div>
+ENDOPTIONFORM
+}
+
+sub generate_edit_table {
+    my ($optionhash_ref,$namehash_ref,$orderhash_ref) = @_;
+    my %optionhash = %{$optionhash_ref};         #id verlinkt mit inhalt
+    my %namehash = %{$namehash_ref};             #name verlinkt mit id
+    my %orderhash = %{$orderhash_ref};           #name mit k├╝rzel verlinkt mit name
+    my $form;
+    $form = '<div class="LC_ContentBoxSpecial"><h4 class="LC_hcell">'.&mt('Upload Course Documents').'<h4>';
+    $form .= '<ul class="LC_TabContent">';
+    foreach my $name (sort(keys(%orderhash))){
+        if($name eq 'zz_hide'){
+            $form .= '<li><a onclick="hideAllSection();" href="#">'.&mt($orderhash{$name}).'</a></li>';
+        }else{
+            $form .= '<li><a onclick="popUpSection(\''.$namehash{$orderhash{$name}}.'\');" href="#">'.&mt($orderhash{$name}).'</a></li>';
+        }
+    }
+    foreach my $field (keys(%optionhash)){
+        $form .= '<div id="'.$field.'" class="LC_ContentBox LC_hideThis">'.$optionhash{$field}.'</div>';
+    }
+    $form .= '</div>';
+    return $form;
+}
 
 sub editing_js {
     my ($udom,$uname) = @_;