[LON-CAPA-cvs] cvs: rat / lonuserstate.pm doc/loncapafiles loncapafiles.lpml loncom/publisher packages.tab
www
lon-capa-cvs@mail.lon-capa.org
Fri, 23 Apr 2004 15:23:35 -0000
www Fri Apr 23 11:23:35 2004 EDT
Modified files:
/doc/loncapafiles loncapafiles.lpml
/loncom/publisher packages.tab
/rat lonuserstate.pm
Log:
Open up the wonderful can of worms of hidden and encrypted URLs and folders.
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.346 doc/loncapafiles/loncapafiles.lpml:1.347
--- doc/loncapafiles/loncapafiles.lpml:1.346 Tue Apr 20 14:23:08 2004
+++ doc/loncapafiles/loncapafiles.lpml Fri Apr 23 11:23:35 2004
@@ -2,7 +2,7 @@
"http://lpml.sourceforge.net/DTD/lpml.dtd">
<!-- loncapafiles.lpml -->
-<!-- $Id: loncapafiles.lpml,v 1.346 2004/04/20 18:23:08 www Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.347 2004/04/23 15:23:35 www Exp $ -->
<!--
@@ -3804,6 +3804,15 @@
<categoryname>handler</categoryname>
<description>
URI to filename translation
+</description>
+<status>works/unverified</status>
+</file>
+<file>
+<source>loncom/lonenc.pm</source>
+<target dist='default'>home/httpd/lib/perl/Apache/lonenc.pm</target>
+<categoryname>handler</categoryname>
+<description>
+Encryption and decryption of URIs
</description>
<status>works/unverified</status>
</file>
Index: loncom/publisher/packages.tab
diff -u loncom/publisher/packages.tab:1.28 loncom/publisher/packages.tab:1.29
--- loncom/publisher/packages.tab:1.28 Thu Apr 1 10:12:26 2004
+++ loncom/publisher/packages.tab Fri Apr 23 11:23:35 2004
@@ -26,8 +26,10 @@
part&display&type:string
part_0&hiddenparts&display:List of hidden parts
part_0&hiddenparts&type:string_any
-#part_0&encrypturl&type:string_yesno
-#part_0t&encrypturl&display:Do not show plain URL
+part_0&hiddenresource&display:Resource hidden from students
+part_0&hiddenresource&type:string_yesno
+part_0&encrypturl&type:string_yesno
+part_0&encrypturl&display:Do not show plain URL
part_0&mapalias&type:string
part_0&mapalias&display:Resource alias name for conditions
numericalhint&tol&display:Numerical Tolerance
@@ -74,8 +76,8 @@
extension_page&contentopen&type:date_start
extension_page&contentclose&display:Due Date
extension_page&contentclose&type:date_end
-#extension_page&encrypturl&type:string_yesno
-#extension_page&encrypturl&display:Do not show plain URL
+extension_page&encrypturl&type:string_yesno
+extension_page&encrypturl&display:Do not show plain URL
#default parameters for anything that doesn't have any more specific
@@ -87,5 +89,7 @@
default&contentclose&type:date_end
default&mapalias&type:string
default&mapalias&display:Resource alias name for conditions
-#default&encrypturl&type:string_yesno
-#default&encrypturl&display:Do not show plain URL
\ No newline at end of file
+default&encrypturl&type:string_yesno
+default&encrypturl&display:Do not show plain URL
+part_0&hiddenresource&display:Resource Hidden from Students
+part_0&hiddenresource&type:string_yesno
Index: rat/lonuserstate.pm
diff -u rat/lonuserstate.pm:1.72 rat/lonuserstate.pm:1.73
--- rat/lonuserstate.pm:1.72 Mon Apr 5 14:25:08 2004
+++ rat/lonuserstate.pm Fri Apr 23 11:23:35 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Construct and maintain state and binary representation of course for user
#
-# $Id: lonuserstate.pm,v 1.72 2004/04/05 18:25:08 raeburn Exp $
+# $Id: lonuserstate.pm,v 1.73 2004/04/23 15:23:35 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -41,6 +41,7 @@
use Safe;
use Safe::Hole;
use Opcode;
+use Apache::lonenc;
# ---------------------------------------------------- Globals for this package
@@ -52,6 +53,8 @@
my $retfurl; # variable with the very first URL in the course
my %randompick; # randomly picked resources
my %randompickseed; # optional seed for randomly picking resources
+my %encurl; # URLs in this folder are supposed to be encrypted
+my %hiddenurl; # this URL (or complete folder) is supposed to be hidden
# ----------------------------------- Remove version from URL and store in hash
@@ -285,6 +288,12 @@
if ($token->[2]->{'name'} eq 'parameter_randompickseed') {
$randompick{$referid}=$token->[2]->{'value'};
}
+ if ($token->[2]->{'name'} eq 'parameter_encrypturl') {
+ $encurl{$referid}=$token->[2]->{'value'};
+ }
+ if ($token->[2]->{'name'} eq 'parameter_hiddenresource') {
+ $hiddenurl{$referid}=$token->[2]->{'value'};
+ }
}
}
@@ -454,9 +463,9 @@
"request.course.uri" => $courseuri);
}
-# ------------------------------------- Selectively delete from randompick maps
+# ---------------- Selectively delete from randompick maps and hidden url parms
-sub pickrandom {
+sub hiddenurls {
my $randomoutentry='';
foreach my $rid (keys %randompick) {
my $rndpick=$randompick{$rid};
@@ -498,6 +507,18 @@
}
}
}
+# ------------------------------ take care of explicitly hidden urls or folders
+ foreach my $rid (keys %hiddenurl) {
+ $hash{'randomout_'.$rid}=1;
+ my ($mapid,$resid)=split(/\./,$rid);
+ $randomoutentry.='&'.
+ &Apache::lonnet::symbclean(
+ &Apache::lonnet::declutter($hash{'map_id_'.$mapid}).
+ '___'.$resid.'___'.
+ &Apache::lonnet::declutter($hash{'src_'.$rid})
+ ).'&';
+ }
+# --------------------------------------- append randomout entry to environment
if ($randomoutentry) {
&Apache::lonnet::appenv('acc.randomout' => $randomoutentry);
}
@@ -523,6 +544,8 @@
unlink($fn.'.state');
unlink($fn.'parms.db');
undef %randompick;
+ undef %hiddenurl;
+ undef %encurl;
$retfurl='';
if ((tie(%hash,'GDBM_File',"$fn.db",&GDBM_WRCREAT(),0640)) &&
(tie(%parmhash,'GDBM_File',$fn.'_parms.db',&GDBM_WRCREAT(),0640))) {
@@ -540,7 +563,7 @@
if (defined($hash{'map_start_'.$uri})) {
&traceroute('0',$hash{'map_start_'.$uri},'&');
&accinit($uri,$short,$fn);
- &pickrandom();
+ &hiddenurls();
}
# ------------------------------------------------------- Put versions into src
foreach (keys %hash) {