[LON-CAPA-cvs] cvs: rat /client parameter.html loncom/interface lonparmset.pm

raeburn raeburn at source.lon-capa.org
Wed Jul 6 23:37:02 EDT 2022


raeburn		Thu Jul  7 03:37:02 2022 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
    /rat/client	parameter.html 
  Log:
  - Bug 6907
    Eighth component in deeplink parameter determines whether "Exit Tool"
    button present in inline menu for sessions launched via deep-link. If,
    shown can also set to redirect to a URL, and the text for the button. 
  
  
-------------- next part --------------
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.615 loncom/interface/lonparmset.pm:1.616
--- loncom/interface/lonparmset.pm:1.615	Sun Jul  3 04:31:07 2022
+++ loncom/interface/lonparmset.pm	Thu Jul  7 03:37:01 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.615 2022/07/03 04:31:07 raeburn Exp $
+# $Id: lonparmset.pm,v 1.616 2022/07/07 03:37:01 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1253,10 +1253,13 @@
     var dlMenusRegExp = /^deeplink_menus_/;
     var dlCollsRegExp = /^deeplink_colls_/;
     var dlTargetRegExp = /^deeplink_target_/;
+    var dlExitRegExp = /^deeplink_exit_/;
+    var dlExitTextRegExp = /^deeplink_exittext_/;
     var patternIP = /[\[\]\*\.a-zA-Z\d\-]+/;
