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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sun, 20 Jan 2008 22:25:07 -0000


This is a MIME encoded message

--raeburn1200867907
Content-Type: text/plain

raeburn		Sun Jan 20 17:25:07 2008 EDT

  Modified files:              
    /loncom/interface	lonuserutils.pm loncreateuser.pm lonaboutme.pm 
  Log:
  Bug 5545. User can choose to display either "Modify user" or User's "About Me" page in a pop-up window.  Display of inline nav suppressed and "Close window" link provided at the end of the page in pop-up window.  
  
  
--raeburn1200867907
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20080120172507.txt"

Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.49 loncom/interface/lonuserutils.pm:1.50
--- loncom/interface/lonuserutils.pm:1.49	Sat Jan 19 19:19:11 2008
+++ loncom/interface/lonuserutils.pm	Sun Jan 20 17:25:05 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.49 2008/01/20 00:19:11 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.50 2008/01/20 22:25:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1994,19 +1994,30 @@
         }
     }
     if (target == 'modify') {
-        document.studentform.srchterm.value=username;
-        document.studentform.srchdomain.value=domain;
-        document.studentform.phase.value='get_user_info';
-        document.studentform.action.value = 'singleuser';
-        document.studentform.submit();
+        if (document.studentform.userwin.checked == true) {
+            var url = '/adm/createuser?srchterm='+username+'&srchdomain='+domain+'&phase=get_user_info&action=singleuser&srchin=dom&srchby=uname&srchtype=exact&popup=1';
+            var options = 'height=600,width=800,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no';
+            modifywin = window.open(url,'',options,1);
+            modifywin.focus();
+            return;
+        } else {
+            document.studentform.srchterm.value=username;
+            document.studentform.srchdomain.value=domain;
+            document.studentform.phase.value='get_user_info';
+            document.studentform.action.value = 'singleuser';
+            document.studentform.submit();
+        }
     }
     if (target == 'aboutme') {
-        document.location.href = '/adm/'+domain+'/'+username+'/aboutme';
-    }
-    if (target == 'aboutmewin') {
-        var url = '/adm/'+domain+'/'+username+'/aboutme';
-        var options = 'height=600,width=800,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no';
-        aboutmewin = window.open(url,'',options,1);
+        if (document.studentform.userwin.checked == true) {
+            var url = '/adm/'+domain+'/'+username+'/aboutme?popup=1';
+            var options = 'height=600,width=800,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no';
+            aboutmewin = window.open(url,'',options,1);
+            aboutmewin.focus();
+            return;
+        } else {
+            document.location.href = '/adm/'+domain+'/'+username+'/aboutme';
+        }
     }
 }
 </script>
@@ -2041,7 +2052,7 @@
                        'ac'         => "Action to take for selected users",
                        'link'       => "Behavior of username links",
                        'aboutme'    => "Display a user's personal page",
-                       'aboutmewin' => "Display a user's personal page in a new window",
+                       'owin'       => "Open in a new window",
                        'modify'     => "Modify a user's information",
                       );
     if ($context eq 'domain' && $env{'form.roletype'} eq 'course') {
@@ -2098,7 +2109,7 @@
 <input type="hidden" name="srchdomain" value="" /> 
 END
             $output = '<p>';
-            my @linkdests = ('aboutme','aboutmewin');
+            my @linkdests = ('aboutme');
             if ($permission->{'cusr'}) {
                 unshift (@linkdests,'modify');
             }
@@ -2114,7 +2125,11 @@
                 }
                 $output .= '<label><input type="radio" name="usernamelink" value="'.$item.'"'.$checkedstr.'>&nbsp;'.$lt{$item}.'</label>&nbsp;&nbsp;';
             }
