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

raeburn lon-capa-cvs@mail.lon-capa.org
Thu, 30 Dec 2004 16:18:17 -0000


raeburn		Thu Dec 30 11:18:17 2004 EDT

  Modified files:              
    /loncom/interface	lonsupportreq.pm 
  Log:
  Retrieve domain information from query string (if one was passed in from 'Contact Helpdesk' link on log-in page). Actually store course information from select boxes and include in message sent to SupportEmail address.  Make more generic and less MSU specific.
  
  
Index: loncom/interface/lonsupportreq.pm
diff -u loncom/interface/lonsupportreq.pm:1.18 loncom/interface/lonsupportreq.pm:1.19
--- loncom/interface/lonsupportreq.pm:1.18	Mon Dec 20 16:09:29 2004
+++ loncom/interface/lonsupportreq.pm	Thu Dec 30 11:18:16 2004
@@ -110,8 +110,11 @@
         my ($sec,$grp) = split/:/,$_;
         $groupid{$sec} = $grp;
     }
-    my $defdom = $Apache::lonnet::perlvar{'lonDefDomain'};
-    my $codedom = $defdom;
+    my $codedom = $Apache::lonnet::perlvar{'lonDefDomain'};
+    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['codedom']);
+    if (exists($ENV{'form.codedom'})) {
+        $codedom = $ENV{'form.codedom'};
+    }
     my %coursecodes = ();
     my %codes = ();
     my @codetitles = ();
@@ -124,7 +127,7 @@
     my $totcodes = 0;
     my $format_reply;
     my $jscript = '';
-    
+ 
     if ($cdom) {
         $codedom = $cdom;
     }
@@ -264,10 +267,10 @@
         }
         if ($udomform eq '') {
             $udomform = '<i>domain</i>:&nbsp;';
-            $udomform .= &Apache::loncommon::select_dom_form($defdom,'udom');
+            $udomform .= &Apache::loncommon::select_dom_form($codedom,'udom');
         }
         if ($unameform eq '') {
-            $unameform= '<i>username</i>:&nbsp;<input type="text" size="20" name="loncname" value="'.$uname.'" />&nbsp;&nbsp;';
+            $unameform= '<i>username</i>:&nbsp;<input type="text" size="12" name="uname" value="'.$uname.'" />&nbsp;&nbsp;';
         }
         $r->print($unameform.$udomform.'<br />Enter the username you use to log-in to your LON-CAPA system, and choose your domain.');
     }
@@ -588,13 +591,27 @@
     my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg');
     my @formvars = ('username','email','uname','udom','sourceurl','phone','section','coursecode','title','subject','description','screenshot');
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars);
-
+    my $coursecode = $ENV{'form.coursecode'};
+    if ($coursecode eq '') {
+        if (defined($ENV{'form.Year'})) {
+            $coursecode .= $ENV{'form.Year'};
+        }
+        if (defined($ENV{'form.Semester'})) {
+            $coursecode .= $ENV{'form.Semester'};
+        }
+        if (defined($ENV{'form.Department'})) {
+            $coursecode .= $ENV{'form.Department'};
+        }
+        if (defined($ENV{'form.Number'})) {
+            $coursecode .= $ENV{'form.Number'};
+        }
+    }
     my $supportmsg = qq|
 Name: $ENV{'form.username'}
 Email: $ENV{'form.email'}
 Username/domain: $ENV{'form.uname'} - $ENV{'form.udom'}
 Tel: $ENV{'form.phone'}
-Course Information: $ENV{'form.title'} - $ENV{'form.coursecode'} - section: $ENV{'form.section'}
+Course Information: $ENV{'form.title'} - $coursecode - section: $ENV{'form.section'}
 Subject: $ENV{'form.subject'}
 Description: $ENV{'form.description'}
 URL: $ENV{'form.sourceurl'}
@@ -608,7 +625,7 @@
 <font color="$fontcolor">Email: </font><font color="$vlinkcolor">$ENV{'form.email'}</font><br />
 <font color="$fontcolor">Username/domain: </font><font color="$vlinkcolor">$ENV{'form.uname'} - $ENV{'form.udom'}</font><br />
 <font color="$fontcolor">Tel: </font><font color="$vlinkcolor">$ENV{'form.phone'}</font><br />
