[LON-CAPA-cvs] cvs: loncom(version_2_5_X) /interface loncommon.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Wed, 05 Sep 2007 00:00:27 -0000


albertel		Tue Sep  4 20:00:27 2007 EDT

  Modified files:              (Branch: version_2_5_X)
    /loncom/interface	loncommon.pm 
  Log:
  - backport 1.576
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.564.2.7 loncom/interface/loncommon.pm:1.564.2.8
--- loncom/interface/loncommon.pm:1.564.2.7	Tue Sep  4 19:59:53 2007
+++ loncom/interface/loncommon.pm	Tue Sep  4 20:00:26 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.564.2.7 2007/09/04 23:59:53 albertel Exp $
+# $Id: loncommon.pm,v 1.564.2.8 2007/09/05 00:00:26 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4451,6 +4451,10 @@
   white-space: nowrap;
 }
 
+span.LC_cusr_emph {
+  font-style: italic;
+}
+
 table.LC_docs_documents {
   background: #BBBBBB;
   border-width: 0px;
@@ -5578,7 +5582,7 @@
                     'lastname'  => 'last name',
                     'lastfirst' => 'last name, first name',
                     'crs'       => 'in this course',
-                    'dom'       => 'in selected domain', 
+                    'dom'       => 'in selected LON-CAPA domain', 
                     'alc'       => 'all LON-CAPA',
                     'instd'     => 'in institutional directory for selected domain',
                     'exact'     => 'is',
@@ -5641,7 +5645,16 @@
     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\','.$caller.');" /> </p>';
+        if (ref($srch) eq 'HASH') {
+            if ($srch->{'srchby'} eq 'uname' && $srch->{'srchtype'} eq 'exact' && $srch->{'srchin'} eq 'dom' && $srch->{'srchdomain'} eq $env{'request.role.domain'}) {
+	        $new_user_create = '<p> <input type="submit" name="forcenew" value="'.&HTML::Entities::encode(&mt('Make new user "[_1]"',$srchterm),'<>&"').'" onclick="javascript:setSearch(\'1\','.$caller.');" /> </p>';
+            } else {
+                $new_user_create = &newuser_radio($caller);
+            }
+        } else {
+            $new_user_create = &newuser_radio($caller);
+        }
+
         $newuserscript = <<"ENDSCRIPT";
 
 function setSearch(createnew,callingForm) {
@@ -5767,6 +5780,11 @@
     return $output;
 }
 
+sub newuser_radio {
+    my ($caller) = @_;
+    return '<span class="LC_nobreak">'.&mt('Make new user if no match found: ').'<input type="radio" name="forcenew" value="1" onclick="javascript:setSearch(\'1\','.$caller.')" />'.&mt('Yes').'&nbsp;&nbsp;<input type="radio" name="forcenew" value="0" checked="checked" />'.&mt('No').'</span><br />';
+}
+
 
 
 =pod