version 1.246, 2009/11/19 10:25:02
|
version 1.255, 2009/12/22 05:33:36
|
Line 62 use Apache::lonlocal;
|
Line 62 use Apache::lonlocal;
|
use Apache::lonnet; |
use Apache::lonnet; |
use LONCAPA; |
use LONCAPA; |
|
|
|
|
|
sub coursepreflink { |
|
my ($text,$category)=@_; |
|
if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { |
|
return '<a href="/adm/courseprefs?phase=display&actions='.$category.'">'.$text.'</a>'; |
|
} else { |
|
return ''; |
|
} |
|
} |
|
|
|
sub raw_href_to_link { |
|
my ($message)=@_; |
|
$message=~s/(https?\:\/\/[^\s\'\"]+)(\s|$)/<a href="$1"><tt>$1<\/tt><\/a>$2/gi; |
|
return $message; |
|
} |
|
|
############################################## |
############################################## |
############################################## |
############################################## |
|
|
Line 222 sub select_recent {
|
Line 238 sub select_recent {
|
unless ($value =~/^error\:/) { |
unless ($value =~/^error\:/) { |
my $escaped = &Apache::loncommon::escape_url($value); |
my $escaped = &Apache::loncommon::escape_url($value); |
&Apache::loncommon::inhibit_menu_check(\$escaped); |
&Apache::loncommon::inhibit_menu_check(\$escaped); |
|
if ($area eq 'residx') { |
|
next if ((!&Apache::lonnet::allowed('bre',$value)) && (!&Apache::lonnet::allowed('bro',$value))); |
|
} |
$return.="\n<option value='$escaped'>". |
$return.="\n<option value='$escaped'>". |
&unescape((split(/\&/,$recent{$value}))[1]). |
&unescape((split(/\&/,$recent{$value}))[1]). |
'</option>'; |
'</option>'; |
Line 1117 sub r_print {
|
Line 1136 sub r_print {
|
# ------------------------------------------------------- Puts directory header |
# ------------------------------------------------------- Puts directory header |
|
|
sub crumbs { |
sub crumbs { |
my ($uri,$target,$prefix,$form,$size,$noformat,$skiplast)=@_; |
my ($uri,$target,$prefix,$form,$skiplast)=@_; |
if (! defined($size)) { |
|
$size = '+2'; |
|
} |
|
if ($target) { |
if ($target) { |
$target = ' target="'. |
$target = ' target="'. |
&Apache::loncommon::escape_single($target).'"'; |
&Apache::loncommon::escape_single($target).'"'; |
} |
} |
my $output=''; |
my $output='<span class="LC_filename">'; |
unless ($noformat) { $output.='<br /><tt><b>'; } |
$output.=$prefix.'/'; |
$output.='<font size="'.$size.'">'.$prefix.'/'; |
if (($env{'user.adv'}) || ($env{'user.author'})) { |
if (($env{'user.adv'}) | ($env{'user.author'})) { |
my $path=$prefix.'/'; |
my $path=$prefix.'/'; |
foreach my $dir (split('/',$uri)) { |
foreach my $dir (split('/',$uri)) { |
|
if (! $dir) { next; } |
if (! $dir) { next; } |
$path .= $dir; |
$path .= $dir; |
if ($path eq $uri) { |
if ($path eq $uri) { |
if ($skiplast) { |
if ($skiplast) { |
$output.=$dir; |
$output.=$dir; |
last; |
last; |
} |
} |
} else { |
} else { |
$path.='/'; |
$path.='/'; |
} |
} |
my $href_path = &HTML::Entities::encode($path,'<>&"'); |
my $href_path = &HTML::Entities::encode($path,'<>&"'); |
&Apache::loncommon::inhibit_menu_check(\$href_path); |
&Apache::loncommon::inhibit_menu_check(\$href_path); |
if ($form) { |
if ($form) { |
my $href = 'javascript:'.$form.".action='".$href_path."';".$form.'.submit();'; |
my $href = 'javascript:'.$form.".action='".$href_path."';".$form.'.submit();'; |
$output.=qq{<a href="$href" $target>$dir</a>/}; |
$output.=qq{<a href="$href"$target>$dir</a>/}; |
} else { |
} else { |
$output.=qq{<a href="$href_path" $target>$dir</a>/}; |
$output.=qq{<a href="$href_path"$target>$dir</a>/}; |
} |
} |
} |
} |
} else { |
} else { |
foreach my $dir (split('/',$uri)) { |
foreach my $dir (split('/',$uri)) { |
if (! $dir) { next; } |
if (! $dir) { next; } |
$output.=$dir.'/'; |
$output.=$dir.'/'; |
} |
} |
} |
} |
if ($uri !~ m|/$|) { $output=~s|/$||; } |
if ($uri !~ m|/$|) { $output=~s|/$||; } |
return $output.'</font>'.($noformat?'':'</b></tt><br />'); |
$output.='</span>'; |
|
|
|
return $output; |
} |
} |
|
|
# --------------------- A function that generates a window for the spellchecker |
# --------------------- A function that generates a window for the spellchecker |
Line 1224 ENDLINK
|
Line 1241 ENDLINK
|
} |
} |
|
|
sub htmlareaheaders { |
sub htmlareaheaders { |
return if (&htmlareablocked()); |
my $s=""; |
return if (!&htmlareabrowser()); |
if (!&htmlareablocked() && &htmlareabrowser()) { |
return (<<ENDHEADERS); |
$s.=(<<ENDEDITOR); |
<script type="text/javascript" src="/fckeditor/fckeditor.js"></script> |
<script type="text/javascript" src="/fckeditor/fckeditor.js"></script> |
ENDHEADERS |
<script type="text/javascript" src="/ckeditor/ckeditor.js"></script> |
|
ENDEDITOR |
|
} |
|
$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-ui-1.7.2.custom.min.js"></script> |
|
ENDJQUERY |
|
return $s; |
} |
} |
|
|
# ----------------------------------------------------------------- Preferences |
# ----------------------------------------------------------------- Preferences |
Line 1267 sub htmlareaselectactive {
|
Line 1291 sub htmlareaselectactive {
|
my $output='<script type="text/javascript" defer="1">'."\n" |
my $output='<script type="text/javascript" defer="1">'."\n" |
.'// <![CDATA['."\n"; |
.'// <![CDATA['."\n"; |
my $lang = &htmlarea_lang(); |
my $lang = &htmlarea_lang(); |
foreach my $field (@fields) { |
$output.=' |
$output.=" |
|
{ |
function containsBlockHtml(id) { |
var oFCKeditor = new FCKeditor('$field'); |
var re = $("#"+id).html().search(/(?:\<\;|\<)(br|h1|h2|h3|h4|h5|h6|p|ol|ul|table|pre|address|blockquote|center|div)[\s]*((?:\/[\s]*(?:\>\;|\>)|(?:\>\;|\>)[\s\S]*(?:\<\;|\<)\/[\s]*\1[\s]*\(?:\>\;|\>))/im); |
oFCKeditor.Config['CustomConfigurationsPath'] = |
return (re >= 0); |
'/fckeditor/loncapaconfig.js'; |
|
oFCKeditor.ReplaceTextarea(); |
|
oFCKeditor.Config['AutoDetectLanguage'] = false; |
|
oFCKeditor.Config['DefaultLanguage'] = '$lang'; |
|
}"; |
|
} |
} |
|
|
|
function startRichEditor(id) { |
|
CKEDITOR.replace(id, |
|
{ |
|
customConfig: "/ckeditor/loncapaconfig.js", |
|
} |
|
); |
|
} |
|
|
|
function destroyRichEditor(id) { |
|
CKEDITOR.instances[id].destroy(); |
|
} |
|
|
|
function editorHandler(event) { |
|
var rawid = $(this).attr("id"); |
|
var id = new RegExp("LC_rt_(.*)").exec(rawid)[1] |
|
event.preventDefault(); |
|
if ($(this).hasClass("LC_enable_rt")) { |
|
startRichEditor(id); |
|
$("#LC_rt_"+id).html("<b>« Plain text</b>"); |
|
$("#LC_rt_"+id).attr("title", "Disable rich text formatting and edit in plain text"); |
|
$("#LC_rt_"+id).addClass("LC_disable_rt"); |
|
$("#LC_rt_"+id).removeClass("LC_enable_rt"); |
|
} else { |
|
destroyRichEditor(id); |
|
$("#LC_rt_"+id).html("<b>Rich formatting »</b>"); |
|
$("#LC_rt_"+id).attr("title", "Enable rich text formatting (bold, italic, etc.)"); |
|
$("#LC_rt_"+id).addClass("LC_enable_rt"); |
|
$("#LC_rt_"+id).removeClass("LC_disable_rt"); |
|
} |
|
} |
|
|
|
$(document).ready(function(){ |
|
$(".LC_richAlwaysOn").each(function() { |
|
startRichEditor($(this).attr("id")); |
|
}); |
|
$(".LC_richDetectHtml").each(function() { |
|
var id = $(this).attr("id"); |
|
if(containsBlockHtml(id)) { |
|
$(this).before("<div><a href=\"#\" id=\"LC_rt_"+id+"\" title=\"Disable rich text formatting and edit in plain text\" class=\"LC_disable_rt\"><b>« Plain text</b></a></div>"); |
|
startRichEditor(id); |
|
$("#LC_rt_"+id).click(editorHandler); |
|
} |
|
else { |
|
$(this).before("<div><a href=\"#\" id=\"LC_rt_"+id+"\" title=\"Enable rich text formatting (bold, italic, etc.)\" class=\"LC_enable_rt\"><b>Rich formatting »</b></a></div>"); |
|
$("#LC_rt_"+id).click(editorHandler); |
|
} |
|
}); |
|
$(".LC_richDefaultOn").each(function() { |
|
var id = $(this).attr("id"); |
|
$(this).before("<div><a href=\"#\" id=\"LC_rt_"+id+"\" title=\"Disable rich text formatting and edit in plain text\" class=\"LC_disable_rt\"><b>« Plain text</b></a></div>"); |
|
startRichEditor(id); |
|
$("#LC_rt_"+id).click(editorHandler); |
|
}); |
|
$(".LC_richDefaultOff").each(function() { |
|
var id = $(this).attr("id"); |
|
$(this).before("<div><a href=\"#\" id=\"LC_rt_"+id+"\" title=\"Enable rich text formatting (bold, italic, etc.)\" class=\"LC_enable_rt\"><b>Rich formatting »</b></a></div>"); |
|
$("#LC_rt_"+id).click(editorHandler); |
|
}); |
|
}); |
|
'; |
|
|
$output.="\nwindow.status='Activated Editfields';\n" |
$output.="\nwindow.status='Activated Editfields';\n" |
.'// ]]>'."\n" |
.'// ]]>'."\n" |
.'</script><br />'. |
.'</script><br />'. |
Line 1491 returns: nothing
|
Line 1572 returns: nothing
|
$item =~ s/<span(.*?)\/span>//; |
$item =~ s/<span(.*?)\/span>//; |
$html .= "<li>$item</li>"; |
$html .= "<li>$item</li>"; |
} |
} |
$html .= '</li></ul>'; |
$html .= '</ul></li>'; |
if ($category eq 'A') { $html .= "<li>$$links</li>"; } |
if ($category eq 'A') { $html .= "<li>$$links</li>"; } |
} |
} |
$$links = $html.'</ul>'; |
$$links = $html.'</ul>'; |
Line 1871 sub course_custom_roles {
|
Line 1952 sub course_custom_roles {
|
|
|
# topic_bar |
# topic_bar |
# |
# |
# Generates a div containing an (optional) numbered (static) image followed by a |
# Generates a div containing an (optional) number with a white background followed by a |
# title with a background color defined in the corresponding CSS: LC_topic_bar |
# title with a background color defined in the corresponding CSS: LC_topic_bar |
# Inputs: |
# Inputs: |
# 1. number to display (corresponding static image should exist). |
# 1. number to display. |
# img tag will be included if arg is an integer in the range 1 to 9. |
# If input for number is empty only the title will be displayed. |
# 2. title text to display. |
# 2. title text to display. |
# Outputs - a scalar containing html mark-up for the div. |
# Outputs - a scalar containing html mark-up for the div. |
|
|
sub topic_bar { |
sub topic_bar { |
my ($imgnum,$title) = @_; |
my ($num,$title) = @_; |
my $imgtag; |
my $number = ''; |
if ($imgnum =~ /^[1-9]$/) { |
if ($num ne '') { |
$imgtag = '<img src="/res/adm/pages/bl_step'.$imgnum.'.gif"'. |
$number = '<span>'.$num.'</span>'; |
' alt="'.&mt('Step [_1]',$imgnum).'" /> '; |
|
} |
} |
return '<div class="LC_topic_bar">'.$imgtag.$title.'</div>'; |
return '<div class="LC_topic_bar">'.$number.$title.'</div>'; |
} |
} |
|
|
############################################## |
############################################## |