[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm loncreateuser.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Wed, 15 Aug 2007 16:25:16 -0000


This is a MIME encoded message

--raeburn1187195116
Content-Type: text/plain

raeburn		Wed Aug 15 12:25:16 2007 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm loncommon.pm 
  Log:
  loncomon.pm
  - &select_dom_form() can optionally include domain description in adddition to domain name.
  - revert some of the changes in rev 1.558 (8/2).
      - "search in" changed from radio back to selectbox
      - "search in" included in search criteria line.
   (N.B., a domain selection is required for both domain and institutional directory searching, and may also be used in a course-specific search).
  - propagate wording changes in 1.558 to messages displayed in alerts
  - checking of domain selection on form submission now works
  
  loncreateuser.pm 
  - revert change in rev 1.168 (8/2)
  - propagate wording change in loncommon.pm 1.558
  - consistency in header title
  - consistency in breadcrumb text 
  
  
  
--raeburn1187195116
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20070815122516.txt"

Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.171 loncom/interface/loncreateuser.pm:1.172
--- loncom/interface/loncreateuser.pm:1.171	Tue Aug 14 12:53:15 2007
+++ loncom/interface/loncreateuser.pm	Wed Aug 15 12:25:14 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.171 2007/08/14 16:53:15 albertel Exp $
+# $Id: loncreateuser.pm,v 1.172 2007/08/15 16:25:14 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -216,7 +216,7 @@
 				       $jscript,{'add_entries' => \%loaditems,});
    &Apache::lonhtmlcommon::add_breadcrumb
      ({href=>"javascript:backPage(document.crtuser)",
-       text=>"User modify/custom role",
+       text=>"User modify/custom role edit",
        faq=>282,bug=>'Instructor Interface',});
 
     my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('User Management');
@@ -329,7 +329,7 @@
 ENDSCRIPT
 
     my %lt=&Apache::lonlocal::texthash(
-                                       'srch'           => "User Search to add/modify roles of",
+                                       'srch'           => "User Search to add/modify roles",
                                        'username'       => "username",
                                        'domain'         => "domain",
                                        'lastname'       => "last name",
@@ -347,7 +347,7 @@
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management'));
     $r->print("<b>$lt{'srch'}</b><br />");
     $r->print(&entry_form($srch->{'srchdomain'},$srch));
-    $r->print('<h3>'.&mt('Select a user to add/modify roles of').'</h3>');
+    $r->print('<h3>'.&mt('Select a user to add/modify roles').'</h3>');
     $r->print('<form name="usersrchform" method="post">'.
               &Apache::loncommon::start_data_table()."\n".
               &Apache::loncommon::start_data_table_header_row()."\n".
@@ -2391,13 +2391,13 @@
                        uname     => 'username',
                        lastfirst => 'last name, first name',
                        lastname  => 'last name',
-                       contains  => 'is contained in',
+                       contains  => 'contains',
                        exact     => 'as exact match to'
                    );
     if ($can_search) {
         if (ref($dom_inst_srch{'directorysrch'}{'searchby'}) eq 'ARRAY') {
             if (!grep(/^\Q$srch->{'srchby'}\E$/,@{$dom_inst_srch{'directorysrch'}{'searchby'}})) {
-                return &mt('Directory search in domain: [_1] is not available for searching by [_2]',$srch->{'srchdomain'},$longtext{$srch->{'srchby'}});
+                return &mt('Directory search in domain: [_1] is not available for searching by "[_2]"',$srch->{'srchdomain'},$longtext{$srch->{'srchby'}});
             }
         } else {
             return &mt('Directory search in domain: [_1] is not available.', $srch->{'srchdomain'});
@@ -2408,7 +2408,7 @@
             ($dom_inst_srch{'directorysrch'}{'searchtypes'} eq $srch->{'srchtype'})) {
             return 'ok';
         } else {    
-            return &mt('Directory search in domain [_1] is not available for the requested search type: [_2]',$srch->{'srchdomain'},$longtext{$srch->{'srchtype'}});
+            return &mt('Directory search in domain [_1] is not available for the requested search type: "[_2]"',$srch->{'srchdomain'},$longtext{$srch->{'srchtype'}});
         }
     }
 }
