Annotation of rat/client/parameter.html, revision 1.81

1.56      raeburn     1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
                      2:     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
                      3: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
1.1       www         4: <!--
                      5: The LearningOnline Network with CAPA
                      6: Parameter Input Window
1.16      albertel    7: //
1.81    ! raeburn     8: // $Id: parameter.html,v 1.80 2019/01/06 15:27:57 raeburn Exp $
1.16      albertel    9: //
                     10: // Copyright Michigan State University Board of Trustees
                     11: //
                     12: // This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                     13: //
                     14: // LON-CAPA is free software; you can redistribute it and/or modify
                     15: // it under the terms of the GNU General Public License as published by
                     16: // the Free Software Foundation; either version 2 of the License, or
                     17: // (at your option) any later version.
                     18: //
                     19: // LON-CAPA is distributed in the hope that it will be useful,
                     20: // but WITHOUT ANY WARRANTY; without even the implied warranty of
                     21: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     22: // GNU General Public License for more details.
                     23: //
                     24: // You should have received a copy of the GNU General Public License
                     25: // along with LON-CAPA; if not, write to the Free Software
                     26: // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     27: //
                     28: // /home/httpd/html/adm/gpl.txt
                     29: //
                     30: // http://www.lon-capa.org/
                     31: //
1.1       www        32: -->
                     33: <head>
1.56      raeburn    34: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
1.1       www        35: <title>LON-CAPA</title>
                     36: 
1.46      albertel   37: <script type="text/javascript">
1.56      raeburn    38: // <![CDATA[
1.1       www        39: 
                     40: var ptype='';
                     41: var pvalue='';
1.68      raeburn    42: var pmodval='';
1.70      raeburn    43: var pextraval='';
1.71      raeburn    44: var pextravaltwo='';
1.1       www        45: var preturn='';
                     46: var pcode='';
1.2       www        47: var pscat='';
                     48: var pmarker='';
1.63      www        49: var pmodal='';
1.1       www        50: var pname='';
1.76      raeburn    51: var precursive='';
                     52: var pnonreccol='';
                     53: var pmarkerst='';
                     54: var pparm='';
1.80      raeburn    55: var pextra='';
1.1       www        56: 
1.31      www        57: var defhour=0;
                     58: var defmin=0;
                     59: var defsec=0;
                     60: 
1.1       www        61: var svalue;
1.2       www        62: var stype;
                     63: var smarker;
1.1       www        64: 
                     65: var vars=new Array();
                     66: 
1.2       www        67: var cdate=new Date();
                     68: 
                     69: var csec;
                     70: var cmin;
                     71: var chour;
                     72: var cday;
                     73: 
                     74: var months=new Array();
                     75: 
                     76: 
