File:  [LON-CAPA] / rat / client / parameter.html
Revision 1.63: download - view: text, annotated - select for diffs
Thu Dec 8 21:37:51 2011 UTC (12 years, 5 months ago) by www
Branches: MAIN
CVS tags: HEAD, BZ4492-merge, BZ4492-feature_horizontal_radioresponse, BZ4492-feature_Support_horizontal_radioresponse
Bug #4046: eliminate date setting popup

    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.63 2011/12/08 21:37:51 www 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 'onchange="parent.radiostringeval(\''
  346:           +newval+'\')" onclick="parent.radiostringeval(\''
  347:           +newval+'\')"';
  348: }
  349: 
  350: function intervaldis() {
  351:     csecs=svalue;
  352:     cdays=Math.floor(csecs/86400);
  353:     csecs-=cdays*86400;
  354:     chours=Math.floor(csecs/3600);
  355:     csecs-=chours*3600;
  356:     cmins=Math.floor(csecs/60);
  357:     csecs-=cmins*60;
  358:     choicewrite(cdays+' days '+chours+' hours '
  359:                +cmins+' mins '+csecs+' secs');
  360: }
  361: 
  362: function pickcolor(picked) {
  363:   svalue=picked;
  364:   draw();
  365: }
  366: 
  367: function colorfield(ir,ig,ib) {
  368:    var col=new Array;
  369:    col=["00","11","22","44","66","88","AA","CC","DD","EE","FF"];
  370:    var color='#'+col[ir]+col[ig]+col[ib];
  371:    var selection="<font color='"+color+"'>X</font>";
  372:    if (color==svalue) { selection="<font color='#"+col[10-ir]+col[10-ig]+col[10-ib]+"'>X</font>"; }
  373:    choicewrite('<td bgcolor="'+color+'"><a href="javascript:parent.pickcolor('+"'"+
  374:                color+"'"+')">'+selection+'</a></td>');
  375:                
  376: }    
  377: 
  378: function draw() {
  379:    choicestart();
  380:    choicewrite('<form name="sch"');
  381:    if (ptype=='int') {
  382:       choicewrite(' action="javascript:integereval();"');
  383:    }
  384:    if (ptype=='float') {
  385:       choicewrite(' action="javascript:floateval();"');
  386:    }
  387:    if (ptype=='string') {
  388:       choicewrite(' action="javascript:stringeval();"');
  389:    }
  390:    if (ptype != 'int' && ptype != 'float' && ptype != 'string') {
  391:        choicewrite(' action=""');
  392:    }
  393:    choicewrite('>');
  394:    if (ptype=='tolerance') {
  395: // 0: pscat
  396:       if (pscat=='default') {
  397:          tablestart('Use default value or algorithm of resource');
  398:       }
  399:       if (pscat=='relative_sym') {
  400: // 2: percentage
  401: // 3: open
  402:          tablestart('Percentage error, symmetric around value');
  403:          valline('Percentage',2,3);
  404:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
  405:             choices.document.forms.sch.val2.value=parseInt(svalue);
  406:             if (svalue.indexOf('+')!=-1) {
  407:                choices.document.forms.sch.val3.checked=true;
  408:             }
  409:          }
  410:       }
  411:       if (pscat=='relative') {
  412: // 2: left
  413: // 3: open
  414: // 4: right
  415: // 5: open
  416:          tablestart('Percentage error, asymmetric around value');
  417:          valline('Upper percentage',2,3);
  418:          valline('Lower percentage',4,5);
  419:          var range1=new Array;
  420:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
  421:             range1=svalue.split(',');
  422:             if (typeof(range1[1])=='undefined') { range1[1]=range1[0]; }
  423:             choices.document.forms.sch.val2.value=parseFloat(range1[0]);
  424:             if (range1[0].indexOf('+')!=-1) {
  425:                choices.document.forms.sch.val3.checked=true;
  426:             }
  427:             choices.document.forms.sch.val4.value=parseFloat(range1[1]);
  428:             if (range1[1].indexOf('+')!=-1) {
  429:                choices.document.forms.sch.val5.checked=true;
  430:             }
  431:          }
  432:       }
  433:       if (pscat=='absolute_sym') {
  434:          tablestart('Absolute error, symmetric around value');
  435:          valline('Value',2,3);
  436:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
  437:             choices.document.forms.sch.val2.value=parseFloat(svalue);
  438:             if (svalue.indexOf('+')!=-1) {
  439:                choices.document.forms.sch.val3.checked=true;
  440:             }
  441:          }
  442:       }
  443:       if (pscat=='absolute') {
  444:          tablestart('Absolute error, asymmetric around value');
  445:          valline('Upper value',2,3);
  446:          valline('Lower value',4,5);
  447:          var range2=new Array;
  448:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
  449:             range=svalue.split(',');
  450:             if (typeof(range2[1])=='undefined') { range2[1]=range2[0]; }
  451:             choices.document.forms.sch.val2.value=parseFloat(range2[0]);
  452:             if (range2[0].indexOf('+')!=-1) {
  453:                choices.document.forms.sch.val3.checked=true;
  454:             }
  455:             choices.document.forms.sch.val4.value=parseFloat(range2[1]);
  456:             if (range2[1].indexOf('+')!=-1) {
  457:                choices.document.forms.sch.val5.checked=true;
  458:             }
  459:          }
  460:       }
  461:    }
  462: 
  463:    if (ptype=='date') {
  464:      if (pscat=='default') {
  465:          tablestart('Default value or none');
  466:          choicewrite('</table>');
  467:      } else {
  468:       if (pscat=='start') {
  469:          tablestart('Date and time');
  470:       }
  471:       if (pscat=='end') {
  472:          tablestart('Date and time');
  473:       }
  474:       if (pscat=='interval') {
  475:          tablestart('Time interval');
  476:          choicewrite('<tr><td colspan="3">');
  477:          intervaldis();
  478:          choicewrite('</td></tr><tr><td>Time:'
  479:          +'</td><td colspan="2">');
  480:          intday();choicewrite('days ');
  481:          inthour();choicewrite('hours ');
  482:          intminute(); choicewrite('mins '); intsecond();
  483:          choicewrite('secs</td></tr></table>');         
  484:       } else { 
  485:          choicewrite('<tr><td colspan="3">'
  486:          +cdate.toString()+
  487:          '</td></tr><tr><td>Date:</td><td colspan="2">');
  488:          month();date();year();
  489:          choicewrite('</td></tr><tr><td>Time:'
  490:          +'</td><td colspan="2">');hour();choicewrite('h ');minute();
  491:          choicewrite('m ');second();
  492:          choicewrite('s</td></tr></table>');
  493:       }
  494:      }
  495:    }
  496: 
  497:    if (ptype=='int') {
  498:       var pscatparts=new Array;
  499:       pscatparts=pscat.split(',');
  500:       pscat=pscatparts[0];
  501:       if (pscat=='default') {
  502:          tablestart('Default value or none');
  503:          choicewrite('</table>');
  504:       } else {
  505:        if (pscat=='range') {
  506:          tablestart('Integer range');      
  507:          choicewrite('<tr><td>Lower Value:'+
  508:               '</td><td colspan="2"><input type="text" size="4" name="val2'+
  509:               '" /></td></tr>');
  510:          choicewrite('<tr><td>Upper Value:'+
  511:               '</td><td colspan="2"><input type="text" size="4" name="val4'+
  512:               '" /></td></tr></table>');
  513:          var range=new Array;
  514:          if ((svalue!='') && (typeof(svalue)!="undefined")) {
  515:             range=svalue.split(',');
  516:             if (typeof(range[1])=='undefined') { range[1]=range[0]; }
  517:             choices.document.forms.sch.val2.value=parseInt(range[0]);
  518:             choices.document.forms.sch.val4.value=parseInt(range[1]);
  519:          }
  520:        } else {
  521:         if (pscat=='pos') {
  522:            tablestart('Positive (non-zero) integer');
  523:         }
  524:         if (pscat=='zeropos') {
  525:            tablestart('Positive integer or zero');
  526:         }
  527:         if (pscat.indexOf('inrange')!=-1) {
  528:            var rangeparts=new Array;
  529:            rangeparts=split(',',pscat);
  530:            tablestart('Integer in the range ['+rangeparts[1]+']');
  531:         }
  532:         if (pscat=='any') {
  533:            tablestart('Integer');
  534:         }
  535:         choicewrite('<tr><td>Value:</td><td colspan="2">');
  536:         choicewrite('<input name="intval" size="10" value="'+escapeHTML(svalue)+
  537:                     '" onchange="parent.integereval()" />');
  538:         choicewrite('</td></tr></table>');
  539:       }
  540:      }
  541:    }
  542: 
  543:    if (ptype=='float') {
  544:       if (pscat=='default') {
  545:          tablestart('Default value or none');
  546:          choicewrite('</table>');         
  547:       } else {
  548:         if (pscat=='pos') {
  549:            tablestart('Positive floating point number or zero');
  550:         }
  551:         if (pscat=='zeroone') {
  552:            tablestart('Floating point number between zero and one');
  553:         }
  554:         if (pscat=='any') {
  555:            tablestart('Floating point number');
  556:         }
  557:         choicewrite('<tr><td>Value:</td><td colspan="2">');
  558:         choicewrite('<input name="floatval" size="10" value="'+escapeHTML(svalue)+
  559:                     '" onchange="parent.floateval()" />');
  560:         choicewrite('</td></tr></table>');
  561:       }
  562:    }
  563: 
  564:    if (ptype=='string') {
  565:         if ((pscat=='any') || (pscat=='') || (pscat=='default') ||  
  566:             (typeof(pscat)=='undefined')) {
  567:            tablestart('Text');
  568:            choicewrite('<tr><td>Value:</td><td colspan="2">');
  569:            choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
  570:                     '" type="text" onchange="parent.stringeval()" />');
  571:         }
  572:         if (pscat=='yesno') {
  573:            tablestart('Yes/No');
  574: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
  575:            choicewrite('<label><input name="stringval" value="yes"'+
  576:                   ' type="radio" '+callradiostringeval('yes'));
  577:            if (svalue=='yes') { choicewrite(' checked="checked"'); }
  578:            choicewrite(' /> Yes</label><br />');
  579:            choicewrite('<label><input name="stringval" value="no"'+
  580:                   ' type="radio" '+callradiostringeval('no'));
  581:            if (svalue=='no') { choicewrite(' checked="checked"'); }
  582:            choicewrite(' /> No</label><br />');
  583:         }
  584:         if (pscat=='problemstatus') {
  585:            tablestart('Problem Status');
  586: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
  587:            choicewrite('<label><input name="stringval" value="yes"'+
  588:                   ' type="radio" '+callradiostringeval('yes'));
  589:            if (svalue=='yes') { choicewrite(' checked="checked"'); }
  590:            choicewrite(' /> Yes</label><br />');
  591:            choicewrite('<label><input name="stringval" value="answer"'+
  592:                   ' type="radio" '+callradiostringeval('answer'));
  593:            if (svalue=='answer') { choicewrite(' checked="checked"'); }
  594:            choicewrite(' /> Yes, and show correct answer if they exceed the maximum number of tries.</label><br />');
  595:            choicewrite('<label><input name="stringval" value="no"'+
  596:                   ' type="radio" '+callradiostringeval('no'));
  597:            if (svalue=='no') { choicewrite(' checked="checked"'); }
  598:            choicewrite(' /> No, don\'t show correct/incorrect feedback.</label><br />');
  599:            choicewrite('<label><input name="stringval" value="no_feedback_ever"'+
  600:                   ' type="radio" '+callradiostringeval('no_feedback_ever'));
  601:            if (svalue=='no_feedback_ever') { choicewrite(' checked="checked"'); }
  602:            choicewrite(' /> No, show no feedback at all.</label><br />');
  603:         }
  604:         if (pscat=='examtype') {
  605:            tablestart('Exam Type');
  606: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
  607:            choicewrite('<label><input name="stringval" value="online"'+
  608:                 ' type="radio" '+callradiostringeval('online'));
  609:            if (svalue=='online') { choicewrite(' checked="checked"'); }
  610:            choicewrite(' /> Online</label><br />');
  611:            choicewrite('<label><input name="stringval" value="checkout"'+
  612:               ' type="radio" '+callradiostringeval('checkout'));
  613:            if (svalue=='checkout') { choicewrite(' checked="checked"'); }
  614:            choicewrite(' /> Check out</label><br />');
  615:        }
  616:         if (pscat=='questiontype') {
  617:            tablestart('Question Type');
  618: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
  619:            choicewrite('<label><input name="stringval" value="problem"'+
  620:                ' type="radio" '+callradiostringeval('problem'));
  621:            if (svalue=='problem') { choicewrite(' checked="checked"'); }
  622:            choicewrite(' /> Standard Problem</label><br />');
  623: //	   choicewrite('<label><input name="stringval" value="quiz"'+
  624: //                ' type="radio" '+callradiostringeval('quiz'));
  625: //         if (svalue=='quiz') { choicewrite(' checked="checked"'); }
  626: //         choicewrite(' /> Quiz</label><br />');
  627:            choicewrite('<label><input name="stringval" value="practice"'+
  628:                   ' type="radio" '+callradiostringeval('practice'));
  629:            if (svalue=='practice') { choicewrite(' checked="checked"'); }
  630:            choicewrite(' /> Practice</label><br />');
  631:            choicewrite('<label><input name="stringval" value="exam"'+
  632:                   ' type="radio" '+callradiostringeval('exam'));
  633:            if (svalue=='exam') { choicewrite(' checked="checked"'); }
  634:            choicewrite(' /> Exam</label><br />');
  635: //         choicewrite('<label><input name="stringval" value="assess"'+
  636: //              ' type="radio" '+callradiostringeval('assess'));
  637: //         if (svalue=='assess') { choicewrite(' checked="checked"'); }
  638: //         choicewrite(' /> Assessment</label><br />');
  639:            choicewrite('<label><input name="stringval" value="survey"'+
  640:                 ' type="radio" '+callradiostringeval('survey'));
  641:            if (svalue=='survey') { choicewrite(' checked="checked"'); }
  642:            choicewrite(' /> Survey</label><br />');
  643: //         choicewrite('<label><input name="stringval" value="form"'+
  644: //                ' type="radio" '+callradiostringeval('form'));
  645: //         if (svalue=='form') { choicewrite(' checked="checked"'); }
  646: //         choicewrite('> Input Form</label><br />');
  647:            choicewrite('<label><input name="stringval" value="surveycred"'+
  648:                 ' type="radio" '+callradiostringeval('surveycred'));
  649:            if (svalue=='surveycred') { choicewrite(' checked="checked"'); }
  650:            choicewrite('> Survey (credit for submission)</label><br />');
  651:            choicewrite('<label><input name="stringval" value="anonsurvey"'+
  652:                 ' type="radio" '+callradiostringeval('anonsurvey'));
  653:            if (svalue=='anonsurvey') { choicewrite(' checked="checked"'); }
  654:            choicewrite('> Anonymous Survey</label><br />');
  655:            choicewrite('<label><input name="stringval" value="anonsurveycred"'+
  656:                 ' type="radio" '+callradiostringeval('anonsurveycred'));
  657:            if (svalue=='anonsurveycred') { choicewrite(' checked="checked"'); }
  658:            choicewrite('> Anonymous Survey (credit for submission)</label><br />');
  659:            choicewrite('<label><input name="stringval" value="randomizetry"'+
  660:                 ' type="radio" '+callradiostringeval('randomizetry'));
  661:            if (svalue=='randomizetry') { choicewrite(' checked="checked"'); }
  662:            choicewrite('> New Randomization Each N Tries (default N=1)</label><br />');
  663:            choicewrite('<label><input name="stringval" value="library"'+
  664:                ' type="radio" '+callradiostringeval('library'));
  665:            if (svalue=='library') { choicewrite(' checked="checked"'); }
  666:            choicewrite(' /> Library</label><br />');
  667:         }
  668:         if (pscat=='lenient') {
  669:            tablestart('Lenient Grading (Partial Credit)');
  670:            choicewrite('<tr><td>Value:</td><td colspan="2">');
  671:            choicewrite('<label><input name="stringval" value="yes"'+
  672:                   ' type="radio" '+callradiostringeval('yes'));
  673:            if (svalue=='yes') { choicewrite(' checked="checked"'); }
  674:            choicewrite(' /> Yes</label><br />');
  675:            choicewrite('<label><input name="stringval" value="no"'+
  676:                   ' type="radio" '+callradiostringeval('no'));
  677:            if (svalue=='no') { choicewrite(' checked="checked"'); }
  678:            choicewrite(' /> No</label><br />');
  679:            choicewrite('<label><input name="stringval" value="default"'+
  680:                ' type="radio" '+callradiostringeval('default'));
  681:            if (svalue=='default') { choicewrite(' checked="checked"'); }
  682:            choicewrite(' /> Default (only bubblesheet grading is lenient)</label><br />');
  683:         }
  684:         if (pscat=='ip') {
  685:            tablestart('IP Number/Name');
  686: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
  687:            choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
  688:                     '" onchange="parent.stringeval()" />');
  689:         }
  690:         if (pscat=='fileext') {
  691:             tablestart('Allowed File Extensions');
  692: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
  693:            choicewrite('<label><input name="radstringval" value="txt"'+
  694:                ' type="radio" '+callradiostringeval('txt'));
  695:            if (svalue=='txt') { choicewrite(' checked="checked"'); }
  696:            choicewrite(' /> Plain Text</label><br />');
  697:            choicewrite('<label><input name="radstringval" value="png,jpg,jpeg,gif"'+
  698:                ' type="radio" '+callradiostringeval('png,jpg,jpeg,gif'));
  699:            if (svalue=='png,jpg,jpeg,gif') { choicewrite(' checked="checked"'); }
  700:            choicewrite(' /> Picture File</label><br />');
  701:            choicewrite('<label><input name="radstringval" value="doc,docx,xls,xlsx,ppt,pptx"'+
  702:                ' type="radio" '+callradiostringeval('doc,docx,xls,xlsx,ppt,pptx'));
  703:            if (svalue=='doc,docx,xls,xlsx,ppt,pptx') { choicewrite(' checked="checked"'); }
  704:            if (svalue=='doc,xls,ppt') { choicewrite(' checked="checked"'); }
  705:            choicewrite(' /> Office Document</label><br />');
  706:            choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
  707:                     '" onchange="parent.stringeval()" />');
  708:        }
  709:        if (pscat=='useslots') {
  710:            tablestart('Slots control access');
  711: 	   choicewrite('<tr><td>Value:</td><td colspan="2">');
  712:            choicewrite('<label><input name="stringval" value="no"'+
  713:                   ' type="radio" '+callradiostringeval('no'));
  714:            if (svalue=='no') { choicewrite(' checked="checked"'); }
  715:            choicewrite(' /> No</label><br />');
  716:            choicewrite('<label><input name="stringval" value="resource"'+
  717:                   ' type="radio" '+callradiostringeval('resource'));
  718:            if (svalue=='resource') { choicewrite(' checked="checked"'); }
  719:            choicewrite(' /> Yes, and the scope of student selected slot is a single resource.</label><br />');
  720:            choicewrite('<label><input name="stringval" value="map"'+
  721:                   ' type="radio" '+callradiostringeval('map'));
  722:            if (svalue=='map') { choicewrite(' checked="checked"'); }
  723:            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 />');
  724:            choicewrite('<label><input name="stringval" value="map_map"'+
  725:                   ' type="radio" '+callradiostringeval('map_map'));
  726:            if (svalue=='map_map') { choicewrite(' checked="checked"'); }
  727:            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 />');
  728:         choicewrite('</td></tr></table>');
  729:       }
  730:    }
  731:    
  732:    if (ptype=='color') {
  733:       tablestart('Choose a Color');
  734:       choicewrite('<table>');
  735:       if (svalue) {
  736:          choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
  737:                      escapeHTML(svalue)+'" colspan="2">&nbsp;</td></tr>');
  738:       }
  739:       for (var ir=0; ir<=10; ir++) {
  740:           for (var ig=0; ig<=10; ig++) {
  741:               choicewrite('<tr>');
  742:               for (var ib=0; ib<=10; ib++) {
  743:                   colorfield(ir,ig,ib);
  744: 	      }
  745:               choicewrite('</tr>');
  746: 	  }	      
  747:       }
  748:       choicewrite('</table></td></table>');
  749:    }
  750: 
  751:    choicewrite('</form>');
  752:    choiceend();
  753: }
  754: 
  755: function sopt(va,text) {
  756:    selwrite('<option value="'+va+'"');
  757:    if (va==pscat) {
  758:      selwrite(' selected="selected"');
  759:    }
  760:    selwrite('>'+text+'</option>');
  761: }
  762: 
  763: function catchange() {
  764:    var sform=selector.document.forms.fsel.fcat;
  765:    pscat=sform.options[sform.selectedIndex].value;
  766:    draw();
  767: }
  768: 
  769: function assemble() {
  770:     if ((ptype=='date') && (pscat!='interval')) {
  771:         svalue=Math.floor(cdate.getTime()/1000);
  772:     }
  773:     if (ptype=='tolerance') {
  774:        if (pscat=='relative_sym') {
  775:           svalue=choices.document.forms.sch.val2.value+'%';
  776:           if (choices.document.forms.sch.val3.checked) {
  777:              svalue+='+';
  778:           }
  779:        }
  780:        if (pscat=='absolute_sym') {
  781:           svalue=choices.document.forms.sch.val2.value;
  782:           if (choices.document.forms.sch.val3.checked) {
  783:              svalue+='+';
  784:           }
  785:        }
  786:        if (pscat=='absolute') {
  787:           svalue=choices.document.forms.sch.val2.value;
  788:           if (choices.document.forms.sch.val3.checked) {
  789:              svalue+='+';
  790:           }
  791:           svalue+=','+choices.document.forms.sch.val4.value;
  792:           if (choices.document.forms.sch.val5.checked) {
  793:              svalue+='+';
  794:           }
  795:        }
  796:        if (pscat=='relative') {
  797:           svalue=choices.document.forms.sch.val2.value+'%';
  798:           if (choices.document.forms.sch.val3.checked) {
  799:              svalue+='+';
  800:           }
  801:           svalue+=','+choices.document.forms.sch.val4.value+'%';
  802:           if (choices.document.forms.sch.val5.checked) {
  803:              svalue+='+';
  804:           }
  805:        }
  806:     }
  807:     if ((ptype=='int') && (pscat=='range')) {
  808:           svalue=choices.document.forms.sch.val2.value+','+
  809:                  choices.document.forms.sch.val4.value;
  810:     }
  811:     if (pscat=='default') { svalue=''; }
  812:     stype=ptype+'_'+pscat;
  813: }
  814: 
  815: 
  816: function init() {
  817:   var i;
  818:   var subs=new Array();
  819:   var namevalue=this.window.location.search.split('&');
  820:   namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
  821: 
  822:   for (i=0;i<namevalue.length;i++) {
  823:      var pair=namevalue[i].split('=');
  824:      pair[1]=unescape(pair[1]);
  825:      if (pair[0]=='value') { pvalue=pair[1]; }
  826:      if (pair[0]=='type') { subs=pair[1].split('_');
  827:                             ptype=subs[0];
  828:                             pscat=subs[1];
  829:                             if (typeof(subs[2])!="undefined") { 
  830:                                pscat+='_'+subs[2]; 
  831:                             }
  832:                             if ((pscat=='') || (typeof(pscat)=="undefined")) { 
  833:                                pscat='default';
  834:                             }
  835:                            }
  836:      if (pair[0]=='return') { preturn=pair[1]; }
  837:      if (pair[0]=='call') { pcode=pair[1]; }
  838:      if (pair[0]=='marker') { pmarker=pair[1]; }
  839:      if (pair[0]=='name') { pname=pair[1]; }
  840:      if (pair[0]=='modal') { pmodal=pair[1]; }
  841:      if (pair[0]=='defhour' && pair[1] >= 0 && pair[1] < 24 ) {
  842:          defhour=pair[1];
  843:      }
  844:      if (pair[0]=='defmin' && pair[1] >= 0 && pair[1] < 60) { defmin=pair[1]; }
  845:      if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; }
  846:   }
  847: 
  848:   svalue=pvalue;
  849:   if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
  850:       (pscat=='default') && 
  851:       (typeof(svalue)!="undefined") && 
  852:       (svalue!=0) && (svalue!='')) { pscat='any'; }
  853: 
  854:   if (ptype=='tolerance') {
  855:      var tperc=0;
  856:      var trange=0;
  857:      if (typeof(svalue)!='undefined') {
  858:         if (svalue.indexOf('%')!=-1) { tperc=1;  }
  859:         if (svalue.indexOf(',')!=-1) { trange=1; }
  860:         if (trange) {
  861:            if (tperc) { pscat='relative'; } else { pscat='absolute'; }
  862:         } else {
  863:            if (tperc) { pscat='relative_sym'; } else { pscat='absolute_sym'; }
  864:         }
  865:      }
  866:   }
  867: 
  868:   this.window.selector.document.open();
  869:   selwrite('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
  870:   selwrite('<html xmlns="http://www.w3.org/1999/xhtml">');
  871:   selwrite('<head>');
  872:   selwrite('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
  873:   selwrite('<title>LON-CAPA</title>');
  874:   selwrite('<style type="text/css">');
  875:   selwrite('<!--');
  876:   selwrite('body {');
  877:   selwrite('font-family: Verdana,Arial,Helvetica,sans-serif;');
  878:   selwrite('line-height:130%;');
  879:   selwrite('font-size:0.83em;');
  880:   selwrite('background: #FFFFFF;');
  881:   selwrite('}');
  882:   selwrite('-->');
  883:   selwrite('</style>');
  884:   selwrite('</head>');
  885:   selwrite('<body>');
  886:   selwrite('<form name="fsel" action=""><b>'+pname+'</b><br />');
  887:   selwrite('<select name="fcat" onchange="parent.catchange();">');
  888: 
  889:   if (ptype=='tolerance') {
  890:      sopt('default','Default');
  891:      sopt('relative_sym','Relative Tolerance, Symmetric (percent)');
  892:      sopt('relative','Relative Tolerance (percentages)');
  893:      sopt('absolute_sym','Absolute Tolerance, Symmetric (value)');
  894:      sopt('absolute','Absolute Tolerance (values)');
  895:   }
  896: 
  897:   if (ptype=='date') {
  898:      if (pscat != 'interval') {
  899:          sopt('default','Default');
  900: 	 sopt('start','Starting Date');
  901: 	 sopt('end','Ending Date');
  902:      } else {
  903:          sopt('interval','Time Interval');
  904:      }
  905: 
  906:      if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
  907:         cdate.setTime(pvalue*1000);
  908:      } else {        
  909:         cdate.setSeconds(defsec);
  910:         cdate.setMinutes(defmin);
  911:         cdate.setHours(defhour);
  912:      }
  913:  
  914:      months[0]='January';
  915:      months[1]='February';
  916:      months[2]='March';
  917:      months[3]='April';
  918:      months[4]='May';
  919:      months[5]='June';
  920:      months[6]='July';
  921:      months[7]='August';
  922:      months[8]='September';
  923:      months[9]='October';
  924:      months[10]='November';
  925:      months[11]='December';
  926:   }
  927:    
  928:   if (ptype=='int') {
  929:      sopt('default','Default');
  930:      sopt('pos','Positive Integer, Not Zero');
  931:      sopt('zeropos','Positive Integer or Zero');
  932:      sopt('inrange','Integer in Range');
  933:      sopt('range','Range of Integers');
  934:      sopt('any','Integer');
  935:   }
  936: 
  937:   if (ptype=='float') {
  938:      sopt('default','Default');
  939:      sopt('zeroone','Floating Point between 0 and 1');
  940:      sopt('pos','Positive Floating Point');
  941:      sopt('any','Floating Point');
  942: 
  943:   }
  944: 
  945:   if (ptype=='string') {
  946:      //sopt('default','Default');
  947:      if (pscat == 'yesno')        { sopt('yesno','Yes/No'); }
  948:      else if (pscat == 'problemstatus'){ sopt('problemstatus','Problem Status'); }
  949:      else if (pscat == 'examtype')     { sopt('examtype','Exam Type'); }
  950:      else if (pscat == 'questiontype') { sopt('questiontype','Question Type'); }
  951:      else if (pscat == 'lenient')      { sopt('lenient','Lenient Grading (Partial Credit)'); }
  952:      else if (pscat == 'ip')           { sopt('ip','IP Number/Name'); }
  953:      else if (pscat == 'fileext')      { sopt('fileext','File Extension'); }
  954:      else if (pscat == 'useslots')     { sopt('useslots','Slots control access'); }
  955:      else { pscat = 'any'; }
  956:      sopt('any','String Value');
  957:   }
  958: 
  959:   if (ptype=='color') {
  960:      sopt('default','Use Default Color');
  961:      sopt('custom','Use Custom Color');
  962:   }
  963: 
  964:   selwrite('</select></form>');
  965:   var targ='parent.opener';
  966:   if (pmodal==1) {
  967:      targ='parent.parent';
  968:   }  
  969:   selwrite('<a href="javascript:parent.assemble();');
  970:   if (preturn!='') {
  971:      selwrite(targ+'.document.'+preturn+'_value.value=parent.window.svalue;');
  972:      selwrite(targ+'.document.'+preturn+'_type.value=parent.window.stype;');
  973:   }
  974:   if (pmarker!='') {
  975:      selwrite(targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
  976:   }
  977:   if (pcode!='') {
  978:      selwrite(targ+'.'+pcode+'();');
  979:   }
  980:   selwrite('">Save</a>&nbsp;&nbsp;');
  981: 
  982:   selwrite('<a href="javascript:');
  983:   selwrite(targ+'.document.'+preturn+'_value.value='+"'';");
  984:   if (pmarker!='') {
  985:      selwrite(
  986:      targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
  987:   }
  988:   if (pcode!='') {
  989:      selwrite(targ+'.'+pcode+'();');
  990:   }
  991:   selwrite('">Delete</a>&nbsp;&nbsp;');
  992:  
  993:   selwrite('</body></html>');
  994:   this.window.selector.document.close();
  995:   draw();
  996:   
  997: }
  998: 
  999: // ]]>
 1000: </script>
 1001: </head>
 1002: 
 1003: <frameset rows="120,*" onload="init();">
 1004: <frame name="selector" src="empty.html" />
 1005: <frame name="choices" src="empty.html" />
 1006: </frameset>
 1007: 
 1008: 
 1009: 
 1010: </html>

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