[LON-CAPA-cvs] cvs: modules /gci lonlogin.pm

gci gci@source.lon-capa.org
Sun, 05 Dec 2010 18:09:25 -0000


gci		Sun Dec  5 18:09:25 2010 EDT

  Modified files:              
    /modules/gci	lonlogin.pm 
  Log:
  - Customization for GCI_3.
    - Suport for multiple Concept Inventories.
  
  
Index: modules/gci/lonlogin.pm
diff -u modules/gci/lonlogin.pm:1.9 modules/gci/lonlogin.pm:1.10
--- modules/gci/lonlogin.pm:1.9	Mon Jan 11 02:31:32 2010
+++ modules/gci/lonlogin.pm	Sun Dec  5 18:09:25 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Login Screen
 #
-# $Id: lonlogin.pm,v 1.9 2010/01/11 02:31:32 gci Exp $
+# $Id: lonlogin.pm,v 1.10 2010/12/05 18:09:25 gci Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -133,10 +133,24 @@
 	(&Apache::lonnet::domain($env{'form.domain'},'description'))) {
 	$domain=$env{'form.domain'};
     }
-    my $sitename = 'GCI WebCenter';
+    my %longname = (
+                     GCI  => 'Geoscience Concept Inventory',
+                     SLCI => 'Science Literacy Concept Inventory',
+                   );
+    my %allnums = &Apache::loncommon::get_faculty_cnums();
+    my ($inventory,$uc_inventory,$testdom);
+    if ($domain =~ /^(\w+ci)test$/) {
+        $inventory = $1;
+        $testdom = $domain;
+    } else {
+        $inventory = $domain;
+        $testdom = $domain.'test';
+    }
+    $uc_inventory = uc($inventory);
+    my $sitename; = $uc_inventory.' WebCenter';
     my $shortsitename = 'WebCenter';
     my $existing = 'Existing WebCenter user?';
-    my $sitedesc = &mt('The Geoscience Concept Inventory (GCI) [_1]WebCenter[_2] is a place to comment on existing concept questions, or submit new ones, and is also a place to build and manage Concept Tests which your students will complete via the [_3]Testing Center[_2].','<a href="http://gci.lite.msu.edu/">','</a>','<a href="http://gcitest.lite.msu.edu/adm/login">');
+    my $sitedesc = &mt('The [_1]WebCenter[_2] is a place to comment on existing concept questions, or submit new ones, and is also a place to build and manage Concept Tests which your students will complete via the [_3]Testing Center[_2].',$longname{$inventory}.' ('.$uc_inventory.') <a href="http://'.$inventory.'.lite.msu.edu/">','</a>','<a href="http://'.$testdom.'.lite.msu.edu/adm/login">');
     my $role    = $r->dir_config('lonRole');
     my $loadlim = $r->dir_config('lonLoadLim');
     my $servadm = $r->dir_config('lonAdmEMail');
@@ -146,13 +160,13 @@
     my $expire  = $r->dir_config('lonExpire');
     my $version = $r->dir_config('lonVersion');
     my $host_name = &Apache::lonnet::hostname($lonhost);