1.1       www        77: function selwrite(text) {
                     78:   this.window.selector.document.write(text);
                     79: }
                     80: 
                     81: function choicestart() {
1.61      raeburn    82:   this.window.choices.document.open();
1.62      raeburn    83:   choicewrite('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
                     84:   choicewrite('<html xmlns="http://www.w3.org/1999/xhtml">');
1.55      bisitz     85:   choicewrite('<head>');
1.62      raeburn    86:   choicewrite('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
                     87:   choicewrite('<title>LON-CAPA</title>');
1.55      bisitz     88:   choicewrite('<style type="text/css">');
                     89:   choicewrite('<!--');
                     90:   choicewrite('body {');
                     91:   choicewrite('font-family: Verdana,Arial,Helvetica,sans-serif;');
                     92:   choicewrite('line-height:130%;');
                     93:   choicewrite('font-size:0.83em;');
                     94:   choicewrite('background: #FFFFFF;');
                     95:   choicewrite('}');
                     96:   choicewrite('table.LC_parmsel_table {font-size: 90%;}');
                     97:   choicewrite('table.LC_parmsel_table tr td { padding: 5px; border: 1px solid #C8C8C8;}');
                     98:   choicewrite('-->');
                     99:   choicewrite('</style>');
                    100:   choicewrite('</head>');
1.62      raeburn   101:   choicewrite('<body>');
1.1       www       102: }
                    103: 
                    104: function choiceend() {
                    105:   choicewrite('</body></html>');
                    106:   this.window.choices.document.close();
                    107: }
                    108: 
                    109: function choicewrite(text) {
                    110:   this.window.choices.document.write(text);
                    111: }
                    112: 
                    113: function tablestart(headtext) {
1.55      bisitz    114:   choicewrite('<table class="LC_parmsel_table"><tr bgcolor="#C5DB99"><th colspan="3">'+
1.1       www       115:               headtext+'</th></tr>');
                    116: }
                    117: 
                    118: function valline(text,id1,id2) {
1.52      bisitz    119:   choicewrite('<tr><td>'+text+
1.51      bisitz    120:               '</td><td><input type="text" size="4" name="val'+
1.53      bisitz    121:               id1+'" /></td><td>incl:<input type="checkbox" name="val'+
                    122:               id2+'" /></td></tr>');
1.1       www       123: }
                    124: 
1.46      albertel  125: function escapeHTML(text) {
                    126:   text = text.replace(/&/g, '&amp;');
                    127:   text = text.replace(/"/g, '&quot;');
                    128:   text = text.replace(/</g, '&lt;');
                    129:   text = text.replace(/>/g, '&gt;');
                    130:   return text;
                    131: }
                    132: 
1.2       www       133: function datecalc() {
                    134:     var sform=choices.document.forms.sch;
                    135: 
                    136:     cdate.setHours(sform.hours.options[sform.hours.selectedIndex].value);
                    137:     cdate.setMinutes(sform.minutes.options[sform.minutes.selectedIndex].value);
                    138:     cdate.setSeconds(sform.minutes.options[sform.seconds.selectedIndex].value);
                    139:     cdate.setDate(sform.date.options[sform.date.selectedIndex].value);
                    140:     cdate.setMonth(sform.month.options[sform.month.selectedIndex].value);
                    141:     cdate.setFullYear(sform.year.options[sform.year.selectedIndex].value);
                    142: 
                    143:     draw();
                    144: }
                    145: 
                    146: function hour() {
                    147:    var thishour=cdate.getHours();
                    148:     var i; var j;
1.53      bisitz    149:     choicewrite('<select name="hours" onchange="parent.datecalc();">');
1.2       www       150:     for (i=0;i<=23;i++) {
1.54      bisitz    151:         choicewrite('<option value="'+i+'"');
1.2       www       152:         if (i==thishour) {
1.54      bisitz    153:             choicewrite(' selected="selected"');
1.2       www       154:         }
                    155:         choicewrite('>');
                    156:         if (i==12) { choicewrite('noon'); } else {
                    157:            if (i==0) { choicewrite('midnight') } else {
                    158:               
                    159:                  if (i<12) { choicewrite(i+' am'); } else {
                    160:                     j=i-12; choicewrite(j+' pm');
                    161:                  }
                    162:               
                    163:            }
                    164:         }
                    165:         choicewrite('</option>');
                    166:     }
                    167:     choicewrite('</select>');
                    168: }
                    169: 
                    170: function minute() {
                    171:    var thisminutes=cdate.getMinutes();
                    172:     var i;
1.53      bisitz    173:     choicewrite('<select name="minutes" onchange="parent.datecalc();">');
1.2       www       174:     for (i=0;i<=59;i++) {
1.54      bisitz    175:         choicewrite('<option value="'+i+'"');
1.2       www       176:         if (i==thisminutes) {
1.54      bisitz    177:             choicewrite(' selected="selected"');
1.2       www       178:         }
                    179:         choicewrite('>'+i+'</option>');
                    180:     }
                    181:     choicewrite('</select>');
                    182: } 
                    183: 
                    184: function second() {
                    185:    var thisseconds=cdate.getSeconds();
                    186:     var i;
1.53      bisitz    187:     choicewrite('<select name="seconds" onchange="parent.datecalc();">');
1.2       www       188:     for (i=0;i<=59;i++) {
1.54      bisitz    189:         choicewrite('<option value="'+i+'"');
1.2       www       190:         if (i==thisseconds) {
1.54      bisitz    191:             choicewrite(' selected="selected"');
1.2       www       192:         }
                    193:         choicewrite('>'+i+'</option>');
                    194:     }
                    195:     choicewrite('</select>');
1.79      raeburn   196: }
1.2       www       197: 
                    198: 
                    199: function date() {
                    200:    var thisdate=cdate.getDate();
                    201:     var i;
1.53      bisitz    202:     choicewrite('<select name="date" onchange="parent.datecalc();">');
1.2       www       203:     for (i=1;i<=31;i++) {
1.54      bisitz    204:         choicewrite('<option value="'+i+'"');
1.2       www       205:         if (i==thisdate) {
1.54      bisitz    206:             choicewrite(' selected="selected"');
1.2       www       207:         }
                    208:         choicewrite('>'+i+'</option>');
                    209:     }
                    210:     choicewrite('</select>');
                    211: }
                    212: 
                    213: function year() {
                    214:    var thisyear=cdate.getFullYear();
1.19      www       215:    var nowdate=new Date();
                    216:    var nowyear=nowdate.getFullYear();
1.33      albertel  217:    if ( !thisyear ) { thisyear=nowyear; }
1.19      www       218:    var loweryear=thisyear-2;
                    219:    var upperyear=thisyear+5;
                    220:    if (thisyear>nowyear) { loweryear=nowyear-2; }
                    221:    if (thisyear<nowyear) { upperyear=nowyear+5; } 
1.2       www       222:     var i;
1.53      bisitz    223:     choicewrite('<select name="year" onchange="parent.datecalc();">');
1.19      www       224:     for (i=loweryear;i<=upperyear;i++) {
1.54      bisitz    225:         choicewrite('<option value="'+i+'"');
1.2       www       226:         if (i==thisyear) {
1.54      bisitz    227:             choicewrite(' selected="selected"');
1.2       www       228:         }
                    229:         choicewrite('>'+i+'</option>');
                    230:     }
                    231:     choicewrite('</select>');
                    232: }
                    233: 
                    234: function month() {
                    235:     var thismonth=cdate.getMonth();
                    236:     var i;
1.53      bisitz    237:     choicewrite('<select name="month" onchange="parent.datecalc();">');
1.2       www       238:     for (i=0;i<=11;i++) {
1.54      bisitz    239:         choicewrite('<option value="'+i+'"');
1.2       www       240:         if (i==thismonth) {
1.54      bisitz    241:             choicewrite(' selected="selected"');
1.2       www       242:         }
                    243:         choicewrite('>'+months[i]+'</option>');
                    244:     }
                    245:     choicewrite('</select>');
                    246: }
1.79      raeburn   247: 
                    248: 
1.2       www       249: function intminute() {
                    250:    var thisminutes=cmins;
                    251:     var i;
1.69      musolffc  252:     var result = '';
                    253:     result += '<select name="minutes" onchange="parent.intcalc();">';
1.2       www       254:     for (i=0;i<=59;i++) {
1.69      musolffc  255:         result += '<option value="'+i+'"';
1.2       www       256:         if (i==thisminutes) {
1.69      musolffc  257:             result += ' selected="selected"';
1.2       www       258:         }
1.69      musolffc  259:         result += '>'+i+'</option>';
1.2       www       260:     }
1.69      musolffc  261:     result += '</select>';
                    262:     return result;
1.2       www       263: } 
                    264: 
                    265: function inthour() {
                    266:    var thishours=chours;
                    267:     var i;
1.69      musolffc  268:     var result = '';
                    269:     result += '<select name="hours" onchange="parent.intcalc();">';
1.2       www       270:     for (i=0;i<=23;i++) {
1.69      musolffc  271:         result += '<option value="'+i+'"';
1.2       www       272:         if (i==thishours) {
1.69      musolffc  273:             result += ' selected="selected"';
1.2       www       274:         }
1.69      musolffc  275:         result += '>'+i+'</option>';
1.2       www       276:     }
1.69      musolffc  277:     result += '</select>';
                    278:     return result;
1.71      raeburn   279: }
1.2       www       280: 
                    281: function intsecond() {
1.69      musolffc  282:     var thisseconds=csecs;
1.2       www       283:     var i;
1.69      musolffc  284:     var result = '';
                    285:     result += '<select name="seconds" onchange="parent.intcalc();">';
1.2       www       286:     for (i=0;i<=59;i++) {
1.69      musolffc  287:         result += '<option value="'+i+'"';
1.2       www       288:         if (i==thisseconds) {
1.69      musolffc  289:             result += ' selected="selected"';
1.2       www       290:         }
1.69      musolffc  291:         result += '>'+i+'</option>';
1.2       www       292:     }
1.69      musolffc  293:     result += '</select>';
                    294:     return result;
1.2       www       295: } 
                    296: 
                    297: 
                    298: function intday() {
                    299:    var thisdate=cdays;
                    300:     var i;
1.69      musolffc  301:     var result ='';
                    302:     result += '<select name="date" onchange="parent.intcalc();">';
1.2       www       303:     for (i=0;i<=31;i++) {
1.69      musolffc  304:         result += '<option value="'+i+'"';
1.2       www       305:         if (i==thisdate) {
1.69      musolffc  306:             result += ' selected="selected"';
1.2       www       307:         }
1.69      musolffc  308:         result += '>'+i+'</option>';
1.2       www       309:     }
1.69      musolffc  310:     result += '</select>';
                    311:     return result;
1.2       www       312: }
                    313: 
                    314: function intcalc() {
                    315:     var sform=choices.document.forms.sch;
                    316:     svalue=((sform.date.options[sform.date.selectedIndex].value*24+
                    317:              sform.hours.options[sform.hours.selectedIndex].value*1)*60+
                    318:              sform.minutes.options[sform.minutes.selectedIndex].value*1)*60+
                    319:              sform.seconds.options[sform.seconds.selectedIndex].value*1;
1.68      raeburn   320:     if ((ptype=='date') && (pscat=='interval')) {
                    321:         var newpmodval = '';
1.70      raeburn   322:         var newpextraval = '';
1.71      raeburn   323:         var newpextravaltwo = 'Done';
1.68      raeburn   324:         if (sform.donebutton.length) {
                    325:             for (var i=0; i<sform.donebutton.length; i++) {
                    326:                 if (sform.donebutton[i].checked) {
                    327:                     if (sform.donebutton[i].value == '_done') {
                    328:                         newpmodval = sform.donebutton[i].value;
1.71      raeburn   329:                         newpextravaltwo = sform.donebutton_text.value;
1.70      raeburn   330:                     } else {
                    331:                         if (sform.donebutton[i].value == '_done_proctor') { 
                    332:                             newpmodval = sform.donebutton[i].value;
                    333:                             newpextraval = sform.donebutton_proctorkey.value;
1.71      raeburn   334:                             newpextravaltwo = sform.donebutton_text.value;
                    335:                             newpextravaltwo = newpextravaltwo.replace(/:/g,'');
1.70      raeburn   336:                         }
1.68      raeburn   337:                     }
                    338:                 }
                    339:             }
                    340:         }
                    341:         pmodval = newpmodval;
1.70      raeburn   342:         pextraval = newpextraval;
1.71      raeburn   343:         pextravaltwo = newpextravaltwo;
1.68      raeburn   344:         draw();
                    345:         if (pmodval) {
1.71      raeburn   346:             var doneRegExp = /^(_done)(|_proctor)$/;
                    347:             var donevals = pmodval.match(doneRegExp);
                    348:             if (donevals.length == 3) {
                    349:                 svalue += donevals[1];
                    350:             }
                    351:             if (newpextravaltwo) {
                    352:                 if (newpextravaltwo != 'Done') { 
                    353:                     svalue += ':'+newpextravaltwo+':';
                    354:                 }
                    355:             }
                    356:             if (donevals[2] != '') {
                    357:                 svalue += donevals[2];
                    358:                 if (pextraval != '') {
                    359:                     svalue += '_'+pextraval;
                    360:                 }
                    361:             }
1.70      raeburn   362:         }
1.68      raeburn   363:     } else {
                    364:         draw();
                    365:     }
1.2       www       366: }
                    367: 
1.70      raeburn   368: function toggleSecret() {
                    369:     var sform=choices.document.forms.sch;
                    370:     if (sform.donebutton.length) {
                    371:         for (var i=0; i<sform.donebutton.length; i++) {
                    372:             if (sform.donebutton[i].checked) {
1.71      raeburn   373:                 if (sform.donebutton[i].value == '') {
                    374:                     if (document.getElementById('donebuttontextdiv')) {
                    375:                         document.getElementById('donebuttontextdiv').style.display='none';
                    376:                     }
                    377:                 } else {
                    378:                     if (document.getElementById('donebuttontextdiv')) {
                    379:                         document.getElementById('donebuttontextdiv').style.display='block';
                    380:                     }
                    381:                 }
1.70      raeburn   382:                 if (sform.donebutton[i].value == '_done_proctor') {
                    383:                     if (document.getElementById('done_proctorkey')) {
                    384:                         document.getElementById('done_proctorkey').type='text';
                    385:                     }
                    386:                 } else {
                    387:                     if (document.getElementById('done_proctorkey')) {
                    388:                         document.getElementById('done_proctorkey').type='hidden';
                    389:                         document.getElementById('done_proctorkey').value='';
                    390:                     }
                    391:                 }
                    392:             }
                    393:         }
                    394:     }
                    395: }
                    396: 
                    397: function validateInterval() {
                    398:     var sform=choices.document.forms.sch;
                    399:     if (sform.donebutton.length) {
                    400:         for (var i=0; i<sform.donebutton.length; i++) {
                    401:             if (sform.donebutton[i].checked) {
                    402:                 if (sform.donebutton[i].value == '_done_proctor') {
                    403:                     if ((sform.donebutton_proctorkey.value == '') || 
                    404:                         (sform.donebutton_proctorkey.value == null)) {
                    405:                         alert('Please provide a key for a proctor to enter when a student uses the "Done" button.');
                    406:                         return;
                    407:                     }
                    408:                 }
                    409:             }
                    410:         }
                    411:     }
                    412:     intcalc();
                    413:     assemble();
                    414: }
                    415: 
1.80      raeburn   416: function validateDeepLink() {
                    417:     var sform=choices.document.forms.sch;
                    418:     svalue = sform.deeplinklisted.options[sform.deeplinklisted.selectedIndex].value+',';
                    419:     svalue += sform.deeplinkacc.options[sform.deeplinkacc.selectedIndex].value+',';
                    420:     if (sform.deeplinktypes.length) {
                    421:         for (var i=0; i<sform.deeplinktypes.length; i++) {
                    422:             if (sform.deeplinktypes[i].checked) {
                    423:                 svalue += sform.deeplinktypes[i].value;
                    424:                 if (sform.deeplinktypes[i].value == 'key') {
                    425:                     var posskey = sform.deeplinkkey.value;
                    426:                     posskey = posskey.replace(/^\s+|\s+$/g,'');
                    427:                     var keyRegExp = /^\w+$/;
                    428:                     if (keyRegExp.test(posskey)) {
                    429:                         svalue += ':'+posskey;
                    430:                     }
                    431:                 } else if (sform.deeplinktypes[i].value == 'lti') {
                    432:                     var posslti = sform.linkposslti.options[sform.linkposslti.selectedIndex].value;
                    433:                     if (posslti != '' && posslti != null) {
                    434:                         svalue += ':'+posslti;
                    435:                     }
                    436:                 }
                    437:                 break;
                    438:             }
                    439:         }
                    440:     }
                    441:     assemble();
                    442: }
                    443: 
                    444: function toggleDeepLink() {
                    445:     var sform=choices.document.forms.sch;
                    446:     if (sform.deeplinktypes.length) {
                    447:         var frame = window.frames["choices"];
                    448:         for (var i=0; i<sform.deeplinktypes.length; i++) {
                    449:             if (sform.deeplinktypes[i].checked) {
                    450:                 if (sform.deeplinktypes[i].value == 'key') {
                    451:                     if (frame.document.getElementById('deeplinkkey')) {
                    452:                         frame.document.getElementById('deeplinkkey').type='text';
                    453:                     }
                    454:                     if (frame.document.getElementById('deeplinkltidiv')) {
                    455:                         frame.document.getElementById('deeplinkltidiv').style.display='none';
                    456:                     }
                    457:                 } else {
                    458:                     if (frame.document.getElementById('deeplinkkey')) {
                    459:                         frame.document.getElementById('deeplinkkey').type='hidden';
                    460:                     }
                    461:                     if (frame.document.getElementById('deeplinkltidiv')) {
                    462:                         if (sform.deeplinktypes[i].value == 'lti') {
                    463:                             frame.document.getElementById('deeplinkltidiv').style.display='inline-block';
                    464:                         } else {
                    465:                             frame.document.getElementById('deeplinkltidiv').style.display='none';
                    466:                         }
                    467:                     }
                    468:                 }
                    469:                 break;
                    470:             }
                    471:         }
                    472:     }
                    473: }
                    474: 
                    475: function calldeeplink() {
                    476:     return 'onclick="parent.toggleDeepLink()"';
                    477: }
                    478: 
1.6       www       479: function integereval() {
                    480:    svalue=choices.document.forms.sch.intval.value;
                    481:    svalue=Math.round(svalue);
                    482:    if (pscat=='zeropos') { svalue=Math.abs(svalue); }
                    483:    if ((pscat=='pos') && (svalue==0)) {
                    484:       svalue='';
                    485:    }
1.12      www       486:    if (pscat.indexOf('inrange')!=-1) {
1.10      www       487:       var rangeparts=new Array;
                    488:       rangeparts=split('_',pscat);
1.12      www       489:       rangeparts=split(',',rangeparts[1]);
1.10      www       490:       if (svalue<rangeparts[0]) { svalue=rangeparts[0]; }
                    491:       if (svalue>rangeparts[1]) { svalue=rangeparts[1]; }
                    492:    }
1.6       www       493:    draw();
                    494: }
                    495: 
                    496: function floateval() {
                    497:    svalue=choices.document.forms.sch.floatval.value;
                    498:    svalue=1.0*svalue;
                    499:    if (pscat=='pos') { svalue=Math.abs(svalue); }
                    500:    if ((pscat=='zeroone') && ((svalue<0) || (svalue>1))) {
                    501:       svalue='';
                    502:    }
                    503:    draw();
                    504: }
                    505: 
                    506: function stringeval() {
                    507:    svalue=choices.document.forms.sch.stringval.value;
                    508:    draw();
                    509: }
                    510: 
1.73      raeburn   511: function ipstringeval() {
                    512:     var patternIp = /^([\[\]a-zA-Z\.\d\*\-]+)$/;
                    513:     var acctypes = new Array;
                    514:     acctypes = ['allow','deny'];
                    515:     svalue = '';
                    516:     for (var i=0; i<acctypes.length; i++) {
                    517:         var items = choices.document.getElementsByName('setip'+acctypes[i]);
1.74      raeburn   518:         if (items.length > 0) { 
1.73      raeburn   519:             for (var j=0; j<items.length; j++) {
                    520:                 if (items[j].type == "text") {
1.79      raeburn   521:                     var possip = items[j].value;
1.73      raeburn   522:                     possip = possip.replace(/^\s+|\s+$/g,'');
                    523:                     if (patternIp.test(possip)) {
                    524:                         if (acctypes[i] == 'deny') {
                    525:                             possip = '!'+possip;
                    526:                         }
                    527:                         if (svalue == '') {
                    528:                             svalue = possip;
                    529:                         } else {
                    530:                             svalue += ','+possip;
                    531:                         }
                    532:                     }
                    533:                 }
                    534:             }
                    535:         }
                    536:     }
                    537: }
                    538: 
                    539: function addIpRule(iptype) {
                    540:     var frame = window.frames["choices"];
                    541:     if (frame.document.getElementById('LC_string_ipacc_inner_'+iptype)) {
                    542:         var innerDiv = frame.document.getElementById('LC_string_ipacc_inner_'+iptype);
                    543:         var count = innerDiv.childNodes.length 
                    544:         var ipDiv = frame.document.createElement('div');
                    545:         ipDiv.innerHTML = '<input type="text" size="10" name="setip'+iptype+'" onblur="parent.ipstringeval();" />'+
                    546:                           '<a href="#" onclick="parent.removeIpRule(\''+iptype+'\',\''+count+'\')">Remove</a>';
                    547:         frame.document.getElementById('LC_string_ipacc_inner_'+iptype).appendChild(ipDiv);
                    548:     }
                    549:     return false;
                    550: }
                    551: 
                    552: function removeIpRule(iptype,num) {
                    553:     var frame = window.frames["choices"];
                    554:     if (frame.document.getElementById('LC_string_ipacc_inner_'+iptype)) {
                    555:         var innerDiv = frame.document.getElementById('LC_string_ipacc_inner_'+iptype);
                    556:         for (var i=0; i<innerDiv.childNodes.length; i++) {
                    557:             if (i==num) {
                    558:                 innerDiv.removeChild(innerDiv.childNodes[i]);
                    559:                 ipstringeval();
                    560:                 break;
                    561:             }
                    562:         }
                    563:     }
                    564: }
                    565: 
1.25      www       566: function radiostringeval(newval) {
                    567:    svalue=newval;
                    568:    draw();
                    569: }
                    570: 
1.29      www       571: function callradiostringeval(newval) {
1.67      raeburn   572:     return 'onclick="parent.radiostringeval(\''+newval+'\')"';
1.29      www       573: }
                    574: 
1.72      raeburn   575: function lenienteval(newval) {
                    576:     if (newval == 'weighted') {
                    577:         if (document.getElementById('lenientweighteddiv')) {
                    578:             document.getElementById('lenientweighteddiv').style.display='block';
                    579:         }
                    580:         var patternRelWeight = /^\-?[\d.]+$/;
1.79      raeburn   581:         var sform=choices.document.forms.sch;
1.72      raeburn   582:         if ((sform.lenientrelwt.length != 'undefined')  && (sform.lenientrelwt.length) != 'null') {
                    583:             for (var i=0; i<sform.lenientrelwt.length; i++) {
                    584:                 var relweight = sform.lenientrelwt[i].value;
                    585:                 relweight = relweight.replace(/^\s+|\s+$/g,'');
                    586:                 if (!patternRelWeight.test(relweight)) {
                    587:                     if (i<2) {
                    588:                         relweight = '1.0';
                    589:                     } else {
                    590:                         relweight = '0.0';
                    591:                     }
                    592:                 }
                    593:                 sform.lenientrelwt[i].value = relweight;
                    594:                 if (i==0) {
                    595:                     svalue = relweight;
                    596:                 } else {
                    597:                     svalue += ','+relweight;
                    598:                 }
                    599:             }
                    600:         }
                    601:     } else {
                    602:         if (document.getElementById('lenientweighteddiv')) {
                    603:             document.getElementById('lenientweighteddiv').style.display='none';
                    604:         }
                    605:         svalue=newval;
1.73      raeburn   606:     }
1.72      raeburn   607:     draw();
                    608: }
                    609: 
                    610: function calllenientradioeval(newval) {
                    611:     return 'onclick="parent.lenienteval(\''+newval+'\')"';
                    612: }
                    613: 
1.68      raeburn   614: function callintervalpmodval() {
1.70      raeburn   615:     return 'onclick="parent.intcalc();parent.toggleSecret()"';
1.79      raeburn   616: }
1.68      raeburn   617: 
1.2       www       618: function intervaldis() {
                    619:     csecs=svalue;
                    620:     cdays=Math.floor(csecs/86400);
                    621:     csecs-=cdays*86400;
                    622:     chours=Math.floor(csecs/3600);
                    623:     csecs-=chours*3600;
                    624:     cmins=Math.floor(csecs/60);
                    625:     csecs-=cmins*60;
1.69      musolffc  626:     return cdays+' days '+chours+' hours '+cmins+' mins '+csecs+' secs';
1.2       www       627: }
1.21      www       628: 
                    629: function pickcolor(picked) {
                    630:   svalue=picked;
                    631:   draw();
                    632: }
                    633: 
                    634: function colorfield(ir,ig,ib) {
                    635:    var col=new Array;
1.23      www       636:    col=["00","11","22","44","66","88","AA","CC","DD","EE","FF"];
1.21      www       637:    var color='#'+col[ir]+col[ig]+col[ib];
1.23      www       638:    var selection="<font color='"+color+"'>X</font>";
                    639:    if (color==svalue) { selection="<font color='#"+col[10-ir]+col[10-ig]+col[10-ib]+"'>X</font>"; }
1.21      www       640:    choicewrite('<td bgcolor="'+color+'"><a href="javascript:parent.pickcolor('+"'"+
                    641:                color+"'"+')">'+selection+'</a></td>');
1.80      raeburn   642: }
1.21      www       643: 
1.1       www       644: function draw() {
                    645:    choicestart();
1.51      bisitz    646:    choicewrite('<form name="sch"');
1.6       www       647:    if (ptype=='int') {
                    648:       choicewrite(' action="javascript:integereval();"');
                    649:    }
                    650:    if (ptype=='float') {
                    651:       choicewrite(' action="javascript:floateval();"');
                    652:    }
                    653:    if (ptype=='string') {
1.73      raeburn   654:       if (pscat == 'ip') {
                    655:           choicewrite(' action="javascript:ipstringeval();"');
                    656:       } else {
                    657:           choicewrite(' action="javascript:stringeval();"');
                    658:       }
1.6       www       659:    }
1.62      raeburn   660:    if (ptype != 'int' && ptype != 'float' && ptype != 'string') {
                    661:        choicewrite(' action=""');
                    662:    }
1.6       www       663:    choicewrite('>');
1.1       www       664:    if (ptype=='tolerance') {
1.2       www       665: // 0: pscat
                    666:       if (pscat=='default') {
1.1       www       667:          tablestart('Use default value or algorithm of resource');
                    668:       }
1.2       www       669:       if (pscat=='relative_sym') {
1.1       www       670: // 2: percentage
                    671: // 3: open
                    672:          tablestart('Percentage error, symmetric around value');
                    673:          valline('Percentage',2,3);
1.13      www       674:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
                    675:             choices.document.forms.sch.val2.value=parseInt(svalue);
                    676:             if (svalue.indexOf('+')!=-1) {
                    677:                choices.document.forms.sch.val3.checked=true;
                    678:             }
                    679:          }
1.1       www       680:       }
1.2       www       681:       if (pscat=='relative') {
1.1       www       682: // 2: left
                    683: // 3: open
                    684: // 4: right
                    685: // 5: open
                    686:          tablestart('Percentage error, asymmetric around value');
                    687:          valline('Upper percentage',2,3);
                    688:          valline('Lower percentage',4,5);
1.17      matthew   689:          var range1=new Array;
1.13      www       690:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
1.17      matthew   691:             range1=svalue.split(',');
                    692:             if (typeof(range1[1])=='undefined') { range1[1]=range1[0]; }
                    693:             choices.document.forms.sch.val2.value=parseFloat(range1[0]);
                    694:             if (range1[0].indexOf('+')!=-1) {
1.13      www       695:                choices.document.forms.sch.val3.checked=true;
                    696:             }
1.17      matthew   697:             choices.document.forms.sch.val4.value=parseFloat(range1[1]);
                    698:             if (range1[1].indexOf('+')!=-1) {
1.13      www       699:                choices.document.forms.sch.val5.checked=true;
                    700:             }
                    701:          }
1.1       www       702:       }
1.2       www       703:       if (pscat=='absolute_sym') {
1.1       www       704:          tablestart('Absolute error, symmetric around value');
                    705:          valline('Value',2,3);
1.13      www       706:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
1.15      www       707:             choices.document.forms.sch.val2.value=parseFloat(svalue);
1.13      www       708:             if (svalue.indexOf('+')!=-1) {
                    709:                choices.document.forms.sch.val3.checked=true;
                    710:             }
                    711:          }
1.1       www       712:       }
1.2       www       713:       if (pscat=='absolute') {
1.1       www       714:          tablestart('Absolute error, asymmetric around value');
                    715:          valline('Upper value',2,3);
                    716:          valline('Lower value',4,5);
1.17      matthew   717:          var range2=new Array;
1.13      www       718:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
                    719:             range=svalue.split(',');
1.17      matthew   720:             if (typeof(range2[1])=='undefined') { range2[1]=range2[0]; }
                    721:             choices.document.forms.sch.val2.value=parseFloat(range2[0]);
                    722:             if (range2[0].indexOf('+')!=-1) {
1.13      www       723:                choices.document.forms.sch.val3.checked=true;
                    724:             }
1.17      matthew   725:             choices.document.forms.sch.val4.value=parseFloat(range2[1]);
                    726:             if (range2[1].indexOf('+')!=-1) {
1.13      www       727:                choices.document.forms.sch.val5.checked=true;
                    728:             }
                    729:          }
1.1       www       730:       }
                    731:    }
                    732: 
                    733:    if (ptype=='date') {
1.2       www       734:      if (pscat=='default') {
                    735:          tablestart('Default value or none');
                    736:          choicewrite('</table>');
                    737:      } else {
                    738:       if (pscat=='start') {
1.24      www       739:          tablestart('Date and time');
1.2       www       740:       }
                    741:       if (pscat=='end') {
1.24      www       742:          tablestart('Date and time');
1.2       www       743:       }
                    744:       if (pscat=='interval') {
1.70      raeburn   745:          var proctorkeytype = 'hidden'; 
1.71      raeburn   746:          var donebuttontext = 'none';
1.70      raeburn   747:          if (pmodval == '_done_proctor') {
                    748:              proctorkeytype = 'text';
1.71      raeburn   749:              donebuttontext = 'block';
                    750:          }
                    751:          if (pmodval == '_done') {
                    752:              donebuttontext = 'block';
1.70      raeburn   753:          }
1.2       www       754:          tablestart('Time interval');
1.69      musolffc  755:          choicewrite( [
                    756:             '<tr><td colspan="3">'+intervaldis()+'</td></tr>',
                    757:             '<tr><td>Time:</td><td colspan="2">',
                    758:                 '<span style="white-space:nowrap">'+intday()+' days </span>',
                    759:                 '<span style="white-space:nowrap">'+inthour()+' hours</span>',
                    760:                 '<span style="white-space:nowrap">'+intminute()+' mins</span>',
                    761:                 '<span style="white-space:nowrap">'+intsecond()+' secs</span>',
                    762:             '</td></tr>',
                    763:             '</table>',
                    764:             '<br />',
                    765:             ].join("\n"));
1.68      raeburn   766:          tablestart('Provide a "Done" button to students?');
                    767:          choicewrite('<tr><td>Value:</td><td colspan="2">');
1.70      raeburn   768:          choicewrite('<label><input name="donebutton" value=""'+
                    769:                      ' type="radio" '+callintervalpmodval());
                    770:          if (pmodval == '') { choicewrite(' checked="checked"'); }
                    771:          choicewrite(' /> No</label><br />');
1.68      raeburn   772:          choicewrite('<label><input name="donebutton" value="_done"'+
                    773:                      ' type="radio" '+callintervalpmodval());
1.70      raeburn   774:          if (pmodval == '_done') { choicewrite(' checked="checked"'); }
1.68      raeburn   775:          choicewrite(' /> Yes</label><br />');
1.70      raeburn   776:          choicewrite('<span style="white-space:nowrap">'+
                    777:                      '<label><input name="donebutton" value="_done_proctor"'+
1.68      raeburn   778:                      ' type="radio" '+callintervalpmodval());
1.70      raeburn   779:          if (pmodval == '_done_proctor') { choicewrite(' checked="checked"'); }
                    780:          choicewrite(' /> Yes, with proctor key</label>');
                    781:          choicewrite('&nbsp;<input name="donebutton_proctorkey" value='+
                    782:                      '"'+escapeHTML(pextraval)+'" type="'+proctorkeytype+
1.71      raeburn   783:                      '" id="done_proctorkey" size="10"'+
                    784:                      ' onblur="parent.intcalc();" /></span><br />'+
                    785:                      '<div id="donebuttontextdiv" style="display:'+donebuttontext+'">'+
                    786:                      '<br /><span style="white-space:nowrap">'+
                    787:                      'Button text:'+
                    788:                      '<input name="donebutton_text" value='+
                    789:                      '"'+escapeHTML(pextravaltwo)+'" type="text" '+
                    790:                      'size="10" onblur="parent.intcalc();" /></span></div>');
1.68      raeburn   791:          choicewrite('</td></tr></table>');
                    792:       } else {
1.52      bisitz    793:          choicewrite('<tr><td colspan="3">'
1.2       www       794:          +cdate.toString()+
1.52      bisitz    795:          '</td></tr><tr><td>Date:</td><td colspan="2">');
1.2       www       796:          month();date();year();
1.52      bisitz    797:          choicewrite('</td></tr><tr><td>Time:'
1.51      bisitz    798:          +'</td><td colspan="2">');hour();choicewrite('h ');minute();
1.2       www       799:          choicewrite('m ');second();
                    800:          choicewrite('s</td></tr></table>');
                    801:       }
                    802:      }
1.1       www       803:    }
                    804: 
