Diff for /loncom/interface/lonextresedit.pm between versions 1.16 and 1.19

version 1.16, 2017/04/25 22:18:59 version 1.19, 2017/05/10 13:49:14
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 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 272  sub update_exttool { Line 272  sub update_exttool {
         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 'linktext') || ($item eq 'explanation')) &&                          ((($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 418  sub extedit_form { Line 425  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 429  sub extedit_form { Line 436  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 447  sub extedit_form { Line 454  sub extedit_form {
                                     $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 511  sub extedit_form { Line 521  sub extedit_form {
                     '<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>'.('&nbsp;'x2).                      '$toolattr{linktext}','$toolattr{explanation}'".');"'.$disabled.' />'.&mt('iframe').'</label>'.('&nbsp;'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>'.('&nbsp;'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 729  function setExternal(extform,residx,type Line 742  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 906  function updateExttool(caller,form,suppl Line 921  function updateExttool(caller,form,suppl
                             }                              }
                         }                          }
                         if (document.getElementById(windiv)) {                          if (document.getElementById(windiv)) {
                             if (ltitoolsTarget[j] == 'window') {                              if ((ltitoolsTarget[j] == 'window') || (ltitoolsTarget[j] == 'tab')) {
                                 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';
                             }                              }
                             if (document.getElementById(linktextdiv)) {                              if (document.getElementById(linktextdiv)) {
                                 if ((ltitoolsLink[j]) && (ltitoolsTarget[j] == 'window')) {                                  if (ltitoolsLink[j]) {
                                     document.getElementById(linktextdiv).style.display = 'inline';                                      document.getElementById(linktextdiv).style.display = 'inline';
                                 } else {                                  } else {
                                     document.getElementById(linktextdiv).style.display = 'none';                                      document.getElementById(linktextdiv).style.display = 'none';
                                 }                                  }
                             }                              }
                             if (document.getElementById(linktextinput)) {                              if (document.getElementById(linktextinput)) {
                                 if ((ltitoolsLink[j]) && (ltitoolsTarget[j] == 'window')) {                                  if (ltitoolsLink[j]) {
                                     document.getElementById(linktextinput).value = ltitoolsLinkDef[j];                                       document.getElementById(linktextinput).value = ltitoolsLinkDef[j]; 
                                 } else {                                  } else {
                                     document.getElementById(linktextinput).value = '';                                      document.getElementById(linktextinput).value = '';
                                 }                                  }
                             }                              }
                             if (document.getElementById(explanationdiv)) {                              if (document.getElementById(explanationdiv)) {
                                 if ((ltitoolsExplain[j]) && (ltitoolsTarget[j] == 'window')) {                                  if (ltitoolsExplain[j]) {
                                     document.getElementById(explanationdiv).style.display = 'inline';                                      document.getElementById(explanationdiv).style.display = 'inline';
                                 } else {                                  } else {
                                     document.getElementById(explanationdiv).style.display = 'none';                                      document.getElementById(explanationdiv).style.display = 'none';
                                 }                                  }
                             }                              }
                             if (document.getElementById(explanationinput)) {                              if (document.getElementById(explanationinput)) {
                                 if ((ltitoolsExplain[j]) && (ltitoolsTarget[j] == 'window')) {                                  if (ltitoolsExplain[j]) {
                                     document.getElementById(explanationinput).value = ltitoolsExplainDef[j];                                      document.getElementById(explanationinput).value = ltitoolsExplainDef[j];
                                 } else {                                  } else {
                                     document.getElementById(explananationinput).value = '';                                      document.getElementById(explananationinput).value = '';
Line 967  function updateTooldim(form,dimendiv,win Line 982  function updateTooldim(form,dimendiv,win
         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';                   var linkconf = 'none';
                 if (form.exttooltarget[i].value == 'window') {                  if (form.exttooltarget[i].value == 'window') {
                     dimen = 'block';                      dimen = 'block';
                     linkconf = '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(linkinput)) {                          if (document.getElementById(heightinput)) {
                         document.getElementById(linkinput).value = '';                              document.getElementById(heightinput).value = '';
                     }                          }
                     if (document.getElementById(explaininput)) {                          if (document.getElementById(linkinput)) {
                         document.getElementById(explaininput).value = '';                              document.getElementById(linkinput).value = '';
                           }
                           if (document.getElementById(explaininput)) {
                               document.getElementById(explaininput).value = '';
                           }
                     }                      }
                 }                  }
                 if (document.getElementById(dimendiv)) {                  if (document.getElementById(dimendiv)) {
Line 990  function updateTooldim(form,dimendiv,win Line 1009  function updateTooldim(form,dimendiv,win
                 }                  }
                 if (document.getElementById(windiv)) {                  if (document.getElementById(windiv)) {
                     document.getElementById(windiv).style.display = linkconf;                      document.getElementById(windiv).style.display = linkconf;
                 }                    }
                 break;                  break;
             }              }
         }          }

Removed from v.1.16  
changed lines
  Added in v.1.19


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>