@@ -2487,7 +2487,7 @@
     my %elements = (
        crtuser => {
            srchterm => 'text',
-           srchin => 'radio',
+           srchin => 'selectbox',
            srchby => 'selectbox',
            srchtype => 'selectbox',
            srchdomain => 'selectbox',
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.562 loncom/interface/loncommon.pm:1.563
--- loncom/interface/loncommon.pm:1.562	Tue Aug 14 15:32:27 2007
+++ loncom/interface/loncommon.pm	Wed Aug 15 12:25:14 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.562 2007/08/14 19:32:27 albertel Exp $
+# $Id: loncommon.pm,v 1.563 2007/08/15 16:25:14 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1424,7 +1424,7 @@
 
 =pod
 
-=item * select_dom_form($defdom,$name,$includeempty)
+=item * select_dom_form($defdom,$name,$includeempty,$showdomdesc)
 
 Returns a string containing a <select name='$name' size='1'> form to 
 allow a user to select the domain to preform an operation in.  
@@ -1433,18 +1433,28 @@
 If the $includeempty flag is set, it also includes an empty choice ("no domain
 selected");
 
+If the $showdomdesc flag is set, the domain name is followed by the domain description. 
+
 =cut
 
 #-------------------------------------------
 sub select_dom_form {
-    my ($defdom,$name,$includeempty) = @_;
+    my ($defdom,$name,$includeempty,$showdomdesc) = @_;
     my @domains = sort {lc($a) cmp lc($b)} (&Apache::lonnet::all_domains());
     if ($includeempty) { @domains=('',@domains); }
     my $selectdomain = "<select name=\"$name\" size=\"1\">\n";
     foreach my $dom (@domains) {
         $selectdomain.="<option value=\"$dom\" ".
-            ($dom eq $defdom ? 'selected="selected" ' : '').
-                ">$dom</option>\n";
+            ($dom eq $defdom ? 'selected="selected" ' : '').'>'.$dom;
+        if ($showdomdesc) {
+            if ($dom ne '') {
+                my $domdesc = &Apache::lonnet::domain($dom,'description');
+                if ($domdesc ne '') {
+                    $selectdomain .= ' ('.$domdesc.')';
+                }
+            } 
+        }
+        $selectdomain .= "</option>\n";
     }
     $selectdomain.="</select>";
     return $selectdomain;
@@ -5565,9 +5575,8 @@
         $srchterm = $srch->{'srchterm'};
     }
     my %lt=&Apache::lonlocal::texthash(
-                    'usr'       => 'Search for',
-                    'or'        => 'or',
-                    'doma'      => 'domain',
+                    'usr'       => 'Search criteria',
+                    'doma'      => 'Domain/institution to search',
                     'uname'     => 'username',
                     'lastname'  => 'last name',
                     'lastfirst' => 'last name, first name',
@@ -5578,9 +5587,8 @@
                     'exact'     => 'is',
                     'contains'  => 'contains',
                                        );
-    my $domform = &select_dom_form($currdom,'srchdomain',1);
-
-    my $srchin;
+    my $domform = &select_dom_form($currdom,'srchdomain',1,1);
+    my $srchinsel = ' <select name="srchin">';
 
     my @srchins = ('crs','dom','alc','instd');
 
@@ -5590,18 +5598,15 @@
         #       has been completed.
         next if ($option eq 'alc');
         next if ($option eq 'crs' && !$env{'request.course.id'});
-        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
+        if ($curr_selected{'srchin'} eq $option) {
+            $srchinsel .= ' 
+   <option value="'.$option.'" selected="selected">'.$lt{$option}.'</option>';
+        } else {
+            $srchinsel .= '
+   <option value="'.$option.'">'.$lt{$option}.'</option>';
+        }
     }
+    $srchinsel .= "\n  </select>\n";
 
     my $srchbysel =  ' <select name="srchby">';
     foreach my $option ('uname','lastname','lastfirst') {
@@ -5641,8 +5646,8 @@
             }
         }
         for (var i=0; i<document.crtuser.srchin.length; i++) {
-            if ( document.crtuser.srchin[i].value == 'dom') {
-		document.crtuser.srchin[i].checked = 1;
+            if ( document.crtuser.srchin.options[i].value == 'dom') {
+		document.crtuser.srchin.selectedIndex = i;
             }
         }
         for (var i=0; i<document.crtuser.srchtype.length; i++) {
@@ -5677,6 +5682,7 @@
     var srchby = document.crtuser.srchby.options[document.crtuser.srchby.selectedIndex].value;
     var srchdomain = document.crtuser.srchdomain.options[document.crtuser.srchdomain.selectedIndex].value;
     var srchterm =  document.crtuser.srchterm.value;
+    var srchin = document.crtuser.srchin.options[document.crtuser.srchin.selectedIndex].value;
     var msg = "";
 
     if (srchterm == "") {
@@ -5687,7 +5693,7 @@
     if (srchtype== 'contains') {
         if (srchterm.length < 3) {
             checkok = 0;
-            msg += "The text you are searching for must contain at least three characters when using a 'contained in' type search.\\n";
+            msg += "The text you are searching for must contain at least three characters when using a 'contains' type search.\\n";
         }
     }
     if (srchin == 'instd') {
@@ -5729,12 +5735,18 @@
 
 <table>
  <tr>
-  <td> $srchbysel
-       $srchtypesel 
-       <input type="text" size="15" name="srchterm" value="$srchterm" />
+  <td>$lt{'usr'}:</td>
+  <td>$srchbysel
+      $srchtypesel 
+      <input type="text" size="15" name="srchterm" value="$srchterm" />
+      &nbsp;&nbsp;$srchinsel 
+  </td>
+ </tr>
+ <tr>
+  <td align="right">$lt{'doma'}:</td>
+  <td>$domform</td>
   </td>
  </tr>
-$srchin
 </table>
 <br />
 END_BLOCK

--raeburn1187195116--