1.6       www       805:    if (ptype=='int') {
1.19      www       806:       var pscatparts=new Array;
                    807:       pscatparts=pscat.split(',');
                    808:       pscat=pscatparts[0];
1.6       www       809:       if (pscat=='default') {
                    810:          tablestart('Default value or none');
1.14      www       811:          choicewrite('</table>');
1.6       www       812:       } else {
1.14      www       813:        if (pscat=='range') {
                    814:          tablestart('Integer range');      
1.52      bisitz    815:          choicewrite('<tr><td>Lower Value:'+
1.51      bisitz    816:               '</td><td colspan="2"><input type="text" size="4" name="val2'+
1.53      bisitz    817:               '" /></td></tr>');
1.52      bisitz    818:          choicewrite('<tr><td>Upper Value:'+
1.51      bisitz    819:               '</td><td colspan="2"><input type="text" size="4" name="val4'+
1.53      bisitz    820:               '" /></td></tr></table>');
1.14      www       821:          var range=new Array;
                    822:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
                    823:             range=svalue.split(',');
                    824:             if (typeof(range[1])=='undefined') { range[1]=range[0]; }
                    825:             choices.document.forms.sch.val2.value=parseInt(range[0]);
                    826:             choices.document.forms.sch.val4.value=parseInt(range[1]);
                    827:          }
                    828:        } else {
1.6       www       829:         if (pscat=='pos') {
                    830:            tablestart('Positive (non-zero) integer');
                    831:         }
                    832:         if (pscat=='zeropos') {
                    833:            tablestart('Positive integer or zero');
                    834:         }
1.12      www       835:         if (pscat.indexOf('inrange')!=-1) {
1.10      www       836:            var rangeparts=new Array;
1.12      www       837:            rangeparts=split(',',pscat);
1.10      www       838:            tablestart('Integer in the range ['+rangeparts[1]+']');
                    839:         }
1.6       www       840:         if (pscat=='any') {
                    841:            tablestart('Integer');
                    842:         }
1.52      bisitz    843:         choicewrite('<tr><td>Value:</td><td colspan="2">');
1.51      bisitz    844:         choicewrite('<input name="intval" size="10" value="'+escapeHTML(svalue)+
1.53      bisitz    845:                     '" onchange="parent.integereval()" />');
1.54      bisitz    846:         choicewrite('</td></tr></table>');
1.6       www       847:       }
1.14      www       848:      }
1.1       www       849:    }
                    850: 
