version 1.105, 2007/02/18 02:00:59
|
version 1.116, 2008/10/24 16:22:54
|
Line 61 sub tag_start {
|
Line 61 sub tag_start {
|
if (!$description) { $description="<$tag>"; } |
if (!$description) { $description="<$tag>"; } |
} |
} |
$result.= &start_table($token)."<tr><td>$description</td> |
$result.= &start_table($token)."<tr><td>$description</td> |
<td>Delete". |
<td>".&mt('Delete?').' '. |
&deletelist($target,$token) |
&deletelist($target,$token) |
."</td> |
."</td> |
<td>". |
<td>". |
Line 128 sub end_table {
|
Line 128 sub end_table {
|
return $result; |
return $result; |
} |
} |
|
|
sub start_spanning_row { return '<tr><td colspan="4" bgcolor="#DDDDDD">';} |
sub start_spanning_row { return '<tr><td colspan="5" bgcolor="#DDDDDD">';} |
sub start_row { return '<tr><td bgcolor="#DDDDDD">'; } |
sub start_row { return '<tr><td bgcolor="#DDDDDD">'; } |
sub end_row { return '</td></tr>'; } |
sub end_row { return '</td></tr>'; } |
|
|
Line 145 sub deletelist {
|
Line 145 sub deletelist {
|
my ($target,$token) = @_; |
my ($target,$token) = @_; |
my $result = "<select name=\"delete_$Apache::lonxml::curdepth\"> |
my $result = "<select name=\"delete_$Apache::lonxml::curdepth\"> |
<option></option> |
<option></option> |
<option>Yes</option> |
<option>".&mt('yes')."</option> |
</select>"; |
</select>"; |
return $result; |
return $result; |
} |
} |
Line 215 sub innerinsertlist {
|
Line 215 sub innerinsertlist {
|
if ($target eq 'edit') { |
if ($target eq 'edit') { |
my $optionlist= &get_insert_list($tagname); |
my $optionlist= &get_insert_list($tagname); |
if ($optionlist) { |
if ($optionlist) { |
$result = "Insert: |
$result = &mt('Insert:')." |
<select name=\"insert$after\_$Apache::lonxml::curdepth\"> |
<select name=\"insert$after\_$Apache::lonxml::curdepth\"> |
$optionlist |
$optionlist |
</select>" |
</select>" |
Line 324 sub insert_customresponse_answer {
|
Line 324 sub insert_customresponse_answer {
|
'; |
'; |
} |
} |
|
|
|
sub insert_customhint { |
|
return ' |
|
<customhint> |
|
<answer type="loncapa/perl"> |
|
</answer> |
|
</customhint>'; |
|
} |
|
|
|
sub insert_customhint_answer { |
|
return ' |
|
<answer type="loncapa/perl"> |
|
</answer> |
|
'; |
|
} |
|
|
|
sub insert_mathresponse { |
|
return ' |
|
<mathresponse> |
|
<answer> |
|
</answer> |
|
<textline /> |
|
<hintgroup> |
|
<startouttext /> |
|
<endouttext /> |
|
</hintgroup> |
|
</mathresponse>'; |
|
} |
|
|
|
sub insert_mathresponse_answer { |
|
return ' |
|
<answer> |
|
</answer> |
|
'; |
|
} |
|
|
|
sub insert_mathhint { |
|
return ' |
|
<mathhint> |
|
<answer> |
|
</answer> |
|
</mathhint>'; |
|
} |
|
|
|
sub insert_mathhint_answer { |
|
return ' |
|
<answer> |
|
</answer> |
|
'; |
|
} |
|
|
sub insert_stringresponse { |
sub insert_stringresponse { |
return ' |
return ' |
<stringresponse answer="" type=""> |
<stringresponse answer="" type=""> |
Line 527 sub element_change_detection {
|
Line 577 sub element_change_detection {
|
} |
} |
|
|
sub submit_ask_anyway { |
sub submit_ask_anyway { |
return ' onclick="still_ask=true;" '; |
my ($extra_action) = @_; |
|
return ' onclick="still_ask=true;'.$extra_action.'" '; |
} |
} |
|
|
sub textarea_sizes { |
sub textarea_sizes { |
Line 547 sub textarea_sizes {
|
Line 598 sub textarea_sizes {
|
sub editline { |
sub editline { |
my ($tag,$data,$description,$size)=@_; |
my ($tag,$data,$description,$size)=@_; |
$data=&HTML::Entities::encode($data,'<>&"'); |
$data=&HTML::Entities::encode($data,'<>&"'); |
if ($description) { $description="<br />".$description."<br />"; } |
if ($description) { $description=$description."<br />"; } |
my $change_code = &element_change_detection(); |
my $change_code = &element_change_detection(); |
my $result = <<"END"; |
my $result = <<"END"; |
$description |
$description |
Line 569 sub editfield {
|
Line 620 sub editfield {
|
if ($cols > 80) { $cols = 80; } |
if ($cols > 80) { $cols = 80; } |
if ($cols < $minwidth ) { $cols = $minwidth; } |
if ($cols < $minwidth ) { $cols = $minwidth; } |
if ($rows < $minheight) { $rows = $minheight; } |
if ($rows < $minheight) { $rows = $minheight; } |
if ($description) { $description="<br />".$description."<br />"; } |
if ($description) { $description=$description."<br />"; } |
if ($usehtmlarea) { |
if ($usehtmlarea) { |
&Apache::lonhtmlcommon::add_htmlareafields('homework_edit_'. |
&Apache::lonhtmlcommon::add_htmlareafields('homework_edit_'. |
$Apache::lonxml::curdepth); |
$Apache::lonxml::curdepth); |
Line 622 sub get_new_args {
|
Line 673 sub get_new_args {
|
$token->[2]->{$arg}=$newvalue; |
$token->[2]->{$arg}=$newvalue; |
} |
} |
$rebuild=1; |
$rebuild=1; |
|
# add new attributes to the of the attribute seq |
|
if (!grep { $arg eq $_ } (@{ $token->[3] })) { |
|
push(@{ $token->[3] },$arg); |
|
} |
} elsif (!defined($newvalue) && defined($value)) { |
} elsif (!defined($newvalue) && defined($value)) { |
delete($token->[2]->{$arg}); |
delete($token->[2]->{$arg}); |
$rebuild=1; |
$rebuild=1; |
Line 636 sub rebuild_tag {
|
Line 691 sub rebuild_tag {
|
my $result; |
my $result; |
if ($token->[0] eq 'S') { |
if ($token->[0] eq 'S') { |
$result = '<'.$token->[1]; |
$result = '<'.$token->[1]; |
while (my ($key,$val)= each(%{$token->[2]})) { |
foreach my $attribute (@{ $token->[3] }) { |
$val=~s:^\s+|\s+$::g; |
my $value = $token->[2]{$attribute}; |
$val=~s:"::g; #" |
next if ($value eq ''); |
&Apache::lonxml::debug("setting :$key: to :$val:"); |
$value =~s/^\s+|\s+$//g; |
$result.=' '.$key.'="'.$val.'"'; |
$value =~s/\"//g; |
|
&Apache::lonxml::debug("setting :$attribute: to :$value:"); |
|
$result.=' '.$attribute.'="'.$value.'"'; |
} |
} |
if ($token->[4] =~ m:/>$:) { |
if ($token->[4] =~ m:/>$:) { |
$result.=' />'; |
$result.=' />'; |
Line 683 sub checked_arg {
|
Line 740 sub checked_arg {
|
$text=$option; |
$text=$option; |
$value='value="'.$option.'"'; |
$value='value="'.$option.'"'; |
} |
} |
$result.="<nobr><label><input type='checkbox' $value name='". |
$result.="<nobr><label><input type=\"checkbox\" $value name=\"". |
&html_element_name($name)."'"; |
&html_element_name($name)."\""; |
foreach my $selected (split(/,/,$allselected)) { |
foreach my $selected (split(/,/,$allselected)) { |
if ( $selected eq $option ) { |
if ( $selected eq $option ) { |
$result.=" checked='checked' "; |
$result.=" checked=\"checked\" "; |
last; |
last; |
} |
} |
} |
} |
Line 723 sub select_arg {
|
Line 780 sub select_arg {
|
$value='value="'.&HTML::Entities::encode($option,'\'"&<>').'"'; |
$value='value="'.&HTML::Entities::encode($option,'\'"&<>').'"'; |
} |
} |
if ( $selected eq $option ) { |
if ( $selected eq $option ) { |
$optionlist.="<option $value selected=\"selected\">$text</option>\n"; |
$optionlist.="<option $value selected=\"selected\">".&mt($text)."</option>\n"; |
} else { |
} else { |
$optionlist.="<option $value >$text</option>\n"; |
$optionlist.="<option $value >".&mt($text)."</option>\n"; |
} |
} |
} |
} |
$result.='<nobr>'.$description.' <select name="'. |
$result.='<nobr>'.&mt($description).' <select name="'. |
&html_element_name($name).'" '.&element_change_detection().' > |
&html_element_name($name).'" '.&element_change_detection().' > |
'.$optionlist.' |
'.$optionlist.' |
</select></nobr>'; |
</select></nobr>'; |
Line 823 sub entercoords {
|
Line 880 sub entercoords {
|
$data{"imagechoice.$id.formwidth"}=$width.'_'. |
$data{"imagechoice.$id.formwidth"}=$width.'_'. |
$Apache::edit::bgimgsrccurdepth; |
$Apache::edit::bgimgsrccurdepth; |
} |
} |
&Apache::lonnet::appenv(%data); |
&Apache::lonnet::appenv(\%data); |
my $text="Click Coordinates"; |
my $text="Click Coordinates"; |
my $result='<a href="/adm/imagechoice?token='.$id.'" target="imagechoice">'.$text.'</a>'; |
my $result='<a href="/adm/imagechoice?token='.$id.'" target="imagechoice">'.$text.'</a>'; |
return $result; |
return $result; |
Line 856 sub entercoord {
|
Line 913 sub entercoord {
|
$data{"imagechoice.$id.formwidth"}=$width.'_'. |
$data{"imagechoice.$id.formwidth"}=$width.'_'. |
$Apache::edit::bgimgsrccurdepth; |
$Apache::edit::bgimgsrccurdepth; |
} |
} |
&Apache::lonnet::appenv(%data); |
&Apache::lonnet::appenv(\%data); |
my $text="Enter Coordinates"; |
my $text="Enter Coordinates"; |
if ($type eq 'polygon') { $text='Create Polygon Data'; } |
if ($type eq 'polygon') { $text='Create Polygon Data'; } |
my $result='<a href="/adm/imagechoice?token='.$id.'" target="imagechoice">'.$text.'</a>'; |
my $result='<a href="/adm/imagechoice?token='.$id.'" target="imagechoice">'.$text.'</a>'; |
Line 870 sub deletecoorddata {
|
Line 927 sub deletecoorddata {
|
#----------------------------------------------------- browse |
#----------------------------------------------------- browse |
sub browse { |
sub browse { |
# insert a link to call up the filesystem browser (lonindexer) |
# insert a link to call up the filesystem browser (lonindexer) |
my ($id, $mode, $titleid) = @_; |
my ($id, $mode, $titleid, $only) = @_; |
my $form = 'lonhomework'; |
my $form = 'lonhomework'; |
my $element; |
my $element; |
if (! defined($mode) || $mode eq 'attribute') { |
if (! defined($mode) || $mode eq 'attribute') { |
Line 881 sub browse {
|
Line 938 sub browse {
|
} |
} |
my $titleelement; |
my $titleelement; |
if ($titleid) { |
if ($titleid) { |
$titleelement=",'','','".&escape("$titleid\_$Apache::lonxml::curdepth")."'"; |
$titleelement=",'$only','','".&escape("$titleid\_$Apache::lonxml::curdepth")."'"; |
|
} else { |
|
$titleelement=",'$only'"; |
} |
} |
my $result = <<"ENDBUTTON"; |
my $result = <<"ENDBUTTON"; |
<a href=\"javascript:openbrowser('$form','$element'$titleelement)\"\>Select</a> |
<a href=\"javascript:openbrowser('$form','$element'$titleelement)\"\>Select</a> |