version 1.8.2.4.2.3, 2022/09/09 14:29:45
|
version 1.17, 2017/05/06 15:47:48
|
Line 60 sub handler {
|
Line 60 sub handler {
|
$symb,$type); |
$symb,$type); |
if (($env{'form.folderpath'} =~ /^supplemental/) && ($env{'form.suppurl'})) { |
if (($env{'form.folderpath'} =~ /^supplemental/) && ($env{'form.suppurl'})) { |
$supplementalflag = 1; |
$supplementalflag = 1; |
if (&unescape($env{'form.suppurl'}) =~ m{^/adm/$cdom/$cnum/\d+/ext\.tool$}) { |
if (&unescape($env{'form.suppurl'}) =~ m{^/adm/$cdom/$cnum/\d+/exttools?$}) { |
$type = 'tool'; |
$type = 'tool'; |
} |
} |
} |
} |
Line 79 sub handler {
|
Line 79 sub handler {
|
if ($symb ne $env{'form.symb'}) { |
if ($symb ne $env{'form.symb'}) { |
$env{'form.symb'} = $symb; |
$env{'form.symb'} = $symb; |
} |
} |
if ($url =~ m{/adm/$cdom/$cnum/\d+/ext\.tool$}) { |
if ($url =~ m{/adm/$cdom/$cnum/\d+/exttools?$}) { |
$type = 'tool'; |
$type = 'tool'; |
} |
} |
} |
} |
Line 98 sub handler {
|
Line 98 sub handler {
|
} |
} |
my %ltitools; |
my %ltitools; |
if ($type eq 'tool') { |
if ($type eq 'tool') { |
%ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer'); |
%ltitools = &Apache::lonnet::get_domain_ltitools($cdom); |
} |
} |
my $js = &Apache::lonhtmlcommon::scripttag(&extedit_javascript()); |
my $js = &Apache::lonhtmlcommon::scripttag(&extedit_javascript()); |
my $pathitem = '<input type="hidden" name="folderpath" value="'. |
my $pathitem = '<input type="hidden" name="folderpath" value="'. |
Line 146 sub process_changes {
|
Line 146 sub process_changes {
|
$oldtitle = &unescape($env{'form.title'}); |
$oldtitle = &unescape($env{'form.title'}); |
$container = 'sequence'; |
$container = 'sequence'; |
$supplementalflag = 1; |
$supplementalflag = 1; |
if ($oldurl =~ m{^/adm/$cdom/$cnum/\d+/ext\.tool$}) { |
if ($oldurl =~ m{^/adm/$cdom/$cnum/\d+/exttools?$}) { |
$type = 'tool'; |
$type = 'tool'; |
} else { |
} else { |
$type = 'ext'; |
$type = 'ext'; |
Line 157 sub process_changes {
|
Line 157 sub process_changes {
|
if ($env{'form.importdetail'}) { |
if ($env{'form.importdetail'}) { |
($newtitle,$newurl,$newidx) = |
($newtitle,$newurl,$newidx) = |
map {&unescape($_)} split(/\=/,$env{'form.importdetail'}); |
map {&unescape($_)} split(/\=/,$env{'form.importdetail'}); |
if ($newurl =~ m{^(/adm/$cdom/$cnum/(\d+)/ext\.tool)\:?(.*)$}) { |
if ($newurl =~ m{^(/adm/$cdom/$cnum/(\d+)/exttools?)\:?(.*)$}) { |
$newurl = $1; |
$newurl = $1; |
$marker = $2; |
$marker = $2; |
$args = $3; |
$args = $3; |
Line 258 sub process_changes {
|
Line 258 sub process_changes {
|
|
|
sub update_exttool { |
sub update_exttool { |
my ($marker,$cdom,$cnum,$args) = @_; |
my ($marker,$cdom,$cnum,$args) = @_; |
|
my %toolhash=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum); |
my (%newhash,$changed,@deleted,$errormsg); |
my (%newhash,$changed,@deleted,$errormsg); |
($newhash{'target'},$newhash{'width'},$newhash{'height'},$newhash{'linktext'},$newhash{'explanation'}, |
($newhash{'target'},$newhash{'width'},$newhash{'height'},$newhash{'linktext'},$newhash{'explanation'}, |
$newhash{'crslabel'},$newhash{'crstitle'},$newhash{'crsappend'}) = split(/:/,$args); |
$newhash{'crslabel'},$newhash{'crstitle'}) = split(/:/,$args); |
foreach my $item ('linktext','explanation','crslabel','crstitle','crsappend') { |
foreach my $item ('linktext','explanation','crslabel','crstitle') { |
$newhash{$item} = &unescape($newhash{$item}); |
$newhash{$item} = &unescape($newhash{$item}); |
} |
} |
my %toolhash=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum); |
my %toolhash=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum); |
foreach my $item ('target','width','height','linktext','explanation','crslabel','crstitle','crsappend') { |
foreach my $item ('target','width','height','linktext','explanation','crslabel','crstitle') { |
$newhash{$item} =~ s/^\s+//; |
$newhash{$item} =~ s/^\s+//; |
$newhash{$item} =~ s/\s+$//; |
$newhash{$item} =~ s/\s+$//; |
if (($item eq 'width') || ($item eq 'height') || ($item eq 'linktext') || ($item eq 'explanation')) { |
if (($item eq 'width') || ($item eq 'height') || ($item eq 'linktext') || ($item eq 'explanation')) { |
if ($newhash{'target'} eq 'iframe') { |
if ($newhash{'target'} eq 'iframe') { |
$newhash{$item} = ''; |
$newhash{$item} = ''; |
} elsif ($newhash{'target'} eq 'tab') { |
|
if (($item eq 'width') || ($item eq 'height')) { |
|
$newhash{$item} = ''; |
|
} |
|
} |
} |
} |
} |
if ($toolhash{$item} ne $newhash{$item}) { |
if ($toolhash{$item} ne $newhash{$item}) { |
if ($newhash{$item} eq '') { |
if ($newhash{$item} eq '') { |
unless (($item eq 'target') || |
unless (($item eq 'target') || |
((($item eq 'width') || ($item eq 'height')) && |
((($item eq 'width') || ($item eq 'height') || ($item eq 'linktext') || ($item eq 'explanation')) && |
(($newhash{'target'} eq 'window') || |
(($newhash{'target'} eq 'window') || |
(($newhash{'target'} eq '') && ($toolhash{'target'} eq 'window')))) || |
(($newhash{'target'} eq '') && ($toolhash{'target'} eq 'window'))))) { |
((($item eq 'linktext') || ($item eq 'explanation')) && |
|
((($newhash{'target'} =~ /^(window|tab)$/)) || |
|
(($newhash{'target'} eq '') && ($toolhash{'target'} =~ /^(window|tab)$/))))) { |
|
delete($toolhash{$item}); |
delete($toolhash{$item}); |
push(@deleted,$item); |
push(@deleted,$item); |
$changed = 1; |
$changed = 1; |
Line 334 sub extedit_form {
|
Line 328 sub extedit_form {
|
} |
} |
my ($formname,$formid,$toggle,$fieldsetid,$urlid,$dispdivstyle,$dimendivstyle, |
my ($formname,$formid,$toggle,$fieldsetid,$urlid,$dispdivstyle,$dimendivstyle, |
$windivstyle,$linktextstyle,$explanationstyle,$labelstyle,$titlestyle, |
$windivstyle,$linktextstyle,$explanationstyle,$labelstyle,$titlestyle, |
$appendstyle,$legend,$urlelem,$toolelem,%toolattr); |
$legend,$urlelem,$toolelem,%toolattr); |
$formname = 'new'.$type; |
$formname = 'new'.$type; |
$toggle = $type; |
$toggle = $type; |
$fieldsetid = 'upload'.$type.'form'; |
$fieldsetid = 'upload'.$type.'form'; |
$urlid = $type.'url'; |
$urlid = $type.'url'; |
map { $toolattr{$_} = $type.$_; } ('dispdiv','dimendiv','dimenwidth','dimenheight', |
map { $toolattr{$_} = $type.$_; } ('dispdiv','dimendiv','dimenwidth','dimenheight', |
'crstitlediv','crslabeldiv','crsappenddiv', |
'crstitlediv','crslabeldiv','crstitle','crslabel', |
'crstitle','crslabel','crsappend','windiv', |
'windiv','linktextdiv','explanationdiv','linktext', |
'linktextdiv','explanationdiv','linktext', |
'explanation'); |
'explanation','providerurl'); |
|
$dispdivstyle = 'display:none'; |
$dispdivstyle = 'display:none'; |
$dimendivstyle = 'display:none'; |
$dimendivstyle = 'display:none'; |
$windivstyle = 'display:none'; |
$windivstyle = 'display:none'; |
Line 351 sub extedit_form {
|
Line 344 sub extedit_form {
|
$explanationstyle = 'display:none'; |
$explanationstyle = 'display:none'; |
$labelstyle = 'display:none'; |
$labelstyle = 'display:none'; |
$titlestyle = 'display:none'; |
$titlestyle = 'display:none'; |
$appendstyle = 'display:none'; |
|
if ($supplementalflag) { |
if ($supplementalflag) { |
$formname = 'newsupp'.$type; |
$formname = 'newsupp'.$type; |
$toggle = 'supp'.$type; |
$toggle = 'supp'.$type; |
Line 360 sub extedit_form {
|
Line 352 sub extedit_form {
|
map { $toolattr{$_} = 'supp'.$toolattr{$_}; } (keys(%toolattr)); |
map { $toolattr{$_} = 'supp'.$toolattr{$_}; } (keys(%toolattr)); |
} |
} |
my ($link,$legend,$active,$srcclass,$extsrc,$preview,$title,$save,$crstitle,$crslabel, |
my ($link,$legend,$active,$srcclass,$extsrc,$preview,$title,$save,$crstitle,$crslabel, |
$crsappend,$fieldsetstyle,$action,$hiddenelem,$form,$width,$height,$tooltarget, |
$fieldsetstyle,$action,$hiddenelem,$form,$width,$height,$tooltarget, |
$linktext,$explanation,$providerurl,%chkstate); |
$linktext,$explanation,%chkstate); |
$fieldsetstyle = 'display: none;'; |
$fieldsetstyle = 'display: none;'; |
$action = '/adm/coursedocs'; |
$action = '/adm/coursedocs'; |
my $protocol = ($ENV{'SERVER_PORT'} == 443?'https':'http'); |
my $protocol = ($ENV{'SERVER_PORT'} == 443?'https':'http'); |
Line 374 sub extedit_form {
|
Line 366 sub extedit_form {
|
$rows = 10; |
$rows = 10; |
$cols = 45; |
$cols = 45; |
if ($type eq 'tool') { |
if ($type eq 'tool') { |
$legend = $lt{'te'}; |
|
} else { |
|
$legend = $lt{'ee'}; |
$legend = $lt{'ee'}; |
|
} else { |
|
$legend = $lt{'te'}; |
} |
} |
$legend = '<legend>'.$legend.'</legend>'; |
$legend = '<legend>'.$legend.'</legend>'; |
if ($symb) { |
if ($symb) { |
Line 426 sub extedit_form {
|
Line 418 sub extedit_form {
|
} else { |
} else { |
$orig_title = $lt{'et'}; |
$orig_title = $lt{'et'}; |
$save = $lt{'at'}; |
$save = $lt{'at'}; |
$orig_url = "/adm/$cdom/$cnum/new/ext\.tool"; |
$orig_url = "/adm/$cdom/$cnum/new/exttool"; |
} |
} |
$pathitem .= '<br />'; |
$pathitem .= '<br />'; |
} |
} |
Line 437 sub extedit_form {
|
Line 429 sub extedit_form {
|
my $class = 'LC_nobreak'; |
my $class = 'LC_nobreak'; |
if ($residx) { |
if ($residx) { |
$class = 'LC_docs_ext_edit LC_nobreak'; |
$class = 'LC_docs_ext_edit LC_nobreak'; |
if ($orig_url =~ m{^/adm/$cdom/$cnum/(\d+)/ext\.tool$}) { |
if ($orig_url =~ m{^/adm/$cdom/$cnum/(\d+)/exttools?$}) { |
my $marker = $1; |
my $marker = $1; |
my %toolhash=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum); |
my %toolhash=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum); |
if ($toolhash{'id'}) { |
if ($toolhash{'id'}) { |
Line 450 sub extedit_form {
|
Line 442 sub extedit_form {
|
if ($icon) { |
if ($icon) { |
$image = '<img src="'.$icon.'" alt="'.$tooltitle.'" />'; |
$image = '<img src="'.$icon.'" alt="'.$tooltitle.'" />'; |
} |
} |
if ($ltitools->{$toolhash{'id'}}->{'url'} =~ m{://}) { |
|
(my $prot,my $host,$providerurl) = ($ltitools->{$toolhash{'id'}}->{'url'} =~ m{^([^/]+)://([^/]+)(|/.+)$}); |
|
} else { |
|
$providerurl = $ltitools->{$toolhash{'id'}}->{'url'}; |
|
} |
|
$tooltarget = $toolhash{'target'}; |
$tooltarget = $toolhash{'target'}; |
if ($tooltarget eq 'window') { |
if ($tooltarget eq 'window') { |
$dimendivstyle = 'display:block'; |
$dimendivstyle = 'display:block'; |
$windivstyle = 'display:block'; |
$windivstyle = 'display:block'; |
$chkstate{'window'} = 'checked="checked" '; |
$chkstate{'window'} = 'checked="checked" '; |
} elsif ($tooltarget eq 'tab') { |
|
$windivstyle = 'display:block'; |
|
$chkstate{'tab'} = 'checked="checked" '; |
|
} else { |
} else { |
$chkstate{'iframe'} = 'checked="checked" '; |
$chkstate{'iframe'} = 'checked="checked" '; |
} |
} |
Line 479 sub extedit_form {
|
Line 463 sub extedit_form {
|
$crslabel = $toolhash{'crslabel'}; |
$crslabel = $toolhash{'crslabel'}; |
$labelstyle = 'display:inline'; |
$labelstyle = 'display:inline'; |
} |
} |
if ($ltitools->{$toolhash{'id'}}->{'crsconf'}->{'append'}) { |
|
$crsappend = $toolhash{'crsappend'}; |
|
$appendstyle = 'display:inline'; |
|
} |
|
if ($ltitools->{$toolhash{'id'}}->{'crsconf'}->{'target'}) { |
if ($ltitools->{$toolhash{'id'}}->{'crsconf'}->{'target'}) { |
$dispdivstyle = 'display:block'; |
$dispdivstyle = 'display:block'; |
} |
} |
Line 525 sub extedit_form {
|
Line 505 sub extedit_form {
|
$toolelem .= '</select></span><br />'; |
$toolelem .= '</select></span><br />'; |
$crslabel = $env{'course.'.$cdom.'_'.$cnum.'.internal.coursecode'}; |
$crslabel = $env{'course.'.$cdom.'_'.$cnum.'.internal.coursecode'}; |
$crstitle = $env{'course.'.$cdom.'_'.$cnum.'.description'}; |
$crstitle = $env{'course.'.$cdom.'_'.$cnum.'.description'}; |
$crsappend = ''; |
|
} |
} |
$toolelem .= '<div id="'.$toolattr{'dispdiv'}.'" style="'.$dispdivstyle.'">'. |
$toolelem .= '<div id="'.$toolattr{'dispdiv'}.'" style="'.$dispdivstyle.'">'. |
'<span class="'.$class.'">'.&mt('Display target:').' '. |
'<span class="'.$class.'">'.&mt('Display target:').' '. |
'<label><input type="radio" name="exttooltarget" value="iframe" '.$chkstate{'iframe'}.'onclick="updateTooldim(this.form,'. |
'<label><input type="radio" name="exttooltarget" value="iframe" '.$chkstate{'iframe'}.'onclick="updateTooldim(this.form,'. |
"'$toolattr{dimendiv}','$toolattr{windiv}','$toolattr{dimenwidth}','$toolattr{dimenheight}', |
"'$toolattr{dimendiv}','$toolattr{windiv}','$toolattr{dimenwidth}','$toolattr{dimenheight}', |
'$toolattr{linktext}','$toolattr{explanation}'".');"'.$disabled.' />'.&mt('iframe').'</label>'.(' 'x2). |
'$toolattr{linktext}','$toolattr{explanation}'".');"'.$disabled.' />'.&mt('iframe').'</label>'.(' 'x2). |
'<label><input type="radio" name="exttooltarget" value="tab" '.$chkstate{'tab'}.'onclick="updateTooldim(this.form,'. |
|
"'$toolattr{dimendiv}','$toolattr{windiv}','$toolattr{dimenwidth}','$toolattr{dimenheight}', |
|
'$toolattr{linktext}','$toolattr{explanation}'".');"'.$disabled.' />'.&mt('tab').'</label>'.(' 'x2). |
|
'<label><input type="radio" name="exttooltarget" value="window" '.$chkstate{'window'}.'onclick="updateTooldim(this.form,'. |
'<label><input type="radio" name="exttooltarget" value="window" '.$chkstate{'window'}.'onclick="updateTooldim(this.form,'. |
"'$toolattr{dimendiv}','$toolattr{windiv}','$toolattr{dimenwidth}','$toolattr{dimenheight}', |
"'$toolattr{dimendiv}','$toolattr{windiv}','$toolattr{dimenwidth}','$toolattr{dimenheight}', |
'$toolattr{linktext}','$toolattr{explanation}'".');"'.$disabled.' />'.&mt('window').'</label></span>'. |
'$toolattr{linktext}','$toolattr{explanation}'".');"'.$disabled.' />'.&mt('window').'</label></span>'. |
Line 558 sub extedit_form {
|
Line 534 sub extedit_form {
|
'<div id="'.$toolattr{'crstitlediv'}.'" style="'.$titlestyle.'">'. |
'<div id="'.$toolattr{'crstitlediv'}.'" style="'.$titlestyle.'">'. |
'<span class="'.$class.'">'.&mt('Course title:').' '. |
'<span class="'.$class.'">'.&mt('Course title:').' '. |
'<input type="text" id="'.$toolattr{'crstitle'}.'" name="exttooltitle" value="'.$crstitle.'"'.$disabled.' /></span><br />'. |
'<input type="text" id="'.$toolattr{'crstitle'}.'" name="exttooltitle" value="'.$crstitle.'"'.$disabled.' /></span><br />'. |
'</div>'. |
|
'<div id="'.$toolattr{'crsappenddiv'}.'" style="'.$appendstyle.'">'. |
|
'<span class="'.$class.'">'.&mt('Append to URL[_1]', |
|
'<span id="'.$toolattr{'providerurl'}.'"> ('.$providerurl.')<br /></span>'). |
|
'<input type="text" id="'.$toolattr{'crsappend'}.'" size="30" name="exttoolappend" value="'.$crsappend.'"'.$disabled.' /></span><br />'. |
|
'</div>'; |
'</div>'; |
} |
} |
my $chooser = $toolelem; |
my $chooser = $toolelem; |
Line 620 sub display_editor {
|
Line 591 sub display_editor {
|
} |
} |
my %ltitools; |
my %ltitools; |
if ($type eq 'tool') { |
if ($type eq 'tool') { |
%ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer'); |
%ltitools = &Apache::lonnet::get_domain_ltitools($cdom); |
} |
} |
$js = &Apache::lonhtmlcommon::scripttag(&extedit_javascript()); |
$js = &Apache::lonhtmlcommon::scripttag(&extedit_javascript()); |
my $args = { 'force_register' => $env{'form.register'} }; |
my $args = { 'force_register' => $env{'form.register'} }; |
Line 645 sub extedit_javascript {
|
Line 616 sub extedit_javascript {
|
if (ref($toolsref) eq 'HASH') { |
if (ref($toolsref) eq 'HASH') { |
my $num = scalar(keys(%{$toolsref})); |
my $num = scalar(keys(%{$toolsref})); |
$toolsjs = " var ltitools = new Array($num);\n". |
$toolsjs = " var ltitools = new Array($num);\n". |
" var ltitoolsUrl = new Array($num);\n". |
|
" var ltitoolsTarget = new Array($num);\n". |
" var ltitoolsTarget = new Array($num);\n". |
" var ltitoolsWidth = new Array($num);\n". |
" var ltitoolsWidth = new Array($num);\n". |
" var ltitoolsHeight = new Array($num);\n". |
" var ltitoolsHeight = new Array($num);\n". |
Line 655 sub extedit_javascript {
|
Line 625 sub extedit_javascript {
|
" var ltitoolsLink = new Array($num);\n". |
" var ltitoolsLink = new Array($num);\n". |
" var ltitoolsExplain = new Array($num);\n". |
" var ltitoolsExplain = new Array($num);\n". |
" var ltitoolsLabel = new Array($num);\n". |
" var ltitoolsLabel = new Array($num);\n". |
" var ltitoolsTitle = new Array($num);\n". |
" var ltitoolsTitle = new Array($num);\n"; |
" var ltitoolsAppend = new Array($num);\n"; |
|
my $i = 0; |
my $i = 0; |
foreach my $key (sort { $a <=> $b } keys(%{$toolsref})) { |
foreach my $key (sort { $a <=> $b } keys(%{$toolsref})) { |
if (ref($toolsref->{$key}) eq 'HASH') { |
if (ref($toolsref->{$key}) eq 'HASH') { |
Line 666 sub extedit_javascript {
|
Line 635 sub extedit_javascript {
|
my $height = $toolsref->{$key}->{'display'}->{'height'}; |
my $height = $toolsref->{$key}->{'display'}->{'height'}; |
my $linkdef = $toolsref->{$key}->{'display'}->{'linktext'}; |
my $linkdef = $toolsref->{$key}->{'display'}->{'linktext'}; |
my $explaindef = $toolsref->{$key}->{'display'}->{'explanation'}; |
my $explaindef = $toolsref->{$key}->{'display'}->{'explanation'}; |
my $providerurl; |
|
if ($toolsref->{$key}->{'url'} =~ m{://}) { |
|
(my $prot,my $host,$providerurl) = ($toolsref->{$key}->{'url'} =~ m{^([^/]+)://([^/]+)(|/.+)$}); |
|
} else { |
|
$providerurl = $toolsref->{$key}->{'url'}; |
|
} |
|
$providerurl = &LONCAPA::map::qtunescape($providerurl); |
|
$toolsjs .= ' ltitools['.$i.'] = '."'$key';\n". |
$toolsjs .= ' ltitools['.$i.'] = '."'$key';\n". |
' ltitoolsTarget['.$i.'] = '."'$target';\n". |
' ltitoolsTarget['.$i.'] = '."'$target';\n". |
' ltitoolsWidth['.$i.'] = '."'$width';\n". |
' ltitoolsWidth['.$i.'] = '."'$width';\n". |
' ltitoolsHeight['.$i.'] = '."'$height';\n". |
' ltitoolsHeight['.$i.'] = '."'$height';\n". |
' ltitoolsLinkDef['.$i.'] = '."'$linkdef';\n". |
' ltitoolsLinkDef['.$i.'] = '."'$linkdef';\n". |
' ltitoolsExplainDef['.$i.'] = '."'$explaindef';\n". |
' ltitoolsExplainDef['.$i.'] = '."'$explaindef';\n"; |
' ltitoolsUrl['.$i.'] = '."'$providerurl';\n"; |
|
} |
} |
if (ref($toolsref->{$key}->{'crsconf'}) eq 'HASH') { |
if (ref($toolsref->{$key}->{'crsconf'}) eq 'HASH') { |
my $display = $toolsref->{$key}->{'crsconf'}->{'target'}; |
my $display = $toolsref->{$key}->{'crsconf'}->{'target'}; |
Line 692 sub extedit_javascript {
|
Line 653 sub extedit_javascript {
|
$toolsjs .= ' ltitoolsLabel['.$i.'] = '."'$label';\n"; |
$toolsjs .= ' ltitoolsLabel['.$i.'] = '."'$label';\n"; |
my $title = $toolsref->{$key}->{'crsconf'}->{'title'}; |
my $title = $toolsref->{$key}->{'crsconf'}->{'title'}; |
$toolsjs .= ' ltitoolsTitle['.$i.'] = '."'$title';\n"; |
$toolsjs .= ' ltitoolsTitle['.$i.'] = '."'$title';\n"; |
my $append = $toolsref->{$key}->{'crsconf'}->{'append'}; |
|
$toolsjs .= ' ltitoolsAppend['.$i.'] = '."'$append';\n"; |
|
} |
} |
$i++; |
$i++; |
} |
} |
Line 702 sub extedit_javascript {
|
Line 661 sub extedit_javascript {
|
my %js_lt = &Apache::lonlocal::texthash( |
my %js_lt = &Apache::lonlocal::texthash( |
invurl => 'Invalid URL', |
invurl => 'Invalid URL', |
titbl => 'Title is blank', |
titbl => 'Title is blank', |
mixfra => 'Show preview in pop-up? (http in https page + no framing)', |
|
mixonly => 'Show preview in pop-up? (http in https page)', |
|
fraonly => 'Show preview in pop-up? (framing disallowed)', |
|
nopopup => 'Pop-up blocked', |
|
nopriv => 'Insufficient privileges to use preview', |
|
badurl => 'URL is not: http://hostname/path or https://hostname/path', |
|
invtool => 'Please select an external tool', |
invtool => 'Please select an external tool', |
); |
); |
&js_escape(\%js_lt); |
&js_escape(\%js_lt); |
Line 776 function setExternal(extform,residx,type
|
Line 729 function setExternal(extform,residx,type
|
var height = extform.exttoolheight.value; |
var height = extform.exttoolheight.value; |
height.trim(); |
height.trim(); |
info += ':window:'+width+':'+height; |
info += ':window:'+width+':'+height; |
} else if (extform.exttooltarget[i].value == 'tab') { |
|
info += ':tab::'; |
|
} else { |
} else { |
info += ':iframe::'; |
info += ':iframe::'; |
} |
} |
Line 820 function setExternal(extform,residx,type
|
Line 771 function setExternal(extform,residx,type
|
} |
} |
var labelinput = prefix+'toolcrslabel'; |
var labelinput = prefix+'toolcrslabel'; |
var titleinput = prefix+'toolcrstitle'; |
var titleinput = prefix+'toolcrstitle'; |
var appendinput = prefix+'toolcrsappend'; |
|
if (residx > 0) { |
if (residx > 0) { |
labelinput += '_'+residx; |
labelinput += '_'+residx; |
titleinput += '_'+residx; |
titleinput += '_'+residx; |
appendinput += '_'+residx; |
|
} |
} |
if (document.getElementById(labelinput)) { |
if (document.getElementById(labelinput)) { |
var crslabel = document.getElementById(labelinput).value; |
var crslabel = document.getElementById(labelinput).value; |
Line 840 function setExternal(extform,residx,type
|
Line 789 function setExternal(extform,residx,type
|
} else { |
} else { |
info += ':'; |
info += ':'; |
} |
} |
if (document.getElementById(appendinput)) { |
|
var crsappend = document.getElementById(appendinput).value; |
|
crsappend.trim(); |
|
info += ':'+escape(crsappend); |
|
} else { |
|
info += ':'; |
|
} |
|
info=escape(info); |
info=escape(info); |
if (residx > 0) { |
if (residx > 0) { |
eval("extform.importdetail.value=title+'='+info+'='+residx;extform.submit();"); |
eval("extform.importdetail.value=title+'='+info+'='+residx;extform.submit();"); |
Line 875 function extUrlPreview(caller,protocol)
|
Line 817 function extUrlPreview(caller,protocol)
|
var url = document.getElementById(caller).value; |
var url = document.getElementById(caller).value; |
if (regexp.test(url)) { |
if (regexp.test(url)) { |
var http_regex = /^http\:\/\//gi; |
var http_regex = /^http\:\/\//gi; |
var mixed = 0; |
|
var noiframe = 0; |
|
var nopriv = 0; |
|
var badurl = 0; |
|
var name = "externalpreview"; |
|
if ((protocol == 'https') && (http_regex.test(url))) { |
if ((protocol == 'https') && (http_regex.test(url))) { |
mixed = 1; |
window.open(url,"externalpreview","height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1"); |
} |
|
var http = new XMLHttpRequest(); |
|
var lcurl = "/adm/exturlcheck"; |
|
var params = "exturl="+url; |
|
http.open("POST",lcurl, true); |
|
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); |
|
http.onreadystatechange = function() { |
|
if (http.readyState == 4) { |
|
if (http.status == 200) { |
|
if (http.responseText.length > 0) { |
|
if (http.responseText == 1) { |
|
noiframe = 1; |
|
} else if (http.responseText == -1) { |
|
nopriv = 1; |
|
} else if (http.responseText == 0) { |
|
badurl = 1; |
|
} |
|
} |
|
openPreviewWindow(url,name,noiframe,mixed,nopriv,badurl); |
|
} |
|
} |
|
} |
|
http.send(params); |
|
} else { |
|
alert("$js_lt{'invurl'}"); |
|
} |
|
} |
|
} |
|
|
|
var previewLCWindow = null; |
|
function openPreviewWindow(url,name,noiframe,mixed,nopriv,badurl) { |
|
if (previewLCWindow !=null) { |
|
previewLCWindow.close(); |
|
} |
|
if (badurl) { |
|
alert("$js_lt{'badurl'}"); |
|
} else if (nopriv) { |
|
alert("$js_lt{'nopriv'}"); |
|
} else if ((noiframe == 1) || (mixed == 1)) { |
|
var encurl = encodeURI(url); |
|
var msg; |
|
if (mixed == 1) { |
|
if (noiframe == 1) { |
|
msg = "$js_lt{'mixfra'}"; |
|
} else { |
} else { |
msg = "$js_lt{'mixonly'}"; |
openMyModal(url,500,400,'yes'); |
} |
} |
} else { |
} else { |
msg = "$js_lt{'fraonly'}"; |
alert("$js_lt{'invurl'}"); |
} |
|
if (confirm(msg)) { |
|
previewLCWindow = window.open(url,name,"height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1"); |
|
if (previewLCWindow != null) { |
|
previewLCWindow.focus(); |
|
} else { |
|
alert("$js_lt{'nopopup'}"); |
|
} |
|
} |
} |
} else { |
|
openMyModal(url,500,400,'yes'); |
|
} |
} |
} |
} |
|
|
Line 956 function updateExttool(caller,form,suppl
|
Line 839 function updateExttool(caller,form,suppl
|
heightinput = prefix+'tooldimenheight'; |
heightinput = prefix+'tooldimenheight'; |
labeldiv = prefix+'toolcrslabeldiv'; |
labeldiv = prefix+'toolcrslabeldiv'; |
titlediv = prefix+'toolcrstitlediv'; |
titlediv = prefix+'toolcrstitlediv'; |
appenddiv = prefix+'toolcrsappenddiv'; |
|
providerurl = prefix+'toolproviderurl'; |
|
labelinput = prefix+'toolcrslabel'; |
labelinput = prefix+'toolcrslabel'; |
titleinput = prefix+'toolcrstitle'; |
titleinput = prefix+'toolcrstitle'; |
appendinput = prefix+'toolcrsappend'; |
|
windiv = prefix+'toolwindiv'; |
windiv = prefix+'toolwindiv'; |
linktextdiv = prefix+'toollinktextdiv'; |
linktextdiv = prefix+'toollinktextdiv'; |
linktextinput = prefix+'toollinktext'; |
linktextinput = prefix+'toollinktext'; |
Line 991 function updateExttool(caller,form,suppl
|
Line 871 function updateExttool(caller,form,suppl
|
if (document.getElementById(titlediv)) { |
if (document.getElementById(titlediv)) { |
document.getElementById(titlediv).style.display = 'none'; |
document.getElementById(titlediv).style.display = 'none'; |
} |
} |
if (document.getElementById(appenddiv)) { |
|
document.getElementById(appenddiv).style.display = 'none'; |
|
} |
|
} else { |
} else { |
if (ltitools.length > 0) { |
if (ltitools.length > 0) { |
for (var j=0; j<ltitools.length; j++) { |
for (var j=0; j<ltitools.length; j++) { |
Line 1029 function updateExttool(caller,form,suppl
|
Line 906 function updateExttool(caller,form,suppl
|
} |
} |
} |
} |
if (document.getElementById(windiv)) { |
if (document.getElementById(windiv)) { |
if ((ltitoolsTarget[j] == 'window') || (ltitoolsTarget[j] == 'tab')) { |
if (ltitoolsTarget[j] == 'window') { |
document.getElementById(windiv).style.display = 'block'; |
document.getElementById(windiv).style.display = 'block'; |
} else { |
} else { |
document.getElementById(windiv).style.display = 'none'; |
document.getElementById(windiv).style.display = 'none'; |
Line 1077 function updateExttool(caller,form,suppl
|
Line 954 function updateExttool(caller,form,suppl
|
document.getElementById(titlediv).style.display = 'none'; |
document.getElementById(titlediv).style.display = 'none'; |
} |
} |
} |
} |
if (document.getElementById(appenddiv)) { |
|
if (ltitoolsAppend[j]) { |
|
document.getElementById(appenddiv).style.display = 'inline'; |
|
if (document.getElementById(providerurl)) { |
|
if ((ltitoolsUrl[j] != '') && (ltitoolsUrl[j] != null)) { |
|
document.getElementById(providerurl).innerHTML = ' ('+ltitoolsUrl[j]+')<br />'; |
|
} |
|
} |
|
} else { |
|
document.getElementById(appenddiv).style.display = 'none'; |
|
if (document.getElementById(providerurl)) { |
|
document.getElementById(providerurl).innerHTML = ''; |
|
} |
|
} |
|
} |
|
break; |
break; |
} |
} |
} |
} |
Line 1110 function updateTooldim(form,dimendiv,win
|
Line 972 function updateTooldim(form,dimendiv,win
|
dimen = 'block'; |
dimen = 'block'; |
linkconf = 'block'; |
linkconf = 'block'; |
} else { |
} else { |
if (form.exttooltarget[i].value == 'tab') { |
if (document.getElementById(widthinput)) { |
linkconf = 'block'; |
document.getElementById(widthinput).value = ''; |
} else { |
} |
if (document.getElementById(widthinput)) { |
if (document.getElementById(heightinput)) { |
document.getElementById(widthinput).value = ''; |
document.getElementById(heightinput).value = ''; |
} |
} |
if (document.getElementById(heightinput)) { |
if (document.getElementById(linkinput)) { |
document.getElementById(heightinput).value = ''; |
document.getElementById(linkinput).value = ''; |
} |
} |
if (document.getElementById(linkinput)) { |
if (document.getElementById(explaininput)) { |
document.getElementById(linkinput).value = ''; |
document.getElementById(explaininput).value = ''; |
} |
|
if (document.getElementById(explaininput)) { |
|
document.getElementById(explaininput).value = ''; |
|
} |
|
} |
} |
} |
} |
if (document.getElementById(dimendiv)) { |
if (document.getElementById(dimendiv)) { |