1.6       www       851:    if (ptype=='float') {
                    852:       if (pscat=='default') {
                    853:          tablestart('Default value or none');
1.79      raeburn   854:          choicewrite('</table>');
1.6       www       855:       } else {
                    856:         if (pscat=='pos') {
                    857:            tablestart('Positive floating point number or zero');
                    858:         }
                    859:         if (pscat=='zeroone') {
                    860:            tablestart('Floating point number between zero and one');
                    861:         }
                    862:         if (pscat=='any') {
                    863:            tablestart('Floating point number');
                    864:         }
1.52      bisitz    865:         choicewrite('<tr><td>Value:</td><td colspan="2">');
1.51      bisitz    866:         choicewrite('<input name="floatval" size="10" value="'+escapeHTML(svalue)+
1.53      bisitz    867:                     '" onchange="parent.floateval()" />');
1.54      bisitz    868:         choicewrite('</td></tr></table>');
1.6       www       869:       }
1.1       www       870:    }
                    871: 
1.6       www       872:    if (ptype=='string') {
1.42      albertel  873:         if ((pscat=='any') || (pscat=='') || (pscat=='default') ||  
                    874:             (typeof(pscat)=='undefined')) {
1.6       www       875:            tablestart('Text');
1.54      bisitz    876:            choicewrite('<tr><td>Value:</td><td colspan="2">');
1.46      albertel  877:            choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.53      bisitz    878:                     '" type="text" onchange="parent.stringeval()" />');
1.25      www       879:         }
                    880:         if (pscat=='yesno') {
                    881:            tablestart('Yes/No');
1.52      bisitz    882: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32      albertel  883:            choicewrite('<label><input name="stringval" value="yes"'+
1.29      www       884:                   ' type="radio" '+callradiostringeval('yes'));
1.53      bisitz    885:            if (svalue=='yes') { choicewrite(' checked="checked"'); }
                    886:            choicewrite(' /> Yes</label><br />');
1.32      albertel  887:            choicewrite('<label><input name="stringval" value="no"'+
1.29      www       888:                   ' type="radio" '+callradiostringeval('no'));
1.53      bisitz    889:            if (svalue=='no') { choicewrite(' checked="checked"'); }
                    890:            choicewrite(' /> No</label><br />');
1.25      www       891:         }
1.47      albertel  892:         if (pscat=='problemstatus') {
                    893:            tablestart('Problem Status');
1.52      bisitz    894: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
1.47      albertel  895:            choicewrite('<label><input name="stringval" value="yes"'+
                    896:                   ' type="radio" '+callradiostringeval('yes'));
1.53      bisitz    897:            if (svalue=='yes') { choicewrite(' checked="checked"'); }
                    898:            choicewrite(' /> Yes</label><br />');
1.49      albertel  899:            choicewrite('<label><input name="stringval" value="answer"'+
                    900:                   ' type="radio" '+callradiostringeval('answer'));
1.53      bisitz    901:            if (svalue=='answer') { choicewrite(' checked="checked"'); }
                    902:            choicewrite(' /> Yes, and show correct answer if they exceed the maximum number of tries.</label><br />');
1.47      albertel  903:            choicewrite('<label><input name="stringval" value="no"'+
                    904:                   ' type="radio" '+callradiostringeval('no'));
1.53      bisitz    905:            if (svalue=='no') { choicewrite(' checked="checked"'); }
                    906:            choicewrite(' /> No, don\'t show correct/incorrect feedback.</label><br />');
1.47      albertel  907:            choicewrite('<label><input name="stringval" value="no_feedback_ever"'+
                    908:                   ' type="radio" '+callradiostringeval('no_feedback_ever'));
1.53      bisitz    909:            if (svalue=='no_feedback_ever') { choicewrite(' checked="checked"'); }
                    910:            choicewrite(' /> No, show no feedback at all.</label><br />');
1.47      albertel  911:         }
1.25      www       912:         if (pscat=='examtype') {
                    913:            tablestart('Exam Type');
1.52      bisitz    914: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32      albertel  915:            choicewrite('<label><input name="stringval" value="online"'+
1.29      www       916:                 ' type="radio" '+callradiostringeval('online'));
1.53      bisitz    917:            if (svalue=='online') { choicewrite(' checked="checked"'); }
                    918:            choicewrite(' /> Online</label><br />');
1.32      albertel  919:            choicewrite('<label><input name="stringval" value="checkout"'+
1.29      www       920:               ' type="radio" '+callradiostringeval('checkout'));
1.53      bisitz    921:            if (svalue=='checkout') { choicewrite(' checked="checked"'); }
                    922:            choicewrite(' /> Check out</label><br />');
1.25      www       923:        }
                    924:         if (pscat=='questiontype') {
                    925:            tablestart('Question Type');
1.52      bisitz    926: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32      albertel  927:            choicewrite('<label><input name="stringval" value="problem"'+
1.29      www       928:                ' type="radio" '+callradiostringeval('problem'));
1.53      bisitz    929:            if (svalue=='problem') { choicewrite(' checked="checked"'); }
                    930:            choicewrite(' /> Standard Problem</label><br />');
1.36      albertel  931: //	   choicewrite('<label><input name="stringval" value="quiz"'+
                    932: //                ' type="radio" '+callradiostringeval('quiz'));
1.53      bisitz    933: //         if (svalue=='quiz') { choicewrite(' checked="checked"'); }
                    934: //         choicewrite(' /> Quiz</label><br />');
1.35      albertel  935:            choicewrite('<label><input name="stringval" value="practice"'+
                    936:                   ' type="radio" '+callradiostringeval('practice'));
1.53      bisitz    937:            if (svalue=='practice') { choicewrite(' checked="checked"'); }
                    938:            choicewrite(' /> Practice</label><br />');
1.32      albertel  939:            choicewrite('<label><input name="stringval" value="exam"'+
1.29      www       940:                   ' type="radio" '+callradiostringeval('exam'));
1.53      bisitz    941:            if (svalue=='exam') { choicewrite(' checked="checked"'); }
1.65      bisitz    942:            choicewrite(' /> Bubblesheet Exam</label><br />');
1.36      albertel  943: //         choicewrite('<label><input name="stringval" value="assess"'+
                    944: //              ' type="radio" '+callradiostringeval('assess'));
1.53      bisitz    945: //         if (svalue=='assess') { choicewrite(' checked="checked"'); }
                    946: //         choicewrite(' /> Assessment</label><br />');
1.32      albertel  947:            choicewrite('<label><input name="stringval" value="survey"'+
1.29      www       948:                 ' type="radio" '+callradiostringeval('survey'));
1.53      bisitz    949:            if (svalue=='survey') { choicewrite(' checked="checked"'); }
                    950:            choicewrite(' /> Survey</label><br />');
1.36      albertel  951: //         choicewrite('<label><input name="stringval" value="form"'+
                    952: //                ' type="radio" '+callradiostringeval('form'));
1.53      bisitz    953: //         if (svalue=='form') { choicewrite(' checked="checked"'); }
1.36      albertel  954: //         choicewrite('> Input Form</label><br />');
1.57      raeburn   955:            choicewrite('<label><input name="stringval" value="surveycred"'+
                    956:                 ' type="radio" '+callradiostringeval('surveycred'));
                    957:            if (svalue=='surveycred') { choicewrite(' checked="checked"'); }
                    958:            choicewrite('> Survey (credit for submission)</label><br />');
                    959:            choicewrite('<label><input name="stringval" value="anonsurvey"'+
                    960:                 ' type="radio" '+callradiostringeval('anonsurvey'));
                    961:            if (svalue=='anonsurvey') { choicewrite(' checked="checked"'); }
                    962:            choicewrite('> Anonymous Survey</label><br />');
                    963:            choicewrite('<label><input name="stringval" value="anonsurveycred"'+
                    964:                 ' type="radio" '+callradiostringeval('anonsurveycred'));
                    965:            if (svalue=='anonsurveycred') { choicewrite(' checked="checked"'); }
                    966:            choicewrite('> Anonymous Survey (credit for submission)</label><br />');
1.59      raeburn   967:            choicewrite('<label><input name="stringval" value="randomizetry"'+
                    968:                 ' type="radio" '+callradiostringeval('randomizetry'));
                    969:            if (svalue=='randomizetry') { choicewrite(' checked="checked"'); }
                    970:            choicewrite('> New Randomization Each N Tries (default N=1)</label><br />');
1.32      albertel  971:            choicewrite('<label><input name="stringval" value="library"'+
1.29      www       972:                ' type="radio" '+callradiostringeval('library'));
1.53      bisitz    973:            if (svalue=='library') { choicewrite(' checked="checked"'); }
                    974:            choicewrite(' /> Library</label><br />');
1.25      www       975:         }
1.60      raeburn   976:         if (pscat=='lenient') {
1.72      raeburn   977:            var patternLenientStd = /^(yes|no|default)$/;
                    978:            var patternLenientRel = /^([\-\d\.]+)\,([\-\d\.]+)\,([\-\d\.]+)\,([\-\d\.]+)$/;
                    979:            var lenientweighted = 'none';
                    980:            var relatives = new Array;
1.60      raeburn   981:            tablestart('Lenient Grading (Partial Credit)');
                    982:            choicewrite('<tr><td>Value:</td><td colspan="2">');
                    983:            choicewrite('<label><input name="stringval" value="yes"'+
1.72      raeburn   984:                   ' type="radio" '+calllenientradioeval('yes'));
1.60      raeburn   985:            if (svalue=='yes') { choicewrite(' checked="checked"'); }
                    986:            choicewrite(' /> Yes</label><br />');
                    987:            choicewrite('<label><input name="stringval" value="no"'+
1.72      raeburn   988:                   ' type="radio" '+calllenientradioeval('no'));
1.60      raeburn   989:            if (svalue=='no') { choicewrite(' checked="checked"'); }
                    990:            choicewrite(' /> No</label><br />');
                    991:            choicewrite('<label><input name="stringval" value="default"'+
1.72      raeburn   992:                ' type="radio" '+calllenientradioeval('default'));
1.60      raeburn   993:            if (svalue=='default') { choicewrite(' checked="checked"'); }
                    994:            choicewrite(' /> Default (only bubblesheet grading is lenient)</label><br />');
1.72      raeburn   995:            choicewrite('<label><input name="stringval" value="weighted"'+
                    996:                ' type="radio" '+calllenientradioeval('weighted'));
                    997:            if (!patternLenientStd.test(svalue) && svalue != '') {
                    998:               choicewrite(' checked="checked"');
                    999:               lenientweighted='block';
                   1000:               var relatives = svalue.match(patternLenientRel);
                   1001:            }
                   1002:            choicewrite(' />Yes, weighted (optionresponse in checkbox mode)</label><br /><br />'+
                   1003:                        '<div id="lenientweighteddiv" style="display:'+lenientweighted+'">'+
                   1004:                        '<table class="LC_parmsel_table"><tr bgcolor="#C5DB99">'+
                   1005:                        '<th colspan="2">Foil submission status</th><th>Points</th></tr>');
                   1006:            var lenienttypes = ['Correct (checked)','Correct (unchecked)','Incorrect (checked)','Incorrect (unchecked)'];
                   1007:            for (var i=0; i<lenienttypes.length; i++) {
                   1008:                var j = i+1;
                   1009:                if (relatives[j] == '') {
                   1010:                    if (i < 2) {
                   1011:                        relatives[j] = '1.0';
                   1012:                    } else {
                   1013:                        relatives[j] = '0.0';
                   1014:                    }
                   1015:                }
                   1016:                choicewrite('<tr><td colspan="2">'+lenienttypes[i]+'</td>'+
                   1017:                            '<td><input type="text" name="lenientrelwt" value="'+relatives[j]+'"'+
                   1018:                            ' size="3" onblur="parent.lenienteval(\'weighted\')" /></td></tr>');
                   1019:            }
                   1020:            choicewrite('</table></div>');
1.60      raeburn  1021:         }
1.64      raeburn  1022:         if (pscat=='discussvote') {
                   1023:            tablestart('Discussion Voting');
                   1024:            choicewrite('<tr><td>Value:</td><td colspan="2">');
                   1025:            choicewrite('<label><input name="stringval" value="yes"'+
                   1026:                   ' type="radio" '+callradiostringeval('yes'));
                   1027:            if (svalue=='yes') { choicewrite(' checked="checked"'); }
                   1028:            choicewrite(' /> Yes</label><br />');
                   1029:            choicewrite('<label><input name="stringval" value="notended"'+
                   1030:                   ' type="radio" '+callradiostringeval('notended'));
                   1031:            if (svalue=='notended') { choicewrite(' checked="checked"'); }
                   1032:            choicewrite(' /> Yes, unless discussion ended</label><br />');
                   1033:            choicewrite('<label><input name="stringval" value="no"'+
                   1034:                   ' type="radio" '+callradiostringeval('no'));
                   1035:            if (svalue=='no') { choicewrite(' checked="checked"'); }
                   1036:            choicewrite(' /> No</label><br />');
                   1037:         }
