version 1.359, 2015/03/31 13:46:01
|
version 1.361, 2015/04/24 21:31:56
|
Line 451 sub radio {
|
Line 451 sub radio {
|
&date_setter returns html and javascript for a compact date-setting form. |
&date_setter returns html and javascript for a compact date-setting form. |
To retrieve values from it, use &get_date_from_form. |
To retrieve values from it, use &get_date_from_form. |
|
|
Inputs |
|
|
|
=over 4 |
=over 4 |
|
|
|
=item Inputs |
|
|
|
=over |
|
|
=item $dname |
=item $dname |
|
|
The name to prepend to the form elements. |
The name to prepend to the form elements. |
Line 486 Defaults to empty, which indiciates the
|
Line 488 Defaults to empty, which indiciates the
|
|
|
=back |
=back |
|
|
Bugs |
=item Bugs |
|
|
The method used to restrict user input will fail in the year 2400. |
The method used to restrict user input will fail in the year 2400. |
|
|
|
=back |
|
|
=cut |
=cut |
|
|
############################################## |
############################################## |
Line 703 sub build_url {
|
Line 707 sub build_url {
|
|
|
get_date_from_form retrieves the date specified in an &date_setter form. |
get_date_from_form retrieves the date specified in an &date_setter form. |
|
|
Inputs: |
=over |
|
|
|
=item Inputs: |
|
|
=over 4 |
=over 4 |
|
|
Line 717 The unix time to use as the default in c
|
Line 723 The unix time to use as the default in c
|
|
|
=back |
=back |
|
|
|
=back |
|
|
Returns: Unix time represented in the form. |
Returns: Unix time represented in the form. |
|
|
=cut |
=cut |
Line 888 sub javascript_docopen {
|
Line 896 sub javascript_docopen {
|
Returns html for a selection box which allows the user to choose the |
Returns html for a selection box which allows the user to choose the |
enrollment status of students. The selection box name is 'Status'. |
enrollment status of students. The selection box name is 'Status'. |
|
|
Inputs: |
=over |
|
|
|
=item Inputs: |
|
|
$status: the currently selected status. If undefined the value of |
$status: the currently selected status. If undefined the value of |
$env{'form.Status'} is taken. If that is undefined, a value of 'Active' |
$env{'form.Status'} is taken. If that is undefined, a value of 'Active' |
Line 902 $size: the size (number of lines) of the
|
Line 912 $size: the size (number of lines) of the
|
$onchange: javascript to use when the value is changed. Enclosed in |
$onchange: javascript to use when the value is changed. Enclosed in |
double quotes, ""s, not single quotes. |
double quotes, ""s, not single quotes. |
|
|
|
=back |
|
|
Returns: a perl string as described. |
Returns: a perl string as described. |
|
|
=cut |
=cut |
Line 949 sub StatusOptions {
|
Line 961 sub StatusOptions {
|
|
|
=pod |
=pod |
|
|
=item Progess Window Handling Routines |
=item Progress Window Handling Routines |
|
|
These routines handle the creation, update, increment, and closure of |
These routines handle the creation, update, increment, and closure of |
progress windows. The progress window reports to the user the number |
progress windows. The progress window reports to the user the number |
Line 963 of items completed and an estimate of th
|
Line 975 of items completed and an estimate of th
|
Writes javascript to the client to open a progress window and returns a |
Writes javascript to the client to open a progress window and returns a |
data structure used for bookkeeping. |
data structure used for bookkeeping. |
|
|
Inputs |
=over |
|
|
=over 4 |
=item Inputs |
|
|
|
=over |
|
|
=item $r Apache request |
=item $r Apache request |
|
|
Line 973 Inputs
|
Line 987 Inputs
|
|
|
=back |
=back |
|
|
Returns a hash containing the progress state data structure. |
=back |
|
|
|
Returns a hash containing the progress state data structure. |
|
|
=item &Update_PrgWin() |
=item &Update_PrgWin() |
|
|
Updates the text in the progress indicator. Does not increment the count. |
Updates the text in the progress indicator. Does not increment the count. |
See &Increment_PrgWin. |
See &Increment_PrgWin. |
|
|
Inputs: |
=over |
|
|
|
=item Inputs: |
|
|
=over 4 |
=over 4 |
|
|
Line 993 Inputs:
|
Line 1010 Inputs:
|
|
|
=back |
=back |
|
|
|
=back |
|
|
Returns: none |
Returns: none |
|
|
|
|
=item Increment_PrgWin() |
=item &Increment_PrgWin() |
|
|
Increment the count of items completed for the progress window by $step or 1 if no step is provided. |
Increment the count of items completed for the progress window by $step or 1 if no step is provided. |
|
|
Inputs: |
=over |
|
|
|
=item Inputs: |
|
|
=over 4 |
=over 4 |
|
|
=item $r Apache request |
=item $r |
|
|
=item $prog_state Pointer to the data structure returned by Create_PrgWin |
Apache request |
|
|
|
=item $prog_state |
|
|
|
Pointer to the data structure returned by Create_PrgWin |
|
|
=item $extraInfo A description of the items being iterated over. Typically |
=item $extraInfo |
'student'. |
|
|
|
=item $step (optional) counter step. Will be set to default 1 if ommited. step must be greater than 0 or empty. |
A description of the items being iterated over. Typically 'student'. |
|
|
|
=item $step |
|
|
|
(optional) counter step. Will be set to default 1 if ommited. step must be greater than 0 or empty. |
|
|
|
=back |
|
|
=back |
=back |
|
|
Line 1022 Returns: none
|
Line 1052 Returns: none
|
|
|
Closes the progress window. |
Closes the progress window. |
|
|
Inputs: |
=over |
|
|
|
=item Inputs: |
|
|
=over 4 |
=over 4 |
|
|
Line 1032 Inputs:
|
Line 1064 Inputs:
|
|
|
=back |
=back |
|
|
|
=back |
|
|
Returns: none |
Returns: none |
|
|
=back |
=back |
Line 1308 sub htmlareaselectactive {
|
Line 1342 sub htmlareaselectactive {
|
function startRichEditor(id) { |
function startRichEditor(id) { |
// fix character entities inside <m> |
// fix character entities inside <m> |
// NOTE: this is not fixing characters inside <parse> |
// NOTE: this is not fixing characters inside <parse> |
|
// NOTE: < and > inside <chem> should fix automatically because there should not be a letter after <. |
var ta = document.getElementById(id); |
var ta = document.getElementById(id); |
var value = ta.value; |
var value = ta.value; |
var in_m = false; // in the m element |
var in_m = false; // in the m element |
Line 1351 sub htmlareaselectactive {
|
Line 1386 sub htmlareaselectactive {
|
|
|
function destroyRichEditor(id) { |
function destroyRichEditor(id) { |
CKEDITOR.instances[id].destroy(); |
CKEDITOR.instances[id].destroy(); |
// replace character entities < and > in <m> |
// replace character entities < and > in <m> and <chem> |
// and "&fctname(" by "&fctname(" |
// and "&fctname(" by "&fctname(" |
// and the quotes inside functions: "&fct(1, "a")" -> "&fct(1, "a")" |
// and the quotes inside functions: "&fct(1, "a")" -> "&fct(1, "a")" |
var ta = document.getElementById(id); |
var ta = document.getElementById(id); |
var value = ta.value; |
var value = ta.value; |
var in_m = false; // in the m element |
var in_element = false; // in the m or chem element |
var in_text = false; // in the text inside the m element |
var tagname = ""; // m or chem |
var im = -1; // position of <m> |
var in_text = false; // in the text inside the element |
|
var im = -1; // position of start tag |
var it = -1; // position of the text inside |
var it = -1; // position of the text inside |
for (var i=0; i<value.length; i++) { |
for (var i=0; i<value.length; i++) { |
if (value.substr(i, 2) == "<m") { |
if (value.substr(i, 2) == "<m" || value.substr(i, 5) == "<chem") { |
// ignore previous <m> if found twice |
// ignore previous tags if found twice |
in_m = true; |
in_element = true; |
|
if (value.substr(i, 2) == "<m") |
|
tagname = "m"; |
|
else |
|
tagname = "chem"; |
in_text = false; |
in_text = false; |
im = i; |
im = i; |
it = -1; |
it = -1; |
} else if (in_m) { |
} else if (in_element) { |
if (!in_text) { |
if (!in_text) { |
if (value.charAt(i) == ">") { |
if (value.charAt(i) == ">") { |
in_text = true; |
in_text = true; |
it = i+1; |
it = i+1; |
} |
} |
} else if (value.substr(i, 4) == "</m>") { |
} else if (value.substr(i, 3+tagname.length) == "</"+tagname+">") { |
in_m = false; |
in_element = false; |
var text = value.substr(it, i-it); |
var text = value.substr(it, i-it); |
var l1 = text.length; |
var l1 = text.length; |
text = text.replace(/</g, "<"); |
text = text.replace(/</g, "<"); |
text = text.replace(/>/g, ">"); |
text = text.replace(/>/g, ">"); |
var l2 = text.length; |
var l2 = text.length; |
value = value.substr(0, it) + text + "</m>" + value.substr(i+4); |
value = value.substr(0, it) + text + value.substr(i); |
i = i + (l2-l1); |
i = i + (l2-l1); |
} |
} |
} |
} |
Line 1714 A link to help for the component will be
|
Line 1754 A link to help for the component will be
|
|
|
All inputs can be undef without problems. |
All inputs can be undef without problems. |
|
|
Inputs: $component (the text on the right side of the breadcrumbs trail), |
=over |
$component_help |
|
$menulink (boolean, controls whether to include a link to /adm/menu) |
=item Inputs: |
$helplink (if 'nohelp' don't include the orange help link) |
|
$css_class (optional name for the class to apply to the table for CSS) |
=over |
$no_mt (optional flag, 1 if &mt() is _not_ to be applied to $component |
|
when including the text on the right. |
=item $component |
|
|
|
the text on the right side of the breadcrumbs trail |
|
|
|
=item $component_help |
|
|
|
=item $menulink |
|
|
|
boolean, controls whether to include a link to /adm/menu |
|
|
|
=item $helplink |
|
|
|
if 'nohelp' don't include the orange help link |
|
|
|
=item $css_class |
|
|
|
optional name for the class to apply to the table for CSS |
|
|
|
=item $no_mt |
|
|
|
optional flag, 1 if &mt() is _not_ to be applied to $component when including the text on the right |
|
|
|
=back |
|
|
|
=back |
|
|
Returns a string containing breadcrumbs for the current page. |
Returns a string containing breadcrumbs for the current page. |
|
|
=item &clear_breadcrumbs() |
=item &clear_breadcrumbs() |
Line 1922 Adds $html to $category of the breadcrum
|
Line 1987 Adds $html to $category of the breadcrum
|
$html is usually a link to a page that invokes a function on the currently |
$html is usually a link to a page that invokes a function on the currently |
displayed data (e.g. print when viewing a problem) |
displayed data (e.g. print when viewing a problem) |
|
|
Currently there are 3 possible values for $category: |
=over |
|
|
|
=item Currently there are 3 possible values for $category: |
|
|
=over |
=over |
|
|
Line 1936 remaining items in right of breadcrumbs
|
Line 2003 remaining items in right of breadcrumbs
|
advanced tools shown in a separate box below breadcrumbs line |
advanced tools shown in a separate box below breadcrumbs line |
|
|
=back |
=back |
|
|
|
=back |
|
|
returns: nothing |
returns: nothing |
|
|
=cut |
=cut |
Line 1975 returns: nothing
|
Line 2044 returns: nothing
|
Creates html for breadcrumb tools (categories navigation and tools) and inserts |
Creates html for breadcrumb tools (categories navigation and tools) and inserts |
\$breadcrumbs at the correct position. |
\$breadcrumbs at the correct position. |
|
|
input: \$breadcrumbs - a reference to the string containing prepared |
=over |
breadcrumbs. |
|
|
=item input: |
|
|
|
=over |
|
|
|
=item \$breadcrumbs - a reference to the string containing prepared breadcrumbs. |
|
|
|
=back |
|
|
|
=back |
|
|
returns: nothing |
returns: nothing |
|
|
Line 2002 returns: nothing
|
Line 2080 returns: nothing
|
Creates html for advanced tools (category advtools) and inserts \$breadcrumbs |
Creates html for advanced tools (category advtools) and inserts \$breadcrumbs |
at the correct position. |
at the correct position. |
|
|
input: \$breadcrumbs - a reference to the string containing prepared |
=over |
breadcrumbs (after render_tools call). |
|
|
=item input: |
|
|
|
=over |
|
|
|
=item \$breadcrumbs - a reference to the string containing prepared breadcrumbs (after render_tools call). |
|
|
|
=back |
|
|
|
=back |
|
|
returns: nothing |
returns: nothing |
|
|
Line 3501 sub scripttag {
|
Line 3588 sub scripttag {
|
|
|
Constructs a XHTML list from \@array. |
Constructs a XHTML list from \@array. |
|
|
input: |
=over |
|
|
|
=item input: |
|
|
=over |
=over |
|
|
Line 3515 Attributes for <ul> and <li> passed in a
|
Line 3604 Attributes for <ul> and <li> passed in a
|
See htmltag() for more details. |
See htmltag() for more details. |
|
|
=back |
=back |
|
|
|
=back |
|
|
returns: XHTML list as String. |
returns: XHTML list as String. |
|
|
Line 3634 should be included in this list.
|
Line 3725 should be included in this list.
|
|
|
If the optional headline text is not provided, a default text will be used. |
If the optional headline text is not provided, a default text will be used. |
|
|
|
=over |
|
|
|
=item Related routines: |
|
|
Related routines: |
|
=over 4 |
=over 4 |
add_item_funclist |
|
end_funclist |
=item add_item_funclist |
|
|
|
=item end_funclist |
|
|
=back |
=back |
|
|
|
=back |
|
|
Inputs: (optional) headline text |
Inputs: (optional) headline text |
|
|
Line 3667 sub start_funclist {
|
Line 3764 sub start_funclist {
|
|
|
Adds an item to the list of available functions |
Adds an item to the list of available functions |
|
|
Related routines: |
=over |
|
|
|
=item Related routines: |
|
|
=over 4 |
=over 4 |
start_funclist |
|
end_funclist |
=item start_funclist |
|
|
|
=item end_funclist |
|
|
|
=back |
|
|
=back |
=back |
|
|
Inputs: content item with text and link to function |
Inputs: content item with text and link to function |
Line 3693 sub add_item_funclist {
|
Line 3798 sub add_item_funclist {
|
|
|
End list of available functions |
End list of available functions |
|
|
Related routines: |
=over |
=over 4 |
|
start_funclist |
=item Related routines: |
add_item_funclist |
|
|
start_funclist |
|
add_item_funclist |
|
|
|
=back |
|
|
=back |
=back |
|
|
Inputs: ./. |
Inputs: ./. |
Line 3708 sub end_funclist {
|
Line 3818 sub end_funclist {
|
return "</ul>\n"; |
return "</ul>\n"; |
} |
} |
|
|
=pod |
=over |
|
|
=item &funclist_from_array( \@array, {legend => 'text for legend'} ) |
=item &funclist_from_array( \@array, {legend => 'text for legend'} ) |
|
|
Line 3743 sub funclist_from_array {
|
Line 3853 sub funclist_from_array {
|
{ listattr => {class => 'LC_funclist'} }); |
{ listattr => {class => 'LC_funclist'} }); |
} |
} |
|
|
=pod |
=over |
|
|
=item &actionbox( \@array ) |
=item &actionbox( \@array ) |
|
|