-    if ((document.parmform.elements.length != 'undefined')  && (document.parmform.elements.length) != 'null') {
-        if (document.parmform.elements.length) {
-            for (i=0; i<document.parmform.elements.length; i++) {
+    var numelements = document.parmform.elements.length;
+    if ((typeof(numelements) != 'undefined') && (numelements != null)) {
+        if (numelements) {
+            for (i=0; i<numelements; i++) {
                 var name=document.parmform.elements[i].name;
                 if (textRegExp.test(name)) {
                     var identifier = name.replace(textRegExp,'');
@@ -1411,12 +1414,50 @@
                         var identifier =  name.replace(dlTargetRegExp,'');
                         var idx = document.parmform.elements[i].selectedIndex;
                         if (idx > 0) {
-                            var possdeeplink = document.parmform.elements[i].options[idx].value
-                            possdeeplink = possdeeplink.replace(/^\s+|\s+$/g,'');
+                            var linktarget = document.parmform.elements[i].options[idx].value
+                            linktarget = linktarget.replace(/^\s+|\s+$/g,'');
                             if (document.parmform.elements['set_'+identifier].value) {
-                                possdeeplink = ','+possdeeplink;
+                                linktarget = ','+linktarget;
+                            }
+                            document.parmform.elements['set_'+identifier].value += linktarget;
+                        }
+                    } else if (dlExitRegExp.test(name)) {
+                        if (document.parmform.elements[i].checked) {
+                            var identifier =  name.replace(dlExitRegExp,'');
+                            var posslinkexit = document.parmform.elements[i].value;
+                            posslinkexit = posslinkexit.replace(/^\s+|\s+$/g,'');
+                            if (document.parmform.elements['set_'+identifier].value) {
+                                posslinkexit = ','+posslinkexit;
+                            }
+                            document.parmform.elements['set_'+identifier].value += posslinkexit;
+                        }
+                    } else if (dlExitTextRegExp.test(name)) {
+                        var identifier = name.replace(dlExitTextRegExp,'');
+                        if ((isRadioSet('deeplink_exit_'+identifier,'yes')) ||
+                            (isRadioSet('deeplink_exit_'+identifier,'url'))) {
+                            var posstext = document.parmform.elements[i].value;
+                            posstext = posstext.replace(/^\s+|\s+$/g,'');
+                            var origlength = posstext.length;
+                            posstext = posstext.replace(/[:;'",]/g,'');
+                            var newlength = posstext.length;
+                            if (newlength > 0) {
+                                var change = origlength - newlength;
+                                if (change) {
+                                    alert(change+' disallowed character(s) removed from Exit Button text');
+                                }
+                                if (posstext !== 'Exit Tool') {
+                                    posstext = ':'+posstext;
+                                    document.parmform.elements['set_'+identifier].value += posstext;
+                                }
+                            } else {
+                                document.parmform.elements['set_'+identifier].value = '';
+                                if (newlength < origlength) {
+                                    alert("An exit link type of 'In use' was selected but the button text value was blank, after removing disallowed characters.\nDisallowed characters are ,\":;'");
+                                } else {
+                                    alert("An exit link type of 'In use' was selected but the button text value was blank.\nPlease enter the text to use.");
+                                }
+                                return false;
                             }
-                            document.parmform.elements['set_'+identifier].value += possdeeplink;
                         }
                     }
                 }
@@ -1562,6 +1603,24 @@
                             keybox.type = 'hidden';
                         }
                     }
+                } else if (item == 'exit') {
+                    if (document.getElementById('deeplinkdiv_'+item+'_'+key)) {
+                        if (radios[i].value == 'no') {
+                            document.getElementById('deeplinkdiv_'+item+'_'+key).style.display = 'none';          
+                            if (document.getElementById('deeplink_exittext_'+key)) {
+                                if (document.getElementById('deeplink_exittext_'+key).value != '') {
+                                    document.getElementById('deeplink_exittext_'+key).value = '';    
+                                }
+                            }
+                        } else {
+                            document.getElementById('deeplinkdiv_'+item+'_'+key).style.display = 'inline-block';
+                            if (document.getElementById('deeplink_exittext_'+key)) {
+                                if (document.getElementById('deeplink_exittext_'+key).value == '') {
+                                    document.getElementById('deeplink_exittext_'+key).value = 'Exit Tool';
+                                }
+                            }
+                        }
+                    }
                 }
             }
         }
@@ -5166,9 +5225,13 @@
 
 sub string_deeplink_selector {
     my ($thiskey, $showval, $readonly) = @_;
-    my (@components,%values, at current,%titles,%options,%optiontext,%defaults,
-        %selectnull,%domlti,%crslti, at possmenus);
-    @components = ('state','others','listing','scope','protect','menus','target');
+    my (@tables,%values, at current,%titles,%options,%optiontext,%defaults,
+        %selectnull,%domlti,%crslti, at possmenus,%components);
+    @tables = ('upper','lower');
+    %components = (
+                    upper => ['state','others','listing','scope'],
+                    lower => ['protect','menus','target','exit'],
+                  );   
     %titles = &Apache::lonlocal::texthash (
                   state   => 'Access status',
                   others  => 'Hide other resources',
@@ -5177,6 +5240,7 @@
                   protect => 'Link protection',
                   menus   => 'Menu Items Displayed',
                   target  => 'Embedded?',
+                  exit    => 'Exit Tool Button?',
               );
     %options = (
                    state   => ['only','off','both'],
@@ -5186,6 +5250,7 @@
                    protect => ['none','key','ltid','ltic'],
                    menus   => ['std','colls'],
                    target  => ['_self','_top'],
+                   exit    => ['no','yes','url'],
                );
     %optiontext = &Apache::lonlocal::texthash (
                     only       => 'deep only',
@@ -5209,6 +5274,9 @@
                     colls      => 'Numbered collection',
                     _self      => 'Embedded',
                     _top       => 'Not embedded',
+                    no         => 'Not in use',
+                    yes        => 'In use, no URL redirect',
+                    url        => 'In use, redirect to URL',  
                   );
     %selectnull = &Apache::lonlocal::texthash (
                     ltic => 'Select Launcher',
@@ -5225,6 +5293,7 @@
         ($values{'protect'}) = ($current[4] =~ /^(key:[a-zA-Z\d_.!\@#\$%^&*()+=-]+|ltic:\d+|ltid:\d+)$/);
         ($values{'menus'}) = ($current[5] =~ /^(\d+)$/);
         ($values{'target'}) = ($current[6] =~ /^(_self|_top)$/);
+        ($values{'exit'}) = ($current[7] =~ /^((?:(?:yes|url)(?:|\:[^:;"',]+))|no)$/);
     } else {
         $defaults{'state'} = 'off',
         $defaults{'others'} = 'unhide',
@@ -5233,6 +5302,7 @@
         $defaults{'protect'} = 'none';
         $defaults{'menus'} = '0';
         $defaults{'target'} = '_top';
+        $defaults{'exit'} = 'yes';
     }
     my $disabled;
     if ($readonly) {
@@ -5263,119 +5333,144 @@
         }
     }
 
-    my $output = '<input type="hidden" name="set_'.$thiskey.'" /><table><tr>';
-    foreach my $item (@components) {
-        $output .= '<th>'.$titles{$item}.'</th>';
-    }
-    $output .= '</tr><tr>';
-    foreach my $item (@components) {
-        $output .= '<td>';
-        if (($item eq 'protect') || ($item eq 'menus')) {
-            my $selected = $values{$item};
-            foreach my $option (@{$options{$item}}) {
-                if ($item eq 'protect') { 
-                    if ($option eq 'ltid') {
-                        next unless (keys(%domlti));
-                    } elsif ($option eq 'ltic') {
-                        next unless (keys(%crslti));
-                    }
-                } elsif (($item eq 'menus') && ($option eq 'colls')) {
-                    next unless (@possmenus);
-                }
-                my $checked;
-                if ($item eq 'menus') {
-                    if (($selected =~ /^\d+$/) && (@possmenus) &&
-                        (grep(/^\Q$selected\E$/, at possmenus))) {
-                        if ($option eq 'colls') {
+    my $output = '<input type="hidden" name="set_'.$thiskey.'" />';
+    foreach my $table ('upper','lower') {
+        next unless (ref($components{$table}) eq 'ARRAY');
+        $output .= '<table width="100%"><tr>';
+        foreach my $item (@{$components{$table}}) {
+            $output .= '<th>'.$titles{$item}.'</th>';
+        }
+        $output .= '</tr><tr>';
+        foreach my $item (@{$components{$table}}) {
+            $output .= '<td>';
+            if (($item eq 'protect') || ($item eq 'menus') || ($item eq 'exit')) {
+                my $selected = $values{$item};
+                foreach my $option (@{$options{$item}}) {
+                    if ($item eq 'protect') { 
+                        if ($option eq 'ltid') {
+                            next unless (keys(%domlti));
+                        } elsif ($option eq 'ltic') {
+                            next unless (keys(%crslti));
+                        }
+                    } elsif (($item eq 'menus') && ($option eq 'colls')) {
+                        next unless (@possmenus);
+                    }
+                    my $checked;
+                    if ($item eq 'menus') {
+                        if (($selected =~ /^\d+$/) && (@possmenus) &&
+                            (grep(/^\Q$selected\E$/, at possmenus))) {
+                            if ($option eq 'colls') {
+                                $checked = ' checked="checked"';
+                            }
+                        } elsif (($option eq 'std') && ($selected == 0) && ($selected ne '')) {
                             $checked = ' checked="checked"';
                         }
-                    } elsif (($option eq 'std') && ($selected == 0) && ($selected ne '')) {
+                    } elsif ($selected =~ /^\Q$option\E/) {
                         $checked = ' checked="checked"';
                     }
-                } elsif ($selected =~ /^\Q$option\E/) {
-                    $checked = ' checked="checked"';
-                }
-                my $onclick;
-                unless ($readonly) {
-                    my $esc_key = &js_escape($thiskey);
-                    $onclick = ' onclick="toggleDeepLink(this.form,'."'$item','$esc_key'".');"';
-                }
-                $output .= '<span class="LC_nobreak"><label>'.
-                           '<input type="radio" name="deeplink_'.$item.'_'.$thiskey.'" value="'.$option.'"'.$onclick.$disabled.$checked.' />'."\n".
-                           $optiontext{$option}.'</label>';
-                if (($item eq 'protect') && ($option eq 'key')) {
-                    my $visibility="hidden";
-                    my $currkey;
-                    if ($checked) {
-                        $visibility = "text";
-                        $currkey = (split(/\:/,$values{$item}))[1];
-                    }
-                    $output .= ' '.
-                        '<input type="'.$visibility.'" name="deeplink_'.$option.'_'.$thiskey.'" id="deeplink_'.$option.'_'.$item.'_'.$thiskey.'" value="'.$currkey.'" size="10"'.$disabled.' />';
-                } elsif (($option eq 'ltic') || ($option eq 'ltid') || ($option eq 'colls')) {
-                    my $display="none";
-                    my ($current,$blankcheck, at possibles);
-                    if ($checked) {
-                        $display = 'inline-block';
-                        if (($option eq 'ltic') || ($option eq 'ltid'))  {
-                            $current = (split(/\:/,$selected))[1];
+                    my $onclick;
+                    unless ($readonly) {
+                        my $esc_key = &js_escape($thiskey);
+                        $onclick = ' onclick="toggleDeepLink(this.form,'."'$item','$esc_key'".');"';
+                    }
+                    $output .= '<span class="LC_nobreak"><label>'.
+                               '<input type="radio" name="deeplink_'.$item.'_'.$thiskey.'" value="'.$option.'"'.$onclick.$disabled.$checked.' />'."\n".
+                               $optiontext{$option}.'</label>';
+                    if (($item eq 'protect') && ($option eq 'key')) {
+                        my $visibility="hidden";
+                        my $currkey;
+                        if ($checked) {
+                            $visibility = "text";
+                            $currkey = (split(/\:/,$values{$item}))[1];
+                        }
+                        $output .= ' '.
+                                   '<input type="'.$visibility.'" name="deeplink_'.$option.'_'.$thiskey.'" id="deeplink_'.$option.'_'.$item.'_'.$thiskey.'" value="'.$currkey.'" size="10"'.$disabled.' />';
+                    } elsif (($option eq 'ltic') || ($option eq 'ltid') || ($option eq 'colls')) {
+                        my $display="none";
+                        my ($current,$blankcheck, at possibles);
+                        if ($checked) {
+                            $display = 'inline-block';
+                            if (($option eq 'ltic') || ($option eq 'ltid'))  {
+                                $current = (split(/\:/,$selected))[1];
+                            } else {
+                                $current = $selected;
+                            }
                         } else {
-                            $current = $selected;
+                            $blankcheck = ' selected="selected"';
                         }
-                    } else {
-                        $blankcheck = ' selected="selected"';
-                    }
-                    if ($option eq 'ltid') {
-                        @possibles = keys(%domlti);
-                    } elsif ($option eq 'ltic') {
-                        @possibles = keys(%crslti); 
-                    } else {
-                        @possibles = @possmenus;
-                    }
-                    $output .= '<div id="deeplinkdiv_'.$option.'_'.$item.'_'.$thiskey.'"'.
-                               ' style="display: '.$display.'"> <select name="'.
-                               'deeplink_'.$option.'_'.$thiskey.'"'.$disabled.'>';
-                    if (@possibles > 1) {
-                        $output .= '<option value=""'.$blankcheck.'>'.$selectnull{$option}.
-                                   '</option>'."\n";
-                    }
-                    foreach my $poss (sort { $a <=> $b } @possibles) {
-                        my $selected;
-                        if (($poss == $current) || (scalar(@possibles) ==1)) {
-                            $selected = ' selected="selected"';
-                        }
-                        my $shown = $poss;
                         if ($option eq 'ltid') {
-                            $shown = $domlti{$poss};
+                            @possibles = keys(%domlti);
                         } elsif ($option eq 'ltic') {
-                            $shown = $crslti{$poss};
+                            @possibles = keys(%crslti); 
+                        } else {
+                            @possibles = @possmenus;
+                        }
+                        $output .= '<div id="deeplinkdiv_'.$option.'_'.$item.'_'.$thiskey.'"'.
+                                   ' style="display: '.$display.'"> <select name="'.
+                                   'deeplink_'.$option.'_'.$thiskey.'"'.$disabled.'>';
+                        if (@possibles > 1) {
+                            $output .= '<option value=""'.$blankcheck.'>'.$selectnull{$option}.
+                                       '</option>'."\n";
+                        }
+                        foreach my $poss (sort { $a <=> $b } @possibles) {
+                            my $selected;
+                            if (($poss == $current) || (scalar(@possibles) ==1)) {
+                                $selected = ' selected="selected"';
+                            }
+                            my $shown = $poss;
+                            if ($option eq 'ltid') {
+                                $shown = $domlti{$poss};
+                            } elsif ($option eq 'ltic') {
+                                $shown = $crslti{$poss};
+                            }
+                            $output .= '<option value="'.$poss.'"'.$selected.'>'.$shown.'</option>';
+                        }
+                        $output .= '</select></div>';
+                    }
+                    $output .= '</span> ';
+                }
+                if ($item eq 'exit') {
+                    my $exitsty = 'none';
+                    my $displayval;
+                    if ($values{$item} =~ /^(yes|url)/) { 
+                        $exitsty = 'inline-block';
+                        my $currval = (split(/\:/,$values{$item}))[1];
+                        if ($currval eq '') {
+                            $displayval = 'Exit Tool';
+                        } else {
+                            $displayval = $currval;
                         }
-                        $output .= '<option value="'.$poss.'"'.$selected.'>'.$shown.'</option>';
                     }
-                    $output .= '</select></div>';
+                    $output .= '<div id="deeplinkdiv_'.$item.'_'.$thiskey.'"'.
+                               ' style="display: '.$exitsty.'"><br />'.&mt('Button text').': '.
+                               '<input type="text" name="deeplink_exittext_'.$thiskey.'"'.
+                               ' id="deeplink_exittext_'.$thiskey.'" value="'.$displayval.'"'.
+                               ' size="10"'.$disabled.' /></div>';
                 }
-                $output .= '</span> ';
-            }
-        } else {
-            my $selected = $values{$item};
-            my $defsel;
-            if ($selected eq '') {
-                $defsel = ' selected="selected"';
-            }
-            $output .= '<select name="deeplink_'.$item.'_'.$thiskey.'"'.$disabled.'>'."\n".
-                       '<option value=""'.$defsel.'>'.&mt('Please select').'</option>'."\n";
-            foreach my $option (@{$options{$item}}) {
-                $output .= '<option value="'.$option.'"';
-                if ($option eq $selected) {
-                    $output .= ' selected="selected"';
+            } else {
+                my $selected = $values{$item};
+                my $defsel;
+                if ($selected eq '') {
+                    $defsel = ' selected="selected"';
+                }
+                $output .= '<select name="deeplink_'.$item.'_'.$thiskey.'"'.$disabled.'>'."\n".
+                           '<option value=""'.$defsel.'>'.&mt('Please select').'</option>'."\n";
+                foreach my $option (@{$options{$item}}) {
+                    $output .= '<option value="'.$option.'"';
+                    if ($option eq $selected) {
+                        $output .= ' selected="selected"';
+                    }
+                    $output .= '>'.$optiontext{$option}.'</option>';
                 }
-                $output .= '>'.$optiontext{$option}.'</option>';
+                $output .= '</select>';
             }
-            $output .= '</select>';
+            $output .= '</td>';
+        }
+        $output .= '</tr></table>'."\n";
+        if ($table eq 'upper') {
+            $output .= '<br />';
         }
-        $output .= '</td>';
     }
-    $output .= '</tr></table>'."\n";
     return $output;
 }
 
@@ -5414,7 +5509,7 @@
              => [['_allowfrom_','Hostname(s), or IP(s) from which access is allowed'],
                  ['_denyfrom_','Hostname(s) or IP(s) from which access is disallowed']], 
      'string_deeplink'
-             => [['on','Set choices for link protection, resource listing, access scope, shown menu items, and embedding']],
+             => [['on','Set choices for link protection, resource listing, access scope, shown menu items, embedding, and exit link']],
     );
    
 
@@ -5425,7 +5520,7 @@
               => [['_allowfrom_','[^\!]+'],
                   ['_denyfrom_','\!']],
          'string_deeplink'
-              => [['on','^(only|off|both)\,(hide|unhide)\,(full|absent|grades|details|datestatus)\,(res|map|rec)\,(none|key\:\w+|ltic\:\d+|ltid\:\d+)\,(\d+|)\,_(self|top)$']],
+              => [['on','^(only|off|both)\,(hide|unhide)\,(full|absent|grades|details|datestatus)\,(res|map|rec)\,(none|key\:\w+|ltic\:\d+|ltid\:\d+)\,(\d+|)\,_(self|top),(yes|url|no)(|:[^:;\'",]+)$']],
     );
 
 my %stringtypes = (
Index: rat/client/parameter.html
diff -u rat/client/parameter.html:1.89 rat/client/parameter.html:1.90
--- rat/client/parameter.html:1.89	Wed Jul  6 22:31:13 2022
+++ rat/client/parameter.html	Thu Jul  7 03:37:02 2022
@@ -5,7 +5,7 @@
 The LearningOnline Network with CAPA
 Parameter Input Window
 //
-// $Id: parameter.html,v 1.89 2022/07/06 22:31:13 raeburn Exp $
+// $Id: parameter.html,v 1.90 2022/07/07 03:37:02 raeburn Exp $
 //
 // Copyright Michigan State University Board of Trustees
 //
@@ -422,6 +422,7 @@
     svalue += sform.deeplinkacc.options[sform.deeplinkacc.selectedIndex].value+',';
     var keyRegExp = /^[a-zA-Z\d_.!@#$%^&*()+=-]+$/;
     var numRegExp = /^\d+$/;
+    var exitTextRegExp = /^[^'":;,]+$/;
     if (sform.deeplinkprotect.length) {
         for (var i=0; i<sform.deeplinkprotect.length; i++) {
             if (sform.deeplinkprotect[i].checked) {
@@ -478,6 +479,30 @@
     }
     svalue += ',';
     svalue += sform.deeplinktarget.options[sform.deeplinktarget.selectedIndex].value;
+    svalue += ',';
+    if (sform.deeplinkexit.length) {
+        for (var i=0; i<sform.deeplinkexit.length; i++) {
+            if (sform.deeplinkexit[i].checked) {
+                if (sform.deeplinkexit[i].value == 'no') {
+                    svalue += sform.deeplinkexit[i].value;
+                } else {
+                    var exittext = sform.deeplinkexittext.value;
+                    exittext = exittext.replace(/^\s+|\s+$/g,'');
+                    if ((exittext.length) && (exitTextRegExp.test(exittext))) {
+                        svalue += sform.deeplinkexit[i].value;
+                        if (exittext !== 'Exit Tool') {
+                            svalue += ':'+exittext;
+                        }
+                    } else {
+                        alert('Please enter the button text. Disallowed characters are ;,":\'\n'+
+                              'or check "not in use" option for "Exit Tool Link"');
+                        return;
+                    }
+                }
+                break;
+            }
+        }
+    }
     assemble();
 }
 
@@ -527,6 +552,26 @@
             }
         }
     }
+    if ((caller == 'exit') && (sform.deeplinkexit.length)) {
+        var frame = window.frames["choices"];
+        for (var i=0; i<sform.deeplinkexit.length; i++) {
+            if (sform.deeplinkexit[i].checked) {
+                if (frame.document.getElementById('deeplinkexitdiv')) {
+                    if (sform.deeplinkexit[i].value == 'no') {
+                        frame.document.getElementById('deeplinkexitdiv').style.display='none';
+                        sform.deeplinkexittext.value = '';
+                    } else {
+                        frame.document.getElementById('deeplinkexitdiv').style.display='inline-block';
+                        if (sform.deeplinkexittext.value == '') {
+                            sform.deeplinkexittext.value = 'Exit Tool';
+                        }
+                        frame.document.getElementById('deeplinkexitdiv').scrollIntoView();
+                    }
+                }
+                break;
+            }
+        }
+    }
 }
 
 function calldeeplink(caller) {
@@ -1184,11 +1229,15 @@
            var deeplinkvals = new Array();
            var linkprotectparts = new Array();
            var ltikeyRegExp = /^(ltic:\d+|ltid:\d+|key:[a-zA-Z\d_.!@#$%^&*()+=-]+)$/;
+           var linkexitparts = new Array();
+           var dlinkexitRegExp = /^(yes|url|no)(|:[^:,;'"]+)$/;
            var dlinkkeysty = 'hidden';
            var dlinkkeyval = '';
            var dlinklticdivsty = 'none';
            var dlinkltiddivsty = 'none';
            var dlinkmenusdivsty = 'none';
+           var dlinkexitdivsty = 'none';
+           var dlinkexittextval = '';
            if ((svalue != '') && (typeof(svalue) != 'undefined')) {
                deeplinkvals = svalue.split(',');
                if (ltikeyRegExp.test(deeplinkvals[4])) {
@@ -1206,8 +1255,20 @@
                if (deeplinkvals[5] >= 1) {
                    dlinkmenusdivsty = 'inline-block';
                }
+               if (dlinkexitRegExp.test(deeplinkvals[7])) {
+                   linkexitparts = deeplinkvals[7].split(':');
+                   deeplinkvals[7] = linkexitparts[0];
+                   if (deeplinkvals[7] != 'no') {
+                       dlinkexitdivsty = 'inline-block'; 
+                       if (!linkexitparts[1]) {
+                           dlinkexittextval = 'Exit Tool';
+                       } else {
+                           dlinkexittextval = linkexitparts[1];
+                       }
+                   }
+               }
            } else {
-               deeplinkvals = ['off','unhide','full','res','','0'];
+               deeplinkvals = ['off','unhide','full','res','','0','_self','no'];
            }
            var deeplinkstate = new Array();
            deeplinkstate = ['only','off','both'];
@@ -1231,6 +1292,7 @@
            deeplinktarget = ['_self','_top'];
            var deeplinktargettxt = new Array();
            deeplinktargettxt = ['Embedded','Not embedded'];
+           var deeplinkexit = ['yes','url','no'];
            tablestart('Deep-linked items');
            choicewrite('<tr><td>Access status?</td><td>');
            choicewrite('<select name="deeplinkstate">');
@@ -1422,6 +1484,27 @@
                choicewrite('>'+deeplinktargettxt[i]+'</option>');
            }
            choicewrite('</select>');
+           choicewrite('</td></tr>');
+           choicewrite('<tr><td>Exit Button?</td><td>');
+           choicewrite('<span style="white-space: nowrap;"><label>');
+           choicewrite('<input name="deeplinkexit" value="no"'+
+                  ' type="radio" '+calldeeplink('exit'));
+           if (deeplinkvals[7]=='no') { choicewrite(' checked="checked"'); }
+           choicewrite(' />not in use</label></span><br />');
+           choicewrite('<span style="white-space: nowrap;"><label>');
+           choicewrite('<input name="deeplinkexit" value="yes"'+
+                  ' type="radio" '+calldeeplink('exit'));
+           if (deeplinkvals[7]=='yes') { choicewrite(' checked="checked"'); }
+           choicewrite(' />in use, no redirect</label></span> ');
+           choicewrite('<span style="white-space: nowrap;"><label>');
+           choicewrite('<input name="deeplinkexit" value="url"'+
+                  ' type="radio" '+calldeeplink('exit'));
+           if (deeplinkvals[7]=='url') { choicewrite(' checked="checked"'); }
+           choicewrite(' />in use, redirect to URL</label></span><br />');
+           choicewrite('<div id="deeplinkexitdiv" style="display:'+dlinkexitdivsty+'">');
+           choicewrite('<br /><span style="white-space: nowrap;">Button text: ');
+           choicewrite('<input type="text" name="deeplinkexittext" id="deeplinkexittext" value="'+dlinkexittextval+'" size="10" />');
+           choicewrite('</span></div>');
            choicewrite('</td></tr></table>');
        }
    }


More information about the LON-CAPA-cvs mailing list