1.25      www      1038:         if (pscat=='ip') {
1.73      raeburn  1039:             var currallow = new Array; 
                   1040:             var currdeny = new Array;
                   1041:             if ((svalue != '') && (svalue != null)) {
                   1042:                 var patternComma = /,/;
                   1043:                 var patternAllow = /^([\[\]a-zA-Z\.\d\*\-]+)$/;
                   1044:                 var patternDeny = /^\!([\[\]a-zA-Z\.\d\*\-]+)$/;
                   1045:                 var current = new Array;
                   1046:                 if (patternComma.test(svalue)) {  
                   1047:                     current = svalue.split(',');
                   1048:                 } else {
1.81    ! raeburn  1049:                     current = [svalue];
1.73      raeburn  1050:                 }
                   1051:                 for (var i=0; i<current.length; i++) {
                   1052:                     if (patternDeny.test(current[i])) {
                   1053:                         var denied = current[i].replace(/^!/,'');
                   1054:                         currdeny.push(denied);
                   1055:                     } else {
                   1056:                         if (patternAllow.test(current[i])) {
                   1057:                             currallow.push(current[i]);
                   1058:                         } 
                   1059:                     }
                   1060:                 }
                   1061:             }
                   1062:             if (currdeny.length == 0) {
                   1063:                 currdeny = ('');
                   1064:             }
                   1065:             if (currallow.length == 0) {
                   1066:                 currallow = ('');
                   1067:             }
                   1068:             var curripaccess = [currallow,currdeny];
                   1069:             tablestart('IP Number/Name');
                   1070:             choicewrite('<tr><th>Allow from</th><th>Deny from</th></tr><tr>');
                   1071:             var acctypes = ['allow','deny'];
                   1072:             for (var i=0; i<acctypes.length; i++) {
                   1073:                 choicewrite('<td valign="top">'+
                   1074:                             '<div class="LC_string_ipacc_wrap" id="LC_string_ipacc_'+acctypes[i]+'">'+
                   1075:                             '<div class="LC_string_ipacc_inner" id="LC_string_ipacc_inner_'+acctypes[i]+'">');
                   1076:                 for (var j=0; j<curripaccess[i].length; j++) {
                   1077:                     choicewrite('<div><input type="text" size="10" name="setip'+acctypes[i]+'" value="'+curripaccess[i][j]+'" onblur="parent.ipstringeval();" />');
1.74      raeburn  1078:                     choicewrite('<a href="#" onclick="parent.removeIpRule(\''+acctypes[i]+'\',\''+j+'\')">Remove</a>');
1.73      raeburn  1079:                     choicewrite('</div>');
                   1080:                 }
1.74      raeburn  1081:                 choicewrite('</div><button onclick="parent.addIpRule(\''+acctypes[i]+'\');">Add item</button>');
1.73      raeburn  1082:             }
                   1083:             choicewrite('</div></td></tr></table>');
1.6       www      1084:         }
1.26      www      1085:         if (pscat=='fileext') {
                   1086:             tablestart('Allowed File Extensions');
1.52      bisitz   1087: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32      albertel 1088:            choicewrite('<label><input name="radstringval" value="txt"'+
1.29      www      1089:                ' type="radio" '+callradiostringeval('txt'));
1.53      bisitz   1090:            if (svalue=='txt') { choicewrite(' checked="checked"'); }
                   1091:            choicewrite(' /> Plain Text</label><br />');
1.32      albertel 1092:            choicewrite('<label><input name="radstringval" value="png,jpg,jpeg,gif"'+
1.29      www      1093:                ' type="radio" '+callradiostringeval('png,jpg,jpeg,gif'));
1.53      bisitz   1094:            if (svalue=='png,jpg,jpeg,gif') { choicewrite(' checked="checked"'); }
                   1095:            choicewrite(' /> Picture File</label><br />');
1.58      raeburn  1096:            choicewrite('<label><input name="radstringval" value="doc,docx,xls,xlsx,ppt,pptx"'+
                   1097:                ' type="radio" '+callradiostringeval('doc,docx,xls,xlsx,ppt,pptx'));
                   1098:            if (svalue=='doc,docx,xls,xlsx,ppt,pptx') { choicewrite(' checked="checked"'); }
1.53      bisitz   1099:            if (svalue=='doc,xls,ppt') { choicewrite(' checked="checked"'); }
                   1100:            choicewrite(' /> Office Document</label><br />');
1.46      albertel 1101:            choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.53      bisitz   1102:                     '" onchange="parent.stringeval()" />');
1.26      www      1103:        }
1.37      albertel 1104:        if (pscat=='useslots') {
                   1105:            tablestart('Slots control access');
1.52      bisitz   1106: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
1.37      albertel 1107:            choicewrite('<label><input name="stringval" value="no"'+
                   1108:                   ' type="radio" '+callradiostringeval('no'));
1.53      bisitz   1109:            if (svalue=='no') { choicewrite(' checked="checked"'); }
                   1110:            choicewrite(' /> No</label><br />');
1.37      albertel 1111:            choicewrite('<label><input name="stringval" value="resource"'+
                   1112:                   ' type="radio" '+callradiostringeval('resource'));
1.53      bisitz   1113:            if (svalue=='resource') { choicewrite(' checked="checked"'); }
                   1114:            choicewrite(' /> Yes, and the scope of student selected slot is a single resource.</label><br />');
1.38      albertel 1115:            choicewrite('<label><input name="stringval" value="map"'+
                   1116:                   ' type="radio" '+callradiostringeval('map'));
1.53      bisitz   1117:            if (svalue=='map') { choicewrite(' checked="checked"'); }
                   1118:            choicewrite(' /> Yes, and the scope of student selected slot is the enclosing map/folder. When checking in, it applies to only one resource.</label><br />');
1.39      albertel 1119:            choicewrite('<label><input name="stringval" value="map_map"'+
1.40      albertel 1120:                   ' type="radio" '+callradiostringeval('map_map'));
1.53      bisitz   1121:            if (svalue=='map_map') { choicewrite(' checked="checked"'); }
1.55      bisitz   1122:            choicewrite(' /> Yes, and the scope of student selected slot is the enclosing map/folder. When checking in, all resources in the map/folder are checked in.</label><br />');
1.79      raeburn  1123:            choicewrite('</td></tr></table>');
1.80      raeburn  1124:        }
                   1125:        if (pscat=='deeplink') {
                   1126:            var deeplinkvals = new Array();
                   1127:            var linktypeparts = new Array();
                   1128:            var ltikeyRegExp = /^(lti|key):(\w+)$/;
                   1129:            var dlinkkeysty = 'hidden';
                   1130:            var dlinkltidivsty = 'none';
                   1131:            var dlinkkeyval = '';
                   1132:            if ((svalue != '') && (svalue != null)) {
                   1133:                deeplinkvals = svalue.split(',');
                   1134:                if (ltikeyRegExp.test(deeplinkvals[2])) {
                   1135:                    linktypeparts = deeplinkvals[2].split(':');
                   1136:                    deeplinkvals[2] = linktypeparts[0];
                   1137:                    if (linktypeparts[0] == 'key') {
                   1138:                        dlinkkeysty = 'text';
                   1139:                        dlinkkeyval = linktypeparts[1];
                   1140:                    } else if (linktypeparts[0] == 'lti') {
                   1141:                        dlinkltidivsty = 'inline-block';
                   1142:                    }
                   1143:                }
                   1144:            } else {
                   1145:                deeplinkvals = ['full','res','any'];
                   1146:            }
                   1147:            var deeplinklisting = new Array();
                   1148:            deeplinklisting = ['full','absent','grades','details','datestatus'];
                   1149:            var deeplinklisttxt = new Array();
                   1150:            deeplinklisttxt = ['Listed (linked) in both','Not listed','Listed in grades only','Listed (unlinked) in both','Listed (unlinked) inc. status in both'];
                   1151:            var deeplinkscopes = new Array();
                   1152:            deeplinkscopes = ['res','map','rec'];
                   1153:            var deeplinkscopetxt = new Array();
                   1154:            deeplinkscopetxt = ['resource only','enclosing map/folder','recursive map/folder'];
                   1155:            var deeplinkurls = new Array();
                   1156:            deeplinkurls = ['any','only','key','lti'];
1.78      raeburn  1157:            tablestart('Deep-linked items');
1.80      raeburn  1158:            choicewrite('<tr><td>In Contents or Gradebook?</td><td>');
                   1159:            choicewrite('<select name="deeplinklisted">');
                   1160:            for (var i=0; i<deeplinklisting.length; i++) {
                   1161:                choicewrite('<option value="'+deeplinklisting[i]+'"');
                   1162:                if (deeplinkvals[0] == deeplinklisting[i]) {
                   1163:                    choicewrite(' selected="selected"');
                   1164:                }
                   1165:                choicewrite('>'+deeplinklisttxt[i]+'</option>');
                   1166:            }
                   1167:            choicewrite('</select></td></tr>');
                   1168:            choicewrite('<tr><td>Access scope via deep-link</td><td>');
                   1169:            choicewrite('<select name="deeplinkacc">');
                   1170:            for (var i=0; i<deeplinkscopes.length; i++) {
                   1171:                choicewrite('<option value="'+deeplinkscopes[i]+'"');
                   1172:                if (deeplinkvals[1] == deeplinkscopes[i]) {
                   1173:                    choicewrite(' selected="selected"');
                   1174:                }
                   1175:                choicewrite('>'+deeplinkscopetxt[i]+'</option>');
                   1176:            }
                   1177:            choicewrite('</select></td></tr>');
                   1178:            choicewrite('<tr><td>Supported Link Types</td><td>');
                   1179:            choicewrite('<span style="white-space: nowrap;"><label>');
                   1180:            choicewrite('<input name="deeplinktypes" value="any"'+
                   1181:                   ' type="radio" '+calldeeplink());
                   1182:            if (deeplinkvals[2]=='any') { choicewrite(' checked="checked"'); }
                   1183:            choicewrite(' /> regular + deep</label></span><br />');
                   1184:            choicewrite('<span style="white-space: nowrap;"><label>');
                   1185:            choicewrite('<input name="deeplinktypes" value="only"'+
                   1186:                   ' type="radio" '+calldeeplink());
                   1187:            if (deeplinkvals[2]=='only') { choicewrite(' checked="checked"'); }
                   1188:            choicewrite(' /> deep only</label></span><br />');
                   1189:            choicewrite('<span style="white-space: nowrap;"><label>');
                   1190:            choicewrite('<input name="deeplinktypes" value="key"'+
                   1191:                   ' type="radio" '+calldeeplink());
                   1192:            if (deeplinkvals[2]=='key') { choicewrite(' checked="checked"'); }
                   1193:            choicewrite(' /> deep with key</label>');
                   1194:            choicewrite('<input type="'+dlinkkeysty+'" name="deeplinkkey" id="deeplinkkey" value="'+dlinkkeyval+'" size="6" />');
                   1195:            choicewrite('</span><br />');
                   1196:            if ((pextra != '') && (pextra != null)) {
                   1197:                var ltiRegExp = /^lti_/;
                   1198:                if (ltiRegExp.test(pextra)) {
                   1199:                    pextra = pextra.replace(ltiRegExp,'');
                   1200:                    var posslti = pextra.split(',');
                   1201:                    if (posslti.length >= 1) {
                   1202:                        var ltinums = new Array();
                   1203:                        var ltititles = new Array();
                   1204:                        for (var i=0; i<posslti.length; i++) {
                   1205:                            var entries = posslti[i].split(':');
                   1206:                            ltinums[i] = entries[0];
                   1207:                            ltititles[i] = decodeURI(entries[1]);
                   1208:                        }
                   1209:                        if (ltinums.length) {
                   1210:                            choicewrite('<span style="white-space: nowrap;"><label>');
                   1211:                            choicewrite('<input name="deeplinktypes" value="lti"'+
                   1212:                                        ' type="radio" '+calldeeplink());
                   1213:                            if (deeplinkvals[2]=='lti') { choicewrite(' checked="checked"'); }
                   1214:                            choicewrite(' /> deep with LTI launch</label>');
                   1215:                            choicewrite('<div id="deeplinkltidiv" style="display:'+dlinkltidivsty+'">');
                   1216:                            choicewrite('<select name="linkposslti">');
                   1217:                            var sel='';
                   1218:                            if (deeplinkvals[2]!='lti') {
                   1219:                                sel = ' selected="selected"';
                   1220:                            }
                   1221:                            if (ltinums.length > 1) {
                   1222:                                choicewrite('<option value=""'+sel+'>Please select</option>');
                   1223:                            }
                   1224:                            for (var i=0; i<ltinums.length; i++) {
                   1225:                                sel = '';
                   1226:                                if (deeplinkvals[2]=='lti') {
                   1227:                                    if (linktypeparts.length) {
                   1228:                                        if (ltinums[i] == linktypeparts[1]) {
                   1229:                                            sel = ' selected="selected"';
                   1230:                                        }
                   1231:                                    }
                   1232:                                }
                   1233:                                choicewrite('<option value="'+ltinums[i]+'"'+sel+'>'+ltititles[i]+'</option>');
                   1234:                            }
                   1235:                            choicewrite('</select></div></span><br />');
                   1236:                        }
                   1237:                    }
                   1238:                }
                   1239:            }
1.78      raeburn  1240:            choicewrite('</td></tr></table>');
1.80      raeburn  1241:        }
1.21      www      1242:    }
1.79      raeburn  1243: 
1.21      www      1244:    if (ptype=='color') {
                   1245:       tablestart('Choose a Color');
                   1246:       choicewrite('<table>');
                   1247:       if (svalue) {
1.23      www      1248:          choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
1.46      albertel 1249:                      escapeHTML(svalue)+'" colspan="2">&nbsp;</td></tr>');
1.21      www      1250:       }
1.23      www      1251:       for (var ir=0; ir<=10; ir++) {
                   1252:           for (var ig=0; ig<=10; ig++) {
1.21      www      1253:               choicewrite('<tr>');
1.23      www      1254:               for (var ib=0; ib<=10; ib++) {
1.21      www      1255:                   colorfield(ir,ig,ib);
                   1256: 	      }
                   1257:               choicewrite('</tr>');
1.79      raeburn  1258: 	  }
1.21      www      1259:       }
                   1260:       choicewrite('</table></td></table>');
