&');
+ if ($symb) {
+ $cfile .= '&symb='.&HTML::Entities::encode($symb,'"<>&');
+ } elsif ($folderpath) {
+ $cfile .= '&folderpath='.&HTML::Entities::encode($folderpath,'"<>&');
+ }
+ if ($forceedit) {
+ $cfile .= '&forceedit=1';
+ }
+ if ($forcereg) {
+ $cfile .= '®ister=1';
+ }
+ $jscall = "need_switchserver('".&Apache::loncommon::escape_single($cfile)."');";
+ }
+ } else {
+ unless ($cfile =~ m{^/priv/}) {
+ if ($cfile =~ m{^(/adm/wrapper/ext/[^#]+)#([^#]+)$}) {
+ $cfile = $1;
+ $anchor = $2;
+ }
+ if ($symb) {
+ if ($anchor ne '') {
+ if ($symb =~ m{^([^#]+)\Q#$anchor\E$}) {
+ $symb = $1.&escape(&escape('#')).$anchor;
+ }
+ }
+ $cfile .= (($cfile=~/\?/)?'&':'?')."symb=$symb";
+ } elsif ($folderpath) {
+ $cfile .= (($cfile=~/\?/)?'&':'?').
+ 'folderpath='.&HTML::Entities::encode(&escape($folderpath),'"<>&');
+ if ($title) {
+ $cfile .= (($cfile=~/\?/)?'&':'?').
+ 'title='.&HTML::Entities::encode(&escape($title),'"<>&');
+ }
+ if ($idx) {
+ $cfile .= (($cfile=~/\?/)?'&':'?').'idx='.$idx;
+ }
+ if ($suppurl) {
+ $cfile .= (($cfile=~/\?/)?'&':'?').
+ 'suppurl='.&HTML::Entities::encode(&escape($suppurl));
+ }
+ }
+ if ($forceedit) {
+ $cfile .= (($cfile=~/\?/)?'&':'?').'forceedit=1';
+ }
+ if ($forcereg) {
+ $cfile .= (($cfile=~/\?/)?'&':'?').'register=1';
+ }
+ if ($todocs) {
+ $cfile .= (($cfile=~/\?/)?'&':'?').'todocs=1';
+ }
+ if ($suppanchor ne '') {
+ $cfile .= (($cfile=~/\?/)?'&':'?').'anchor='.
+ &HTML::Entities::encode($suppanchor,'"<>&');
+ }
+ }
+ if ($anchor ne '') {
+ $cfile .= '#'.$anchor;
+ }
+ $jscall = "go('".&Apache::loncommon::escape_single($cfile)."')";
+ }
+ return $jscall;
+}
+
+##############################################
+##############################################
+
# javascript_valid_email
#
# Generates javascript to validate an e-mail address.
@@ -2306,7 +3533,7 @@ END
sub htmltag{
return
qq|<$_[0]|
- . join( '', map { qq| $_="${$_[2]}{$_}"| if ${$_[2]}{$_} } keys %{ $_[2] } )
+ . join( '', map { qq| $_="${$_[2]}{$_}"| if ${$_[2]}{$_} } keys(%{ $_[2] }) )
. ($_[1] ? qq|>$_[1]$_[0]>| : qq|/>|). "\n";
};
@@ -2362,8 +3589,9 @@ sub scripttag {
return htmltag('script', $content, {type => 'text/javascript'});
};
+=pod
-=item list_from_array( \@array, { listattr =>{}, itemattr =>{} } )
+=item &list_from_array( \@array, { listattr =>{}, itemattr =>{} } )
Constructs a XHTML list from \@array.
@@ -2389,6 +3617,7 @@ returns: XHTML list as String.
# \@items, {listattr => { class => 'abc', id => 'xyx' }, itemattr => {class => 'abc', id => 'xyx'}}
sub list_from_array {
my ($items, $args) = @_;
+ return unless (ref($items) eq 'ARRAY');
return unless scalar @$items;
my ($ul, $li) = inittags( qw(ul li) );
my $listitems = join '', map { $li->($_, $args->{itemattr}) } @$items;
@@ -2440,16 +3669,21 @@ sub generate_menu {
# create the markup for the current $link and push it into @links.
# each entry consists of an image and a text optionally followed
# by a help link.
+ my $src;
+ if ($$link{icon} ne '') {
+ $src = '/res/adm/pages/'.$$link{icon};
+ }
push(@links,$li->(
$a->(
$img->("", {
class => "LC_noBorder LC_middle",
- src => "/res/adm/pages/$$link{icon}",
+ src => $src,
alt => mt(defined($$link{alttext}) ?
$$link{alttext} : $$link{linktext})
}), {
href => $$link{url},
- title => mt($$link{linktitle})
+ title => mt($$link{linktitle}),
+ class => 'LC_menubuttons_link'
}).
$a->(mt($$link{linktext}), {
href => $$link{url},
@@ -2483,7 +3717,7 @@ sub generate_menu {
=pod
-=item &start_funclist
+=item &start_funclist()
Start list of available functions
@@ -2523,7 +3757,7 @@ sub start_funclist {
=pod
-=item &add_item_funclist
+=item &add_item_funclist()
Adds an item to the list of available functions
@@ -2549,7 +3783,7 @@ sub add_item_funclist {
=pod
-=item &end_funclist
+=item &end_funclist()
End list of available functions
@@ -2562,6 +3796,7 @@ add_item_funclist
Inputs: ./.
Returns: HTML code with function list end
+
=cut
sub end_funclist {
@@ -2570,7 +3805,7 @@ sub end_funclist {
=pod
-=item funclist_from_array( \@array, {legend => 'text for legend'} )
+=item &funclist_from_array( \@array, {legend => 'text for legend'} )
Constructs a XHTML list from \@array with the first item being visually
highlighted and set to the value of legend or 'Functions' if legend is
@@ -2597,11 +3832,48 @@ returns: XHTML list as string.
sub funclist_from_array {
my ($items, $args) = @_;
+ return unless(ref($items) eq 'ARRAY');
$args->{legend} ||= mt('Functions');
return list_from_array( [$args->{legend}, @$items],
{ listattr => {class => 'LC_funclist'} });
}
+=pod
+
+=over
+
+=item &actionbox( \@array )
+
+Constructs a XHTML list from \@array with the first item being visually
+highlighted and set to the value 'Actions'. The list is wrapped in a division.
+
+The actionlist is used to offer contextual actions, mostly at the bottom
+of a page, on which the outcome of an processed action is shown,
+e.g. a file operation in Authoring Space.
+
+=over
+
+=item \@array
+
+A reference to the array containing text. Details: sub funclist_from_array
+
+=back
+
+Returns: XHTML div as string.
+
+=back
+
+=cut
+
+sub actionbox {
+ my ($items) = @_;
+ return unless(ref($items) eq 'ARRAY');
+ return
+ ''
+ .&funclist_from_array($items, {legend => &mt('Actions')})
+ .'
';
+}
+
1;
__END__