[LON-CAPA-cvs] cvs: loncom /interface lonaboutme.pm lonmanagekeys.pm lonmenu.pm lonmeta.pm

www lon-capa-cvs@mail.lon-capa.org
Sat, 12 Apr 2003 15:57:30 -0000


This is a MIME encoded message

--www1050163050
Content-Type: text/plain

www		Sat Apr 12 11:57:30 2003 EDT

  Added files:                 
    /loncom/interface	lonmanagekeys.pm 

  Modified files:              
    /loncom/interface	lonaboutme.pm lonmenu.pm lonmeta.pm 
  Log:
  "Return Location" link in inline remote
  
  
--www1050163050
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20030412115730.txt"

Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.15 loncom/interface/lonaboutme.pm:1.16
--- loncom/interface/lonaboutme.pm:1.15	Mon Mar 10 09:20:07 2003
+++ loncom/interface/lonaboutme.pm	Sat Apr 12 11:57:30 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # "About Me" Personal Information
 #
-# $Id: lonaboutme.pm,v 1.15 2003/03/10 14:20:07 www Exp $
+# $Id: lonaboutme.pm,v 1.16 2003/04/12 15:57:30 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -97,7 +97,7 @@
        if ($forcestudent) { $allowed=0; }
  
        if ($allowed) {
-          $r->print('<p><b>Privacy Note:</b> 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 publically.</p>'.
+          $r->print('<p><b>Privacy Note:</b> 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','Help with filling in text boxes').'</p><p><a href="'.$r->uri.'?forcestudent=1">Show Public View</a>'.
  &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'</p>');
       }
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.58 loncom/interface/lonmenu.pm:1.59
--- loncom/interface/lonmenu.pm:1.58	Sat Apr  5 17:14:40 2003
+++ loncom/interface/lonmenu.pm	Sat Apr 12 11:57:30 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.58 2003/04/05 22:14:40 www Exp $
+# $Id: lonmenu.pm,v 1.59 2003/04/12 15:57:30 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -57,6 +57,7 @@
     my $target  =shift;
     my $registration=shift;
     my $navmaps='';
