version 1.17, 2003/05/02 19:20:51
|
version 1.21, 2003/05/07 18:22:43
|
Line 997 sub render {
|
Line 997 sub render {
|
if ($self->{'multichoice'}) { |
if ($self->{'multichoice'}) { |
$result .= <<SCRIPT; |
$result .= <<SCRIPT; |
<script> |
<script> |
function checkall(value) { |
function checkall(value, checkName) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
document.forms.helpform.elements[i].checked=value; |
ele = document.forms.helpform.elements[i]; |
|
if (ele.name == checkName + '.forminput') { |
|
document.forms.helpform.elements[i].checked=value; |
|
} |
} |
} |
} |
} |
</script> |
</script> |
SCRIPT |
SCRIPT |
$buttons = <<BUTTONS; |
$buttons = <<BUTTONS; |
<br /> |
<br /> |
<input type="button" onclick="checkall(true)" value="Select All" /> |
<input type="button" onclick="checkall(true, '$var')" value="Select All" /> |
<input type="button" onclick="checkall(false)" value="Unselect All" /> |
<input type="button" onclick="checkall(false, '$var')" value="Unselect All" /> |
<br /> |
<br /> |
BUTTONS |
BUTTONS |
} |
} |
Line 1474 sub render {
|
Line 1477 sub render {
|
if ($self->{'multichoice'}) { |
if ($self->{'multichoice'}) { |
$result = <<SCRIPT; |
$result = <<SCRIPT; |
<script> |
<script> |
function checkall(value) { |
function checkall(value, checkName) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
ele = document.forms.helpform.elements[i]; |
ele = document.forms.helpform.elements[i]; |
if (ele.type == "checkbox") { |
if (ele.name == checkName + '.forminput') { |
document.forms.helpform.elements[i].checked=value; |
document.forms.helpform.elements[i].checked=value; |
} |
} |
} |
} |
Line 1486 sub render {
|
Line 1489 sub render {
|
SCRIPT |
SCRIPT |
$buttons = <<BUTTONS; |
$buttons = <<BUTTONS; |
<br /> |
<br /> |
<input type="button" onclick="checkall(true)" value="Select All" /> |
<input type="button" onclick="checkall(true, '$var')" value="Select All Resources" /> |
<input type="button" onclick="checkall(false)" value="Unselect All" /> |
<input type="button" onclick="checkall(false, '$var')" value="Unselect All Resources" /> |
<br /> |
<br /> |
BUTTONS |
BUTTONS |
} |
} |
Line 1627 sub render {
|
Line 1630 sub render {
|
my $self = shift; |
my $self = shift; |
my $result = ''; |
my $result = ''; |
my $buttons = ''; |
my $buttons = ''; |
|
my $var = $self->{'variable'}; |
|
|
if ($self->{'multichoice'}) { |
if ($self->{'multichoice'}) { |
$result = <<SCRIPT; |
$result = <<SCRIPT; |
<script> |
<script> |
function checkall(value) { |
function checkall(value, checkName) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
document.forms.helpform.elements[i].checked=value; |
ele = document.forms.helpform.elements[i]; |
|
if (ele.name == checkName + '.forminput') { |
|
document.forms.helpform.elements[i].checked=value; |
|
} |
} |
} |
} |
} |
</script> |
</script> |
SCRIPT |
SCRIPT |
$buttons = <<BUTTONS; |
$buttons = <<BUTTONS; |
<br /> |
<br /> |
<input type="button" onclick="checkall(true)" value="Select All" /> |
<input type="button" onclick="checkall(true, '$var')" value="Select All Students" /> |
<input type="button" onclick="checkall(false)" value="Unselect All" /> |
<input type="button" onclick="checkall(false, '$var')" value="Unselect All Students" /> |
<br /> |
<br /> |
BUTTONS |
BUTTONS |
} |
} |
Line 1682 BUTTONS
|
Line 1689 BUTTONS
|
$checked = 1; |
$checked = 1; |
} |
} |
$result .= |
$result .= |
" value='" . HTML::Entities::encode($_) |
" value='" . HTML::Entities::encode($_ . ':' . $choices->{$_}->[$section]) |
. "' /></td><td>" |
. "' /></td><td>" |
. HTML::Entities::encode($choices->{$_}->[$fullname]) |
. HTML::Entities::encode($choices->{$_}->[$fullname]) |
. "</td><td align='center'>" |
. "</td><td align='center'>" |
Line 1832 sub render {
|
Line 1839 sub render {
|
if ($self->{'multichoice'}) { |
if ($self->{'multichoice'}) { |
$result = <<SCRIPT; |
$result = <<SCRIPT; |
<script> |
<script> |
function checkall(value) { |
function checkall(value, checkName) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
ele = document.forms.helpform.elements[i]; |
ele = document.forms.helpform.elements[i]; |
if (ele.type == "checkbox") { |
if (ele.name == checkName + '.forminput') { |
|
document.forms.helpform.elements[i].checked=value; |
|
} |
|
} |
|
} |
|
|
|
function checkallid(value, idName) { |
|
for (i=0; i<document.forms.helpform.elements.length; i++) { |
|
ele = document.forms.helpform.elements[i]; |
|
if (ele.id == idName) { |
document.forms.helpform.elements[i].checked=value; |
document.forms.helpform.elements[i].checked=value; |
} |
} |
} |
} |
Line 1844 sub render {
|
Line 1860 sub render {
|
SCRIPT |
SCRIPT |
$buttons = <<BUTTONS; |
$buttons = <<BUTTONS; |
<br /> |
<br /> |
<input type="button" onclick="checkall(true)" value="Select All" /> |
<input type="button" onclick="checkall(true, '$var')" value="Select All Files" /> |
<input type="button" onclick="checkall(false)" value="Unselect All" /> |
<input type="button" onclick="checkall(false, '$var')" value="Unselect All Files" /> |
|
<input type="button" onclick="checkallid(true, 'Published')" value="Select All Published" /> |
|
<input type="button" onclick="checkallid(false, 'Published')" value="Unselect All Published" /> |
<br /> |
<br /> |
BUTTONS |
BUTTONS |
} |
} |
Line 1869 BUTTONS
|
Line 1887 BUTTONS
|
$result .= '<br /><font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br /><br />'; |
$result .= '<br /><font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br /><br />'; |
} |
} |
|
|
$result .= '<table border="0" cellpadding="1" cellspacing="1">'; |
$result .= '<table border="0" cellpadding="2" cellspacing="0">'; |
|
|
# Keeps track if there are no choices, prints appropriate error |
# Keeps track if there are no choices, prints appropriate error |
# if there are none. |
# if there are none. |
Line 1886 BUTTONS
|
Line 1904 BUTTONS
|
} |
} |
my $fileName = $subdir .'/'. $file; |
my $fileName = $subdir .'/'. $file; |
if (&$filterFunc($file)) { |
if (&$filterFunc($file)) { |
$result .= '<tr><td align="right">' . |
(my $status, my $color) = @{fileState($subdir, $file)}; |
"<input type='$type' name='" . $var |
$result .= '<tr><td align="right"' . " bgcolor='$color'>" . |
|
"<input id='$status' type='$type' name='" . $var |
. ".forminput' value='" . HTML::Entities::encode($fileName) . |
. ".forminput' value='" . HTML::Entities::encode($fileName) . |
"'"; |
"'"; |
if (!$self->{'multichoice'} && $choices == 0) { |
if (!$self->{'multichoice'} && $choices == 0) { |
$result .= ' checked'; |
$result .= ' checked'; |
} |
} |
$result .= "/></td><td>" . $file . "</td></tr>\n"; |
$result .= "/></td><td bgcolor='$color'>" . $file . |
|
"</td><td bgcolor='$color'>$status</td></tr>\n"; |
$choices++; |
$choices++; |
} |
} |
} |
} |
Line 1909 BUTTONS
|
Line 1929 BUTTONS
|
return $result; |
return $result; |
} |
} |
|
|
|
# Determine the state of the file: Published, unpublished, modified. |
|
# Return the color it should be in and a label as a two-element array |
|
# reference. |
|
# Logic lifted from lonpubdir.pm, even though I don't know that it's still |
|
# the most right thing to do. |
|
|
|
sub fileState { |
|
my $constructionSpaceDir = shift; |
|
my $file = shift; |
|
|
|
my $docroot = $Apache::lonnet::perlvar{'lonDocRoot'}; |
|
my $subdirpart = $constructionSpaceDir; |
|
$subdirpart =~ s/^\/home\/$ENV{'user.name'}\/public_html//; |
|
my $resdir = $docroot . '/res/' . $ENV{'user.domain'} . '/' . $ENV{'user.name'} . |
|
$subdirpart; |
|
|
|
my @constructionSpaceFileStat = stat($constructionSpaceDir . '/' . $file); |
|
my @resourceSpaceFileStat = stat($resdir . '/' . $file); |
|
if (!@resourceSpaceFileStat) { |
|
return ['Unpublished', '#FFCCCC']; |
|
} |
|
|
|
my $constructionSpaceFileModified = $constructionSpaceFileStat[9]; |
|
my $resourceSpaceFileModified = $resourceSpaceFileStat[9]; |
|
|
|
if ($constructionSpaceFileModified > $resourceSpaceFileModified) { |
|
return ['Modified', '#FFFFCC']; |
|
} |
|
return ['Published', '#CCFFCC']; |
|
} |
|
|
sub postprocess { |
sub postprocess { |
my $self = shift; |
my $self = shift; |
my $result = $ENV{'form.' . $self->{'variable'} . '.forminput'}; |
my $result = $ENV{'form.' . $self->{'variable'} . '.forminput'}; |