version 1.89, 2004/12/07 11:25:53
|
version 1.92, 2005/01/10 12:15:23
|
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} = [ ]; |
|
|
|
} |
|
# OPTION_TEXTS is a list of the text attribute |
|
# values used to create column headings. |
|
# OPTION_VARS is a list of the variable names, used to create the checkbox |
|
# inputs. |
|
# 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'}); |
|
|
|
# Need to create and declare the option variables as well to make them |
|
# persistent. |
|
# |
|
my $varname = $token->[2]{'variable'}; |
|
$helper->declareVar($varname); |
|
|
|
|
|
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 1952 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 1976 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 $option_var (@$option_vars) { |
|
$col .= |
|
"<td align='center'><input type='checkbox' name ='$option_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 2018 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 2132 SCRIPT
|
Line 2194 SCRIPT
|
|
|
$buttons = <<BUTTONS; |
$buttons = <<BUTTONS; |
<br /> |
<br /> |
<input type="button" onclick="checkactive()" value="$lt{'ocs'}" /> |
<table> |
<input type="button" onclick="uncheckexpired()" value="$lt{'ues'}" /><br /> |
<tr> |
<input type="button" onclick="checkall(true, '$var')" value="$lt{'sas'}" /> |
|
<input type="button" onclick="checkall(false, '$var')" value="$lt{'uas'}" /><br /> |
<td><input type="button" onclick="checkactive()" value="$lt{'ocs'}" /></td> |
<input type="button" onclick="checksec(true)" value="$lt{'sfsg'}"> |
<td><input type="button" onclick="uncheckexpired()" value="$lt{'ues'}" /><br /></td> |
<input type="text" size="5" name="chksec"> |
</tr> |
<input type="button" onclick="checksec(false)" value="$lt{'ufsg'}"> |
<tr> |
|
<td><input type="button" onclick="checkall(true, '$var')" value="$lt{'sas'}" /></td> |
|
<td> <input type="button" onclick="checkall(false, '$var')" value="$lt{'uas'}" /><br /></td> |
|
</tr> |
|
<tr> |
|
<td><input type="button" onclick="checksec(true)" value="$lt{'sfsg'}"></td> |
|
<td><input type="text" size="5" name="chksec"> </td> |
|
</tr> |
|
<tr> |
|
<td><input type="button" onclick="checksec(false)" value="$lt{'ufsg'}"></td> |
|
<td></td> |
|
</tr> |
|
</table> |
<br /> |
<br /> |
BUTTONS |
BUTTONS |
} |
} |