1.1       www      1261:    }
                   1262: 
1.40      albertel 1263:    choicewrite('</form>');
1.1       www      1264:    choiceend();
                   1265: }
                   1266: 
                   1267: function sopt(va,text) {
                   1268:    selwrite('<option value="'+va+'"');
1.2       www      1269:    if (va==pscat) {
1.54      bisitz   1270:      selwrite(' selected="selected"');
1.1       www      1271:    }
                   1272:    selwrite('>'+text+'</option>');
                   1273: }
                   1274: 
                   1275: function catchange() {
                   1276:    var sform=selector.document.forms.fsel.fcat;
1.2       www      1277:    pscat=sform.options[sform.selectedIndex].value;
1.1       www      1278:    draw();
                   1279: }
                   1280: 
1.76      raeburn  1281: function recursechange() {
                   1282:    var rform=selector.document.forms.frec;
                   1283:    var count = rform.recurse.length;
                   1284:    if (count > 0) {
                   1285:        for (var i=0; i<count; i++) {
                   1286:            if (rform.recurse[i].checked) {
                   1287:                var colnum = pnonreccol;
                   1288:                if (rform.recurse[i].value == 1) {
                   1289:                    colnum++;
                   1290:                }
1.79      raeburn  1291:                pmarker = pmarkerst+'_'+pparm+'&'+colnum;
1.76      raeburn  1292:            }
                   1293:        }
                   1294:    }
                   1295: }
                   1296: 
