version 1.46, 2006/04/10 22:59:16
|
version 1.54, 2009/06/05 12:24:14
|
Line 73 use HTML::Entities();
|
Line 73 use HTML::Entities();
|
sub textfield { |
sub textfield { |
my ($title,$name,$value)=@_; |
my ($title,$name,$value)=@_; |
return "\n<p><b>$title:</b><br />". |
return "\n<p><b>$title:</b><br />". |
'<input type=text name="'.$name.'" size=80 value="'.$value.'" />'; |
'<input type="text" name="'.$name.'" size="80" value="'.$value.'" />'; |
} |
} |
|
|
sub hiddenfield { |
sub hiddenfield { |
my ($name,$value)=@_; |
my ($name,$value)=@_; |
return '<input type=hidden name="'.$name.'" value="'.$value.'" />'."\n"; |
return '<input type="hidden" name="'.$name.'" value="'.$value.'" />'."\n"; |
} |
} |
|
|
sub selectbox { |
sub selectbox { |
Line 86 sub selectbox {
|
Line 86 sub selectbox {
|
my $selout="\n<p><b>$title:</b><br />".'<select name="'.$name.'">'; |
my $selout="\n<p><b>$title:</b><br />".'<select name="'.$name.'">'; |
foreach (sort keys(%options)) { |
foreach (sort keys(%options)) { |
$selout.='<option value="'.$_.'"'; |
$selout.='<option value="'.$_.'"'; |
if ($_ eq $value) { $selout.=' selected'; } |
if ($_ eq $value) { $selout.=' selected="selected"'; } |
$selout.='>'.&mt($options{$_}).'</option>'; |
$selout.='>'.&mt($options{$_}).'</option>'; |
} |
} |
return $selout.'</select>'; |
return $selout.'</select>'; |
Line 140 sub file_dialogs {
|
Line 140 sub file_dialogs {
|
if ($spreadsheet->is_default()) { |
if ($spreadsheet->is_default()) { |
$filename = 'Default'; |
$filename = 'Default'; |
} |
} |
my $save_dialog = '<nobr>'. |
my $save_dialog = '<span class="LC_nobreak">'. |
'<input type="submit" name="save" value="'.&mt('Save as').'" /> '. |
'<input type="submit" name="save" value="'.&mt('Save as').'" /> '. |
'<input type="text" name="savefilename" size="30" value="'. |
'<input type="text" name="savefilename" size="30" value="'. |
$truefilename.'" />'. |
$truefilename.'" />'. |
'</nobr>'; |
'</span>'; |
my $makedefault_dialog = '<input type="submit" name="makedefault" '. |
my $makedefault_dialog = '<input type="submit" name="makedefault" '. |
'value="'.&mt('Save as & Make This Sheet the Default').'"/>'; |
'value="'.&mt('Save as & Make This Sheet the Default').'"/>'; |
# |
# |
Line 154 sub file_dialogs {
|
Line 154 sub file_dialogs {
|
my $load_dialog = <<END; |
my $load_dialog = <<END; |
<table bgcolor="$bgcolor"> |
<table bgcolor="$bgcolor"> |
<tr><td><input type="submit" name="load" value="$load" /></td> |
<tr><td><input type="submit" name="load" value="$load" /></td> |
<td><nobr> |
<td><span class="LC_nobreak"> |
<input type="text" name="loadfilename" size="20" value="$filename" /> |
<input type="text" name="loadfilename" size="20" value="$filename" /> |
$link</nobr> |
$link</span> |
</td></tr> |
</td></tr> |
<tr><td> </td><td> |
<tr><td> </td><td> |
<select name="fileselect" onchange="document.sheet.loadfilename.value=document.sheet.fileselect.value" > |
<select name="fileselect" onchange="document.sheet.loadfilename.value=document.sheet.fileselect.value" > |
Line 165 END
|
Line 165 END
|
foreach my $sheetfilename ($spreadsheet->othersheets()) { |
foreach my $sheetfilename ($spreadsheet->othersheets()) { |
$load_dialog .= ' <option value="'.$sheetfilename.'"'; |
$load_dialog .= ' <option value="'.$sheetfilename.'"'; |
if ($filename eq $sheetfilename) { |
if ($filename eq $sheetfilename) { |
$load_dialog .= ' selected'; |
$load_dialog .= ' selected="selected"'; |
$default_filename_set = 1; |
$default_filename_set = 1; |
} |
} |
$load_dialog .= '>'.$sheetfilename."</option>\n"; |
$load_dialog .= '>'.$sheetfilename."</option>\n"; |
} |
} |
$load_dialog .= "</select>\n</td><td> </td></tr>\n</table>\n"; |
$load_dialog .= "</select>\n</td><td> </td></tr>\n</table>\n"; |
# |
# |
|
my $headline = &mt('File Dialogs'); |
$result .=<<END; |
$result .=<<END; |
<!-- |
<!-- |
<fieldset title="File Dialogs" > |
<fieldset title="File Dialogs" > |
<legend>File Dialogs</legend> |
<legend>$headline</legend> |
--> |
--> |
<!-- load / save dialogs --> |
<!-- load / save dialogs --> |
<table cellspacing="2"> |
<table cellspacing="2"> |
Line 266 sub handler {
|
Line 267 sub handler {
|
$env{'form.sdomain'} = $domain; |
$env{'form.sdomain'} = $domain; |
my $section = &Apache::lonnet::getsection($domain,$name, |
my $section = &Apache::lonnet::getsection($domain,$name, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
my $group; |
my @groups; |
my @groups = (); |
|
if (($env{'user.name'} eq $name) && ($env{'user.domain'} eq $domain)) { |
if (($env{'user.name'} eq $name) && ($env{'user.domain'} eq $domain)) { |
@groups=&Apache::lonnet::sort_course_groups( |
@groups = &Apache::lonnet::sort_course_groups($env{'request.course.id'}, |
$env{'request.course.groups'}, |
split(':',$env{'request.course.groups'})); |
$env{'request.course.id'}); |
|
} else { |
} else { |
my $grouplist = &Apache::lonnet::get_users_groups($domain,$name, |
@groups = &Apache::lonnet::get_users_groups($domain,$name, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
if ($grouplist) { |
|
@groups=&Apache::lonnet::sort_course_groups($grouplist, |
|
$env{'request.course.id'}); |
|
} |
|
} |
|
if (@groups > 0) { |
|
$group = $groups[0]; |
|
} |
} |
|
|
## |
## |
Line 348 sub handler {
|
Line 340 sub handler {
|
my $extra_javascript = |
my $extra_javascript = |
&Apache::loncommon::browser_and_searcher_javascript(); |
&Apache::loncommon::browser_and_searcher_javascript(); |
|
|
|
my $cell_extra_js = &Apache::loncommon::resize_textarea_js(); |
my $cell_edit_start = |
my $cell_edit_start = |
&Apache::loncommon::start_page('Cell Edit Window',undef, |
&Apache::loncommon::start_page('Cell Edit Window',$cell_extra_js, |
{'only_body' => 1, |
{'only_body' => 1, |
'js_ready' => 1,}); |
'js_ready' => 1, |
|
'add_entries' => { |
|
'onresize' => "resize_textarea('LC_newformula','LC_aftertextarea')", |
|
'onload' => "resize_textarea('LC_newformula','LC_aftertextarea')", |
|
}}); |
my $cell_edit_end = |
my $cell_edit_end = |
&Apache::loncommon::end_page({'js_ready' => 1,}); |
&Apache::loncommon::end_page({'js_ready' => 1,}); |
|
|
Line 369 sub handler {
|
Line 366 sub handler {
|
edit_text +='$cell_edit_start'; |
edit_text +='$cell_edit_start'; |
edit_text += '<form name="editwinform">'; |
edit_text += '<form name="editwinform">'; |
edit_text += '<center><h3>$lt{'ce'} '+cellname+'</h3>'; |
edit_text += '<center><h3>$lt{'ce'} '+cellname+'</h3>'; |
edit_text += '<textarea name="newformula" cols="60" rows="12"'; |
edit_text += '<textarea id="LC_newformula" name="newformula" '; |
edit_text += ' wrap="off" >'+cellformula+'</textarea>'; |
edit_text += ' cols="60" rows="12"; wrap="off" style="width:100%">'; |
edit_text += '</br>'; |
edit_text += cellformula+'</textarea>'; |
|
edit_text += '<div id="LC_aftertextarea"><br />'; |
edit_text += '<input type="button" name="accept" value="$lt{'ac'}"'; |
edit_text += '<input type="button" name="accept" value="$lt{'ac'}"'; |
edit_text += ' onClick=\\\'javascript:'; |
edit_text += ' onClick=\\\'javascript:'; |
edit_text += 'opener.document.sheet.cell.value='; |
edit_text += 'opener.document.sheet.cell.value='; |
Line 384 sub handler {
|
Line 382 sub handler {
|
edit_text += '<input type="button" name="abort" '; |
edit_text += '<input type="button" name="abort" '; |
edit_text += 'value="$lt{'dc'}"'; |
edit_text += 'value="$lt{'dc'}"'; |
edit_text += ' onClick="javascript:self.close()" />'; |
edit_text += ' onClick="javascript:self.close()" />'; |
edit_text += '</center>$cell_edit_end'; |
edit_text += '</center></div></form>$cell_edit_end'; |
|
|
if (editwin != null && !(editwin.closed) ) { |
if (editwin != null && !(editwin.closed) ) { |
editwin.close(); |
editwin.close(); |
Line 392 sub handler {
|
Line 390 sub handler {
|
|
|
editwin = window.open($nothing,'CellEditWin','height=280,width=480,scrollbars=no,resizable=yes,alwaysRaised=yes,dependent=yes',true); |
editwin = window.open($nothing,'CellEditWin','height=280,width=480,scrollbars=no,resizable=yes,alwaysRaised=yes,dependent=yes',true); |
editwin.document.write(edit_text); |
editwin.document.write(edit_text); |
|
editwin.document.close(); |
} |
} |
//--> |
//--> |
</script> |
</script> |
Line 405 ENDSCRIPT
|
Line 404 ENDSCRIPT
|
faq => 134, |
faq => 134, |
bug => 'Spreadsheet'}); |
bug => 'Spreadsheet'}); |
$r->print(&Apache::loncommon::start_page('Grades Spreadsheet',$js). |
$r->print(&Apache::loncommon::start_page('Grades Spreadsheet',$js). |
&Apache::lonhtmlcommon::breadcrumbs(undef,'Spreadsheet'). |
&Apache::lonhtmlcommon::breadcrumbs('Spreadsheet', |
|
'Spreadsheet_About'). |
'<form action="'.$r->uri.'" name="sheet" method="post">'); |
'<form action="'.$r->uri.'" name="sheet" method="post">'); |
$r->print(&hiddenfield('sname' ,$env{'form.sname'}). |
$r->print(&hiddenfield('sname' ,$env{'form.sname'}). |
&hiddenfield('sdomain',$env{'form.sdomain'}). |
&hiddenfield('sdomain',$env{'form.sdomain'}). |
Line 467 ENDSCRIPT
|
Line 467 ENDSCRIPT
|
my $spreadsheet = undef; |
my $spreadsheet = undef; |
if ($sheettype eq 'classcalc') { |
if ($sheettype eq 'classcalc') { |
$spreadsheet = Apache::classcalc->new($name,$domain,$filename,undef, |
$spreadsheet = Apache::classcalc->new($name,$domain,$filename,undef, |
$section,$group); |
$section,\@groups); |
} elsif ($sheettype eq 'studentcalc') { |
} elsif ($sheettype eq 'studentcalc') { |
$spreadsheet = Apache::studentcalc->new($name,$domain,$filename,undef, |
$spreadsheet = Apache::studentcalc->new($name,$domain,$filename,undef, |
$section,$group); |
$section,\@groups); |
} elsif ($sheettype eq 'assesscalc' && |
} elsif ($sheettype eq 'assesscalc' && |
defined($symb) && |
defined($symb) && |
$allowed_to_edit) { |
$allowed_to_edit) { |
$spreadsheet = Apache::assesscalc->new($name,$domain,$filename,$symb, |
$spreadsheet = Apache::assesscalc->new($name,$domain,$filename,$symb, |
$section,$group); |
$section,\@groups); |
} else { |
} else { |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |