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

raeburn raeburn at source.lon-capa.org
Wed Feb 8 12:49:01 EST 2012


raeburn		Wed Feb  8 17:49:01 2012 EDT

  Modified files:              (Branch: loncapaMITrelate_1)
    /loncom/interface	lonsupportreq.pm 
  Log:
  - Customization for MITrelate.
    - Course information not required.
  
  
-------------- next part --------------
Index: loncom/interface/lonsupportreq.pm
diff -u loncom/interface/lonsupportreq.pm:1.66 loncom/interface/lonsupportreq.pm:1.66.6.1
--- loncom/interface/lonsupportreq.pm:1.66	Thu Mar  3 17:29:29 2011
+++ loncom/interface/lonsupportreq.pm	Wed Feb  8 17:49:01 2012
@@ -1,5 +1,5 @@
 #
-# $Id: lonsupportreq.pm,v 1.66 2011/03/03 17:29:29 bisitz Exp $
+# $Id: lonsupportreq.pm,v 1.66.6.1 2012/02/08 17:49:01 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -36,7 +36,6 @@
 use Apache::lonnet;
 use Apache::lonlocal;
 use Apache::lonacc();
-use Apache::courseclassifier;
 use LONCAPA qw(:DEFAULT :match);
  
 
@@ -70,9 +69,8 @@
     
 sub print_request_form {
     my ($r,$origurl,$function) = @_;
-    my ($os,$browser,$bversion,$uhost,$uname,$udom,$uhome,$urole,$usec,$email,$cid,
-        $cdom,$cnum,$ctitle,$ccode,$sectionlist,$lastname,$firstname,$server,
-        $formname,$public);
+    my ($os,$browser,$bversion,$uhost,$uname,$udom,$uhome,$email,
+        $lastname,$firstname,$server,$formname,$public);
     $function = &Apache::loncommon::get_users_function() if (!$function);
     $ccode = '';
     $os = $env{'browser.os'};
@@ -86,9 +84,6 @@
         $udom = $env{'user.domain'};
     }
     $uhome = $env{'user.home'};
-    $urole = $env{'request.role'};
-    $usec = $env{'request.course.sec'};
-    $cid = $env{'request.course.id'};
     $formname = 'logproblem';
     my $machine = &Apache::lonnet::absolute_url();
     if ($origurl =~ m-^https?://-) {
@@ -114,14 +109,7 @@
                   entr => 'Enter the username you use to log-in to LON-CAPA, and your domain.',
                   urlp => 'URL of page',
                   phon => 'Phone',
-                  crsd => 'Course Details',
-                  enin => 'Enter institutional course code',
                   pick => 'Pick',
-                  enct => 'Enter course title',
-                  secn => 'Section Number',
-                  sele => 'Select',
-                  titl => 'Title',
-                  lsec => 'LON-CAPA sec',
                   subj => 'Subject',
                   detd => 'Detailed Description',
                   opfi => 'Optional file upload',
@@ -148,16 +136,6 @@
 
 END
     $scripttag .= &Apache::lonhtmlcommon::javascript_valid_email();
-    if ($cid) {
-        $cdom = $env{'course.'.$cid.'.domain'};
-        $cnum = $env{'course.'.$cid.'.num'};
-    }
-    if ($cdom && $cnum) {
-        my %csettings = &Apache::lonnet::get('environment',['description','internal.coursecode','internal.sectionnums'],$cdom,$cnum);
-        $ctitle = $csettings{'description'};
-        $ccode = $csettings{'internal.coursecode'};
-        $sectionlist = $csettings{'internal.sectionnums'};
-    }
 
     if ($env{'environment.permanentemail'}) {
         $email = $env{'environment.permanentemail'};
@@ -172,12 +150,7 @@
     if ($env{'environment.firstname'}) {
         $firstname = $env{'environment.firstname'};
     }
-    my @sections = split(/,/,$sectionlist);
-    my %groupid;
-    foreach my $section (@sections) {
-        my ($sec,$grp) = split(/:/,$section);
-        $groupid{$sec} = $grp;
-    }
+
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['codedom',
                                                  'useremail','useraccount']);
     if ($env{'form.origurl'} eq '/adm/createaccount') {
@@ -193,62 +166,14 @@
         }
     }
     my $codedom = &get_domain();
-    my $details_title;
-    if ($codedom) {
-        $details_title = '<br />('.$codedom.')';
-    }
-    my %coursecodes;
-    my %codes;
-    my @codetitles;
-    my %cat_titles;
-    my %cat_order;
-    my %idlist;
-    my %idnums;
-    my %idlist_titles;
     my $caller = 'global';
-    my $totcodes = 0;
     my $format_reply;
     my $jscript = '';
-    my $loaditems = qq|
-function initialize_codes() {
-    return;
-}
-    |;
-    if ($cnum) {
-        $coursecodes{$cnum} = $ccode;
-        if ($ccode eq '') {
-            $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom,$totcodes);
-        } else {
-            $coursecodes{$cnum} = $ccode;
-            $caller = $cnum;
-            $totcodes ++;
-        }
-    } else { 
-        $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom,$totcodes);
-    }
-    if ($totcodes > 0) {
-        if ($ccode eq '') {
-            $format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order);
-            if ($format_reply eq 'ok') {
-                my $numtypes = @codetitles;
-                &Apache::courseclassifier::build_code_selections(\%codes,\@codetitles,\%cat_titles,\%cat_order,\%idlist,\%idnums,\%idlist_titles);
-                my ($scripttext,$longtitles) = &Apache::courseclassifier::javascript_definitions(\@codetitles,\%idlist,\%idlist_titles,\%idnums,\%cat_titles);
-                my $longtitles_str = join('","',@{$longtitles});
-                my $allidlist = $idlist{$codetitles[0]};
-                $jscript .= &Apache::courseclassifier::courseset_js_start($formname,$longtitles_str,$allidlist);
-                $jscript .= $scripttext;
-                $jscript .= &Apache::courseclassifier::javascript_code_selections($formname, at codetitles);
-                $loaditems = '';
-            }
-        }
-    }
-	
     my $js = '<script type="text/javascript">'."\n$scripttag\n$jscript\n".
-	     $loaditems.'</script>';
+	     '</script>';
     my %add_entries = (topmargin    => "0",
 		       marginheight => "0",
-		       onLoad       =>"initialize_codes()",);
-
+		      );
     
     $r->print(&Apache::loncommon::start_page('Support Request',$js,
 				       { 'function'    => $function,
@@ -334,115 +259,14 @@
                $showserver.'<input type="hidden" name="sourceurl" value="'.
                &HTML::Entities::encode($server,'"<>&').'" />'.
                &Apache::lonhtmlcommon::row_closure().
-               &Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef,'LC_evenrow_value').
+    $num ++;
+    $i = $num%2;
+    $output .= &Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef,
+                                                 'LC_evenrow_value').
                '<input type="text" size="15" name="phone" /><br />'.
                &Apache::lonhtmlcommon::row_closure();
     $num ++;
-    $i = $num%2; 
-    $output .= &Apache::lonhtmlcommon::row_title("$lt{'crsd'}$details_title",undef,$css[$i]);
-    if ($cnum) {
-        if ($coursecodes{$cnum}) {
-            foreach my $item (@codetitles) {
-                $output .= '<i>'.$item.'</i>: '.$codes{$cnum}{$item}.'; ';
-            }
-            $output .= ' <input type="hidden" name="coursecode" value="'.&HTML::Entities::encode($coursecodes{$cnum},'"<>&').'" />';
-        } else {
-            $output .= $lt{'enin'}.': 
-                  <input type="text" name="coursecode" size="15" value="" />';
-        }
-    } else {
-        if ($totcodes > 0) {
-            my $numtitles = @codetitles;
-            if ($numtitles == 0) {
-                $output .= $lt{'enin'}.': 
-                  <input type="text" name="coursecode" size="15" value="" />';
-            } else {
-                my @standardnames = &Apache::loncommon::get_standard_codeitems();
-                my $lasttitle = $numtitles;
-                if ($numtitles > 4) {
-                    $lasttitle = 4;
-                } 
-                $output .= '<table><tr><td>'.$codetitles[0].'<br />'."\n".
-                      '<select name="'.$standardnames[0].'" onchange="courseSet('."'$codetitles[0]'".')">'."\n".
-                      ' <option value="-1" />'.$lt{'sele'}."\n";
-                my @items = ();
-                my @longitems = ();
-                if ($idlist{$codetitles[0]} =~ /","/) {
-                    @items = split(/","/,$idlist{$codetitles[0]});
-                } else {
-                    $items[0] = $idlist{$codetitles[0]};
-                }
-                if (defined($idlist_titles{$codetitles[0]})) {
-                    if ($idlist_titles{$codetitles[0]} =~ /","/) {
-                        @longitems = split(/","/,$idlist_titles{$codetitles[0]});
-                    } else {
-                        $longitems[0] = $idlist_titles{$codetitles[0]};
-                    }
-                    for (my $i=0; $i<@longitems; $i++) {
-                        if ($longitems[$i] eq '') {
-                            $longitems[$i] = $items[$i];
-                        }
-                    }
-                } else {
-                    @longitems = @items;
-                }
-                for (my $i=0; $i<@items; $i++) {
-                    $output .= ' <option value="'.$items[$i].'">'.$longitems[$i].'</option>'."\n";
-                }
-                $output .= '</select></td>';
-                for (my $i=1; $i<$numtitles; $i++) {
-                    $output .= '<td>'.$codetitles[$i].'<br />'."\n".
-                     '<select name="'.$standardnames[$i].'" onchange="courseSet('."'$codetitles[$i]'".')">'."\n".
-                     '<option value="-1"><-'.$lt{'pick'}.' '.$codetitles[$i-1].'</option>'."\n".
-                     '</select>'."\n".
-                     '</td>'."\n";
-                }
-                $output .= '</tr></table>';
-                if ($numtitles > 4) {
-                    $output .= '<br /><br />'.$codetitles[$numtitles].'<br />'."\n".
-                          '<select name="'.$standardnames[$numtitles].'" onchange="courseSet('."'$codetitles[$numtitles]'".')">'."\n".
-                          '<option value="-1"><-'.$lt{'pick'}.' '.$codetitles[$numtitles-1].'</option>'."\n".
-                          '</select>'."\n";
-                }
-            }
-        } else {
-            $output .= $lt{'enin'}.': 
-                  <input type="text" name="coursecode" size="15" value="" />';
-        }
-    }
-    if ($ctitle) {
-        $output .= '<br /><i>'.$lt{'titl'}.'</i>: '.$ctitle.
-                   '<input type="hidden" name="title" value="'.
-                   &HTML::Entities::encode($ctitle,'"<>&').'" />'."\n";
-    } else {
-        $output .= '<br />'.$lt{'enct'}.': 
-                 <input type="text" name="title" size="25" value="" />'."\n";
-    }
-    $output .= &Apache::lonhtmlcommon::row_closure();
-    $num ++;
     $i = $num%2;
-    $output .= &Apache::lonhtmlcommon::row_title($lt{'secn'},undef,$css[$i]);
-    if ($sectionlist) {
-        $output .= "<select name=\"section\"\n>".
-                   "  <option value=\"\" selected=\"selected\">$lt{'sele'}</option>\n";
-        foreach my $id (sort(keys(%groupid))) {
-            if ($id eq $groupid{$id} || $groupid{$id} eq '') {
-                $output .= "  <option value=".
-                           &HTML::Entities::encode($id,'"<>&').
-                           " >$id</option>\n";
-            } else {
-                $output .= "  <option value=".
-                           &HTML::Entities::encode($id,'"<>&').
-                           " >$id - ($lt{'lsec'}: $groupid{$id})</option>\n";
-            }
-        }
-        $output .= "</select>";
-    } else {
-        $output .= '<input type="text" name="section" size="10" />';
-    }
-    $output .= &Apache::lonhtmlcommon::row_closure();
-    $num ++;
-    $i = $num%2; 
     $output .= &Apache::lonhtmlcommon::row_title($lt{'subj'},undef,'LC_oddrow_value').
                '  <input type="text" size="40" name="subject" />'."\n".
                &Apache::lonhtmlcommon::row_closure().
@@ -524,43 +348,21 @@
         }
     }
     my $reporttime = &Apache::lonlocal::locallocaltime(time);
