version 1.281, 2010/08/07 19:23:50
|
version 1.285.2.3, 2011/10/23 00:50:58
|
Line 60 use Time::Local;
|
Line 60 use Time::Local;
|
use Time::HiRes; |
use Time::HiRes; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonnet; |
use Apache::lonnet; |
|
use HTML::Entities(); |
use LONCAPA; |
use LONCAPA; |
|
|
|
sub java_not_enabled { |
|
return "\n".'<span class="LC_error">'. |
|
&mt('The required Java applet could not be started. Please make sure to have Java installed and active in your browser.'). |
|
"</span>\n"; |
|
} |
|
|
sub coursepreflink { |
sub coursepreflink { |
my ($text,$category)=@_; |
my ($text,$category)=@_; |
Line 78 sub raw_href_to_link {
|
Line 84 sub raw_href_to_link {
|
return $message; |
return $message; |
} |
} |
|
|
|
sub entity_encode { |
|
my ($text)=@_; |
|
return &HTML::Entities::encode($text, '<>&"'); |
|
} |
|
|
############################################## |
############################################## |
############################################## |
############################################## |
|
|
Line 121 sub dragmath_button {
|
Line 132 sub dragmath_button {
|
my ($textarea,$helpicon) = @_; |
my ($textarea,$helpicon) = @_; |
my $help_text; |
my $help_text; |
if ($helpicon) { |
if ($helpicon) { |
$help_text = &Apache::loncommon::help_open_topic('Authoring_Math_Editor'); |
$help_text = &Apache::loncommon::help_open_topic('Authoring_Math_Editor',undef,undef,undef,undef,'mathhelpicon_'.$textarea); |
} |
} |
my $buttontext=&mt('Edit Math'); |
my $buttontext=&mt('Edit Math'); |
return <<ENDDRAGMATH; |
return <<ENDDRAGMATH; |
Line 1222 sub htmlareaheaders {
|
Line 1233 sub htmlareaheaders {
|
ENDEDITOR |
ENDEDITOR |
} |
} |
$s.=(<<ENDJQUERY); |
$s.=(<<ENDJQUERY); |
<script type="text/javascript" src="/adm/jQuery/js/jquery-1.3.2.min.js"></script> |
<script type="text/javascript" src="/adm/jQuery/js/jquery-1.6.2.min.js"></script> |
<script type="text/javascript" src="/adm/jQuery/js/jquery-ui-1.7.2.custom.min.js"></script> |
<script type="text/javascript" src="/adm/jQuery/js/jquery-ui-1.8.16.custom.min.js"></script> |
<link rel="stylesheet" type="text/css" href="/adm/jQuery/css/smoothness/jquery-ui-1.7.2.custom.css" /> |
<link rel="stylesheet" type="text/css" href="/adm/jQuery/css/smoothness/jquery-ui-1.8.16.custom.css" /> |
ENDJQUERY |
ENDJQUERY |
return $s; |
return $s; |
} |
} |
|
|
# ----------------------------------------------------------------- Preferences |
# ----------------------------------------------------------------- Preferences |
|
|
sub disablelink { |
|
my @fields=@_; |
|
if (defined($#fields)) { |
|
unless ($#fields>=0) { return ''; } |
|
} |
|
return '<a href="'.&HTML::Entities::encode('/adm/preferences?action=set_wysiwyg&wysiwyg=off&returnurl=','<>&"').&escape($ENV{'REQUEST_URI'}).'">'.&mt('Disable WYSIWYG Editor').'</a>'; |
|
} |
|
|
|
sub enablelink { |
|
my @fields=@_; |
|
if (defined($#fields)) { |
|
unless ($#fields>=0) { return ''; } |
|
} |
|
return '<a href="'.&HTML::Entities::encode('/adm/preferences?action=set_wysiwyg&wysiwyg=on&returnurl=','<>&"').&escape($ENV{'REQUEST_URI'}).'">'.&mt('Enable WYSIWYG Editor').'</a>'; |
|
} |
|
|
|
# ------------------------------------------------- lang to use in html editor |
# ------------------------------------------------- lang to use in html editor |
sub htmlarea_lang { |
sub htmlarea_lang { |
my $lang='en'; |
my $lang='en'; |
Line 1265 sub htmlareaselectactive {
|
Line 1260 sub htmlareaselectactive {
|
.'// <![CDATA['."\n"; |
.'// <![CDATA['."\n"; |
my $lang = &htmlarea_lang(); |
my $lang = &htmlarea_lang(); |
my $fullpage = 'false'; |
my $fullpage = 'false'; |
my $dragmath_prefix; |
my ($dragmath_prefix,$dragmath_helpicon,$dragmath_whitespace); |
if (ref($args) eq 'HASH') { |
if (ref($args) eq 'HASH') { |
if (exists($args->{'lang'})) { |
if (exists($args->{'lang'})) { |
if ($args->{'lang'} ne '') { |
if ($args->{'lang'} ne '') { |
Line 1280 sub htmlareaselectactive {
|
Line 1275 sub htmlareaselectactive {
|
if (exists($args->{'dragmath'})) { |
if (exists($args->{'dragmath'})) { |
if ($args->{'dragmath'} ne '') { |
if ($args->{'dragmath'} ne '') { |
$dragmath_prefix = $args->{'dragmath'}; |
$dragmath_prefix = $args->{'dragmath'}; |
|
$dragmath_helpicon=&Apache::loncommon::lonhttpdurl("/adm/help/help.png"); |
|
$dragmath_whitespace=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/transparent1x1.gif"); |
} |
} |
} |
} |
} |
} |
Line 1383 sub htmlareaselectactive {
|
Line 1380 sub htmlareaselectactive {
|
return; |
return; |
} |
} |
mathele.style.display = value; |
mathele.style.display = value; |
|
var mathhelpicon = "'.$dragmath_prefix.'helpicon'.'_"+id; |
|
mathhelpiconele = document.getElementById(mathhelpicon); |
|
if (mathhelpiconele == null) { |
|
return; |
|
} |
|
if (value == "none") { |
|
mathhelpiconele.src = "'.$dragmath_whitespace.'"; |
|
} else { |
|
mathhelpiconele.src = "'.$dragmath_helpicon.'"; |
|
} |
} |
} |
'; |
'; |
|
|
Line 1602 returns: nothing
|
Line 1609 returns: nothing
|
sub add_breadcrumb_tool { |
sub add_breadcrumb_tool { |
my ($category, @html) = @_; |
my ($category, @html) = @_; |
return unless @html; |
return unless @html; |
if (!defined(%tools)) { |
if (!keys(%tools)) { |
%tools = ( navigation => [], tools => [], advtools => []); |
%tools = ( navigation => [], tools => [], advtools => []); |
} |
} |
|
|
Line 1610 returns: nothing
|
Line 1617 returns: nothing
|
@html = grep {defined $_ && $_ ne ''} @html; |
@html = grep {defined $_ && $_ ne ''} @html; |
for (@html) { |
for (@html) { |
s/align="(right|left)"//; |
s/align="(right|left)"//; |
s/<span.*?\/span>// if $category ne 'advtools'; |
if (($category ne 'advtools') && ($category ne 'tools')) { |
|
s/<span.*?\/span>//; |
|
} |
} |
} |
|
|
push @{$tools{$category}}, @html; |
push @{$tools{$category}}, @html; |
Line 1642 returns: nothing
|
Line 1651 returns: nothing
|
#TODO might split this in separate functions for each category |
#TODO might split this in separate functions for each category |
sub render_tools { |
sub render_tools { |
my ($breadcrumbs) = @_; |
my ($breadcrumbs) = @_; |
return unless defined %tools; |
return unless (keys(%tools)); |
|
|
my $navigation = list_from_array($tools{navigation}, |
my $navigation = list_from_array($tools{navigation}, |
{ listattr => { class=>"LC_breadcrumb_tools_navigation" } }); |
{ listattr => { class=>"LC_breadcrumb_tools_navigation" } }); |
Line 2104 sub echo_form_input {
|
Line 2113 sub echo_form_input {
|
if ($key =~ /^form\.(.+)$/) { |
if ($key =~ /^form\.(.+)$/) { |
my $name = $1; |
my $name = $1; |
my $match = 0; |
my $match = 0; |
if ((!@{$excluded}) || (!grep/^$name$/,@{$excluded})) { |
if (ref($excluded) eq 'ARRAY') { |
if (defined($regexps)) { |
next if (grep(/^\Q$name\E$/,@{$excluded})); |
if (@{$regexps} > 0) { |
} |
foreach my $regexp (@{$regexps}) { |
if (ref($regexps) eq 'ARRAY') { |
if ($name =~ /\Q$regexp\E/) { |
if (@{$regexps} > 0) { |
$match = 1; |
foreach my $regexp (@{$regexps}) { |
last; |
if ($name =~ /$regexp/) { |
} |
$match = 1; |
|
last; |
} |
} |
} |
} |
} |
} |
if (!$match) { |
} |
if (ref($env{$key})) { |
next if ($match); |
foreach my $value (@{$env{$key}}) { |
if (ref($env{$key}) eq 'ARRAY') { |
$value = &HTML::Entities::encode($value,'<>&"'); |
foreach my $value (@{$env{$key}}) { |
$output .= '<input type="hidden" name="'.$name. |
$value = &HTML::Entities::encode($value,'<>&"'); |
'" value="'.$value.'" />'."\n"; |
$output .= '<input type="hidden" name="'.$name. |
} |
'" value="'.$value.'" />'."\n"; |
} else { |
|
my $value = &HTML::Entities::encode($env{$key},'<>&"'); |
|
$output .= '<input type="hidden" name="'.$name. |
|
'" value="'.$value.'" />'."\n"; |
|
} |
|
} |
} |
|
} else { |
|
my $value = &HTML::Entities::encode($env{$key},'<>&"'); |
|
$output .= '<input type="hidden" name="'.$name. |
|
'" value="'.$value.'" />'."\n"; |
} |
} |
} |
} |
} |
} |
Line 2428 returns: XHTML list as String.
|
Line 2437 returns: XHTML list as String.
|
# \@items, {listattr => { class => 'abc', id => 'xyx' }, itemattr => {class => 'abc', id => 'xyx'}} |
# \@items, {listattr => { class => 'abc', id => 'xyx' }, itemattr => {class => 'abc', id => 'xyx'}} |
sub list_from_array { |
sub list_from_array { |
my ($items, $args) = @_; |
my ($items, $args) = @_; |
|
return unless (ref($items) eq 'ARRAY'); |
return unless scalar @$items; |
return unless scalar @$items; |
my ($ul, $li) = inittags( qw(ul li) ); |
my ($ul, $li) = inittags( qw(ul li) ); |
my $listitems = join '', map { $li->($_, $args->{itemattr}) } @$items; |
my $listitems = join '', map { $li->($_, $args->{itemattr}) } @$items; |
Line 2479 sub generate_menu {
|
Line 2489 sub generate_menu {
|
# create the markup for the current $link and push it into @links. |
# create the markup for the current $link and push it into @links. |
# each entry consists of an image and a text optionally followed |
# each entry consists of an image and a text optionally followed |
# by a help link. |
# by a help link. |
|
my $src; |
|
if ($$link{icon} ne '') { |
|
$src = '/res/adm/pages/'.$$link{icon}; |
|
} |
push(@links,$li->( |
push(@links,$li->( |
$a->( |
$a->( |
$img->("", { |
$img->("", { |
class => "LC_noBorder LC_middle", |
class => "LC_noBorder LC_middle", |
src => "/res/adm/pages/$$link{icon}", |
src => $src, |
alt => mt(defined($$link{alttext}) ? |
alt => mt(defined($$link{alttext}) ? |
$$link{alttext} : $$link{linktext}) |
$$link{alttext} : $$link{linktext}) |
}), { |
}), { |
Line 2636 returns: XHTML list as string.
|
Line 2650 returns: XHTML list as string.
|
|
|
sub funclist_from_array { |
sub funclist_from_array { |
my ($items, $args) = @_; |
my ($items, $args) = @_; |
|
return unless(ref($items) eq 'ARRAY'); |
$args->{legend} ||= mt('Functions'); |
$args->{legend} ||= mt('Functions'); |
return list_from_array( [$args->{legend}, @$items], |
return list_from_array( [$args->{legend}, @$items], |
{ listattr => {class => 'LC_funclist'} }); |
{ listattr => {class => 'LC_funclist'} }); |