version 1.14, 2017/02/19 00:15:51
|
version 1.22, 2017/12/15 16:33:51
|
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+/exttools?$}) { |
if (&unescape($env{'form.suppurl'}) =~ m{^/adm/$cdom/$cnum/\d+/ext\.tool$}) { |
$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+/exttools?$}) { |
if ($url =~ m{/adm/$cdom/$cnum/\d+/ext\.tool$}) { |
$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_ltitools($cdom); |
%ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer'); |
} |
} |
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+/exttools?$}) { |
if ($oldurl =~ m{^/adm/$cdom/$cnum/\d+/ext\.tool$}) { |
$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+)/exttools?)\:?(.*)$}) { |
if ($newurl =~ m{^(/adm/$cdom/$cnum/(\d+)/ext\.tool)\:?(.*)$}) { |
$newurl = $1; |
$newurl = $1; |
$marker = $2; |
$marker = $2; |
$args = $3; |
$args = $3; |
Line 260 sub update_exttool {
|
Line 260 sub update_exttool {
|
my ($marker,$cdom,$cnum,$args) = @_; |
my ($marker,$cdom,$cnum,$args) = @_; |
my %toolhash=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum); |
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{'crslabel'},$newhash{'crstitle'}) = split(/:/,$args); |
($newhash{'target'},$newhash{'width'},$newhash{'height'},$newhash{'linktext'},$newhash{'explanation'}, |
$newhash{'crslabel'} = &unescape($newhash{'crslabel'}); |
$newhash{'crslabel'},$newhash{'crstitle'},$newhash{'crsappend'}) = split(/:/,$args); |
$newhash{'crstitle'} = &unescape($newhash{'crstitle'}); |
foreach my $item ('linktext','explanation','crslabel','crstitle','crsappend') { |
|
$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','crslabel','crstitle') { |
foreach my $item ('target','width','height','linktext','explanation','crslabel','crstitle','crsappend') { |
$newhash{$item} =~ s/^\s+//; |
$newhash{$item} =~ s/^\s+//; |
$newhash{$item} =~ s/\s+$//; |
$newhash{$item} =~ s/\s+$//; |
if (($item eq 'width') || ($item eq 'height')) { |
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}) { |
Line 277 sub update_exttool {
|
Line 283 sub update_exttool {
|
unless (($item eq 'target') || |
unless (($item eq 'target') || |
((($item eq 'width') || ($item eq 'height')) && |
((($item eq 'width') || ($item eq 'height')) && |
(($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 325 sub extedit_form {
|
Line 334 sub extedit_form {
|
$tabid = 'ee'; |
$tabid = 'ee'; |
} |
} |
my ($formname,$formid,$toggle,$fieldsetid,$urlid,$dispdivstyle,$dimendivstyle, |
my ($formname,$formid,$toggle,$fieldsetid,$urlid,$dispdivstyle,$dimendivstyle, |
$labelstyle,$titlestyle,$legend,$urlelem,$toolelem,%toolattr); |
$windivstyle,$linktextstyle,$explanationstyle,$labelstyle,$titlestyle, |
|
$appendstyle,$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','crstitle','crslabel'); |
'crstitlediv','crslabeldiv','crsappenddiv', |
|
'crstitle','crslabel','crsappend','windiv', |
|
'linktextdiv','explanationdiv','linktext', |
|
'explanation','providerurl'); |
$dispdivstyle = 'display:none'; |
$dispdivstyle = 'display:none'; |
$dimendivstyle = 'display:none'; |
$dimendivstyle = 'display:none'; |
|
$windivstyle = 'display:none'; |
|
$linktextstyle = '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 344 sub extedit_form {
|
Line 361 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, |
$fieldsetstyle,$action,$hiddenelem,$form,$width,$height,$tooltarget,%chkstate); |
$crsappend,$fieldsetstyle,$action,$hiddenelem,$form,$width,$height,$tooltarget, |
|
$linktext,$explanation,$providerurl,%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'); |
|
my $rows = 2; |
|
my $cols = 20; |
if ($residx) { |
if ($residx) { |
if ($caller eq 'direct') { |
if ($caller eq 'direct') { |
$fieldsetstyle = 'display: block;'; |
$fieldsetstyle = 'display: block;'; |
$action = '/adm/extresedit'; |
$action = '/adm/extresedit'; |
|
$rows = 10; |
|
$cols = 45; |
if ($type eq 'tool') { |
if ($type eq 'tool') { |
$legend = $lt{'ee'}; |
$legend = $lt{'ee'}; |
} else { |
} else { |
Line 405 sub extedit_form {
|
Line 427 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/exttool"; |
$orig_url = "/adm/$cdom/$cnum/new/ext\.tool"; |
} |
} |
$pathitem .= '<br />'; |
$pathitem .= '<br />'; |
} |
} |
Line 416 sub extedit_form {
|
Line 438 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+)/exttools?$}) { |
if ($orig_url =~ m{^/adm/$cdom/$cnum/(\d+)/ext\.tool$}) { |
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 429 sub extedit_form {
|
Line 451 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'; |
$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" '; |
} |
} |
$width = $toolhash{'width'}; |
$width = $toolhash{'width'}; |
$height = $toolhash{'height'}; |
$height = $toolhash{'height'}; |
|
$linktext = $toolhash{'linktext'}; |
|
$explanation = $toolhash{'explanation'}; |
if (ref($ltitools->{$toolhash{'id'}}->{'crsconf'}) eq 'HASH') { |
if (ref($ltitools->{$toolhash{'id'}}->{'crsconf'}) eq 'HASH') { |
if ($ltitools->{$toolhash{'id'}}->{'crsconf'}->{'title'}) { |
if ($ltitools->{$toolhash{'id'}}->{'crsconf'}->{'title'}) { |
$crstitle = $toolhash{'crstitle'}; |
$crstitle = $toolhash{'crstitle'}; |
Line 447 sub extedit_form {
|
Line 480 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'; |
} |
} |
|
if ($ltitools->{$toolhash{'id'}}->{'crsconf'}->{'linktext'}) { |
|
$linktextstyle = 'padding:0;display:inline'; |
|
} |
|
if ($ltitools->{$toolhash{'id'}}->{'crsconf'}->{'explanation'}) { |
|
$explanationstyle = 'padding:0;display:inline'; |
|
} |
} |
} |
$toolelem = '<span class="LC_nobreak">'.$image.' '.$tooltitle.'</span><br />'; |
$toolelem = '<span class="LC_nobreak">'.$image.' '.$tooltitle.'</span><br />'; |
} |
} |
Line 483 sub extedit_form {
|
Line 526 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{dimenwidth}','$toolattr{dimenheight}'".');"'.$disabled.'>'.&mt('iframe').'</label>'.(' 'x2). |
"'$toolattr{dimendiv}','$toolattr{windiv}','$toolattr{dimenwidth}','$toolattr{dimenheight}', |
|
'$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{dimenwidth}','$toolattr{dimenheight}'".');"'.$disabled.'>'.&mt('window').'</label>'. |
"'$toolattr{dimendiv}','$toolattr{windiv}','$toolattr{dimenwidth}','$toolattr{dimenheight}', |
'</span><div id="'.$toolattr{'dimendiv'}.'" style="'.$dimendivstyle.'">'. |
'$toolattr{linktext}','$toolattr{explanation}'".');"'.$disabled.' />'.&mt('window').'</label></span>'. |
'<span class="'.$class.'">'. |
'<div id="'.$toolattr{'dimendiv'}.'" style="'.$dimendivstyle.'"><span class="'.$class.'">'. |
&mt('Width').'<input type="text" id="'.$toolattr{'dimenwidth'}.'" name="exttoolwidth" value="'.$width.'"'.$disabled.'>'.(' 'x2). |
&mt('Width').': <input type="text" size="4" id="'.$toolattr{'dimenwidth'}.'" name="exttoolwidth" value="'.$width.'"'.$disabled.' />'.(' 'x2). |
&mt('Height').'<input type="text" id="'.$toolattr{'dimenheight'}.'" name="exttoolheight" value="'.$height.'"'.$disabled.'></span>'."\n". |
&mt('Height').': <input type="text" size="4" id="'.$toolattr{'dimenheight'}.'" name="exttoolheight" value="'.$height.'"'.$disabled.' /></span>'."\n". |
'</div></div>'. |
'</div></div>'; |
'<div id="'.$toolattr{'crslabeldiv'}.'" style="'.$labelstyle.'">'. |
$toolelem .= '<div id="'.$toolattr{'windiv'}.'" style="'.$windivstyle.'">'. |
|
'<div id="'.$toolattr{'linktextdiv'}.'" class="LC_left_float" style="'.$linktextstyle.'">'. |
|
'<span class="'.$class.'">'.&mt('Link Text').'</span><br /><input type="text" size="25" id="'.$toolattr{'linktext'}. |
|
'" name="exttoollinktext" value="'.$linktext.'"'.$disabled.' />'. |
|
'</div><div id="'.$toolattr{'explanationdiv'}.'" class="LC_left_float" style="'.$explanationstyle.'">'. |
|
'<span class="'.$class.'">'.&mt('Explanation').'</span><br />'. |
|
'<textarea rows="'.$rows.'" cols="'.$cols.'" id="'.$toolattr{'explanation'}.'" name="exttoolexplanation" '.$disabled.'>'. |
|
$explanation.'</textarea></div><div style="padding:0;clear:both;margin:0;border:0"></div>'. |
|
'</div>'; |
|
$toolelem .= '<div id="'.$toolattr{'crslabeldiv'}.'" style="'.$labelstyle.'">'. |
'<span class="'.$class.'">'.&mt('Course label:').' '. |
'<span class="'.$class.'">'.&mt('Course label:').' '. |
'<input type="text" id="'.$toolattr{'crslabel'}.'" name="exttoollabel" value="'.$crslabel.'"'.$disabled.'><br />'. |
'<input type="text" id="'.$toolattr{'crslabel'}.'" name="exttoollabel" value="'.$crslabel.'"'.$disabled.' /></span><br />'. |
'</div>'. |
'</div>'. |
'<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.'><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 543 ENDFORM
|
Line 605 ENDFORM
|
} |
} |
|
|
sub display_editor { |
sub display_editor { |
my ($url,$folderpath,$symb,$idx,$type,$cdom,$cnum) = @_; |
my ($url,$folderpath,$symb,$idx,$type,$cdom,$cnum,$hostname) = @_; |
my ($residx,$supplementalflag,$title,$pathitem,$output,$js,$navmap); |
my ($residx,$supplementalflag,$title,$pathitem,$output,$js,$navmap); |
if ($folderpath =~ /^supplemental/) { |
if ($folderpath =~ /^supplemental/) { |
$supplementalflag = 1; |
$supplementalflag = 1; |
Line 559 sub display_editor {
|
Line 621 sub display_editor {
|
} |
} |
my %ltitools; |
my %ltitools; |
if ($type eq 'tool') { |
if ($type eq 'tool') { |
%ltitools = &Apache::lonnet::get_domain_ltitools($cdom); |
%ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer'); |
} |
} |
$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'} }; |
|
if ($hostname) { |
|
$args->{'hostname'} = $hostname; |
|
} |
my $description = 'External Resource Editor'; |
my $description = 'External Resource Editor'; |
if ($type eq 'tool') { |
if ($type eq 'tool') { |
$description = 'External Tool Editor'; |
$description = 'External Tool Editor'; |
Line 581 sub extedit_javascript {
|
Line 646 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". |
|
" var ltitoolsLinkDef = new Array($num);\n". |
|
" var ltitoolsExplainDef = new Array($num);\n". |
" var ltitoolsDisplay = new Array($num);\n". |
" var ltitoolsDisplay = new Array($num);\n". |
|
" var ltitoolsLink = 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})) { |
if (ref($toolsref->{$key}) eq 'HASH') { |
my $target = $toolsref->{$key}->{'target'}; |
if (ref($toolsref->{$key}->{'display'}) eq 'HASH') { |
my $width = $toolsref->{$key}->{'width'}; |
my $target = $toolsref->{$key}->{'display'}->{'target'}; |
my $height = $toolsref->{$key}->{'height'}; |
my $width = $toolsref->{$key}->{'display'}->{'width'}; |
$toolsjs .= ' ltitools['.$i.'] = '."'$key';\n". |
my $height = $toolsref->{$key}->{'display'}->{'height'}; |
' ltitoolsTarget['.$i.'] = '."'$target';\n". |
my $linkdef = $toolsref->{$key}->{'display'}->{'linktext'}; |
' ltitoolsWidth['.$i.'] = '."'$width';\n". |
my $explaindef = $toolsref->{$key}->{'display'}->{'explanation'}; |
' ltitoolsHeight['.$i.'] = '."'$height';\n"; |
my $providerurl; |
my %courseconfig; |
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". |
|
' ltitoolsTarget['.$i.'] = '."'$target';\n". |
|
' ltitoolsWidth['.$i.'] = '."'$width';\n". |
|
' ltitoolsHeight['.$i.'] = '."'$height';\n". |
|
' ltitoolsLinkDef['.$i.'] = '."'$linkdef';\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'}; |
$toolsjs .= ' ltitoolsDisplay['.$i.'] = '."'$display';\n"; |
$toolsjs .= ' ltitoolsDisplay['.$i.'] = '."'$display';\n"; |
|
my $linktext = $toolsref->{$key}->{'crsconf'}->{'linktext'}; |
|
$toolsjs .= ' ltitoolsLink['.$i.'] = '."'$linktext';\n"; |
|
my $explanation = $toolsref->{$key}->{'crsconf'}->{'explanation'}; |
|
$toolsjs .= ' ltitoolsExplain['.$i.'] = '."'$explanation';\n"; |
my $label = $toolsref->{$key}->{'crsconf'}->{'label'}; |
my $label = $toolsref->{$key}->{'crsconf'}->{'label'}; |
$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 665 function setExternal(extform,residx,type
|
Line 756 function setExternal(extform,residx,type
|
prefix = 'supp'; |
prefix = 'supp'; |
} |
} |
var dispdiv = prefix+'tooldispdiv'; |
var dispdiv = prefix+'tooldispdiv'; |
|
var windiv = prefix+'toolwindiv'; |
if (residx > 0) { |
if (residx > 0) { |
dispdiv += '_'+residx; |
dispdiv += '_'+residx; |
|
windiv += '_'+residx; |
} |
} |
if (document.getElementById(dispdiv)) { |
if (document.getElementById(dispdiv)) { |
if (document.getElementById(dispdiv).style.display == 'block') { |
if (document.getElementById(dispdiv).style.display == 'block') { |
Line 678 function setExternal(extform,residx,type
|
Line 771 function setExternal(extform,residx,type
|
width.trim(); |
width.trim(); |
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 691 function setExternal(extform,residx,type
|
Line 786 function setExternal(extform,residx,type
|
} else { |
} else { |
info += ':::'; |
info += ':::'; |
} |
} |
|
if (document.getElementById(windiv)) { |
|
if (document.getElementById(windiv).style.display == 'block') { |
|
var linktextdiv = prefix+'toollinktextdiv'; |
|
var explanationdiv = prefix+'toolexplanationdiv'; |
|
if (residx > 0) { |
|
linktextdiv += '_'+residx; |
|
explanationdiv += '_'+residx; |
|
} |
|
if (document.getElementById(linktextdiv).style.display == 'inline') { |
|
var linktext = extform.exttoollinktext.value; |
|
linktext.trim(); |
|
info += ':'+escape(linktext); |
|
} else { |
|
info += ':'; |
|
} |
|
if (document.getElementById(explanationdiv).style.display == 'inline') { |
|
var explaintext = extform.exttoolexplanation.value; |
|
explaintext.trim(); |
|
info += ':'+escape(explaintext); |
|
} else { |
|
info += ':'; |
|
} |
|
} else { |
|
info += '::'; |
|
} |
|
} else { |
|
info += '::'; |
|
} |
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 711 function setExternal(extform,residx,type
|
Line 836 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 757 function updateExttool(caller,form,suppl
|
Line 889 function updateExttool(caller,form,suppl
|
} |
} |
dispdiv = prefix+'tooldispdiv'; |
dispdiv = prefix+'tooldispdiv'; |
dimendiv = prefix+'tooldimendiv'; |
dimendiv = prefix+'tooldimendiv'; |
widthinput = prefix+'toolwidth'; |
widthinput = prefix+'tooldimenwidth'; |
heightinput = prefix+'toolheight'; |
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'; |
|
linktextdiv = prefix+'toollinktextdiv'; |
|
linktextinput = prefix+'toollinktext'; |
|
explanationdiv = prefix+'toolexplanationdiv'; |
|
explanationinput = prefix+'toolexplanation'; |
if (document.getElementById(dispdiv)) { |
if (document.getElementById(dispdiv)) { |
var toolpick = caller.options[caller.selectedIndex].value; |
var toolpick = caller.options[caller.selectedIndex].value; |
$toolsjs |
$toolsjs |
Line 773 function updateExttool(caller,form,suppl
|
Line 913 function updateExttool(caller,form,suppl
|
if (document.getElementById(dimendiv)) { |
if (document.getElementById(dimendiv)) { |
document.getElementById(dimendiv).style.display = 'none'; |
document.getElementById(dimendiv).style.display = 'none'; |
} |
} |
|
if (document.getElementById(windiv)) { |
|
document.getElementById(windiv).style.display = 'none'; |
|
} |
|
if (document.getElementById(linktextdiv)) { |
|
document.getElementById(linktextdiv).style.display = 'none'; |
|
} |
|
if (document.getElementById(explanationdiv)) { |
|
document.getElementById(explanationdiv).style.display = 'none'; |
|
} |
if (document.getElementById(labeldiv)) { |
if (document.getElementById(labeldiv)) { |
document.getElementById(labeldiv).style.display = 'none'; |
document.getElementById(labeldiv).style.display = 'none'; |
} |
} |
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 794 function updateExttool(caller,form,suppl
|
Line 946 function updateExttool(caller,form,suppl
|
} |
} |
} |
} |
} |
} |
if (ltitoolsTarget[j] == 'window') { |
} |
dimen = 'block'; |
var dimen = 'none'; |
dimenwidth = ltitoolsWidth[j]; |
var dimenwidth = ''; |
dimenheight = ltitoolsHeight[j]; |
var dimenheight = ''; |
|
if ((ltitoolsDisplay[j]) && (ltitoolsTarget[j] == 'window')) { |
|
dimen = 'block'; |
|
dimenwidth = ltitoolsWidth[j]; |
|
dimenheight = ltitoolsHeight[j]; |
|
} |
|
if (document.getElementById(dimendiv)) { |
|
document.getElementById(dimendiv).style.display = dimen; |
|
} |
|
if (document.getElementById(widthinput)) { |
|
document.getElementById(widthinput).value = dimenwidth; |
|
} |
|
if (document.getElementById(heightinput)) { |
|
document.getElementById(heightinput).value = dimenheight; |
|
} |
|
} |
|
if (document.getElementById(windiv)) { |
|
if ((ltitoolsTarget[j] == 'window') || (ltitoolsTarget[j] == 'tab')) { |
|
document.getElementById(windiv).style.display = 'block'; |
|
} else { |
|
document.getElementById(windiv).style.display = 'none'; |
|
} |
|
if (document.getElementById(linktextdiv)) { |
|
if (ltitoolsLink[j]) { |
|
document.getElementById(linktextdiv).style.display = 'inline'; |
} else { |
} else { |
dimen = 'none'; |
document.getElementById(linktextdiv).style.display = 'none'; |
dimenwidth = ''; |
|
dimenheight = ''; |
|
} |
} |
if (document.getElementById(dimendiv)) { |
} |
document.getElementById(dimendiv).style.display = dimen; |
if (document.getElementById(linktextinput)) { |
|
if (ltitoolsLink[j]) { |
|
document.getElementById(linktextinput).value = ltitoolsLinkDef[j]; |
|
} else { |
|
document.getElementById(linktextinput).value = ''; |
} |
} |
if (document.getElementById(widthinput)) { |
} |
document.getElementById(widthinput).value = dimenwidth; |
if (document.getElementById(explanationdiv)) { |
|
if (ltitoolsExplain[j]) { |
|
document.getElementById(explanationdiv).style.display = 'inline'; |
|
} else { |
|
document.getElementById(explanationdiv).style.display = 'none'; |
} |
} |
if (document.getElementById(heightinput)) { |
} |
document.getElementById(heightinput).value = dimenheight; |
if (document.getElementById(explanationinput)) { |
|
if (ltitoolsExplain[j]) { |
|
document.getElementById(explanationinput).value = ltitoolsExplainDef[j]; |
|
} else { |
|
document.getElementById(explananationinput).value = ''; |
} |
} |
} |
} |
} |
} |
Line 828 function updateExttool(caller,form,suppl
|
Line 1014 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 836 function updateExttool(caller,form,suppl
|
Line 1037 function updateExttool(caller,form,suppl
|
} |
} |
} |
} |
|
|
function updateTooldim(form,dimendiv,widthinput,heightinput) { |
function updateTooldim(form,dimendiv,windiv,widthinput,heightinput,linkinput,explaininput) { |
if (form.exttooltarget.length) { |
if (form.exttooltarget.length) { |
for (var i=0; i<form.exttooltarget.length; i++) { |
for (var i=0; i<form.exttooltarget.length; i++) { |
if (form.exttooltarget[i].checked) { |
if (form.exttooltarget[i].checked) { |
var dimen = 'none'; |
var dimen = 'none'; |
|
var linkconf = 'none'; |
if (form.exttooltarget[i].value == 'window') { |
if (form.exttooltarget[i].value == 'window') { |
dimen = 'block'; |
dimen = 'block'; |
|
linkconf = 'block'; |
} else { |
} else { |
if (document.getElementById(widthinput)) { |
if (form.exttooltarget[i].value == 'tab') { |
document.getElementById(widthinput).value = ''; |
linkconf = 'block'; |
} |
} else { |
if (document.getElementById(heightinput)) { |
if (document.getElementById(widthinput)) { |
document.getElementById(heightinput).value = ''; |
document.getElementById(widthinput).value = ''; |
|
} |
|
if (document.getElementById(heightinput)) { |
|
document.getElementById(heightinput).value = ''; |
|
} |
|
if (document.getElementById(linkinput)) { |
|
document.getElementById(linkinput).value = ''; |
|
} |
|
if (document.getElementById(explaininput)) { |
|
document.getElementById(explaininput).value = ''; |
|
} |
} |
} |
} |
} |
if (document.getElementById(dimendiv)) { |
if (document.getElementById(dimendiv)) { |
document.getElementById(dimendiv).style.display = dimen; |
document.getElementById(dimendiv).style.display = dimen; |
} |
} |
|
if (document.getElementById(windiv)) { |
|
document.getElementById(windiv).style.display = linkconf; |
|
} |
break; |
break; |
} |
} |
} |
} |