version 1.88, 2004/10/07 22:12:47
|
version 1.90, 2005/01/03 13:45:31
|
Line 1267 BUTTONS
|
Line 1267 BUTTONS
|
$result .= "<tr>\n<td width='20'> </td>\n"; |
$result .= "<tr>\n<td width='20'> </td>\n"; |
$result .= "<td valign='top'><input type='$type' name='$var.forminput'" |
$result .= "<td valign='top'><input type='$type' name='$var.forminput'" |
. "' value='" . |
. "' value='" . |
HTML::Entities::encode($choice->[1],'<>&"') |
HTML::Entities::encode($choice->[1],"<>&\"'") |
. "'"; |
. "'"; |
if ($checkedChoices{$choice->[1]}) { |
if ($checkedChoices{$choice->[1]}) { |
$result .= " checked "; |
$result .= " checked "; |
Line 1424 sub render {
|
Line 1424 sub render {
|
$result .= "<select name='${var}.forminput'>\n"; |
$result .= "<select name='${var}.forminput'>\n"; |
foreach my $choice (@{$self->{CHOICES}}) { |
foreach my $choice (@{$self->{CHOICES}}) { |
$result .= "<option value='" . |
$result .= "<option value='" . |
HTML::Entities::encode($choice->[1],'<>&"') |
HTML::Entities::encode($choice->[1],"<>&\"'") |
. "'"; |
. "'"; |
if ($checkedChoices{$choice->[1]}) { |
if ($checkedChoices{$choice->[1]}) { |
$result .= " selected"; |
$result .= " selected"; |
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; |
|
} |
} |
}; |
}; |
|
|
Line 2217 BUTTONS
|
Line 2266 BUTTONS
|
$checked = 1; |
$checked = 1; |
} |
} |
$result .= |
$result .= |
" value='" . HTML::Entities::encode($choice->[0] . ':' . $choice->[2] . ':' . $choice->[1] . ':' . $choice->[3],'<>&"') |
" value='" . HTML::Entities::encode($choice->[0] . ':' |
|
.$choice->[2] . ':' |
|
.$choice->[1] . ':' |
|
.$choice->[3], "<>&\"'") |
. "' /></td><td>" |
. "' /></td><td>" |
. HTML::Entities::encode($choice->[1],'<>&"') |
. HTML::Entities::encode($choice->[1],'<>&"') |
. "</td><td align='center'>" |
. "</td><td align='center'>" |
Line 2533 BUTTONS
|
Line 2585 BUTTONS
|
my $id = &new_id(); |
my $id = &new_id(); |
$result .= '<tr><td align="right"' . " bgcolor='$color'>" . |
$result .= '<tr><td align="right"' . " bgcolor='$color'>" . |
"<input $onclick type='$type' name='" . $var |
"<input $onclick type='$type' name='" . $var |
. ".forminput' ".qq{id="$id"}." value='" . HTML::Entities::encode($fileName,'<>&"'). |
. ".forminput' ".qq{id="$id"}." value='" . HTML::Entities::encode($fileName,"<>&\"'"). |
"'"; |
"'"; |
if (!$self->{'multichoice'} && $choices == 0) { |
if (!$self->{'multichoice'} && $choices == 0) { |
$result .= ' checked'; |
$result .= ' checked'; |
Line 3215 sub render {
|
Line 3267 sub render {
|
$result .= '<li>'.&mt('for section [_1]',"<b>$section</b>").'</li>'; |
$result .= '<li>'.&mt('for section [_1]',"<b>$section</b>").'</li>'; |
$level -= 3; |
$level -= 3; |
$result .= "<input type='hidden' name='csec' value='" . |
$result .= "<input type='hidden' name='csec' value='" . |
HTML::Entities::encode($section,'<>&"') . "' />\n"; |
HTML::Entities::encode($section,"'<>&\"") . "' />\n"; |
} else { |
} else { |
# FIXME: This is probably wasteful! Store the name! |
# FIXME: This is probably wasteful! Store the name! |
my $classlist = Apache::loncoursedata::get_classlist(); |
my $classlist = Apache::loncoursedata::get_classlist(); |
Line 3227 sub render {
|
Line 3279 sub render {
|
$level -= 6; |
$level -= 6; |
my ($uname, $udom) = split /:/, $vars->{USER_NAME}; |
my ($uname, $udom) = split /:/, $vars->{USER_NAME}; |
$result .= "<input type='hidden' name='uname' value='". |
$result .= "<input type='hidden' name='uname' value='". |
HTML::Entities::encode($uname,'<>&"') . "' />\n"; |
HTML::Entities::encode($uname,"'<>&\"") . "' />\n"; |
$result .= "<input type='hidden' name='udom' value='". |
$result .= "<input type='hidden' name='udom' value='". |
HTML::Entities::encode($udom,'<>&"') . "' />\n"; |
HTML::Entities::encode($udom,"'<>&\"") . "' />\n"; |
} |
} |
|
|
# Print value |
# Print value |