-            $output .= '</span><br />';
+            my $checkwin;
+            if ($env{'form.userwin'}) { 
+                $checkwin = 'checked = "checked"'; 
+            }
+            $output .= '&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="userwin" value="1" $checkwin />'.$lt{'owin'}.'</span><br />';
             if ($actionselect) {
                 $output .= <<"END";
 $lt{'ac'}:&nbsp;$actionselect <input type="button" value="$lt{'go'}" onclick="javascript:opendatebrowser(this.form,'studentform','go')" /></p>
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.232 loncom/interface/loncreateuser.pm:1.233
--- loncom/interface/loncreateuser.pm:1.232	Sat Jan 19 20:40:37 2008
+++ loncom/interface/loncreateuser.pm	Sun Jan 20 17:25:05 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.232 2008/01/20 01:40:37 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.233 2008/01/20 22:25:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -355,7 +355,7 @@
 <input type="hidden" name="action" value="$env{'form.action'}" />
 <input type="hidden" name="phase" value="createnewuser" />
 <input type="hidden" name="srchtype" value="exact" />
-<input type="hidden" name="srchby" value="username" />
+<input type="hidden" name="srchby" value="uname" />
 <input type="hidden" name="srchin" value="dom" />
 <input type="hidden" name="forcenewuser" value="1" />
 <input type="hidden" name="origform" value="crtusername" />
@@ -603,9 +603,12 @@
 
     my $js = &validation_javascript($context,$ccdomain,$pjump_def,
                                $groupslist,$newuser,$formname,\%loaditem);
+    my $args = {'add_entries' => \%loaditem};  
+    if ($env{'form.popup'}) {
+       $args->{'no_nav_bar'} = 1; 
+    }
     my $start_page = 
-	&Apache::loncommon::start_page('User Management',
-				       $js,{'add_entries' => \%loaditem,});
+	&Apache::loncommon::start_page('User Management',$js,$args);
     my %breadcrumb_text = &singleuser_breadcrumb();
     &Apache::lonhtmlcommon::add_breadcrumb
      ({href=>"javascript:backPage($form)",
@@ -1486,7 +1489,13 @@
     my $jscript = '<script type="text/javascript">'."\n".
                   $jsback."\n".'</script>'."\n";
     my %breadcrumb_text = &singleuser_breadcrumb();
-    $r->print(&Apache::loncommon::start_page($title,$jscript));
+    my $args;
+    if ($env{'form.popup'}) {
+        $args->{'no_nav_bar'} = 1;
+    } else {
+        $args = undef;
+    }
+    $r->print(&Apache::loncommon::start_page($title,$jscript,$args));
     &Apache::lonhtmlcommon::add_breadcrumb
        ({href=>"javascript:backPage(document.userupdate)",
          text=>$breadcrumb_text{'search'},
@@ -2054,8 +2063,12 @@
             }
         }
         my $userinfo = &Apache::loncommon::plainname($env{'form.ccuname'},
-                                                     $env{'form.ccdomain'}); 
-        $r->print('<p><a href="javascript:backPage(document.userupdate,'."'$env{'form.prevphase'}','modify'".')">'.&mt('Modify this user: <span class="LC_cusr_emph">([_1])</span>',$userinfo).'</a>'.('&nbsp;'x5).'<a href="javascript:backPage(document.userupdate)">'.&mt('Create/Modify Another User').'</a></p>');
+                                                     $env{'form.ccdomain'});
+        if ($env{'form.popup'}) {
+            $r->print('<p><a href="javascript:window.close()">'.&mt('Close window').'</a></p>');
+        } else {
+            $r->print('<p><a href="javascript:backPage(document.userupdate,'."'$env{'form.prevphase'}','modify'".')">'.&mt('Modify this user: <span class="LC_cusr_emph">([_1])</span>',$userinfo).'</a>'.('&nbsp;'x5).'<a href="javascript:backPage(document.userupdate)">'.&mt('Create/Modify Another User').'</a></p>');
+        }
     }
     $r->print(&Apache::loncommon::end_page());
 }
