version 1.89, 2004/12/07 11:25:53
|
version 1.90, 2005/01/03 13:45:31
|
Line 1760 BEGIN {
|
Line 1760 BEGIN {
|
&Apache::lonhelper::register('Apache::lonhelper::resource', |
&Apache::lonhelper::register('Apache::lonhelper::resource', |
('resource', 'filterfunc', |
('resource', 'filterfunc', |
'choicefunc', 'valuefunc', |
'choicefunc', 'valuefunc', |
'mapurl')); |
'mapurl','option')); |
} |
} |
|
|
sub new { |
sub new { |
Line 1865 sub start_mapurl {
|
Line 1865 sub start_mapurl {
|
|
|
sub end_mapurl { return ''; } |
sub end_mapurl { return ''; } |
|
|
|
|
|
sub start_option { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
if (!defined($paramHash->{OPTION_TEXTS})) { |
|
$paramHash->{OPTION_TEXTS} = [ ]; |
|
$paramHash->{OPTION_VARS} = [ ]; |
|
|
|
} |
|
# We're ok with empty elements. as place holders |
|
# Although the 'variable' element should really exist. |
|
my $option_texts = $paramHash->{OPTION_TEXTS}; |
|
my $option_vars = $paramHash->{OPTION_VARS}; |
|
|
|
push(@$option_texts, $token->[2]{'text'}); |
|
push(@$option_vars, $token->[2]{'variable'}); |
|
|
|
return ''; |
|
} |
|
|
|
sub end_option { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
return ''; |
|
} |
|
|
# A note, in case I don't get to this before I leave. |
# A note, in case I don't get to this before I leave. |
# If someone complains about the "Back" button returning them |
# If someone complains about the "Back" button returning them |
# to the previous folder state, instead of returning them to |
# to the previous folder state, instead of returning them to |
Line 1916 BUTTONS
|
Line 1940 BUTTONS
|
|
|
$result .= $buttons; |
$result .= $buttons; |
|
|
my $filterFunc = $self->{FILTER_FUNC}; |
my $filterFunc = $self->{FILTER_FUNC}; |
my $choiceFunc = $self->{CHOICE_FUNC}; |
my $choiceFunc = $self->{CHOICE_FUNC}; |
my $valueFunc = $self->{VALUE_FUNC}; |
my $valueFunc = $self->{VALUE_FUNC}; |
my $multichoice = $self->{'multichoice'}; |
my $multichoice = $self->{'multichoice'}; |
|
my $option_vars = $self->{OPTION_VARS}; |
|
my $option_texts = $self->{OPTION_TEXTS}; |
|
my $headings_done = 0; |
|
|
# Evaluate the map url as needed |
# Evaluate the map url as needed |
my $mapUrl; |
my $mapUrl; |
Line 1937 BUTTONS
|
Line 1964 BUTTONS
|
my $checked = 0; |
my $checked = 0; |
my $renderColFunc = sub { |
my $renderColFunc = sub { |
my ($resource, $part, $params) = @_; |
my ($resource, $part, $params) = @_; |
|
my $result = ""; |
|
|
|
if(!$headings_done) { |
|
if ($option_texts) { |
|
foreach my $text (@$option_texts) { |
|
$result .= "<th>$text</th>"; |
|
} |
|
} |
|
$result .= "<th>Select</th>"; |
|
$result .= "</tr><tr>"; # Close off the extra row and start a new one. |
|
$headings_done = 1; |
|
} |
|
|
my $inputType; |
my $inputType; |
if ($multichoice) { $inputType = 'checkbox'; } |
if ($multichoice) { $inputType = 'checkbox'; } |
else {$inputType = 'radio'; } |
else {$inputType = 'radio'; } |
|
|
if (!&$choiceFunc($resource)) { |
if (!&$choiceFunc($resource)) { |
return '<td> </td>'; |
$result .= '<td> </td>'; |
|
return $result; |
} else { |
} else { |
my $col = "<td><input type='$inputType' name='${var}.forminput' "; |
my $col = ""; |
|
my $resource_name = |
|
HTML::Entities::encode(&$valueFunc($resource),"<>&\"'"); |
|
if($option_vars) { |
|
foreach my $var (@$option_vars) { |
|
$col .= |
|
"<td align='center'><input type='checkbox' name ='$var'.forminput' value='". |
|
$resource_name . "' /> </td>"; |
|
} |
|
} |
|
|
|
$col .= "<td align='center'><input type='$inputType' name='${var}.forminput' "; |
if (!$checked && !$multichoice) { |
if (!$checked && !$multichoice) { |
$col .= "checked "; |
$col .= "checked "; |
$checked = 1; |
$checked = 1; |
Line 1954 BUTTONS
|
Line 2005 BUTTONS
|
$col .= "checked "; |
$col .= "checked "; |
$checked = 1; |
$checked = 1; |
} |
} |
$col .= "value='" . |
$col .= "value='" . $resource_name . "' /></td>"; |
HTML::Entities::encode(&$valueFunc($resource),"<>&\"'") |
return $result.$col; |
. "' /></td>"; |
|
return $col; |
|
} |
} |
}; |
}; |
|
|