File:  [LON-CAPA] / loncom / interface / lonpickresource.pm
Revision 1.2: download - view: text, annotated - select for diffs
Sat May 21 01:02:27 2011 UTC (12 years, 11 months ago) by www
Branches: MAIN
CVS tags: language_hyphenation_merge, language_hyphenation, HEAD, BZ4492-merge, BZ4492-feature_horizontal_radioresponse
Continued work on picking resources

    1: # The LearningOnline Network with CAPA
    2: # Pick resource or folder in the course
    3: #
    4: # $Id: lonpickresource.pm,v 1.2 2011/05/21 01:02:27 www Exp $
    5: #
    6: # Copyright Michigan State University Board of Trustees
    7: #
    8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    9: #
   10: # LON-CAPA is free software; you can redistribute it and/or modify
   11: # it under the terms of the GNU General Public License as published by
   12: # the Free Software Foundation; either version 2 of the License, or
   13: # (at your option) any later version.
   14: #
   15: # LON-CAPA is distributed in the hope that it will be useful,
   16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   18: # GNU General Public License for more details.
   19: #
   20: # You should have received a copy of the GNU General Public License
   21: # along with LON-CAPA; if not, write to the Free Software
   22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   23: #
   24: # /home/httpd/html/adm/gpl.txt
   25: #
   26: # http://www.lon-capa.org/
   27: #
   28: #
   29: ###############################################################
   30: ###############################################################
   31: 
   32: package Apache::lonpickresource;
   33: 
   34: use strict;
   35: use Apache::Constants qw(:common);
   36: use Apache::loncommon;
   37: use Apache::lonnet;
   38: use Apache::lonlocal;
   39: use Apache::lonroles;
   40: use Apache::lonuserutils;
   41: use Apache::lonstathelpers;
   42: use LONCAPA;
   43: 
   44: sub handler {
   45:     my $r = shift;
   46:     &Apache::loncommon::content_type($r,'text/html');
   47:     $r->send_http_header;
   48:     return OK if $r->header_only;
   49: 
   50: # ------------------------------------------------------------ Print the screen
   51:     $r->print(&Apache::loncommon::start_page("Selecting Resource",undef,
   52:                                              {'no_nav_bar' => 1}));
   53: 
   54:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['form','reslink']);
   55:     my $form='opener.document.forms.'.$env{'form.form'};
   56:     my $reslink=$env{'form.reslink'};
   57: 
   58:     $r->print('<form name="pickresource" action="/adm/pickresource">');
   59:     $r->print(&Apache::lonstathelpers::problem_selector('.',undef,1,1,'resource'));
   60:     $r->print(<<ENDGETVALUE);
   61: <script type="text/javascript">
   62: function getCheckedValue(radioObj) {
   63: 	if(!radioObj)
   64: 		return "";
   65: 	var radioLength = radioObj.length;
   66: 	if(radioLength == undefined)
   67: 		if(radioObj.checked)
   68: 			return radioObj.value;
   69: 		else
   70: 			return "";
   71: 	for(var i = 0; i < radioLength; i++) {
   72: 		if(radioObj[i].checked) {
   73: 			return radioObj[i].value;
   74: 		}
   75: 	}
   76: 	return "";
   77: }
   78: </script>
   79: ENDGETVALUE
   80:     $r->print('<input type="button" value="'.&mt('Pick').
   81:       '" onClick="val=getCheckedValue(this.form.resourcesymb);if (val) { '.
   82:                     $form.'.resourcesymb.value=val;'.
   83:                     $form.".cmd.value='".$reslink."';".
   84:                     $form.".submit();} window.close();".'" />');
   85:     $r->print('</form>');
   86:     $r->print(&Apache::loncommon::end_page());
   87:     return OK;
   88: }
   89: 
   90: 1;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>