&');
+ 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('$cfile');";
+ }
+ } else {
+ unless ($cfile =~ m{^/priv/}) {
+ if ($symb) {
+ $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';
+ }
+ }
+ $jscall = "go('$cfile')";
+ }
+ return $jscall;
+}
+
+##############################################
+##############################################
+
# javascript_valid_email
#
# Generates javascript to validate an e-mail address.
@@ -2186,7 +3238,7 @@ sub htmltag{
# USAGE: inittags(@tags);
#
# EXAMPLES:
-# - my ($h1, $h2, $h3) = initTags( qw( h1 h2 h3 ) )
+# - my ($h1, $h2, $h3) = inittags( qw( h1 h2 h3 ) )
# $h1->("This is a headline") #Returns: This is a headline
#
# NOTES: See sub htmltag for further information.
@@ -2234,6 +3286,41 @@ sub scripttag {
return htmltag('script', $content, {type => 'text/javascript'});
};
+=pod
+
+=item &list_from_array( \@array, { listattr =>{}, itemattr =>{} } )
+
+Constructs a XHTML list from \@array.
+
+input:
+
+=over
+
+=item \@array
+
+A reference to the array containing text that will be wrapped in tags.
+
+=item { listattr => {}, itemattr =>{} }
+
+Attributes for and - passed in as hash references.
+See htmltag() for more details.
+
+=back
+
+returns: XHTML list as String.
+
+=cut
+
+# \@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;
+ return $ul->( $listitems, $args->{listattr} );
+}
+
##############################################
##############################################
@@ -2264,12 +3351,6 @@ sub scripttag {
#
# Outputs: A scalar containing the html markup for the menu.
-# ---- Remove when done ----
-# This routine is part of the redesign of LON-CAPA and it's
-# subject to change during this project.
-# Don't rely on its current functionality as it might be
-# changed or removed.
-# --------------------------
sub generate_menu {
my @menu = @_;
# subs for specific html elements
@@ -2285,16 +3366,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},
@@ -2328,7 +3414,7 @@ sub generate_menu {
=pod
-=item &start_funclist
+=item &start_funclist()
Start list of available functions
@@ -2368,7 +3454,7 @@ sub start_funclist {
=pod
-=item &add_item_funclist
+=item &add_item_funclist()
Adds an item to the list of available functions
@@ -2392,12 +3478,9 @@ sub add_item_funclist {
return '
- '.$content.'
'."\n";
}
-##############################################
-##############################################
-
=pod
-=item &end_funclist
+=item &end_funclist()
End list of available functions
@@ -2410,16 +3493,81 @@ add_item_funclist
Inputs: ./.
Returns: HTML code with function list end
-
=cut
-##############################################
-##############################################
-
sub end_funclist {
return "
\n";
}
+=pod
+
+=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
+empty.
+
+=over
+
+=item \@array
+
+A reference to the array containing text that will be wrapped in tags.
+
+=item { legend => 'text' }
+
+A string that's used as visually highlighted first item. 'Functions' is used if
+it's value evaluates to false.
+
+=back
+
+returns: XHTML list as string.
+
+=back
+
+=cut
+
+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
+
+=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 Construction 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__
500 Internal Server Error
Internal Server Error
The server encountered an internal error or
misconfiguration and was unable to complete
your request.
Please contact the server administrator at
root@localhost to inform them of the time this error occurred,
and the actions you performed just before this error.
More information about this error may be available
in the server error log.