[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm
raeburn
raeburn@source.lon-capa.org
Wed, 04 Nov 2009 14:08:36 -0000
raeburn Wed Nov 4 14:08:36 2009 EDT
Modified files:
/loncom/interface loncommon.pm
Log:
- Accommodate communities.
loncommon.pm
- Extra args for &coursebrowser_javascript() and &selectcourse_link().
- Additional arg in opencrbrowser() javascription function call.
- type_elem form element in opener page will be set when course or community is selected in coursepick pop-up window.
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.908 loncom/interface/loncommon.pm:1.909
--- loncom/interface/loncommon.pm:1.908 Tue Nov 3 03:18:21 2009
+++ loncom/interface/loncommon.pm Wed Nov 4 14:08:36 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.908 2009/11/03 03:18:21 raeburn Exp $
+# $Id: loncommon.pm,v 1.909 2009/11/04 14:08:36 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -482,8 +482,11 @@
}
sub coursebrowser_javascript {
- my ($domainfilter,$sec_element,$formname,$role_element)=@_;
- my $crs_or_grp_alert = &mt('Please select the type of LON-CAPA entity - Course or Community - for which you wish to add/modify a user role.');
+ my ($domainfilter,$sec_element,$formname,$role_element,$crstype) = @_;
+ my $wintitle = &mt('Course Browser');
+ if ($crstype ne '') {
+ $wintitle = &mt($crstype);
+ }
my $id_functions = &javascript_index_functions();
my $output = '
<script type="text/javascript" language="JavaScript">
@@ -491,7 +494,7 @@
var stdeditbrowser;'."\n";
$output .= <<"ENDSTDBRW";
- function opencrsbrowser(formname,uname,udom,desc,extra_element,multflag,crstype) {
+ function opencrsbrowser(formname,uname,udom,desc,extra_element,multflag,type,type_elem) {
var url = '/adm/pickcourse?';
var formid = getFormIdByName(formname);
var domainfilter = getDomainFromSelectbox(formname,udom);
@@ -520,6 +523,12 @@
}
}
}
+ if (type != null && type != '') {
+ url += '&type='+type;
+ }
+ if (type_elem != null && type_elem != '') {
+ url += '&typeelement='+type_elem;
+ }
if (formname == 'ccrs') {
var ownername = document.forms[formid].ccuname.value;
var ownerdom = document.forms[formid].ccdomain.options[document.forms[formid].ccdomain.selectedIndex].value;
@@ -528,19 +537,7 @@
if (multflag !=null && multflag != '') {
url += '&multiple='+multflag;
}
- if (crstype == 'Course/Community') {
- if (formname == 'cu') {
- crstype = document.cu.crstype.options[document.cu.crstype.selectedIndex].value;
- if (crstype == "") {
- alert("$crs_or_grp_alert");
- return;
- }
- }
- }
- if (crstype !=null && crstype != '') {
- url += '&type='+crstype;
- }
- var title = 'Course_Browser';
+ var title = '$wintitle';
var options = 'scrollbars=1,resizable=1,menubar=0';
options += ',width=700,height=600';
stdeditbrowser = open(url,title,options,'1');
@@ -760,19 +757,21 @@
}
sub selectcourse_link {
- my ($form,$unameele,$udomele,$desc,$extra_element,$multflag,$selecttype)=@_;
+ my ($form,$unameele,$udomele,$desc,$extra_element,$multflag,$selecttype,
+ $typeelement) = @_;
+ my $type = $selecttype;
my $linktext = &mt('Select Course');
if ($selecttype eq 'Community') {
- $linktext = &mt('Select Community');
+ $linktext = &mt('Select Community');
} elsif ($selecttype eq 'Course/Community') {
$linktext = &mt('Select Course/Community');
- $selecttype = 'Course';
+ $type = '';
}
return '<span class="LC_nobreak">'
."<a href='"
.'javascript:opencrsbrowser("'.$form.'","'.$unameele
.'","'.$udomele.'","'.$desc.'","'.$extra_element
- .'","'.$multflag.'","'.$selecttype.'");'
+ .'","'.$multflag.'","'.$type.'","'.$typeelement.'");'
."'>".$linktext.'</a>'
.'</span>';
}