[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonpickcourse.pm /publisher lonrights.pm
www
lon-capa-cvs@mail.lon-capa.org
Thu, 27 Mar 2003 20:56:30 -0000
www Thu Mar 27 15:56:30 2003 EDT
Modified files:
/loncom/interface loncommon.pm lonpickcourse.pm
/loncom/publisher lonrights.pm
Log:
First use of "pick-a-course" - does not set domain yet.
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.90 loncom/interface/loncommon.pm:1.91
--- loncom/interface/loncommon.pm:1.90 Wed Mar 26 14:34:42 2003
+++ loncom/interface/loncommon.pm Thu Mar 27 15:56:30 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.90 2003/03/26 19:34:42 www Exp $
+# $Id: loncommon.pm,v 1.91 2003/03/27 20:56:30 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -347,6 +347,36 @@
}
return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele.
'","'.$udomele.'");'."'>Select</a>";
+}
+
+sub coursebrowser_javascript {
+ return (<<'ENDSTDBRW');
+<script type="text/javascript" language="Javascript" >
+ var stdeditbrowser;
+ function opencrsbrowser(formname,uname,udom) {
+ var url = '/adm/pickcourse?';
+ var filter;
+ if (filter != null) {
+ if (filter != '') {
+ url += 'filter='+filter+'&';
+ }
+ }
+ url += 'form=' + formname + '&cnumelement='+uname+
+ '&cdomelement='+udom;
+ var title = 'Course Browser';
+ var options = 'scrollbars=1,resizable=1,menubar=0';
+ options += ',width=700,height=600';
+ stdeditbrowser = open(url,title,options,'1');
+ stdeditbrowser.focus();
+ }
+</script>
+ENDSTDBRW
+}
+
+sub selectcourse_link {
+ my ($form,$unameele,$udomele)=@_;
+ return "<a href='".'javascript:opencrsbrowser("'.$form.'","'.$unameele.
+ '","'.$udomele.'");'."'>Select Course</a>";
}
###############################################################
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.5 loncom/interface/lonpickcourse.pm:1.6
--- loncom/interface/lonpickcourse.pm:1.5 Wed Mar 26 21:05:43 2003
+++ loncom/interface/lonpickcourse.pm Thu Mar 27 15:56:30 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Pick a course
#
-# $Id: lonpickcourse.pm,v 1.5 2003/03/27 02:05:43 www Exp $
+# $Id: lonpickcourse.pm,v 1.6 2003/03/27 20:56:30 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -103,9 +103,10 @@
</form>
<hr />
ENDSCRIPT
- $r->rflush();
# ---------------------------------------------------------------- Get the data
if ($ENV{'form.gosearch'}) {
+ $r->print('Searching ...<br /> <br />');
+ $r->rflush();
unless ($descriptfilter) { $descriptfilter='.'; }
my $timefilter=($sincefilter==-1?1:time-$sincefilter);
my %courses=
Index: loncom/publisher/lonrights.pm
diff -u loncom/publisher/lonrights.pm:1.7 loncom/publisher/lonrights.pm:1.8
--- loncom/publisher/lonrights.pm:1.7 Fri Mar 21 09:13:30 2003
+++ loncom/publisher/lonrights.pm Thu Mar 27 15:56:30 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to show and edit custom distribution rights
#
-# $Id: lonrights.pm,v 1.7 2003/03/21 14:13:30 www Exp $
+# $Id: lonrights.pm,v 1.8 2003/03/27 20:56:30 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -44,7 +44,8 @@
$r->send_http_header;
$r->print(
- '<html><head><title>LON-CAPA Custom Distribution Rights</title></head>');
+ '<html><head><title>LON-CAPA Custom Distribution Rights</title>'.
+ &Apache::loncommon::coursebrowser_javascript().'</head>');
$r->print(&Apache::loncommon::bodytag('Custom Distribution Rights'));
$r->rflush();
@@ -152,7 +153,7 @@
$contents=join('',<$fh>);
$fh->close();
}
- $r->print('<form method="post">');
+ $r->print('<form name="rules" method="post">');
}
unless ($contents=~/\<accessrule/s) {
$contents='<accessrule effect="deny" />';
@@ -199,7 +200,7 @@
while ($token=$parser->get_token) {
if (($token->[0] eq 'S') && ($token->[1] eq 'accessrule')) {
$rulecounter++;
- $r->print('<tr><td align="right">');
+ $r->print('<tr><td align="right" rowspan="2">');
# insert, delete, etc
$r->print($rulecounter.'. ');
if ($constructmode) {
@@ -212,7 +213,7 @@
'moveup' => 'Move rule up',
'movedown' => 'Move rule down')));
}
- $r->print('</td><td>');
+ $r->print('</td><td rowspan="2">');
# effect
if ($constructmode) {
$r->print(&Apache::loncommon::select_form
@@ -245,7 +246,7 @@
$r->print($rcourse);
}
- $r->print('</td><td>');
+ $r->print('</td><td rowspan="2">');
# realm section
if ($constructmode) {
$r->print('<input input type="text" size="5" name="section_'.
@@ -254,7 +255,7 @@
$r->print($rsec);
}
- $r->print('</td><td>');
+ $r->print('</td><td rowspan="2">');
# role
if ($constructmode) {
my %hash=('' => '');
@@ -268,6 +269,15 @@
} else {
$r->print(&Apache::lonnet::plaintext($token->[2]->{'role'}));
}
+# course selection link
+ $r->print('</td></tr><tr><td colspan="2" align="right">');
+ if ($rcourse) {
+ my %descript=
+ &Apache::lonnet::coursedescription($rdom.'_'.$rcourse);
+ $r->print($descript{'description'}.' ');
+ }
+ $r->print(&Apache::loncommon::selectcourse_link('rules',
+ 'course_'.$rulecounter,'domain_'.$rulecounter));
# close row
$r->print('</td></tr>');
}