-    if ($domain eq 'gcitest') {
-        $lonhost = 'gcitestl1';
-        $host_name = 'gcitest.lite.msu.edu';
-        $sitename = 'GCI Testing Center';
+    if ($domain =~ /^(\w+ci)test$/) {
+        $lonhost = $domain.'l1';
+        $host_name = $domain.'.lite.msu.edu';
+        $sitename = $inventory.' Testing Center';
         $shortsitename = 'Testing Center';
         $existing = 'Student with Testing Center account?';
-        $sitedesc = &mt('The GCI Testing Center is used by [_1]students[_2] to complete online concept tests created by their instructors using questions available in the Geoscience Concept Inventory.','<i>','</i>');
+        $sitedesc = &mt('The [_1] Testing Center is used by [_2]students[_3] to complete online concept tests created by their instructors using questions available in the [_4].',$inventory,'<i>','</i>',$longname{$inventory});
     }
 
 # --------------------------------------------- Default values for login fields
@@ -207,9 +221,9 @@
     if ($env{'form.role'}) {
         $tokenextras = '&role='.&escape($env{'form.role'});
     }
-    if ($domain eq 'gci') {
+    if ($domain !~ /^\w+citest$/) {
         unless ($env{'form.symb'} eq '/adm/statistics') {
-            $env{'form.symb'} = '/adm/gci_info';
+            $env{'form.symb'} = '/adm/ci_info';
         }
     }
     if ($env{'form.symb'}) {
@@ -401,7 +415,7 @@
 
     my $css_url = "/css/$domain/login.css";
     $js .= "\n".'<link type="text/css" rel="stylesheet" href="'.$css_url.'">'."\n";
-    $r->print(&Apache::loncommon::start_page('GCI WebCenter Login',$js,
+    $r->print(&Apache::loncommon::start_page($uc_inventory.' WebCenter Login',$js,
                                        { 'redirect'       => [$expire,'/adm/roles'], 
                                          'add_entries' => \%add_entries,
                                          'only_body'   => 1,}));
@@ -463,7 +477,7 @@
     <td width="450" valign="top">
       <table class="LC_loginbox_left">
         <tr>
-          <td width="411" align="left"><br /><img src="/images/login/$domain/logo_smrnd.png" width="411" height="51" alt="GCI" align="left"></td>
+          <td width="411" align="left"><br /><img src="/images/login/$domain/logo_smrnd.png" width="411" height="51" alt="$uc_inventory" align="left"></td>
         </tr>
         <tr>
          <td>
@@ -484,10 +498,14 @@
          <span style="font-size: 18px; line-height: 22px; "><font style="font-size: 18px; line-height: 22px;"><br />New to the $sitename?</font></span><br />
           <font class="bodyblue">$sitedesc<br /><br />The $shortsitename runs on <a href="http://loncapa.org/">LON-CAPA</a> - an open source freeware distributed learning content management and assessment system.</font><br /><br />
 END_OF_BLOCK1
-    if ($domain eq 'gci') {
+    if ($domain !~ /^\w+citest$/) {
+        my $review;
+        if (ref($allnums{$domain}) eq 'HASH') {
+            $review = $domain.'_'.$allnums{$domain}{'review'};
+        }
         $r->print(<<"END_OF_BLOCK2"); 
-          <font class="bodyblue"><b>Create a GCI WebCenter ID</b> &#150; use your ID to submit comments or new content, or to create a new test.  If you are already a GCI WebCenter user, please log-in.</font><br /><br /><br />
-         <form name="signup" method="post" action="/adm/createaccount?courseid=gci_9615072b469884921gcil1"><input type="hidden" name="process" value="signup"/>
+          <font class="bodyblue"><b>Create a $uc_inventory WebCenter ID</b> &#150; use your ID to submit comments or new content, or to create a new test.  If you are already a $uc_inventory WebCenter user, please log-in.</font><br /><br /><br />
+         <form name="signup" method="post" action="/adm/createaccount?courseid=$review"><input type="hidden" name="process" value="signup"/>
          <table class="LC_signup">
            <tr>
              <td align="left" valign="top" width="11" height="11"><img src="/images/login/$domain/r2_c4.png" width="11" height="11" border="0" alt=""></td>
@@ -496,7 +514,7 @@
            </tr>
            <tr>
              <td>&nbsp;</td>
-             <td align="center" valign="middle"><span style="white-space: nowrap;">New to GCI WebCenter:&nbsp;<a href="javascript:send('newaccount')" style="color: #ffffff">Click here to sign up</a></span></td>
+             <td align="center" valign="middle"><span style="white-space: nowrap;">New to $uc_inventory WebCenter:&nbsp;<a href="javascript:send('newaccount')" style="color: #ffffff">Click here to sign up</a></span></td>
              <td>&nbsp;</td>
            </tr>
            <tr>