File:  [LON-CAPA] / rat / client / parameter.html
Revision 1.64.2.2: download - view: text, annotated - select for diffs
Fri Jan 23 19:41:19 2015 UTC (9 years, 4 months ago) by raeburn
Branches: version_2_11_X
CVS tags: version_2_11_1
Diff to branchpoint 1.64: preferred, unified
- For 2.11
  - Backport 1.67

    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">
    4: <!--
    5: The LearningOnline Network with CAPA
    6: Parameter Input Window
    7: //
    8: // $Id: parameter.html,v 1.64.2.2 2015/01/23 19:41:19 raeburn Exp $
    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: //
   32: -->
   33: <head>
   34: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   35: <title>LON-CAPA</title>
   36: 
   37: <script type="text/javascript">
   38: // <![CDATA[
   39: 
   40: var ptype='';
   41: var pvalue='';
   42: var preturn='';
   43: var pcode='';
   44: var pscat='';
   45: var pmarker='';
   46: var pmodal='';
   47: var pname='';
   48: 
   49: var defhour=0;
   50: var defmin=0;
   51: var defsec=0;
   52: 
   53: var svalue;
   54: var stype;
   55: var smarker;
   56: 
   57: var vars=new Array();
   58: 
   59: var cdate=new Date();
   60: 
   61: var csec;
   62: var cmin;
   63: var chour;
   64: var cday;
   65: 
   66: var months=new Array();
   67: 
   68: 
   69: function selwrite(text) {
   70:   this.window.selector.document.write(text);
   71: }
   72: 
   73: function choicestart() {
   74:   this.window.choices.document.open();
   75:   choicewrite('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
   76:   choicewrite('<html xmlns="http://www.w3.org/1999/xhtml">');
   77:   choicewrite('<head>');
   78:   choicewrite('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
   79:   choicewrite('<title>LON-CAPA</title>');
   80:   choicewrite('<style type="text/css">');
   81:   choicewrite('<!--');
   82:   choicewrite('body {');
   83:   choicewrite('font-family: Verdana,Arial,Helvetica,sans-serif;');
   84:   choicewrite('line-height:130%;');
   85:   choicewrite('font-size:0.83em;');
   86:   choicewrite('background: #FFFFFF;');
   87:   choicewrite('}');
   88:   choicewrite('table.LC_parmsel_table {font-size: 90%;}');
   89:   choicewrite('table.LC_parmsel_table tr td { padding: 5px; border: 1px solid #C8C8C8;}');
   90:   choicewrite('-->');
   91:   choicewrite('</style>');
   92:   choicewrite('</head>');
   93:   choicewrite('<body>');
   94: }
   95: 
   96: function choiceend() {
   97:   choicewrite('</body></html>');
   98:   this.window.choices.document.close();
   99: }
  100: 
  101: function choicewrite(text) {
  102:   this.window.choices.document.write(text);
  103: }
  104: 
  105: function tablestart(headtext) {
  106:   choicewrite('<table class="LC_parmsel_table"><tr bgcolor="#C5DB99"><th colspan="3">'+
  107:               headtext+'</th></tr>');
  108: }
  109: 
  110: function valline(text,id1,id2) {
  111:   choicewrite('<tr><td>'+text+
  112:               '</td><td><input type="text" size="4" name="val'+
  113:               id1+'" /></td><td>incl:<input type="checkbox" name="val'+
  114:               id2+'" /></td></tr>');
  115: }
  116: 
  117: function escapeHTML(text) {
  118:   text = text.replace(/&/g, '&amp;');
  119:   text = text.replace(/"/g, '&quot;');
  120:   text = text.replace(/</g, '&lt;');
  121:   text = text.replace(/>/g, '&gt;');
  122:   return text;
  123: }
  124: 
  125: function datecalc() {
  126:     var sform=choices.document.forms.sch;
  127: 
  128:     cdate.setHours(sform.hours.options[sform.hours.selectedIndex].value);
  129:     cdate.setMinutes(sform.minutes.options[sform.minutes.selectedIndex].value);
  130:     cdate.setSeconds(sform.minutes.options[sform.seconds.selectedIndex].value);
  131:     cdate.setDate(sform.date.options[sform.date.selectedIndex].value);
  132:     cdate.setMonth(sform.month.options[sform.month.selectedIndex].value);
  133:     cdate.setFullYear(sform.year.options[sform.year.selectedIndex].value);
  134: 
  135:     draw();
  136: }
  137: 
  138: function hour() {
  139:    var thishour=cdate.getHours();
  140:     var i; var j;
  141:     choicewrite('<select name="hours" onchange="parent.datecalc();">');
  142:     for (i=0;i<=23;i++) {
  143:         choicewrite('<option value="'+i+'"');
  144:         if (i==thishour) {
  145:             choicewrite(' selected="selected"');
  146:         }
  147:         choicewrite('>');
  148:         if (i==12) { choicewrite('noon'); } else {
  149:            if (i==0) { choicewrite('midnight') } else {
  150:               
  151:                  if (i<12) { choicewrite(i+' am'); } else {
  152:                     j=i-12; choicewrite(j+' pm');
  153:                  }
  154:               
  155:            }
  156:         }
  157:         choicewrite('</option>');
  158:     }
  159:     choicewrite('</select>');
  160: }
  161: 
  162: function minute() {
  163:    var thisminutes=cdate.getMinutes();
  164:     var i;
  165:     choicewrite('<select name="minutes" onchange="parent.datecalc();">');
  166:     for (i=0;i<=59;i++) {
  167:         choicewrite('<option value="'+i+'"');
  168:         if (i==thisminutes) {
  169:             choicewrite(' selected="selected"');
  170:         }
  171:         choicewrite('>'+i+'</option>');
  172:     }
  173:     choicewrite('</select>');
  174: } 
  175: 
  176: function second() {
  177:    var thisseconds=cdate.getSeconds();
  178:     var i;
  179:     choicewrite('<select name="seconds" onchange="parent.datecalc();">');
  180:     for (i=0;i<=59;i++) {
  181:         choicewrite('<option value="'+i+'"');
  182:         if (i==thisseconds) {
  183:             choicewrite(' selected="selected"');
  184:         }
  185:         choicewrite('>'+i+'</option>');
  186:     }
  187:     choicewrite('</select>');
  188: } 
  189: 
  190: 
  191: function date() {
  192:    var thisdate=cdate.getDate();
  193:     var i;
  194:     choicewrite('<select name="date" onchange="parent.datecalc();">');
  195:     for (i=1;i<=31;i++) {
  196:         choicewrite('<option value="'+i+'"');
  197:         if (i==thisdate) {
  198:             choicewrite(' selected="selected"');
  199:         }
  200:         choicewrite('>'+i+'</option>');
  201:     }
  202:     choicewrite('</select>');
  203: }
  204: 
  205: function year() {
  206:    var thisyear=cdate.getFullYear();
  207:    var nowdate=new Date();
  208:    var nowyear=nowdate.getFullYear();
  209:    if ( !thisyear ) { thisyear=nowyear; }
  210:    var loweryear=thisyear-2;
  211:    var upperyear=thisyear+5;
  212:    if (thisyear>nowyear) { loweryear=nowyear-2; }
  213:    if (thisyear<nowyear) { upperyear=nowyear+5; } 
  214:     var i;
  215:     choicewrite('<select name="year" onchange="parent.datecalc();">');
  216:     for (i=loweryear;i<=upperyear;i++) {
  217:         choicewrite('<option value="'+i+'"');
  218:         if (i==thisyear) {
  219:             choicewrite(' selected="selected"');
  220:         }
  221:         choicewrite('>'+i+'</option>');
  222:     }
  223:     choicewrite('</select>');
  224: }
  225: 
  226: function month() {
  227:     var thismonth=cdate.getMonth();
  228:     var i;
  229:     choicewrite('<select name="month" onchange="parent.datecalc();">');
  230:     for (i=0;i<=11;i++) {
  231:         choicewrite('<option value="'+i+'"');
  232:         if (i==thismonth) {
  233:             choicewrite(' selected="selected"');
  234:         }
  235:         choicewrite('>'+months[i]+'</option>');
  236:     }
  237:     choicewrite('</select>');
  238: }
  239:     
  240:     
  241: function intminute() {
  242:    var thisminutes=cmins;
  243:     var i;
  244:     choicewrite('<select name="minutes" onchange="parent.intcalc();">');
  245:     for (i=0;i<=59;i++) {
  246:         choicewrite('<option value="'+i+'"');
  247:         if (i==thisminutes) {
  248:             choicewrite(' selected="selected"');
  249:         }
  250:         choicewrite('>'+i+'</option>');
  251:     }
  252:     choicewrite('</select>');
  253: } 
  254: 
  255: function inthour() {
  256:    var thishours=chours;
  257:     var i;
  258:     choicewrite('<select name="hours" onchange="parent.intcalc();">');
  259:     for (i=0;i<=23;i++) {
  260:         choicewrite('<option value="'+i+'"');
  261:         if (i==thishours) {
  262:             choicewrite(' selected="selected"');
  263:         }
  264:         choicewrite('>'+i+'</option>');
  265:     }
  266:     choicewrite('</select>');
  267: } 
  268: 
  269: function intsecond() {
  270:    var thisseconds=csecs;
  271:     var i;
  272:     choicewrite('<select name="seconds" onchange="parent.intcalc();">');
  273:     for (i=0;i<=59;i++) {
  274:         choicewrite('<option value="'+i+'"');
  275:         if (i==thisseconds) {
  276:             choicewrite(' selected="selected"');
  277:         }
  278:         choicewrite('>'+i+'</option>');
  279:     }
  280:     choicewrite('</select>');
  281: } 
  282: 
  283: 
  284: function intday() {
  285:    var thisdate=cdays;
  286:     var i;
  287:     choicewrite('<select name="date" onchange="parent.intcalc();">');
  288:     for (i=0;i<=31;i++) {
  289:         choicewrite('<option value="'+i+'"');
  290:         if (i==thisdate) {
  291:             choicewrite(' selected="selected"');
  292:         }
  293:         choicewrite('>'+i+'</option>');
  294:     }
  295:     choicewrite('</select>');
  296: }
  297: 
  298: function intcalc() {
  299:     var sform=choices.document.forms.sch;
  300:     svalue=((sform.date.options[sform.date.selectedIndex].value*24+
  301:              sform.hours.options[sform.hours.selectedIndex].value*1)*60+
  302:              sform.minutes.options[sform.minutes.selectedIndex].value*1)*60+
  303:              sform.seconds.options[sform.seconds.selectedIndex].value*1;
  304:     draw();
  305: }
  306: 
  307: function integereval() {
  308:    svalue=choices.document.forms.sch.intval.value;
  309:    svalue=Math.round(svalue);
  310:    if (pscat=='zeropos') { svalue=Math.abs(svalue); }
  311:    if ((pscat=='pos') && (svalue==0)) {
  312:       svalue='';
  313:    }
  314:    if (pscat.indexOf('inrange')!=-1) {
  315:       var rangeparts=new Array;
  316:       rangeparts=split('_',pscat);
  317:       rangeparts=split(',',rangeparts[1]);
  318:       if (svalue<rangeparts[0]) { svalue=rangeparts[0]; }
  319:       if (svalue>rangeparts[1]) { svalue=rangeparts[1]; }
  320:    }
  321:    draw();
  322: }
  323: 
  324: function floateval() {
  325:    svalue=choices.document.forms.sch.floatval.value;
  326:    svalue=1.0*svalue;
  327:    if (pscat=='pos') { svalue=Math.abs(svalue); }
  328:    if ((pscat=='zeroone') && ((svalue<0) || (svalue>1))) {
  329:       svalue='';
  330:    }
  331:    draw();
  332: }
  333: 
  334: function stringeval() {
  335:    svalue=choices.document.forms.sch.stringval.value;
  336:    draw();
  337: }
  338: 
  339: function radiostringeval(newval) {
  340:    svalue=newval;
  341:    draw();
  342: }
  343: 
  344: function callradiostringeval(newval) {
  345:     return 'onclick="parent.radiostringeval(\''+newval+'\')"';
  346: }
  347: 
  348: function intervaldis() {
  349:     csecs=svalue;
  350:     cdays=Math.floor(csecs/86400);
  351:     csecs-=cdays*86400;
  352:     chours=Math.floor(csecs/3600);
  353:     csecs-=chours*3600;
  354:     cmins=Math.floor(csecs/60);
  355:     csecs-=cmins*60;
  356:     choicewrite(cdays+' days '+chours+' hours '
  357:                +cmins+' mins '+csecs+' secs');
  358: }
  359: 
  360: function pickcolor(picked) {
  361:   svalue=picked;
  362:   draw();
  363: }
  364: 
  365: function colorfield(ir,ig,ib) {
  366:    var col=new Array;
  367:    col=["00","11","22","44","66","88","AA","CC","DD","EE","FF"];
  368:    var color='#'+col[ir]+col[ig]+col[ib];
  369:    var selection="<font color='"+color+"'>X</font>";
  370:    if (color==svalue) { selection="<font color='#"+col[10-ir]+col[10-ig]+col[10-ib]+"'>X</font>"; }
  371:    choicewrite('<td bgcolor="'+color+'"><a href="javascript:parent.pickcolor('+"'"+
  372:                color+"'"+')">'+selection+'</a></td>');
  373:                
  374: }    
  375: 
  376: function draw() {
  377:    choicestart();
  378:    choicewrite('<form name="sch"');
  379:    if (ptype=='int') {
  380:       choicewrite(' action="javascript:integereval();"');
  381:    }
  382:    if (ptype=='float') {
  383:       choicewrite(' action="javascript:floateval();"');
  384:    }
  385:    if (ptype=='string') {
  386:       choicewrite(' action="javascript:stringeval();"');
  387:    }
  388:    if (ptype != 'int' && ptype != 'float' && ptype != 'string') {
  389:        choicewrite(' action=""');
  390:    }
  391:    choicewrite('>');
  392:    if (ptype=='tolerance') {
  393: // 0: pscat
  394:       if (pscat=='default') {
  395:          tablestart('Use default value or algorithm of resource');
  396:       }
  397:       if (pscat=='relative_sym') {
  398: // 2: percentage
  399: // 3: open
  400:          tablestart('Percentage error, symmetric around value');
  401:          valline('Percentage',2,3);
  402:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
  403:             choices.document.forms.sch.val2.value=parseInt(svalue);
  404:             if (svalue.indexOf('+')!=-1) {
  405:                choices.document.forms.sch.val3.checked=true;
  406:             }
  407:          }
  408:       }
  409:       if (pscat=='relative') {
  410: // 2: left
  411: // 3: open
  412: // 4: right
  413: // 5: open
  414:          tablestart('Percentage error, asymmetric around value');
  415:          valline('Upper percentage',2,3);
  416:          valline('Lower percentage',4,5);
  417:          var range1=new Array;
  418:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
  419:             range1=svalue.split(',');
  420:             if (typeof(range1[1])=='undefined') { range1[1]=range1[0]; }
  421:             choices.document.forms.sch.val2.value=parseFloat(range1[0]);
  422:             if (range1[0].indexOf('+')!=-1) {
  423:                choices.document.forms.sch.val3.checked=true;
  424:             }
  425:             choices.document.forms.sch.val4.value=parseFloat(range1[1]);
  426:             if (range1[1].indexOf('+')!=-1) {
  427:                choices.document.forms.sch.val5.checked=true;
  428:             }
  429:          }
  430:       }
  431:       if (pscat=='absolute_sym') {
  432:          tablestart('Absolute error, symmetric around value');
  433:          valline('Value',2,3);
  434:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
  435:             choices.document.forms.sch.val2.value=parseFloat(svalue);
  436:             if (svalue.indexOf('+')!=-1) {
  437:                choices.document.forms.sch.val3.checked=true;
  438:             }
  439:          }
  440:       }
  441:       if (pscat=='absolute') {
  442:          tablestart('Absolute error, asymmetric around value');
  443:          valline('Upper value',2,3);
  444:          valline('Lower value',4,5);
  445:          var range2=new Array;
  446:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
  447:             range=svalue.split(',');
  448:             if (typeof(range2[1])=='undefined') { range2[1]=range2[0]; }
  449:             choices.document.forms.sch.val2.value=parseFloat(range2[0]);
  450:             if (range2[0].indexOf('+')!=-1) {
  451:                choices.document.forms.sch.val3.checked=true;
  452:             }
  453:             choices.document.forms.sch.val4.value=parseFloat(range2[1]);
  454:             if (range2[1].indexOf('+')!=-1) {
  455:                choices.document.forms.sch.val5.checked=true;
  456:             }
  457:          }
  458:       }
  459:    }
  460: 
  461:    if (ptype=='date') {
  462:      if (pscat=='default') {
  463:          tablestart('Default value or none');
  464:          choicewrite('</table>');
  465:      } else {
  466:       if (pscat=='start') {
  467:          tablestart('Date and time');
  468:       }
  469:       if (pscat=='end') {
  470:          tablestart('Date and time');
  471:       }
  472:       if (pscat=='interval') {
  473:          tablestart('Time interval');
  474:          choicewrite('<tr><td colspan="3">');
  475:          intervaldis();
  476:          choicewrite('</td></tr><tr><td>Time:'
  477:          +'</td><td colspan="2">');
  478:          intday();choicewrite('days ');
  479:          inthour();choicewrite('hours ');
  480:          intminute(); choicewrite('mins '); intsecond();
  481:          choicewrite('secs</td></tr></table>');         
  482:       } else { 
  483:          choicewrite('<tr><td colspan="3">'
  484:          +cdate.toString()+
  485:          '</td></tr><tr><td>Date:</td><td colspan="2">');
  486:          month();date();year();
  487:          choicewrite('</td></tr><tr><td>Time:'
  488:          +'</td><td colspan="2">');hour();choicewrite('h ');minute();
  489:          choicewrite('m ');second();
  490:          choicewrite('s</td></tr></table>');
  491:       }
  492:      }
  493:    }
  494: 
  495:    if (ptype=='int') {
  496:       var pscatparts=new Array;
  497:       pscatparts=pscat.split(',');
  498:       pscat=pscatparts[0];
  499:       if (pscat=='default') {
  500:          tablestart('Default value or none');
  501:          choicewrite('</table>');
  502:       } else {
  503:        if (pscat=='range') {
  504:          tablestart('Integer range');      
  505:          choicewrite('<tr><td>Lower Value:'+
  506:               '</td><td colspan="2"><input type="text" size="4" name="val2'+
  507:               '" /></td></tr>');
  508:          choicewrite('<tr><td>Upper Value:'+
  509:               '</td><td colspan="2"><input type="text" size="4" name="val4'+
  510:               '" /></td></tr></table>');
  511:          var range=new Array;
  512:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
  513:             range=svalue.split(',');
  514:             if (typeof(range[1])=='undefined') { range[1]=range[0]; }
  515:             choices.document.forms.sch.val2.value=parseInt(range[0]);
  516:             choices.document.forms.sch.val4.value=parseInt(range[1]);
  517:          }
  518:        } else {
  519:         if (pscat=='pos') {
  520:            tablestart('Positive (non-zero) integer');
  521:         }
  522:         if (pscat=='zeropos') {
  523:            tablestart('Positive integer or zero');
  524:         }
  525:         if (pscat.indexOf('inrange')!=-1) {
  526:            var rangeparts=new Array;
  527:            rangeparts=split(',',pscat);
  528:            tablestart('Integer in the range ['+rangeparts[1]+']');
  529:         }
  530:         if (pscat=='any') {
  531:            tablestart('Integer');
  532:         }
  533:         choicewrite('<tr><td>Value:</td><td colspan="2">');
  534:         choicewrite('<input name="intval" size="10" value="'+escapeHTML(svalue)+
  535:                     '" onchange="parent.integereval()" />');
  536:         choicewrite('</td></tr></table>');
  537:       }
  538:      }
  539:    }
  540: 
  541:    if (ptype=='float') {
  542:       if (pscat=='default') {
  543:          tablestart('Default value or none');
  544:          choicewrite('</table>');         
  545:       } else {
  546:         if (pscat=='pos') {
  547:            tablestart('Positive floating point number or zero');
  548:         }
  549:         if (pscat=='zeroone') {
  550:            tablestart('Floating point number between zero and one');
  551:         }
  552:         if (pscat=='any') {
  553:            tablestart('Floating point number');
  554:         }
  555:         choicewrite('<tr><td>Value:</td><td colspan="2">');
  556:         choicewrite('<input name="floatval" size="10" value="'+escapeHTML(svalue)+
  557:                     '" onchange="parent.floateval()" />');
  558:         choicewrite('</td></tr></table>');
  559:       }
  560:    }
  561: 
  562:    if (ptype=='string') {
  563:         if ((pscat=='any') || (pscat=='') || (pscat=='default') ||  
  564:             (typeof(pscat)=='undefined')) {
  565:            tablestart('Text');
  566:            choicewrite('<tr><td>Value:</td><td colspan="2">');
  567:            choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
  568:                     '" type="text" onchange="parent.stringeval()" />');
  569:         }
  570:         if (pscat=='yesno') {
  571:            tablestart('Yes/No');
  572: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
  573:            choicewrite('<label><input name="stringval" value="yes"'+
  574:                   ' type="radio" '+callradiostringeval('yes'));
  575:            if (svalue=='yes') { choicewrite(' checked="checked"'); }
  576:            choicewrite(' /> Yes</label><br />');
  577:            choicewrite('<label><input name="stringval" value="no"'+
  578:                   ' type="radio" '+callradiostringeval('no'));
  579:            if (svalue=='no') { choicewrite(' checked="checked"'); }
  580:            choicewrite(' /> No</label><br />');
  581:         }
  582:         if (pscat=='problemstatus') {
  583:            tablestart('Problem Status');
  584: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
  585:            choicewrite('<label><input name="stringval" value="yes"'+
  586:                   ' type="radio" '+callradiostringeval('yes'));
  587:            if (svalue=='yes') { choicewrite(' checked="checked"'); }
  588:            choicewrite(' /> Yes</label><br />');
  589:            choicewrite('<label><input name="stringval" value="answer"'+
  590:                   ' type="radio" '+callradiostringeval('answer'));
  591:            if (svalue=='answer') { choicewrite(' checked="checked"'); }
  592:            choicewrite(' /> Yes, and show correct answer if they exceed the maximum number of tries.</label><br />');
  593:            choicewrite('<label><input name="stringval" value="no"'+
  594:                   ' type="radio" '+callradiostringeval('no'));
  595:            if (svalue=='no') { choicewrite(' checked="checked"'); }
  596:            choicewrite(' /> No, don\'t show correct/incorrect feedback.</label><br />');
  597:            choicewrite('<label><input name="stringval" value="no_feedback_ever"'+
  598:                   ' type="radio" '+callradiostringeval('no_feedback_ever'));
  599:            if (svalue=='no_feedback_ever') { choicewrite(' checked="checked"'); }
  600:            choicewrite(' /> No, show no feedback at all.</label><br />');
  601:         }
  602:         if (pscat=='examtype') {
  603:            tablestart('Exam Type');
  604: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
  605:            choicewrite('<label><input name="stringval" value="online"'+
  606:                 ' type="radio" '+callradiostringeval('online'));
  607:            if (svalue=='online') { choicewrite(' checked="checked"'); }
  608:            choicewrite(' /> Online</label><br />');
  609:            choicewrite('<label><input name="stringval" value="checkout"'+
  610:               ' type="radio" '+callradiostringeval('checkout'));
  611:            if (svalue=='checkout') { choicewrite(' checked="checked"'); }
  612:            choicewrite(' /> Check out</label><br />');
  613:        }
  614:         if (pscat=='questiontype') {
  615:            tablestart('Question Type');
  616: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
  617:            choicewrite('<label><input name="stringval" value="problem"'+
  618:                ' type="radio" '+callradiostringeval('problem'));
  619:            if (svalue=='problem') { choicewrite(' checked="checked"'); }
  620:            choicewrite(' /> Standard Problem</label><br />');
  621: //	   choicewrite('<label><input name="stringval" value="quiz"'+
  622: //                ' type="radio" '+callradiostringeval('quiz'));
  623: //         if (svalue=='quiz') { choicewrite(' checked="checked"'); }
  624: //         choicewrite(' /> Quiz</label><br />');
  625:            choicewrite('<label><input name="stringval" value="practice"'+
  626:                   ' type="radio" '+callradiostringeval('practice'));
  627:            if (svalue=='practice') { choicewrite(' checked="checked"'); }
  628:            choicewrite(' /> Practice</label><br />');
  629:            choicewrite('<label><input name="stringval" value="exam"'+
  630:                   ' type="radio" '+callradiostringeval('exam'));
  631:            if (svalue=='exam') { choicewrite(' checked="checked"'); }
  632:            choicewrite(' /> Exam</label><br />');
  633: //         choicewrite('<label><input name="stringval" value="assess"'+
  634: //              ' type="radio" '+callradiostringeval('assess'));
  635: //         if (svalue=='assess') { choicewrite(' checked="checked"'); }
  636: //         choicewrite(' /> Assessment</label><br />');
  637:            choicewrite('<label><input name="stringval" value="survey"'+
  638:                 ' type="radio" '+callradiostringeval('survey'));
  639:            if (svalue=='survey') { choicewrite(' checked="checked"'); }
  640:            choicewrite(' /> Survey</label><br />');
  641: //         choicewrite('<label><input name="stringval" value="form"'+
  642: //                ' type="radio" '+callradiostringeval('form'));
  643: //         if (svalue=='form') { choicewrite(' checked="checked"'); }
  644: //         choicewrite('> Input Form</label><br />');
  645:            choicewrite('<label><input name="stringval" value="surveycred"'+
  646:                 ' type="radio" '+callradiostringeval('surveycred'));
  647:            if (svalue=='surveycred') { choicewrite(' checked="checked"'); }
  648:            choicewrite('> Survey (credit for submission)</label><br />');
  649:            choicewrite('<label><input name="stringval" value="anonsurvey"'+
  650:                 ' type="radio" '+callradiostringeval('anonsurvey'));
  651:            if (svalue=='anonsurvey') { choicewrite(' checked="checked"'); }
  652:            choicewrite('> Anonymous Survey</label><br />');
  653:            choicewrite('<label><input name="stringval" value="anonsurveycred"'+
  654:                 ' type="radio" '+callradiostringeval('anonsurveycred'));
  655:            if (svalue=='anonsurveycred') { choicewrite(' checked="checked"'); }
  656:            choicewrite('> Anonymous Survey (credit for submission)</label><br />');
  657:            choicewrite('<label><input name="stringval" value="randomizetry"'+
  658:                 ' type="radio" '+callradiostringeval('randomizetry'));
  659:            if (svalue=='randomizetry') { choicewrite(' checked="checked"'); }
  660:            choicewrite('> New Randomization Each N Tries (default N=1)</label><br />');
  661:            choicewrite('<label><input name="stringval" value="library"'+
  662:                ' type="radio" '+callradiostringeval('library'));
  663:            if (svalue=='library') { choicewrite(' checked="checked"'); }
  664:            choicewrite(' /> Library</label><br />');
  665:         }
  666:         if (pscat=='lenient') {
  667:            tablestart('Lenient Grading (Partial Credit)');
  668:            choicewrite('<tr><td>Value:</td><td colspan="2">');
  669:            choicewrite('<label><input name="stringval" value="yes"'+
  670:                   ' type="radio" '+callradiostringeval('yes'));
  671:            if (svalue=='yes') { choicewrite(' checked="checked"'); }
  672:            choicewrite(' /> Yes</label><br />');
  673:            choicewrite('<label><input name="stringval" value="no"'+
  674:                   ' type="radio" '+callradiostringeval('no'));
  675:            if (svalue=='no') { choicewrite(' checked="checked"'); }
  676:            choicewrite(' /> No</label><br />');
  677:            choicewrite('<label><input name="stringval" value="default"'+
  678:                ' type="radio" '+callradiostringeval('default'));
  679:            if (svalue=='default') { choicewrite(' checked="checked"'); }
  680:            choicewrite(' /> Default (only bubblesheet grading is lenient)</label><br />');
  681:         }
  682:         if (pscat=='discussvote') {
  683:            tablestart('Discussion Voting');
  684:            choicewrite('<tr><td>Value:</td><td colspan="2">');
  685:            choicewrite('<label><input name="stringval" value="yes"'+
  686:                   ' type="radio" '+callradiostringeval('yes'));
  687:            if (svalue=='yes') { choicewrite(' checked="checked"'); }
  688:            choicewrite(' /> Yes</label><br />');
  689:            choicewrite('<label><input name="stringval" value="notended"'+
  690:                   ' type="radio" '+callradiostringeval('notended'));
  691:            if (svalue=='notended') { choicewrite(' checked="checked"'); }
  692:            choicewrite(' /> Yes, unless discussion ended</label><br />');
  693:            choicewrite('<label><input name="stringval" value="no"'+
  694:                   ' type="radio" '+callradiostringeval('no'));
  695:            if (svalue=='no') { choicewrite(' checked="checked"'); }
  696:            choicewrite(' /> No</label><br />');
  697:         }
  698:         if (pscat=='ip') {
  699:            tablestart('IP Number/Name');
  700: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
  701:            choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
  702:                     '" onchange="parent.stringeval()" />');
  703:         }
  704:         if (pscat=='fileext') {
  705:             tablestart('Allowed File Extensions');
  706: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
  707:            choicewrite('<label><input name="radstringval" value="txt"'+
  708:                ' type="radio" '+callradiostringeval('txt'));
  709:            if (svalue=='txt') { choicewrite(' checked="checked"'); }
  710:            choicewrite(' /> Plain Text</label><br />');
  711:            choicewrite('<label><input name="radstringval" value="png,jpg,jpeg,gif"'+
  712:                ' type="radio" '+callradiostringeval('png,jpg,jpeg,gif'));
  713:            if (svalue=='png,jpg,jpeg,gif') { choicewrite(' checked="checked"'); }
  714:            choicewrite(' /> Picture File</label><br />');
  715:            choicewrite('<label><input name="radstringval" value="doc,docx,xls,xlsx,ppt,pptx"'+
  716:                ' type="radio" '+callradiostringeval('doc,docx,xls,xlsx,ppt,pptx'));
  717:            if (svalue=='doc,docx,xls,xlsx,ppt,pptx') { choicewrite(' checked="checked"'); }
  718:            if (svalue=='doc,xls,ppt') { choicewrite(' checked="checked"'); }
  719:            choicewrite(' /> Office Document</label><br />');
  720:            choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
  721:                     '" onchange="parent.stringeval()" />');
  722:        }
  723:        if (pscat=='useslots') {
  724:            tablestart('Slots control access');
  725: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
  726:            choicewrite('<label><input name="stringval" value="no"'+
  727:                   ' type="radio" '+callradiostringeval('no'));
  728:            if (svalue=='no') { choicewrite(' checked="checked"'); }
  729:            choicewrite(' /> No</label><br />');
  730:            choicewrite('<label><input name="stringval" value="resource"'+
  731:                   ' type="radio" '+callradiostringeval('resource'));
  732:            if (svalue=='resource') { choicewrite(' checked="checked"'); }
  733:            choicewrite(' /> Yes, and the scope of student selected slot is a single resource.</label><br />');
  734:            choicewrite('<label><input name="stringval" value="map"'+
  735:                   ' type="radio" '+callradiostringeval('map'));
  736:            if (svalue=='map') { choicewrite(' checked="checked"'); }
  737:            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 />');
  738:            choicewrite('<label><input name="stringval" value="map_map"'+
  739:                   ' type="radio" '+callradiostringeval('map_map'));
  740:            if (svalue=='map_map') { choicewrite(' checked="checked"'); }
  741:            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 />');
  742:         choicewrite('</td></tr></table>');
  743:       }
  744:    }
  745:    
  746:    if (ptype=='color') {
  747:       tablestart('Choose a Color');
  748:       choicewrite('<table>');
  749:       if (svalue) {
  750:          choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
  751:                      escapeHTML(svalue)+'" colspan="2">&nbsp;</td></tr>');
  752:       }
  753:       for (var ir=0; ir<=10; ir++) {
  754:           for (var ig=0; ig<=10; ig++) {
  755:               choicewrite('<tr>');
  756:               for (var ib=0; ib<=10; ib++) {
  757:                   colorfield(ir,ig,ib);
  758: 	      }
  759:               choicewrite('</tr>');
  760: 	  }	      
  761:       }
  762:       choicewrite('</table></td></table>');
  763:    }
  764: 
  765:    choicewrite('</form>');
  766:    choiceend();
  767: }
  768: 
  769: function sopt(va,text) {
  770:    selwrite('<option value="'+va+'"');
  771:    if (va==pscat) {
  772:      selwrite(' selected="selected"');
  773:    }
  774:    selwrite('>'+text+'</option>');
  775: }
  776: 
  777: function catchange() {
  778:    var sform=selector.document.forms.fsel.fcat;
  779:    pscat=sform.options[sform.selectedIndex].value;
  780:    draw();
  781: }
  782: 
  783: function assemble() {
  784:     if ((ptype=='date') && (pscat!='interval')) {
  785:         svalue=Math.floor(cdate.getTime()/1000);
  786:     }
  787:     if (ptype=='tolerance') {
  788:        if (pscat=='relative_sym') {
  789:           svalue=choices.document.forms.sch.val2.value+'%';
  790:           if (choices.document.forms.sch.val3.checked) {
  791:              svalue+='+';
  792:           }
  793:        }
  794:        if (pscat=='absolute_sym') {
  795:           svalue=choices.document.forms.sch.val2.value;
  796:           if (choices.document.forms.sch.val3.checked) {
  797:              svalue+='+';
  798:           }
  799:        }
  800:        if (pscat=='absolute') {
  801:           svalue=choices.document.forms.sch.val2.value;
  802:           if (choices.document.forms.sch.val3.checked) {
  803:              svalue+='+';
  804:           }
  805:           svalue+=','+choices.document.forms.sch.val4.value;
  806:           if (choices.document.forms.sch.val5.checked) {
  807:              svalue+='+';
  808:           }
  809:        }
  810:        if (pscat=='relative') {
  811:           svalue=choices.document.forms.sch.val2.value+'%';
  812:           if (choices.document.forms.sch.val3.checked) {
  813:              svalue+='+';
  814:           }
  815:           svalue+=','+choices.document.forms.sch.val4.value+'%';
  816:           if (choices.document.forms.sch.val5.checked) {
  817:              svalue+='+';
  818:           }
  819:        }
  820:     }
  821:     if ((ptype=='int') && (pscat=='range')) {
  822:           svalue=choices.document.forms.sch.val2.value+','+
  823:                  choices.document.forms.sch.val4.value;
  824:     }
  825:     if (pscat=='default') { svalue=''; }
  826:     stype=ptype+'_'+pscat;
  827: }
  828: 
  829: 
  830: function init() {
  831:   var i;
  832:   var subs=new Array();
  833:   var namevalue=this.window.location.search.split('&');
  834:   namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
  835: 
  836:   for (i=0;i<namevalue.length;i++) {
  837:      var pair=namevalue[i].split('=');
  838:      pair[1]=unescape(pair[1]);
  839:      if (pair[0]=='value') { pvalue=pair[1]; }
  840:      if (pair[0]=='type') { subs=pair[1].split('_');
  841:                             ptype=subs[0];
  842:                             pscat=subs[1];
  843:                             if (typeof(subs[2])!="undefined") { 
  844:                                pscat+='_'+subs[2]; 
  845:                             }
  846:                             if ((pscat=='') || (typeof(pscat)=="undefined")) { 
  847:                                pscat='default';
  848:                             }
  849:                            }
  850:      if (pair[0]=='return') { preturn=pair[1]; }
  851:      if (pair[0]=='call') { pcode=pair[1]; }
  852:      if (pair[0]=='marker') { pmarker=pair[1]; }
  853:      if (pair[0]=='name') { pname=pair[1]; }
  854:      if (pair[0]=='modal') { pmodal=pair[1]; }
  855:      if (pair[0]=='defhour' && pair[1] >= 0 && pair[1] < 24 ) {
  856:          defhour=pair[1];
  857:      }
  858:      if (pair[0]=='defmin' && pair[1] >= 0 && pair[1] < 60) { defmin=pair[1]; }
  859:      if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; }
  860:   }
  861: 
  862:   svalue=pvalue;
  863:   if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
  864:       (pscat=='default') && 
  865:       (typeof(svalue)!="undefined") && 
  866:       (svalue!=0) && (svalue!='')) { pscat='any'; }
  867: 
  868:   if (ptype=='tolerance') {
  869:      var tperc=0;
  870:      var trange=0;
  871:      if (typeof(svalue)!='undefined') {
  872:         if (svalue.indexOf('%')!=-1) { tperc=1;  }
  873:         if (svalue.indexOf(',')!=-1) { trange=1; }
  874:         if (trange) {
  875:            if (tperc) { pscat='relative'; } else { pscat='absolute'; }
  876:         } else {
  877:            if (tperc) { pscat='relative_sym'; } else { pscat='absolute_sym'; }
  878:         }
  879:      }
  880:   }
  881: 
  882:   this.window.selector.document.open();
  883:   selwrite('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
  884:   selwrite('<html xmlns="http://www.w3.org/1999/xhtml">');
  885:   selwrite('<head>');
  886:   selwrite('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
  887:   selwrite('<title>LON-CAPA</title>');
  888:   selwrite('<style type="text/css">');
  889:   selwrite('<!--');
  890:   selwrite('body {');
  891:   selwrite('font-family: Verdana,Arial,Helvetica,sans-serif;');
  892:   selwrite('line-height:130%;');
  893:   selwrite('font-size:0.83em;');
  894:   selwrite('background: #FFFFFF;');
  895:   selwrite('}');
  896:   selwrite('-->');
  897:   selwrite('</style>');
  898:   selwrite('</head>');
  899:   selwrite('<body>');
  900:   selwrite('<form name="fsel" action=""><b>'+pname+'</b><br />');
  901:   selwrite('Format of Value(s): <select name="fcat" onchange="parent.catchange();">');
  902: 
  903:   if (ptype=='tolerance') {
  904:      sopt('default','Default');
  905:      sopt('relative_sym','Relative Tolerance, Symmetric (percent)');
  906:      sopt('relative','Relative Tolerance (percentages)');
  907:      sopt('absolute_sym','Absolute Tolerance, Symmetric (value)');
  908:      sopt('absolute','Absolute Tolerance (values)');
  909:   }
  910: 
  911:   if (ptype=='date') {
  912:      if (pscat != 'interval') {
  913:          sopt('default','Default');
  914: 	 sopt('start','Starting Date');
  915: 	 sopt('end','Ending Date');
  916:      } else {
  917:          sopt('interval','Time Interval');
  918:      }
  919: 
  920:      if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
  921:         cdate.setTime(pvalue*1000);
  922:      } else {        
  923:         cdate.setSeconds(defsec);
  924:         cdate.setMinutes(defmin);
  925:         cdate.setHours(defhour);
  926:      }
  927:  
  928:      months[0]='January';
  929:      months[1]='February';
  930:      months[2]='March';
  931:      months[3]='April';
  932:      months[4]='May';
  933:      months[5]='June';
  934:      months[6]='July';
  935:      months[7]='August';
  936:      months[8]='September';
  937:      months[9]='October';
  938:      months[10]='November';
  939:      months[11]='December';
  940:   }
  941:    
  942:   if (ptype=='int') {
  943:      sopt('default','Default');
  944:      sopt('pos','Positive Integer, Not Zero');
  945:      sopt('zeropos','Positive Integer or Zero');
  946:      sopt('inrange','Integer in Range');
  947:      sopt('range','Range of Integers');
  948:      sopt('any','Integer');
  949:   }
  950: 
  951:   if (ptype=='float') {
  952:      sopt('default','Default');
  953:      sopt('zeroone','Floating Point between 0 and 1');
  954:      sopt('pos','Positive Floating Point');
  955:      sopt('any','Floating Point');
  956: 
  957:   }
  958: 
  959:   if (ptype=='string') {
  960:      //sopt('default','Default');
  961:      if (pscat == 'yesno')        { sopt('yesno','Yes/No'); }
  962:      else if (pscat == 'problemstatus'){ sopt('problemstatus','Problem Status'); }
  963:      else if (pscat == 'examtype')     { sopt('examtype','Exam Type'); }
  964:      else if (pscat == 'questiontype') { sopt('questiontype','Question Type'); }
  965:      else if (pscat == 'lenient')      { sopt('lenient','Lenient Grading (Partial Credit)'); }
  966:      else if (pscat == 'discussvote')  { sopt('discussvote','Discussion Voting'); }
  967:      else if (pscat == 'ip')           { sopt('ip','IP Number/Name'); }
  968:      else if (pscat == 'fileext')      { sopt('fileext','File Extension'); }
  969:      else if (pscat == 'useslots')     { sopt('useslots','Slots control access'); }
  970:      else { pscat = 'any'; }
  971:      sopt('any','String Value');
  972:   }
  973: 
  974:   if (ptype=='color') {
  975:      sopt('default','Use Default Color');
  976:      sopt('custom','Use Custom Color');
  977:   }
  978: 
  979:   selwrite('</select></form>');
  980:   var targ='parent.opener';
  981:   if (pmodal==1) {
  982:      targ='parent.parent';
  983:   }  
  984:   selwrite('<a href="javascript:parent.assemble();');
  985:   if (preturn!='') {
  986:      selwrite(targ+'.document.'+preturn+'_value.value=parent.window.svalue;');
  987:      selwrite(targ+'.document.'+preturn+'_type.value=parent.window.stype;');
  988:   }
  989:   if (pmarker!='') {
  990:      selwrite(targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
  991:   }
  992:   if (pcode!='') {
  993:      selwrite(targ+'.'+pcode+'();');
  994:   }
  995:   selwrite('">Save</a>&nbsp;&nbsp;');
  996: 
  997:   selwrite('<a href="javascript:');
  998:   selwrite(targ+'.document.'+preturn+'_value.value='+"'';");
  999:   if (pmarker!='') {
 1000:      selwrite(
 1001:      targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
 1002:   }
 1003:   if (pcode!='') {
 1004:      selwrite(targ+'.'+pcode+'();');
 1005:   }
 1006:   selwrite('">Delete</a>&nbsp;&nbsp;');
 1007:  
 1008:   selwrite('</body></html>');
 1009:   this.window.selector.document.close();
 1010:   draw();
 1011:   
 1012: }
 1013: 
 1014: // ]]>
 1015: </script>
 1016: </head>
 1017: 
 1018: <frameset rows="120,*" onload="init();">
 1019: <frame name="selector" src="empty.html" />
 1020: <frame name="choices" src="empty.html" />
 1021: </frameset>
 1022: 
 1023: 
 1024: 
 1025: </html>

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