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

www lon-capa-cvs@mail.lon-capa.org
Tue, 27 Aug 2002 12:18:13 -0000


www		Tue Aug 27 08:18:13 2002 EDT

  Modified files:              
    /loncom/interface	groupsort.pm londocs.pm 
  Log:
  Course Documents can now Group Import and Search
  
  
Index: loncom/interface/groupsort.pm
diff -u loncom/interface/groupsort.pm:1.14 loncom/interface/groupsort.pm:1.15
--- loncom/interface/groupsort.pm:1.14	Fri Aug 16 13:03:23 2002
+++ loncom/interface/groupsort.pm	Tue Aug 27 08:18:13 2002
@@ -2,7 +2,7 @@
 # The LON-CAPA group sort handler
 # Allows for sorting prior to import into RAT.
 #
-# $Id: groupsort.pm,v 1.14 2002/08/16 17:03:23 matthew Exp $
+# $Id: groupsort.pm,v 1.15 2002/08/27 12:18:13 www Exp $
 # 
 # Copyright Michigan State University Board of Trustees
 #
@@ -39,6 +39,7 @@
 
 use Apache::Constants qw(:common);
 use GDBM_File;
+use Apache::loncommon;
 
 my %hash; # variable to tie to user specific database
 my $iconpath; # variable to be accessible to multiple subroutines
@@ -130,9 +131,8 @@
 }
 </script>
 </head>
-<body bgcolor="#FFFFFF">
 END
-
+    $r->print(&Apache::loncommon::bodytag('Sort Imported Resources'));
     # read pertinent machine configuration
     my $domain  = $r->dir_config('lonDefDomain');
     $iconpath = $r->dir_config('lonIconsURL') . "/";
@@ -284,9 +284,6 @@
     my $ctr = 0;
     my $clen = scalar(keys %shash);
    $r->print(<<END);
-<h2><font color="#888888">
-    The LearningOnline Network With CAPA Group Sorter
-    </font></h2>
 <b><font color="#888888">Finalize order of resources</font></b>
 <form method='post' action='/adm/groupsort' name='groupsort'
       enctype='application/x-www-form-urlencoded'>
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.10 loncom/interface/londocs.pm:1.11
--- loncom/interface/londocs.pm:1.10	Mon Aug 26 08:44:45 2002
+++ loncom/interface/londocs.pm	Tue Aug 27 08:18:13 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.10 2002/08/26 12:44:45 www Exp $
+# $Id: londocs.pm,v 1.11 2002/08/27 12:18:13 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -112,6 +112,28 @@
 # Store the changed version
 		&storemap($coursenum,$coursedom,$folder.'.sequence');
             }
+# Group import/search
+	    if ($ENV{'form.importdetail'}) {
+               foreach (split(/\&/,$ENV{'form.importdetail'})) {
+                  if (defined($_)) {
+	             my ($name,$url)=split(/\=/,$_);
+                     $name=&Apache::lonnet::unescape($name);
+                     $url=&Apache::lonnet::unescape($url);
+                     if ($url) {
+	                my $idx=$#Apache::lonratedt::resources+1;
+                        $Apache::lonratedt::order
+                           [$#Apache::lonratedt::order+1]=$idx;
+                        my $ext='false';
+                        if ($url=~/^http\:\/\//) { $ext='true'; }
+                        $url=~s/\:/\&colon;/g;
+                        $Apache::lonratedt::resources[$idx]=
+                           $name.':'.$url.':'.$ext.':normal:res';
+	             }
+                 }
+	      }
+# Store the changed version
+		&storemap($coursenum,$coursedom,$folder.'.sequence');
+            }
 	}
 # ---------------------------------------------------------------- Print screen
         my $idx=0;
@@ -180,7 +202,7 @@
     my $script='';
     if ($allowed) { 
        &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']);
-       $script=&Apache::lonratedt::editscript('docs'); 
+       $script=&Apache::lonratedt::editscript('simple'); 
     }
 
 # get course data
@@ -207,15 +229,46 @@
        unless ($folder=~/^default/) { $folder='default'; }
        &editor($r,$coursenum,$coursedom,$folder,$allowed);
        $r->print(<<ENDFORM);
-<h3>Post a new main course document</h3>
+<table><tr>
+<th>Upload a new main course document</th>
+<th>Import a published document</th>
+<th>Special documents</th>
+</tr>
+<tr><td>
+File:<br />
 <form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
 <input type="file" name="uploaddoc" size="50">
 <br />
-Title: <input type="text" size="50" name="comment">
+Title:<br /> 
+<input type="text" size="50" name="comment">
 <input type="hidden" name="folder" value="$folder">
 <input type="hidden" name="cmd" value="upload_default">
 <input type="submit" value="Upload Document">
 </form>
+</td>
+<td>
+<form action="/adm/coursedocs" method="post" name="simpleedit">
+<input type=hidden name="importdetail" value="">
+<input type=button onClick=
+"javascript:groupsearch()" value="Group Search">
+<input type=button onClick=
+"javascript:groupimport();" value="Group Import">
+</form>
+</td><td>
+<form action="/adm/coursedocs" method="post" name="newfolder">
+<input name="newfolder" type="button" onClick="javascript:newfolder();"
+value="New Folder" />
+</form>
+<form action="/adm/coursedocs" method="post" name="newext">
+<input name="newext" type="button" onClick="javascript:newext();"
+value="External Resource" />
+</form>
+<form action="/adm/coursedocs" method="post" name="newsyl">
+<input name="newsyl" type="button" onClick="javascript:newsyl();"
+value="Syllabus" />
+</form>
+</td></tr>
+</table>
 ENDFORM
        $r->print('<hr />');
     }