[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm loncreateuser.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Thu, 02 Aug 2007 01:07:02 -0000
This is a MIME encoded message
--albertel1186016822
Content-Type: text/plain
albertel Wed Aug 1 21:07:02 2007 EDT
Modified files:
/loncom/interface loncommon.pm loncreateuser.pm
Log:
- Felicia suggested interface changes
- ordering of dropdowns
- failed to find user, give them a make new user button
- make scope of search radio buttons
--albertel1186016822
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20070801210702.txt"
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.557 loncom/interface/loncommon.pm:1.558
--- loncom/interface/loncommon.pm:1.557 Tue Jul 31 14:22:02 2007
+++ loncom/interface/loncommon.pm Wed Aug 1 21:07:00 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.557 2007/07/31 18:22:02 albertel Exp $
+# $Id: loncommon.pm,v 1.558 2007/08/02 01:07:00 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -334,10 +334,12 @@
return (<<'ENDSTDBRW');
<script type="text/javascript" language="Javascript" >
var stdeditbrowser;
- function openstdbrowser(formname,uname,udom,roleflag) {
+ function openstdbrowser(formname,uname,udom,roleflag,ignorefilter) {
var url = '/adm/pickstudent?';
var filter;
- eval('filter=document.'+formname+'.'+uname+'.value;');
+ if (!ignorefilter) {
+ eval('filter=document.'+formname+'.'+uname+'.value;');
+ }
if (filter != null) {
if (filter != '') {
url += 'filter='+filter+'&';
@@ -365,7 +367,7 @@
return '';
}
return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele.
- '","'.$udomele.'");'."'>".&mt('Select User')."</a>";
+ '","'.$udomele.'","","1");'."'>".&mt('Select User')."</a>";
}
if ($env{'request.role'}=~/^(au|dc|su)/) {
return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele.
@@ -5555,25 +5557,25 @@
}
$srchterm = $srch->{'srchterm'};
}
-
+ use Data::Dumper;
+ &Apache::lonnet::logthis(&Dumper($srch));
my %lt=&Apache::lonlocal::texthash(
- 'usr' => 'Search for',
- 'or' => 'or',
- 'in' => 'in',
- 'doma' => 'domain',
- 'uname' => 'username',
- 'lastname' => 'last name',
+ 'usr' => 'Search for',
+ 'or' => 'or',
+ 'doma' => 'domain',
+ 'uname' => 'username',
+ 'lastname' => 'last name',
'lastfirst' => 'last name, first name',
- 'crs' => 'this course',
- 'dom' => 'this domain',
- 'alc' => 'all LON-CAPA',
- 'instd' => 'institutional directory',
- 'exact' => 'as exact match to',
- 'contains' => 'contained in',
+ 'crs' => 'in this course',
+ 'dom' => 'in this domain',
+ 'alc' => 'all LON-CAPA',
+ 'instd' => 'in institutional directory',
+ 'exact' => 'is',
+ 'contains' => 'contains',
);
my $domform = &select_dom_form($currdom,'srchdomain',1);
- my $srchinsel = ' <select name="srchin">';
+ my $srchin;
my @srchins = ('crs','dom','alc','instd');
@@ -5583,15 +5585,18 @@
# has been completed.
next if ($option eq 'alc');
next if ($option eq 'crs' && !$env{'request.course.id'});
- if ($curr_selected{'srchin'} eq $option) {
- $srchinsel .= '
- <option value="'.$option.'" selected="selected">'.$lt{$option}.'</option>';
- } else {
- $srchinsel .= '
- <option value="'.$option.'">'.$lt{$option}.'</option>';
- }
+ my $checked =($curr_selected{'srchin'} eq $option) ?'checked="checked"'
+ :'';
+ my $extra = ($option eq 'dom') ? $domform
+ : '';
+ $srchin.=<<ROW
+ <tr>
+ <td>
+ <label><input type="radio" name="srchin" value="$option" $checked /> $lt{$option}</label> $extra
+ </td>
+</tr>
+ROW
}
- $srchinsel .= "\n </select>\n";
my $srchbysel = ' <select name="srchby">';
foreach my $option ('uname','lastname','lastfirst') {
@@ -5617,20 +5622,13 @@
}
$srchtypesel .= "\n </select>\n";
- my ($newuserscript,$newuservalidate);
+ my ($newuserscript,$new_user_create);
if ($forcenewuser) {
+ $new_user_create = '<p> <input type="submit" name="forcenew" value="'.&HTML::Entities::encode(&mt('Make new user "[_1]"',$srchterm),'<>&"').'" onclick="javascript:setSearch(\'1\');" /> </p>';
$newuserscript = <<"ENDSCRIPT";
-function setSearch() {
- var createnew = 0;
- for (var i=0; i<document.crtuser.forcenew.length; i++) {
- if (document.crtuser.forcenew[i].checked) {
- if (document.crtuser.forcenew[i].value == 1) {
- createnew = 1;
- }
- }
- }
+function setSearch(createnew) {
if (createnew == 1) {
for (var i=0; i<document.crtuser.srchby.length; i++) {
if (document.crtuser.srchby.options[i].value == 'uname') {
@@ -5638,8 +5636,8 @@
}
}
for (var i=0; i<document.crtuser.srchin.length; i++) {
- if (document.crtuser.srchin.options[i].value == 'dom') {
- document.crtuser.srchin.selectedIndex = i;
+ if ( document.crtuser.srchin[i].value == 'dom') {
+ document.crtuser.srchin[i].checked = 1;
}
}
for (var i=0; i<document.crtuser.srchtype.length; i++) {
@@ -5655,17 +5653,21 @@
}
}
ENDSCRIPT
- $newuservalidate = <<"ENDBLOCK";
-setSearch();
-ENDBLOCK
+
}
my $output = <<"END_BLOCK";
<script type="text/javascript">
function validateEntry() {
- $newuservalidate
+
var checkok = 1;
- var srchin = document.crtuser.srchin.options[document.crtuser.srchin.selectedIndex].value;
+ var srchin;
+ for (var i=0; i<document.crtuser.srchin.length; i++) {
+ if ( document.crtuser.srchin[i].checked ) {
+ srchin = document.crtuser.srchin[i].value;
+ }
+ }
+
var srchtype = document.crtuser.srchtype.options[document.crtuser.srchtype.selectedIndex].value;
var srchby = document.crtuser.srchby.options[document.crtuser.srchby.selectedIndex].value;
var srchdomain = document.crtuser.srchdomain.options[document.crtuser.srchdomain.selectedIndex].value;
@@ -5717,31 +5719,21 @@
$newuserscript
</script>
+
+$new_user_create
+
<table>
-<tr>
- <td align="right">$lt{'usr'}:</td><td><input type="text" size="15" name="srchterm" value="$srchterm" /></td>
- <td>
-$srchtypesel
- </td>
- <td>
-$srchbysel
- </td>
-</tr>
-<tr>
- <td align="right">$lt{'in'}:</td>
- <td colspan="2">
-$srchinsel
- </td>
-</tr>
-<tr>
- <td align="right">$lt{'doma'}:</td><td colspan="2">$domform</td>
-</tr>
+ <tr>
+ <td> $srchbysel
+ $srchtypesel
+ <input type="text" size="15" name="srchterm" value="$srchterm" />
+ </td>
+ </tr>
+$srchin
</table>
<br />
END_BLOCK
- if ($forcenewuser) {
- $output .= '<span class="LC_nobreak">'.&mt('Make new user if no match found: ').'<label><input type="radio" name="forcenew" value="1" onclick="javascript:setSearch()" />'.&mt('Yes').'</label> <label><input type="radio" name="forcenew" value="0" checked="checked" />'.&mt('No').'</label></span><br />';
- }
+
return $output;
}
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.167 loncom/interface/loncreateuser.pm:1.168
--- loncom/interface/loncreateuser.pm:1.167 Wed Aug 1 21:04:41 2007
+++ loncom/interface/loncreateuser.pm Wed Aug 1 21:07:00 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.167 2007/08/02 01:04:41 albertel Exp $
+# $Id: loncreateuser.pm,v 1.168 2007/08/02 01:07:00 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2459,7 +2459,6 @@
}
}
}
- $response .= '<br />'.&mt("To add as a new user:").'<ul><li>'.&mt("Enter the proposed username in the <i>'Search for'</i> box").'</li><li>'.&mt("Set <i>'Make new user if no match found</i>' to <b>Yes</b>").'</li><li>'.&mt("Click <i>'Search'</i>").'</li></ul>'.&mt("Note: you can only create new users in the domain of your current role - [_1]",$env{'request.role.domain'}).'<br /><br />';
}
}
}
@@ -2470,7 +2469,7 @@
my %elements = (
crtuser => {
srchterm => 'text',
- srchin => 'selectbox',
+ srchin => 'radio',
srchby => 'selectbox',
srchtype => 'selectbox',
srchdomain => 'selectbox',
--albertel1186016822--