1.1       www      1297: function assemble() {
1.2       www      1298:     if ((ptype=='date') && (pscat!='interval')) {
1.41      www      1299:         svalue=Math.floor(cdate.getTime()/1000);
1.2       www      1300:     }
1.12      www      1301:     if (ptype=='tolerance') {
                   1302:        if (pscat=='relative_sym') {
                   1303:           svalue=choices.document.forms.sch.val2.value+'%';
                   1304:           if (choices.document.forms.sch.val3.checked) {
                   1305:              svalue+='+';
                   1306:           }
                   1307:        }
                   1308:        if (pscat=='absolute_sym') {
                   1309:           svalue=choices.document.forms.sch.val2.value;
                   1310:           if (choices.document.forms.sch.val3.checked) {
                   1311:              svalue+='+';
                   1312:           }
                   1313:        }
                   1314:        if (pscat=='absolute') {
                   1315:           svalue=choices.document.forms.sch.val2.value;
                   1316:           if (choices.document.forms.sch.val3.checked) {
                   1317:              svalue+='+';
                   1318:           }
                   1319:           svalue+=','+choices.document.forms.sch.val4.value;
                   1320:           if (choices.document.forms.sch.val5.checked) {
                   1321:              svalue+='+';
                   1322:           }
                   1323:        }
                   1324:        if (pscat=='relative') {
                   1325:           svalue=choices.document.forms.sch.val2.value+'%';
                   1326:           if (choices.document.forms.sch.val3.checked) {
                   1327:              svalue+='+';
                   1328:           }
                   1329:           svalue+=','+choices.document.forms.sch.val4.value+'%';
                   1330:           if (choices.document.forms.sch.val5.checked) {
                   1331:              svalue+='+';
                   1332:           }
                   1333:        }
1.14      www      1334:     }
                   1335:     if ((ptype=='int') && (pscat=='range')) {
                   1336:           svalue=choices.document.forms.sch.val2.value+','+
                   1337:                  choices.document.forms.sch.val4.value;
1.12      www      1338:     }
1.6       www      1339:     if (pscat=='default') { svalue=''; }
1.2       www      1340:     stype=ptype+'_'+pscat;
1.1       www      1341: }
                   1342: 
                   1343: 
                   1344: function init() {
                   1345:   var i;
1.2       www      1346:   var subs=new Array();
1.71      raeburn  1347:   var doneRegExp = /_done(|\:[^\:]+\:)/;
                   1348:   var doneproctorRegExp = /_done(|\:[^\:]+\:)_proctor/;
1.70      raeburn  1349:   var proctorkeyRegExp = /^(\d+)_(.+)$/;
1.71      raeburn  1350:   var donetextRegExp = /\:([^\:]+)\:/;
1.79      raeburn  1351:   var markerRegExp = /^(.+)_([A-Za-z0-9]+)\&(\d+)$/;
1.1       www      1352:   var namevalue=this.window.location.search.split('&');
                   1353:   namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
                   1354: 
                   1355:   for (i=0;i<namevalue.length;i++) {
                   1356:      var pair=namevalue[i].split('=');
1.3       www      1357:      pair[1]=unescape(pair[1]);
1.1       www      1358:      if (pair[0]=='value') { pvalue=pair[1]; }
1.2       www      1359:      if (pair[0]=='type') { subs=pair[1].split('_');
                   1360:                             ptype=subs[0];
                   1361:                             pscat=subs[1];
1.79      raeburn  1362:                             if (typeof(subs[2])!="undefined") {
                   1363:                                pscat+='_'+subs[2];
1.11      www      1364:                             }
1.79      raeburn  1365:                             if ((pscat=='') || (typeof(pscat)=="undefined")) {
1.6       www      1366:                                pscat='default';
                   1367:                             }
1.2       www      1368:                            }
1.1       www      1369:      if (pair[0]=='return') { preturn=pair[1]; }
                   1370:      if (pair[0]=='call') { pcode=pair[1]; }
1.2       www      1371:      if (pair[0]=='marker') { pmarker=pair[1]; }
1.1       www      1372:      if (pair[0]=='name') { pname=pair[1]; }
1.63      www      1373:      if (pair[0]=='modal') { pmodal=pair[1]; }
1.34      albertel 1374:      if (pair[0]=='defhour' && pair[1] >= 0 && pair[1] < 24 ) {
                   1375:          defhour=pair[1];
                   1376:      }
                   1377:      if (pair[0]=='defmin' && pair[1] >= 0 && pair[1] < 60) { defmin=pair[1]; }
                   1378:      if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; }
1.80      raeburn  1379:      if (pair[0]=='extra') { pextra=pair[1]; }
1.1       www      1380:   }
                   1381: 
1.79      raeburn  1382:   var tablecol = '';
1.76      raeburn  1383:   var ismap = '';
                   1384:   if (markerRegExp.test(pmarker)) {
                   1385:       var markerinfo = pmarker.match(markerRegExp);
                   1386:       if (markerinfo.length == 4) {
                   1387:           pmarkerst = markerinfo[1];
                   1388:           pparm = markerinfo[2];
1.79      raeburn  1389:           tablecol = markerinfo[3];
1.76      raeburn  1390:           if (tablecol == 17 || tablecol == 16) {
                   1391:               ismap = 1;
                   1392:               if (tablecol == 17) {
                   1393:                   precursive = 1;
                   1394:               }
                   1395:               pnonreccol = 16;
1.79      raeburn  1396:           } else if (tablecol == 11 || tablecol == 10) {
1.76      raeburn  1397:               ismap = 1;
                   1398:               if (tablecol == 11) {
                   1399:                   precursive = 1;
                   1400:               }
                   1401:               pnonreccol = 10;
                   1402:           } else if (tablecol == 7 || tablecol == 6) {
                   1403:               ismap = 1;
                   1404:               if (tablecol == 7) {
                   1405:                   precursive = 1;
                   1406:               }
                   1407:               pnonreccol = 6;
                   1408:           } else if (tablecol == 3 || tablecol == 2) {
                   1409:               ismap = 1;
                   1410:               if (tablecol == 3) {
                   1411:                   precursive = 1;
                   1412:               }
                   1413:               pnonreccol = 2;
                   1414:           }
                   1415:       }
                   1416:   }
                   1417: 
                   1418: 