-<font color="$fontcolor">Course Information: </font><font color="$vlinkcolor">$ENV{'form.title'} - $ENV{'form.coursecode'} - section: $ENV{'form.section'}</font><br />
+<font color="$fontcolor">Course Information: </font><font color="$vlinkcolor">$ENV{'form.title'} - $coursecode - section: $ENV{'form.section'}</font><br />
 <font color="$fontcolor">Subject: </font><font color="$vlinkcolor">$ENV{'form.subject'}</font><br />
 <font color="$fontcolor">Description: </font><font color="$vlinkcolor">$descrip</font><br />
 <font color="$fontcolor">URL: </font><font color="$vlinkcolor">$ENV{'form.sourceurl'}</font><br />
@@ -922,9 +939,9 @@
                     my @sorted_b = ();
                     my @sorted_b_titles = ();
                     &sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[2]}{$key_a}{$key_b}},\@sorted_b);
-                    if (defined($$cat_titles{$$codetitles[1]})) {
+                    if (defined($$cat_titles{$$codetitles[2]})) {
                         foreach (@sorted_b) {
-                            push @sorted_b_titles, $$cat_titles{$$codetitles[1]}{$_};
+                            push @sorted_b_titles, $$cat_titles{$$codetitles[2]}{$_};
                         }
                     }
                     $$idlist{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_b);
@@ -1104,14 +1121,14 @@
         }
     }
     $$script_tag .= (<<END_OF_BLOCK);
- if (caller == "Year") {
+ if (caller == "$$codetitles[0]") {
    document.logproblem.Department.length = 0
    document.logproblem.Number.length = 0
-   document.logproblem.Department.options[0] = new Option("<-Pick Semester.","-1",true,true)
-   document.logproblem.Number.options[0] = new Option("<-Pick Department","-1",true,true)
+   document.logproblem.Department.options[0] = new Option("<-Pick $$codetitles[1]","-1",true,true)
+   document.logproblem.Number.options[0] = new Option("<-Pick $$codetitles[2]","-1",true,true)
    if (idyr == 0) {
     document.logproblem.Semester.length = 0
-    document.logproblem.Semester.options[0] = new Option("<-Pick Year","-1",true,true)
+    document.logproblem.Semester.options[0] = new Option("<-Pick $$codetitles[0]","-1",true,true)
    }
    else {
     document.logproblem.Semester.length = 0
@@ -1122,13 +1139,12 @@
    }
    document.logproblem.Semester.selectedIndex = 0;
  }
- if (caller == "Semester") {
+ if (caller == "$$codetitles[1]") {
    document.logproblem.Department.length = 0
    document.logproblem.Number.length = 0
-   document.logproblem.Number.options[0] = new Option("<-Pick Department.","-1",true,true)
+   document.logproblem.Number.options[0] = new Option("<-Pick $$codetitles[2]","-1",true,true)
    if (idsem == 0) {
-     document.logproblem.Department.options[0] = new Option("<-Pick Semester.","-1",true,true)
-     document.logproblem.Department.options[0] = new Option("<-Pick Semester","-1",true,true)
+     document.logproblem.Department.options[0] = new Option("<-Pick $$codetitles[1]","-1",true,true)
    }
    else {
     document.logproblem.Department.options[0] = new Option("Select","-1",true,true)    
@@ -1138,10 +1154,10 @@
    }
    document.logproblem.Department.selectedIndex = 0
  }
- if (caller == "Department") {
+ if (caller == "$$codetitles[2]") {
    document.logproblem.Number.length = 0
    if (iddept == 0) {
-     document.logproblem.Number.options[0] = new Option("<-Pick Department.","-1",true,true)
+     document.logproblem.Number.options[0] = new Option("<-Pick $$codetitles[2]","-1",true,true)
    }
    else {
     document.logproblem.Number.options[0] = new Option("Select","-1",true,true)