@@ -2752,7 +2765,8 @@
         $context = 'domain';
     }
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-        ['action','state','callingform','roletype','showrole','bulkaction']);
+        ['action','state','callingform','roletype','showrole','bulkaction','popup','phase',
+         'username','domain','srchterm','srchdomain','srchin','srchby','srchtype']);
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     if ($env{'form.action'} ne 'dateselect') {
         &Apache::lonhtmlcommon::add_breadcrumb
Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.68 loncom/interface/lonaboutme.pm:1.69
--- loncom/interface/lonaboutme.pm:1.68	Sat Jan 19 22:27:16 2008
+++ loncom/interface/lonaboutme.pm	Sun Jan 20 17:25:05 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # "About Me" Personal Information
 #
-# $Id: lonaboutme.pm,v 1.68 2008/01/20 03:27:16 raeburn Exp $
+# $Id: lonaboutme.pm,v 1.69 2008/01/20 22:25:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -69,7 +69,7 @@
 # ------------------------------------------------------------ Get Query String
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
 					    ['forceedit','forcestudent',
-					     'register']);
+					     'register','popup']);
 
 # ----------------------------------------------- Available Portfolio file display 
     if (($target ne 'tex') && ($action eq 'portfolio')) {
@@ -115,12 +115,14 @@
     my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum);
     if ($target ne 'tex') {
 	my $rss_link = &Apache::lonrss::rss_link($cnum,$cdom);
+        my $args = {'function' => $forcestudent,
+                    'domain'   => $cdom,
+                    'force_register' => $forceregister};
+        if ($env{'form.popup'}) {
+            $args->{'no_nav_bar'} = 1;
+        }
 	my $start_page = 
-	    &Apache::loncommon::start_page("Personal Information", $rss_link,
-					   {'function'       => $forcestudent,
- 					    'domain'         => $cdom,
-					    'force_register' =>
-						            $forceregister,});
+	    &Apache::loncommon::start_page("Personal Information",$rss_link,$args);
 	$r->print($start_page);
 	$r->print('<h1>'.&Apache::loncommon::plainname($cnum,$cdom).'</h1>');
     } else {
@@ -147,14 +149,14 @@
        if ($forcestudent or $target eq 'tex') { $allowed=0; }
  
        if ($allowed) {
-           my $query_string = &build_query_string({'forcestudent' => '1',});
+           my $query_string = &build_query_string({'forcestudent' => '1','popup' => $env{'form.popup'}});
 	   $r->print('<p><b>'.&mt('Privacy Note').':</b> '.
 		     &mt('The information you submit can be viewed by anybody who is logged into LON-CAPA. Do not provide information that you are not ready to share publicly.').
 		     '</p>'.
 		     &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes')).'</p><p><a href="'.$r->uri.$query_string.'">'.&mt('Show Public View').'</a>'.
 		     &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'</p>');
        } elsif ($privleged && $target ne 'tex') {
-           my $query_string = &build_query_string({'forceedit' => '1',});
+           my $query_string = &build_query_string({'forceedit' => '1','popup' => $env{'form.popup'}});
 	   $r->print('<p><a href="'.$r->uri.$query_string.'"><font size="+1">'.
 		     &mt('Edit').'</font></a></p>');
        }
@@ -213,6 +215,7 @@
          '<h3>'.&mt('Upload a Photo').'</h3>'.
          '<input type="file" name="uploaddoc" size="50" />'.
          '<input type="submit" name="storeupl" value="'.&mt('Upload').'" />'.
+         '<input type="hidden" name="popup" value="'.$env{'form.popup'}.'" />'.
 	 '</form><form method="post">');
 
        }
@@ -242,6 +245,10 @@
 	  }
        }
        if ($allowed) {
+           if ($env{'form.popup'}) {
+               $r->print('<input type="hidden" name="popup" value="'.
+                         $env{'form.popup'}.'" />');
+           }
 	   $r->print('</form>');
        }
        if ($target ne 'tex') {$r->print('<br />');} else {$r->print('\\\\');}
@@ -281,6 +288,9 @@
 	}
     }
     if ($target ne 'tex') {
+        if ($env{'form.popup'}) {
+            $r->print('<p><a href="javascript:window.close()">'.&mt('Close window').'</a>');
+        }
 	$r->print(&Apache::loncommon::end_page());
     } else {
 	$r->print('\end{document}');

--raeburn1200867907--