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