Apache::loncommon - pile of common routines
Referenced by other mod_perl Apache modules.
Invocation: &Apache::loncommon::SUBROUTINENAME(ARGUMENTS);
Common collection of used subroutines. This collection helps remove redundancy from other modules and increase efficiency of memory usage.
Current things done:
Makes a table out of the previous homework attempts Inputs result_from_symbread, user, domain, course_id Reads in non-network-related .tab files
This is part of the LearningOnline Network with CAPA project described at http://www.lon-capa.org.
BEGIN()
openbrowser(formname,elementname,only,omit)
[javascript]formname and elementname indicate the name of the html form and name of the element that the results of the browsing selection are to be placed in.
Specifying 'only' will restrict the browser to displaying only files with the given extension. Can be a comma seperated list.
Specifying 'omit' will restrict the browser to NOT displaying files with the given extension. Can be a comma seperated list.
formname and elementname specify the name of the html form and the name of the element the selection from the search results will be placed in.
linked_select_forms(...)
linked_select_forms takes the following ordered inputs:
Below is an example of such a hash. Only the 'text', 'default', and
'select2' keys must appear as stated. keys(%menu)
are the possible
values for the first select menu. The text that coincides with the
first menu value is given in $menu{$choice1}->{'text'}. The values
and text for the second menu are given in the hash pointed to by
$menu{$choice1}->{'select2'}.
my %menu = ( A1 => { text =>``Choice A1'' , default => ``B3'', select2 => { B1 => ``Choice B1'', B2 => ``Choice B2'', B3 => ``Choice B3'', B4 => ``Choice B4'' } }, A2 => { text =>``Choice A2'' , default => ``C2'', select2 => { C1 => ``Choice C1'', C2 => ``Choice C2'', C3 => ``Choice C3'' } }, A3 => { text =>``Choice A3'' , default => ``D6'', select2 => { D1 => ``Choice D1'', D2 => ``Choice D2'', D3 => ``Choice D3'', D4 => ``Choice D4'', D5 => ``Choice D5'', D6 => ``Choice D6'', D7 => ``Choice D7'' } } );
$text will optionally be linked to the same topic, allowing you to link text in addition to the graphic. If you do not want to link text, but wish to specify one of the later parameters, pass an empty string.
$stayOnPage is a value that will be interpreted as a boolean. If true, the link will not open a new window. If false, the link will open a new window using Javascript. (Default is false.)
$width and $height are optional numerical parameters that will override the width and height of the popped up window, which may be useful for certain help topics with big pictures included.
csv_translate($text)
get_domains()
select_dom_form($defdom,$name)
get_library_servers($domain)
home_server_option_list($domain)
See loncreateuser.pm for invocation and use examples.
keyword($word)
Uses global $thesaurus_db_file.
Returns: Determines which domain should be used for designs
Returns: A link to a domain logo, if the domain logo exists. If the domain logo does not exist, a description of the domain.
Returns: value of designparamter $which
Inputs:
$title, A title to be displayed on the page. $function, the current role (can be undef). $addentries, extra parameters for the <body> tag. $bodyonly, if defined, only return the <body> tag. $domain, if defined, force a given domain.
Returns: A uniform header for LON-CAPA web pages. If $bodyonly is nonzero, a string containing a <body> tag will be returned. If $bodyonly is undef or zero, an html string containing a <body> tag and other decorations will be returned.
upfile_store($r)
load_tmp_file($r)
upfile_record_sep()
record_sep($record)
upfile_select_html()
csv_print_samples($r,$records)
csv_print_select_table($r,$records,$d)
csv_samples_select_table($r,$records,$d)
$r is an Apache Request ref, $records is an arrayref from &Apache::loncommon::upfile_record_sep, $d is an array of 2 element arrays (internal name, displayed name)
languageids()
languagedescription()
copyrightids()
copyrightdescription()
filecategories()
filecategorytypes()
fileembstyle()
filedescription()
filedescriptionex()
get_previous_attempt()
get_student_view()
get_student_answers()
get_unprocessed_cgi($query,$possible_names)
Typically called with $ENV{'QUERY_STRING'} as the first parameter. $possible_names is an ref to an array of form element names. As an example: get_unprocessed_cgi($ENV{'QUERY_STRING'},['uname','udom']); will result in $ENV{'form.uname'} and $ENV{'form.udom'} being set.
cacheheader()
no_cache($r)
add_to_env($name,$value)