+    my $reloadlink='';
     my $escurl=&Apache::lonnet::escape($ENV{'REQUEST_URI'});
     my $escsymb=&Apache::lonnet::escape($ENV{'request.symb'});
     if ($ENV{'browser.interface'} eq 'textual') {
@@ -65,13 +66,21 @@
 	    $navmaps=(<<ENDNAV);
 <a href="/adm/navmaps?postdata=$escurl&postsymb=$escsymb" target="_top">Navigate Contents</a>
 ENDNAV
+            if (($ENV{'REQUEST_URI'}=~/^\/adm\//) &&
+         ($ENV{'REQUEST_URI'}!~/^\/adm\/wrapper\//) &&
+         ($ENV{'REQUEST_URI'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) {
+                my $escreload=&Apache::lonnet::escape('return:');
+                $reloadlink=(<<ENDRELOAD);
+<a href="/adm/flip?postdata=$escreload" target="_top"><font color="$font">Return to Last Location</font></a>
+ENDRELOAD
+            }
         }
 	my $output=(<<ENDMAINMENU);
 <script>
 // BEGIN LON-CAPA Internal
 </script>
 <a href="/adm/menu" target="_top">Main Menu</a>
-$navmaps<br />
+$reloadlink $navmaps<br />
 <script>
 // END LON-CAPA Internal
 </script>
@@ -106,6 +115,15 @@
 <td bgcolor="$tabbg">
 <a href="/adm/navmaps?postdata=$escurl&postsymb=$escsymb" target="_top"><font color="$font">Navigate Contents</font></a></td>
 ENDNAVREM
+            if (($ENV{'REQUEST_URI'}=~/^\/adm\//) &&
+                ($ENV{'REQUEST_URI'}!~/^\/adm\/wrapper\//) &&
+         ($ENV{'REQUEST_URI'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) {
+                my $escreload=&Apache::lonnet::escape('return:');
+                $reloadlink=(<<ENDRELOAD);
+<td bgcolor="$tabbg">
+<a href="/adm/flip?postdata=$escreload" target="_top"><font color="$font">Return to Last Location</font></a></td>
+ENDRELOAD
+            }
         }
         my $reg='';
         if ($registration) {
@@ -120,6 +138,7 @@
 <td bgcolor="$tabbg">
 <a href="/adm/menu" target="_top"><font color="$font">Main Menu</font></a>
 </td>
+$reloadlink
 $navmaps
 <td bgcolor="$tabbg">
 <a href="/adm/remote?action=launch&url=$escurl" target="_top">
@@ -758,7 +777,7 @@
 }
 
 function catalog_info() {
-   loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=320,width=280,resizeable=yes,location=no,menubar=no,toolbar=no');
+   loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=320,width=280,resizeable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
 }
 
 function chat_win() {
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.28 loncom/interface/lonmeta.pm:1.29
--- loncom/interface/lonmeta.pm:1.28	Fri Mar 14 14:29:36 2003
+++ loncom/interface/lonmeta.pm	Sat Apr 12 11:57:30 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.28 2003/03/14 19:29:36 albertel Exp $
+# $Id: lonmeta.pm,v 1.29 2003/04/12 15:57:30 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -55,6 +55,8 @@
     my %cnt;
     my %listitems=('count'        => 'add',
                    'course'       => 'add',
+                   'goto'         => 'add',
+                   'comefrom'     => 'add',
                    'avetries'     => 'avg',
                    'stdno'        => 'add',
                    'difficulty'   => 'avg',
@@ -115,6 +117,15 @@
                  { return 'No information available'; }
 }
 
+# -------------------------------------------------------------- Author display
+
+sub authordisplay {
+    my ($aname,$adom)=@_;
+    return &Apache::loncommon::aboutmewrapper(
+                &Apache::loncommon::plainname($aname,$adom),
+                    $aname,$adom).' <tt>['.$aname.'@'.$adom.']</tt>';
+}
+
 # -------------------------------------------------------------- Pretty display
 
 sub evalgraph {
@@ -210,6 +221,10 @@
 my $disuri=&Apache::lonnet::declutter($uri);
   $disuri=~s/\.meta$//;
 my $currentversion=&Apache::lonnet::getversion($disuri);
+my $author=$content{'author'};
+$author=~s/(\w+)(\:|\@)(\w+)/&authordisplay($1,$3)/gse;
+my $owner=$content{'owner'};
+$owner=~s/(\w+)(\:|\@)(\w+)/&authordisplay($1,$3)/gse;
 my $versiondisplay='';
 if ($thisversion) {
     $versiondisplay='Version: '.$thisversion.
@@ -217,6 +232,11 @@
 } else {
     $versiondisplay='Version: '.$currentversion;
 }
+my $customdistributionfile='';
+if ($content{'customdistributionfile'}) {
+   $customdistributionfile='<a href="'.$content{'customdistributionfile'}.
+     '"><tt>'.$content{'customdistributionfile'}.'</tt></a>';
+}
 my $bodytag=&Apache::loncommon::bodytag
             ('Catalog Information','','','',$resdomain);
   $r->print(<<ENDHEAD);
@@ -227,7 +247,7 @@
 $versiondisplay<br />
 <table cellspacing=2 border=0>
 <tr><td bgcolor='#AAAAAA'>Author(s)</td>
-<td bgcolor="#CCCCCC">$content{'author'}&nbsp;</td></tr>
+<td bgcolor="#CCCCCC">$author&nbsp;</td></tr>
 <tr><td bgcolor='#AAAAAA'>Subject</td>
 <td bgcolor="#CCCCCC">$content{'subject'}&nbsp;</td></tr>
 <tr><td bgcolor='#AAAAAA'>Keyword(s)</td>
@@ -245,9 +265,11 @@
 <tr><td bgcolor='#AAAAAA'>
 Last Revision Date</td><td bgcolor="#CCCCCC">$lastrevisiondate&nbsp;</td></tr>
 <tr><td bgcolor='#AAAAAA'>Publisher/Owner</td>
-<td bgcolor="#CCCCCC">$content{'owner'}&nbsp;</td></tr>
+<td bgcolor="#CCCCCC">$owner&nbsp;</td></tr>
 <tr><td bgcolor='#AAAAAA'>Copyright/Distribution</td>
-<td bgcolor="#CCCCCC">$content{'copyright'}
+<td bgcolor="#CCCCCC">$content{'copyright'}&nbsp;</td></tr>
+<tr><td bgcolor='#AAAAAA'>Custom Distribution File</td>
+<td bgcolor="#CCCCCC">$customdistributionfile&nbsp;</td></tr>
 </table>
 ENDHEAD
   delete($content{'title'});

Index: loncom/interface/lonmanagekeys.pm
+++ loncom/interface/lonmanagekeys.pm
# The LearningOnline Network with CAPA
# Handler to manage course access keys 
#
# $Id: lonmanagekeys.pm,v 1.1 2003/04/12 15:57:30 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#
###############################################################
###############################################################

package Apache::lonmanagekeys;

use strict;
use Apache::lonnet();
use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::Constants qw(:common :http REDIRECT);
use Spreadsheet::WriteExcel;

###############################################################
###############################################################
sub header {
    my $bodytag=&Apache::loncommon::bodytag('Access Key Management');
    return(<<ENDHEAD);
<html>
<head>
<title>LON-CAPA Access Key Management</title>
</head>
$bodytag
<form method="post" enctype="multipart/form-data"  
      action="/adm/keymanage" name="keyform">
ENDHEAD
}

# =================================================== Show student list to drop
sub show_key_list {
    my ($r,$mode,$linkto,$action,$statusmode,$classlist,$keylist)=@_;
#
# Just junk so that this compiles
#
    my ($username,$domain,$id,$name,$section,$status,@Sorted_Students);
#
# 
# 
    my $cid=$ENV{'request.course.id'};
    #
    # Variables for excel output
    my ($excel_workbook, $excel_sheet, $excel_filename,$row);
    #

    # Print out header 
    if ($mode eq 'view') {
    } elsif ($mode eq 'excel') {
        # Create the excel spreadsheet
        $excel_filename = '/prtspool/'.
            $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'.
                time.'_'.rand(1000000000).'.xls';
        $excel_workbook = Spreadsheet::WriteExcel->new('/home/httpd'.
                                                       $excel_filename);
        $excel_workbook->set_tempdir('/home/httpd/perl/tmp');
        $excel_sheet = $excel_workbook->addworksheet('classlist');
        #
        my $description = 'Classlist for '.
            $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
        $excel_sheet->write($row++,0,$description);
        #
        $excel_sheet->write($row++,0,["username","domain","ID",
                                      "student name","section","status"]);
    }
    foreach my $student (@Sorted_Students) {
        if ($mode eq 'view') {
        } elsif ($mode eq 'csv') {
            # no need to bother with $linkto
            my @line = ();
            foreach ($username,$domain,$id,$name,$section) {
                push @line,&Apache::loncommon::csv_translate($_);
            }
            if ($statusmode eq 'Any') {
                push @line,&Apache::loncommon::csv_translate($status);
            }
            my $tmp = $";
            $" = '","';
            $r->print("\"@line\"\n");
            $" = $tmp;
        } elsif ($mode eq 'excel') {
            $excel_sheet->write($row++,0,[$username,$domain,$id,
                                          $name,$section,$status]);
        }
    }
    if ($mode eq 'view') {
    } elsif ($mode eq 'excel') {
        $excel_workbook->close();
        $r->print('<p><a href="'.$excel_filename.'">'.
                  'Your Excel spreadsheet</a> is ready for download.</p>'."\n");
    }
}

###################################################################
###################################################################
sub handler {
    my $r=shift;
    if ($r->header_only) {
        $r->content_type('text/html');
        $r->send_http_header;
        return OK;
    }
    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['state']);

    unless (&Apache::lonnet::allowed('mky',$ENV{'request.role.domain'})) {
        $ENV{'user.error.msg'}=
            "/adm/managekeys:mky:0:0:Cannot manage access keys";
        return HTTP_NOT_ACCEPTABLE; 
    }
    #
    # Only output the header information if they did not request csv format
    #
    if (exists($ENV{'form.state'}) && ($ENV{'form.state'} eq 'csv')) {
        $r->content_type('text/csv');
    } else {
        # Start page
        $r->content_type('text/html');
        $r->send_http_header;
        $r->print(&header());
    }
#
# do stuff here.
#

    if (exists($ENV{'form.state'}) && ($ENV{'form.state'} eq 'csv')) {
        $r->print("\n");
    } else {
        $r->print('</form></body></html>');
    }
    return OK;
}

###################################################################
###################################################################

1;
__END__



--www1050163050--