1.68      raeburn  1419:   if (ptype=='date' && pscat == 'interval') {
1.70      raeburn  1420:       if (doneproctorRegExp.test(pvalue)) {
1.71      raeburn  1421:           var current = pvalue.match(doneproctorRegExp);
                   1422:           if (current.length == 2) {
                   1423:               var textstr = current[1];
                   1424:               if (textstr != '') {
                   1425:                   var textvals = textstr.match(donetextRegExp);
                   1426:                   if (textvals.length == 2) {
                   1427:                       pextravaltwo = textvals[1];
                   1428:                   }
                   1429:               }
                   1430:           }
1.70      raeburn  1431:           var intervalwithkey = pvalue.replace(doneproctorRegExp,'');
                   1432:           if (proctorkeyRegExp.test(intervalwithkey)) {
                   1433:               var currvals = intervalwithkey.match(proctorkeyRegExp);
                   1434:               if (currvals.length == 3) {
                   1435:                   pvalue = currvals[1];
                   1436:                   pextraval = currvals[2];
1.71      raeburn  1437:                   pmodval = '_done_proctor';
1.70      raeburn  1438:               } else {
                   1439:                   pmodval = '';
                   1440:               }
                   1441:           }
                   1442:       } else {
                   1443:           if (doneRegExp.test(pvalue)) {
1.79      raeburn  1444:               var current = pvalue.match(doneRegExp);
1.71      raeburn  1445:               if (current.length == 2) {
                   1446:                   var textstr = current[1];
                   1447:                   if (textstr != '') {
                   1448:                       var textvals = textstr.match(donetextRegExp);
                   1449:                       if (textvals.length == 2) {
                   1450:                           pextravaltwo = textvals[1];
                   1451:                       }
                   1452:                   }
                   1453:               }
1.70      raeburn  1454:               var pnumval = pvalue.replace(doneRegExp,'');
1.71      raeburn  1455:               pmodval = '_done';
1.70      raeburn  1456:               pvalue = pnumval;
                   1457:           }
1.68      raeburn  1458:       }
                   1459:   }
1.1       www      1460:   svalue=pvalue;
1.6       www      1461:   if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
1.79      raeburn  1462:       (pscat=='default') &&
                   1463:       (typeof(svalue)!="undefined") &&
1.11      www      1464:       (svalue!=0) && (svalue!='')) { pscat='any'; }
1.1       www      1465: 
1.13      www      1466:   if (ptype=='tolerance') {
                   1467:      var tperc=0;
                   1468:      var trange=0;
                   1469:      if (typeof(svalue)!='undefined') {
                   1470:         if (svalue.indexOf('%')!=-1) { tperc=1;  }
                   1471:         if (svalue.indexOf(',')!=-1) { trange=1; }
                   1472:         if (trange) {
                   1473:            if (tperc) { pscat='relative'; } else { pscat='absolute'; }
                   1474:         } else {
                   1475:            if (tperc) { pscat='relative_sym'; } else { pscat='absolute_sym'; }
                   1476:         }
                   1477:      }
                   1478:   }
                   1479: 
1.61      raeburn  1480:   this.window.selector.document.open();
1.62      raeburn  1481:   selwrite('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
                   1482:   selwrite('<html xmlns="http://www.w3.org/1999/xhtml">');
1.55      bisitz   1483:   selwrite('<head>');
1.62      raeburn  1484:   selwrite('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
                   1485:   selwrite('<title>LON-CAPA</title>');
1.55      bisitz   1486:   selwrite('<style type="text/css">');
                   1487:   selwrite('<!--');
                   1488:   selwrite('body {');
                   1489:   selwrite('font-family: Verdana,Arial,Helvetica,sans-serif;');
                   1490:   selwrite('line-height:130%;');
                   1491:   selwrite('font-size:0.83em;');
                   1492:   selwrite('background: #FFFFFF;');
                   1493:   selwrite('}');
                   1494:   selwrite('-->');
                   1495:   selwrite('</style>');
                   1496:   selwrite('</head>');
1.62      raeburn  1497:   selwrite('<body>');
                   1498:   selwrite('<form name="fsel" action=""><b>'+pname+'</b><br />');
1.66      bisitz   1499:   selwrite('Format of Value(s): <select name="fcat" onchange="parent.catchange();">');
1.12      www      1500: 
1.1       www      1501:   if (ptype=='tolerance') {
                   1502:      sopt('default','Default');
                   1503:      sopt('relative_sym','Relative Tolerance, Symmetric (percent)');
                   1504:      sopt('relative','Relative Tolerance (percentages)');
                   1505:      sopt('absolute_sym','Absolute Tolerance, Symmetric (value)');
                   1506:      sopt('absolute','Absolute Tolerance (values)');
                   1507:   }
                   1508: 
                   1509:   if (ptype=='date') {
1.48      albertel 1510:      if (pscat != 'interval') {
                   1511:          sopt('default','Default');
                   1512: 	 sopt('start','Starting Date');
                   1513: 	 sopt('end','Ending Date');
                   1514:      } else {
                   1515:          sopt('interval','Time Interval');
                   1516:      }
                   1517: 
1.11      www      1518:      if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
1.2       www      1519:         cdate.setTime(pvalue*1000);
1.30      www      1520:      } else {        
1.31      www      1521:         cdate.setSeconds(defsec);
                   1522:         cdate.setMinutes(defmin);
                   1523:         cdate.setHours(defhour);
1.2       www      1524:      }
                   1525:  
                   1526:      months[0]='January';
                   1527:      months[1]='February';
                   1528:      months[2]='March';
                   1529:      months[3]='April';
                   1530:      months[4]='May';
                   1531:      months[5]='June';
                   1532:      months[6]='July';
                   1533:      months[7]='August';
                   1534:      months[8]='September';
                   1535:      months[9]='October';
                   1536:      months[10]='November';
                   1537:      months[11]='December';
1.1       www      1538:   }
1.79      raeburn  1539: 
1.6       www      1540:   if (ptype=='int') {
                   1541:      sopt('default','Default');
                   1542:      sopt('pos','Positive Integer, Not Zero');
                   1543:      sopt('zeropos','Positive Integer or Zero');
1.13      www      1544:      sopt('inrange','Integer in Range');
                   1545:      sopt('range','Range of Integers');
1.6       www      1546:      sopt('any','Integer');
1.1       www      1547:   }
                   1548: 
1.6       www      1549:   if (ptype=='float') {
                   1550:      sopt('default','Default');
                   1551:      sopt('zeroone','Floating Point between 0 and 1');
                   1552:      sopt('pos','Positive Floating Point');
                   1553:      sopt('any','Floating Point');
1.1       www      1554: 
                   1555:   }
                   1556: 
1.6       www      1557:   if (ptype=='string') {
1.44      albertel 1558:      //sopt('default','Default');
                   1559:      if (pscat == 'yesno')        { sopt('yesno','Yes/No'); }
1.47      albertel 1560:      else if (pscat == 'problemstatus'){ sopt('problemstatus','Problem Status'); }
1.45      albertel 1561:      else if (pscat == 'examtype')     { sopt('examtype','Exam Type'); }
                   1562:      else if (pscat == 'questiontype') { sopt('questiontype','Question Type'); }
1.60      raeburn  1563:      else if (pscat == 'lenient')      { sopt('lenient','Lenient Grading (Partial Credit)'); }
1.64      raeburn  1564:      else if (pscat == 'discussvote')  { sopt('discussvote','Discussion Voting'); }
1.45      albertel 1565:      else if (pscat == 'ip')           { sopt('ip','IP Number/Name'); }
                   1566:      else if (pscat == 'fileext')      { sopt('fileext','File Extension'); }
                   1567:      else if (pscat == 'useslots')     { sopt('useslots','Slots control access'); }
1.78      raeburn  1568:      else if (pscat == 'deeplink')     { sopt('deeplink','Deep-linked items'); }
1.45      albertel 1569:      else { pscat = 'any'; }
1.80      raeburn  1570:      if (pscat != 'deeplink') { sopt('any','String Value'); }
1.22      www      1571:   }
                   1572: 
                   1573:   if (ptype=='color') {
                   1574:      sopt('default','Use Default Color');
                   1575:      sopt('custom','Use Custom Color');
1.1       www      1576:   }
                   1577: 
                   1578:   selwrite('</select></form>');
1.77      raeburn  1579:   if (ismap == 1) {
1.76      raeburn  1580:       if ((pparm != 'hiddenresource') && (pparm != 'encrypturl')) {
                   1581:           selwrite('<form name="frec" action="">');
                   1582:           selwrite('Recursive: <label><input type="radio" name="recurse" value="1" ');
                   1583:           if (precursive == 1) {
                   1584:               selwrite('checked="checked" ');
                   1585:           }
                   1586:           selwrite('onclick="parent.recursechange();" />Yes</label>&nbsp;&nbsp;');
                   1587:           selwrite('<label><input type="radio" name="recurse" value="0" ');
                   1588:           if (precursive != 1) {
                   1589:               selwrite('checked="checked" ');
                   1590:           }
                   1591:           selwrite('onclick="parent.recursechange();" />No</label>'); 
                   1592:           selwrite('</form><br />');
                   1593:       }
                   1594:   }
1.63      www      1595:   var targ='parent.opener';
                   1596:   if (pmodal==1) {
                   1597:      targ='parent.parent';
1.70      raeburn  1598:   }
                   1599:   if ((ptype=='date') && (pscat=='interval')) {
                   1600:       selwrite('<a href="javascript:parent.validateInterval();');
1.80      raeburn  1601:   } else if ((ptype=='string') && (pscat=='deeplink')) {
                   1602:       selwrite('<a href="javascript:parent.validateDeepLink();');
1.70      raeburn  1603:   } else {
                   1604:       selwrite('<a href="javascript:parent.assemble();');
                   1605:   }
1.1       www      1606:   if (preturn!='') {
1.63      www      1607:      selwrite(targ+'.document.'+preturn+'_value.value=parent.window.svalue;');
                   1608:      selwrite(targ+'.document.'+preturn+'_type.value=parent.window.stype;');
1.2       www      1609:   }
                   1610:   if (pmarker!='') {
1.63      www      1611:      selwrite(targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.1       www      1612:   }
                   1613:   if (pcode!='') {
1.63      www      1614:      selwrite(targ+'.'+pcode+'();');
1.1       www      1615:   }
1.43      albertel 1616:   selwrite('">Save</a>&nbsp;&nbsp;');
1.5       www      1617: 
                   1618:   selwrite('<a href="javascript:');
1.63      www      1619:   selwrite(targ+'.document.'+preturn+'_value.value='+"'';");
1.5       www      1620:   if (pmarker!='') {
                   1621:      selwrite(
1.63      www      1622:      targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.5       www      1623:   }
                   1624:   if (pcode!='') {
1.63      www      1625:      selwrite(targ+'.'+pcode+'();');
1.5       www      1626:   }
                   1627:   selwrite('">Delete</a>&nbsp;&nbsp;');
1.4       www      1628:  
1.1       www      1629:   selwrite('</body></html>');
                   1630:   this.window.selector.document.close();
1.2       www      1631:   draw();
1.1       www      1632:   
                   1633: }
                   1634: 
1.56      raeburn  1635: // ]]>
1.1       www      1636: </script>
1.56      raeburn  1637: </head>
1.1       www      1638: 
1.76      raeburn  1639: <frameset rows="125,*" onload="init();">
1.56      raeburn  1640: <frame name="selector" src="empty.html" />
                   1641: <frame name="choices" src="empty.html" />
1.1       www      1642: </frameset>
                   1643: 
                   1644: 
                   1645: 
1.16      albertel 1646: </html>

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