--- loncom/homework/edit.pm 2003/09/10 22:03:40 1.57.2.1
+++ loncom/homework/edit.pm 2003/09/17 15:44:19 1.65
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# edit mode helpers
#
-# $Id: edit.pm,v 1.57.2.1 2003/09/10 22:03:40 albertel Exp $
+# $Id: edit.pm,v 1.65 2003/09/17 15:44:19 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -45,233 +45,241 @@ $Apache::edit::bgimgsrc='';
$Apache::edit::bgimgsrccurdepth='';
sub initialize_edit {
- $Apache::edit::colordepth=0;
- @Apache::edit::inserttag=();
+ $Apache::edit::colordepth=0;
+ @Apache::edit::inserttag=();
}
sub tag_start {
- my ($target,$token,$description) = @_;
- my $result='';
- if ($target eq "edit") {
- my $tag=$token->[1];
- if (!$description) {
- $description=&Apache::lonxml::description($token);
- if (!$description) { $description="<$tag>"; }
- }
- $result.= &start_table($token)."
$description |
-Delete".
- &deletelist($target,$token)
- ." |
-".
- &insertlist($target,$token).&end_row().&start_spanning_row();
+ my ($target,$token,$description) = @_;
+ my $result='';
+ if ($target eq "edit") {
+ my $tag=$token->[1];
+ if (!$description) {
+ $description=&Apache::lonxml::description($token);
+ if (!$description) { $description="<$tag>"; }
+ }
+ $result.= &start_table($token)." |
$description |
+ Delete".
+ &deletelist($target,$token)
+ ." |
+ ".
+ &insertlist($target,$token);
# | ".
# &movebuttons($target,$token).
# " |
\n";
- }
- return $result;
+ my @help;# = Apache::lonxml::helpinfo($token);
+ if ($help[0]) {
+ $result .= ' | ' .
+ Apache::loncommon::help_open_topic(@help) .
+ ' | ';
+ } else { $result .= " | "; }
+ $result .= &end_row().&start_spanning_row();
+ }
+ return $result;
}
sub tag_end {
- my ($target,$token,$description) = @_;
- my $result='';
- if ($target eq 'edit') {
- $result.="
".&end_table()."\n";
- }
- return $result;
+ my ($target,$token,$description) = @_;
+ my $result='';
+ if ($target eq 'edit') {
+ $result.="".&end_table()."\n";
+ }
+ return $result;
}
sub start_table {
- my ($token)=@_;
- my $tag = $token->[1];
- my $tagnum;
- foreach my $namespace (reverse @Apache::lonxml::namespace) {
- my $testtag=$namespace.'::'.$tag;
- $tagnum=$Apache::lonxml::insertlist{"$testtag.num"};
- if (defined($tagnum)) { last; }
- }
- if (!defined ($tagnum)) { $tagnum=$Apache::lonxml::insertlist{"$tag.num"}; }
- my $color = $Apache::lonxml::insertlist{"$tagnum.color"};
- if (!defined($color)) {
- $color = $Apache::edit::colorlist[$Apache::edit::colordepth];
- }
- $Apache::edit::colordepth++;
- push(@Apache::edit::inserttag,$token->[1]);
- my $result='';
- $result.='
';
- return $result;
+ my ($token)=@_;
+ my $tag = $token->[1];
+ my $tagnum;
+ foreach my $namespace (reverse @Apache::lonxml::namespace) {
+ my $testtag=$namespace.'::'.$tag;
+ $tagnum=$Apache::lonxml::insertlist{"$testtag.num"};
+ if (defined($tagnum)) { last; }
+ }
+ if (!defined ($tagnum)) {$tagnum=$Apache::lonxml::insertlist{"$tag.num"};}
+ my $color = $Apache::lonxml::insertlist{"$tagnum.color"};
+ if (!defined($color)) {
+ $color = $Apache::edit::colorlist[$Apache::edit::colordepth];
+ }
+ $Apache::edit::colordepth++;
+ push(@Apache::edit::inserttag,$token->[1]);
+ my $result='';
+ $result.='
';
+ return $result;
}
sub end_table {
- $Apache::edit::colordepth--;
- my $result='
';
- $result.="";
-
- my ($tagname,$closingtag);
- if (defined($Apache::edit::inserttag[-2])) {
- $tagname=$Apache::edit::inserttag[-2];
- } else {$tagname='problem';}
- if (defined($Apache::edit::inserttag[-1])) {
- $closingtag=$Apache::edit::inserttag[-1];
- }
- $result.=&innerinsertlist('edit',$tagname,$closingtag).
- " |
";
- pop(@Apache::edit::inserttag);
- return $result;
+ $Apache::edit::colordepth--;
+ my $result='
';
+ $result.="";
+
+ my ($tagname,$closingtag);
+ if (defined($Apache::edit::inserttag[-2])) {
+ $tagname=$Apache::edit::inserttag[-2];
+ } else {$tagname='problem';}
+ if (defined($Apache::edit::inserttag[-1])) {
+ $closingtag=$Apache::edit::inserttag[-1];
+ }
+ $result.=&innerinsertlist('edit',$tagname,$closingtag).
+ " |
";
+ pop(@Apache::edit::inserttag);
+ return $result;
}
-sub start_spanning_row { return '';}
+sub start_spanning_row { return ' |
';}
sub start_row { return ' |
'; }
sub end_row { return ' |
'; }
sub movebuttons {
- my ($target,$token) = @_;
- my $result='';
- $result.='';
- return $result;
+ my ($target,$token) = @_;
+ my $result='';
+ $result.='';
+ return $result;
}
sub deletelist {
- my ($target,$token) = @_;
- my $result = "