-    my @formvars = ('username','email','uname','udom','sourceurl','phone','section','coursecode','title','subject','description','screenshot');
-
+    my @formvars = ('username','email','uname','udom','sourceurl','phone',
+                    'subject','description','screenshot');
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars);
-    my $coursecode = $env{'form.coursecode'};
-    if ($coursecode eq '') {
-        my $totcodes = 0;
-        my %coursecodes;
-        $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$defdom,$totcodes);
-        my @standardnames = &Apache::loncommon::get_standard_codeitems();
-        if ($totcodes > 0) {
-            my $noregexps = 1;
-            $coursecode = 
-                &Apache::courseclassifier::instcode_from_selectors($defdom,$noregexps);
-        } 
-        if ($coursecode eq '') {
-            foreach my $item (@standardnames) {
-                if ((defined($env{'form.'.$item})) && ($env{'form.'.$item} ne '-1')) {
-                    $coursecode .= $env{'form.'.$item};
-                }
-            }
-        }
-    }
     my %lt = &Apache::lonlocal::texthash (
                  username    => 'Name',
                  email       => 'E-mail',
                  cc          => 'Cc',
                  user        => 'Username/domain',
                  phone       => 'Phone',
-                 crsi        => 'Course Information',
                  subject     => 'Subject',
                  description => 'Description',
                  sourceurl   => 'URL',
                  date        => 'Date/Time',
-                 secn        => 'Section',
                  warn        => 'Warning: Problem with support e-mail address',
                  your        => 'Your support request contained the following information',
-                 sect        => 'section',
                  info        => 'Information supplied',
                  adin        => 'Additional information recorded',
     );
@@ -599,14 +401,12 @@
         }
     }
     $env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'";
-    $env{'form.crsi'} = $env{'form.title'}.' - '.$coursecode.' - '.$lt{'sect'}.': '.$env{'form.section'};
     my $supportmsg = <<END;
 $lt{'username'}: $env{'form.username'}
 $lt{'email'}: $env{'form.email'}
 $lt{'cc'}: $okcclist
 $lt{'user'}: $env{'form.user'}
 $lt{'phone'}: $env{'form.phone'}
-$lt{'crsi'}: $env{'form.crsi'}
 $lt{'subject'}: $env{'form.subject'}
 $lt{'description'}: $env{'form.description'}
 $lt{'sourceurl'}: $env{'form.sourceurl'}
@@ -614,7 +414,8 @@
 
 END
     my $displaymsg;
-    foreach my $item ('username','email','cc','user','phone','crsi','subject','description','sourceurl') {
+    foreach my $item ('username','email','cc','user','phone','subject',
+                      'description','sourceurl') {
         if ($env{'form.'.$item} ne '') {
             if ($item eq 'description') {
                 my $descrip = $env{'form.description'};


More information about the LON-CAPA-cvs mailing list