Annotation of rat/client/parameter.html, revision 1.79
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.79 ! raeburn 8: // $Id: parameter.html,v 1.78 2018/11/13 03:59:12 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>');
1.79 ! raeburn 195: }
1.2 www 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: }
1.79 ! raeburn 246:
! 247:
1.2 www 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") {
1.79 ! raeburn 457: var possip = items[j].value;
1.73 raeburn 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.]+$/;
1.79 ! raeburn 517: var sform=choices.document.forms.sch;
1.72 raeburn 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.79 ! raeburn 552: }
1.68 raeburn 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');
1.79 ! raeburn 791: choicewrite('</table>');
1.6 www 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.79 ! raeburn 1060: choicewrite('</td></tr></table>');
1.6 www 1061: }
1.78 raeburn 1062: if (pscat=='deeplink') {
1063: tablestart('Deep-linked items');
1064: choicewrite('<tr><td>Value:</td><td colspan="2">');
1065: choicewrite('<label><input name="stringval" value="full"'+
1066: ' type="radio" '+callradiostringeval('full'));
1067: if (svalue=='full') { choicewrite(' checked="checked"'); }
1068: choicewrite(' /> Displayed (linked) in Contents and Grades.</label><br />');
1069: choicewrite('<label><input name="stringval" value="absent"'+
1070: ' type="radio" '+callradiostringeval('absent'));
1071: if (svalue=='absent') { choicewrite(' checked="checked"'); }
1072: choicewrite(' /> Not displayed in Contents or Grades.</label><br />');
1073: choicewrite('<label><input name="stringval" value="grades"'+
1074: ' type="radio" '+callradiostringeval('grades'));
1075: if (svalue=='grades') { choicewrite(' checked="checked"'); }
1076: choicewrite(' /> Displayed in Grades only.</label><br />');
1077: choicewrite('<label><input name="stringval" value="details"'+
1078: ' type="radio" '+callradiostringeval('details'));
1079: if (svalue=='details') { choicewrite(' checked="checked"'); }
1080: choicewrite(' /> Displayed (unlinked) in Contents and Grades.</label><br />');
1081: choicewrite('<label><input name="stringval" value="datestatus"'+
1082: ' type="radio" '+callradiostringeval('datestatus'));
1083: if (svalue=='datestatus') { choicewrite(' checked="checked"'); }
1084: choicewrite(' /> Displayed (with date status) but unlinked in Contents and Grades.</label><br />');
1085: choicewrite('</td></tr></table>');
1086: }
1.21 www 1087: }
1.79 ! raeburn 1088:
1.21 www 1089: if (ptype=='color') {
1090: tablestart('Choose a Color');
1091: choicewrite('<table>');
1092: if (svalue) {
1.23 www 1093: choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
1.46 albertel 1094: escapeHTML(svalue)+'" colspan="2"> </td></tr>');
1.21 www 1095: }
1.23 www 1096: for (var ir=0; ir<=10; ir++) {
1097: for (var ig=0; ig<=10; ig++) {
1.21 www 1098: choicewrite('<tr>');
1.23 www 1099: for (var ib=0; ib<=10; ib++) {
1.21 www 1100: colorfield(ir,ig,ib);
1101: }
1102: choicewrite('</tr>');
1.79 ! raeburn 1103: }
1.21 www 1104: }
1105: choicewrite('</table></td></table>');
1.1 www 1106: }
1107:
1.40 albertel 1108: choicewrite('</form>');
1.1 www 1109: choiceend();
1110: }
1111:
1112: function sopt(va,text) {
1113: selwrite('<option value="'+va+'"');
1.2 www 1114: if (va==pscat) {
1.54 bisitz 1115: selwrite(' selected="selected"');
1.1 www 1116: }
1117: selwrite('>'+text+'</option>');
1118: }
1119:
1120: function catchange() {
1121: var sform=selector.document.forms.fsel.fcat;
1.2 www 1122: pscat=sform.options[sform.selectedIndex].value;
1.1 www 1123: draw();
1124: }
1125:
1.76 raeburn 1126: function recursechange() {
1127: var rform=selector.document.forms.frec;
1128: var count = rform.recurse.length;
1129: if (count > 0) {
1130: for (var i=0; i<count; i++) {
1131: if (rform.recurse[i].checked) {
1132: var colnum = pnonreccol;
1133: if (rform.recurse[i].value == 1) {
1134: colnum++;
1135: }
1.79 ! raeburn 1136: pmarker = pmarkerst+'_'+pparm+'&'+colnum;
1.76 raeburn 1137: }
1138: }
1139: }
1140: }
1141:
1.1 www 1142: function assemble() {
1.2 www 1143: if ((ptype=='date') && (pscat!='interval')) {
1.41 www 1144: svalue=Math.floor(cdate.getTime()/1000);
1.2 www 1145: }
1.12 www 1146: if (ptype=='tolerance') {
1147: if (pscat=='relative_sym') {
1148: svalue=choices.document.forms.sch.val2.value+'%';
1149: if (choices.document.forms.sch.val3.checked) {
1150: svalue+='+';
1151: }
1152: }
1153: if (pscat=='absolute_sym') {
1154: svalue=choices.document.forms.sch.val2.value;
1155: if (choices.document.forms.sch.val3.checked) {
1156: svalue+='+';
1157: }
1158: }
1159: if (pscat=='absolute') {
1160: svalue=choices.document.forms.sch.val2.value;
1161: if (choices.document.forms.sch.val3.checked) {
1162: svalue+='+';
1163: }
1164: svalue+=','+choices.document.forms.sch.val4.value;
1165: if (choices.document.forms.sch.val5.checked) {
1166: svalue+='+';
1167: }
1168: }
1169: if (pscat=='relative') {
1170: svalue=choices.document.forms.sch.val2.value+'%';
1171: if (choices.document.forms.sch.val3.checked) {
1172: svalue+='+';
1173: }
1174: svalue+=','+choices.document.forms.sch.val4.value+'%';
1175: if (choices.document.forms.sch.val5.checked) {
1176: svalue+='+';
1177: }
1178: }
1.14 www 1179: }
1180: if ((ptype=='int') && (pscat=='range')) {
1181: svalue=choices.document.forms.sch.val2.value+','+
1182: choices.document.forms.sch.val4.value;
1.12 www 1183: }
1.6 www 1184: if (pscat=='default') { svalue=''; }
1.2 www 1185: stype=ptype+'_'+pscat;
1.1 www 1186: }
1187:
1188:
1189: function init() {
1190: var i;
1.2 www 1191: var subs=new Array();
1.71 raeburn 1192: var doneRegExp = /_done(|\:[^\:]+\:)/;
1193: var doneproctorRegExp = /_done(|\:[^\:]+\:)_proctor/;
1.70 raeburn 1194: var proctorkeyRegExp = /^(\d+)_(.+)$/;
1.71 raeburn 1195: var donetextRegExp = /\:([^\:]+)\:/;
1.79 ! raeburn 1196: var markerRegExp = /^(.+)_([A-Za-z0-9]+)\&(\d+)$/;
1.1 www 1197: var namevalue=this.window.location.search.split('&');
1198: namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
1199:
1200: for (i=0;i<namevalue.length;i++) {
1201: var pair=namevalue[i].split('=');
1.3 www 1202: pair[1]=unescape(pair[1]);
1.1 www 1203: if (pair[0]=='value') { pvalue=pair[1]; }
1.2 www 1204: if (pair[0]=='type') { subs=pair[1].split('_');
1205: ptype=subs[0];
1206: pscat=subs[1];
1.79 ! raeburn 1207: if (typeof(subs[2])!="undefined") {
! 1208: pscat+='_'+subs[2];
1.11 www 1209: }
1.79 ! raeburn 1210: if ((pscat=='') || (typeof(pscat)=="undefined")) {
1.6 www 1211: pscat='default';
1212: }
1.2 www 1213: }
1.1 www 1214: if (pair[0]=='return') { preturn=pair[1]; }
1215: if (pair[0]=='call') { pcode=pair[1]; }
1.2 www 1216: if (pair[0]=='marker') { pmarker=pair[1]; }
1.1 www 1217: if (pair[0]=='name') { pname=pair[1]; }
1.63 www 1218: if (pair[0]=='modal') { pmodal=pair[1]; }
1.34 albertel 1219: if (pair[0]=='defhour' && pair[1] >= 0 && pair[1] < 24 ) {
1220: defhour=pair[1];
1221: }
1222: if (pair[0]=='defmin' && pair[1] >= 0 && pair[1] < 60) { defmin=pair[1]; }
1223: if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; }
1.1 www 1224: }
1225:
1.79 ! raeburn 1226: var tablecol = '';
1.76 raeburn 1227: var ismap = '';
1228: if (markerRegExp.test(pmarker)) {
1229: var markerinfo = pmarker.match(markerRegExp);
1230: if (markerinfo.length == 4) {
1231: pmarkerst = markerinfo[1];
1232: pparm = markerinfo[2];
1.79 ! raeburn 1233: tablecol = markerinfo[3];
1.76 raeburn 1234: if (tablecol == 17 || tablecol == 16) {
1235: ismap = 1;
1236: if (tablecol == 17) {
1237: precursive = 1;
1238: }
1239: pnonreccol = 16;
1.79 ! raeburn 1240: } else if (tablecol == 11 || tablecol == 10) {
1.76 raeburn 1241: ismap = 1;
1242: if (tablecol == 11) {
1243: precursive = 1;
1244: }
1245: pnonreccol = 10;
1246: } else if (tablecol == 7 || tablecol == 6) {
1247: ismap = 1;
1248: if (tablecol == 7) {
1249: precursive = 1;
1250: }
1251: pnonreccol = 6;
1252: } else if (tablecol == 3 || tablecol == 2) {
1253: ismap = 1;
1254: if (tablecol == 3) {
1255: precursive = 1;
1256: }
1257: pnonreccol = 2;
1258: }
1259: }
1260: }
1261:
1262:
1.68 raeburn 1263: if (ptype=='date' && pscat == 'interval') {
1.70 raeburn 1264: if (doneproctorRegExp.test(pvalue)) {
1.71 raeburn 1265: var current = pvalue.match(doneproctorRegExp);
1266: if (current.length == 2) {
1267: var textstr = current[1];
1268: if (textstr != '') {
1269: var textvals = textstr.match(donetextRegExp);
1270: if (textvals.length == 2) {
1271: pextravaltwo = textvals[1];
1272: }
1273: }
1274: }
1.70 raeburn 1275: var intervalwithkey = pvalue.replace(doneproctorRegExp,'');
1276: if (proctorkeyRegExp.test(intervalwithkey)) {
1277: var currvals = intervalwithkey.match(proctorkeyRegExp);
1278: if (currvals.length == 3) {
1279: pvalue = currvals[1];
1280: pextraval = currvals[2];
1.71 raeburn 1281: pmodval = '_done_proctor';
1.70 raeburn 1282: } else {
1283: pmodval = '';
1284: }
1285: }
1286: } else {
1287: if (doneRegExp.test(pvalue)) {
1.79 ! raeburn 1288: var current = pvalue.match(doneRegExp);
1.71 raeburn 1289: if (current.length == 2) {
1290: var textstr = current[1];
1291: if (textstr != '') {
1292: var textvals = textstr.match(donetextRegExp);
1293: if (textvals.length == 2) {
1294: pextravaltwo = textvals[1];
1295: }
1296: }
1297: }
1.70 raeburn 1298: var pnumval = pvalue.replace(doneRegExp,'');
1.71 raeburn 1299: pmodval = '_done';
1.70 raeburn 1300: pvalue = pnumval;
1301: }
1.68 raeburn 1302: }
1303: }
1.1 www 1304: svalue=pvalue;
1.6 www 1305: if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
1.79 ! raeburn 1306: (pscat=='default') &&
! 1307: (typeof(svalue)!="undefined") &&
1.11 www 1308: (svalue!=0) && (svalue!='')) { pscat='any'; }
1.1 www 1309:
1.13 www 1310: if (ptype=='tolerance') {
1311: var tperc=0;
1312: var trange=0;
1313: if (typeof(svalue)!='undefined') {
1314: if (svalue.indexOf('%')!=-1) { tperc=1; }
1315: if (svalue.indexOf(',')!=-1) { trange=1; }
1316: if (trange) {
1317: if (tperc) { pscat='relative'; } else { pscat='absolute'; }
1318: } else {
1319: if (tperc) { pscat='relative_sym'; } else { pscat='absolute_sym'; }
1320: }
1321: }
1322: }
1323:
1.61 raeburn 1324: this.window.selector.document.open();
1.62 raeburn 1325: selwrite('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
1326: selwrite('<html xmlns="http://www.w3.org/1999/xhtml">');
1.55 bisitz 1327: selwrite('<head>');
1.62 raeburn 1328: selwrite('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
1329: selwrite('<title>LON-CAPA</title>');
1.55 bisitz 1330: selwrite('<style type="text/css">');
1331: selwrite('<!--');
1332: selwrite('body {');
1333: selwrite('font-family: Verdana,Arial,Helvetica,sans-serif;');
1334: selwrite('line-height:130%;');
1335: selwrite('font-size:0.83em;');
1336: selwrite('background: #FFFFFF;');
1337: selwrite('}');
1338: selwrite('-->');
1339: selwrite('</style>');
1340: selwrite('</head>');
1.62 raeburn 1341: selwrite('<body>');
1342: selwrite('<form name="fsel" action=""><b>'+pname+'</b><br />');
1.66 bisitz 1343: selwrite('Format of Value(s): <select name="fcat" onchange="parent.catchange();">');
1.12 www 1344:
1.1 www 1345: if (ptype=='tolerance') {
1346: sopt('default','Default');
1347: sopt('relative_sym','Relative Tolerance, Symmetric (percent)');
1348: sopt('relative','Relative Tolerance (percentages)');
1349: sopt('absolute_sym','Absolute Tolerance, Symmetric (value)');
1350: sopt('absolute','Absolute Tolerance (values)');
1351: }
1352:
1353: if (ptype=='date') {
1.48 albertel 1354: if (pscat != 'interval') {
1355: sopt('default','Default');
1356: sopt('start','Starting Date');
1357: sopt('end','Ending Date');
1358: } else {
1359: sopt('interval','Time Interval');
1360: }
1361:
1.11 www 1362: if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
1.2 www 1363: cdate.setTime(pvalue*1000);
1.30 www 1364: } else {
1.31 www 1365: cdate.setSeconds(defsec);
1366: cdate.setMinutes(defmin);
1367: cdate.setHours(defhour);
1.2 www 1368: }
1369:
1370: months[0]='January';
1371: months[1]='February';
1372: months[2]='March';
1373: months[3]='April';
1374: months[4]='May';
1375: months[5]='June';
1376: months[6]='July';
1377: months[7]='August';
1378: months[8]='September';
1379: months[9]='October';
1380: months[10]='November';
1381: months[11]='December';
1.1 www 1382: }
1.79 ! raeburn 1383:
1.6 www 1384: if (ptype=='int') {
1385: sopt('default','Default');
1386: sopt('pos','Positive Integer, Not Zero');
1387: sopt('zeropos','Positive Integer or Zero');
1.13 www 1388: sopt('inrange','Integer in Range');
1389: sopt('range','Range of Integers');
1.6 www 1390: sopt('any','Integer');
1.1 www 1391: }
1392:
1.6 www 1393: if (ptype=='float') {
1394: sopt('default','Default');
1395: sopt('zeroone','Floating Point between 0 and 1');
1396: sopt('pos','Positive Floating Point');
1397: sopt('any','Floating Point');
1.1 www 1398:
1399: }
1400:
1.6 www 1401: if (ptype=='string') {
1.44 albertel 1402: //sopt('default','Default');
1403: if (pscat == 'yesno') { sopt('yesno','Yes/No'); }
1.47 albertel 1404: else if (pscat == 'problemstatus'){ sopt('problemstatus','Problem Status'); }
1.45 albertel 1405: else if (pscat == 'examtype') { sopt('examtype','Exam Type'); }
1406: else if (pscat == 'questiontype') { sopt('questiontype','Question Type'); }
1.60 raeburn 1407: else if (pscat == 'lenient') { sopt('lenient','Lenient Grading (Partial Credit)'); }
1.64 raeburn 1408: else if (pscat == 'discussvote') { sopt('discussvote','Discussion Voting'); }
1.45 albertel 1409: else if (pscat == 'ip') { sopt('ip','IP Number/Name'); }
1410: else if (pscat == 'fileext') { sopt('fileext','File Extension'); }
1411: else if (pscat == 'useslots') { sopt('useslots','Slots control access'); }
1.78 raeburn 1412: else if (pscat == 'deeplink') { sopt('deeplink','Deep-linked items'); }
1.45 albertel 1413: else { pscat = 'any'; }
1.28 albertel 1414: sopt('any','String Value');
1.22 www 1415: }
1416:
1417: if (ptype=='color') {
1418: sopt('default','Use Default Color');
1419: sopt('custom','Use Custom Color');
1.1 www 1420: }
1421:
1422: selwrite('</select></form>');
1.77 raeburn 1423: if (ismap == 1) {
1.76 raeburn 1424: if ((pparm != 'hiddenresource') && (pparm != 'encrypturl')) {
1425: selwrite('<form name="frec" action="">');
1426: selwrite('Recursive: <label><input type="radio" name="recurse" value="1" ');
1427: if (precursive == 1) {
1428: selwrite('checked="checked" ');
1429: }
1430: selwrite('onclick="parent.recursechange();" />Yes</label> ');
1431: selwrite('<label><input type="radio" name="recurse" value="0" ');
1432: if (precursive != 1) {
1433: selwrite('checked="checked" ');
1434: }
1435: selwrite('onclick="parent.recursechange();" />No</label>');
1436: selwrite('</form><br />');
1437: }
1438: }
1.63 www 1439: var targ='parent.opener';
1440: if (pmodal==1) {
1441: targ='parent.parent';
1.70 raeburn 1442: }
1443: if ((ptype=='date') && (pscat=='interval')) {
1444: selwrite('<a href="javascript:parent.validateInterval();');
1445: } else {
1446: selwrite('<a href="javascript:parent.assemble();');
1447: }
1.1 www 1448: if (preturn!='') {
1.63 www 1449: selwrite(targ+'.document.'+preturn+'_value.value=parent.window.svalue;');
1450: selwrite(targ+'.document.'+preturn+'_type.value=parent.window.stype;');
1.2 www 1451: }
1452: if (pmarker!='') {
1.63 www 1453: selwrite(targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.1 www 1454: }
1455: if (pcode!='') {
1.63 www 1456: selwrite(targ+'.'+pcode+'();');
1.1 www 1457: }
1.43 albertel 1458: selwrite('">Save</a> ');
1.5 www 1459:
1460: selwrite('<a href="javascript:');
1.63 www 1461: selwrite(targ+'.document.'+preturn+'_value.value='+"'';");
1.5 www 1462: if (pmarker!='') {
1463: selwrite(
1.63 www 1464: targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.5 www 1465: }
1466: if (pcode!='') {
1.63 www 1467: selwrite(targ+'.'+pcode+'();');
1.5 www 1468: }
1469: selwrite('">Delete</a> ');
1.4 www 1470:
1.1 www 1471: selwrite('</body></html>');
1472: this.window.selector.document.close();
1.2 www 1473: draw();
1.1 www 1474:
1475: }
1476:
1.56 raeburn 1477: // ]]>
1.1 www 1478: </script>
1.56 raeburn 1479: </head>
1.1 www 1480:
1.76 raeburn 1481: <frameset rows="125,*" onload="init();">
1.56 raeburn 1482: <frame name="selector" src="empty.html" />
1483: <frame name="choices" src="empty.html" />
1.1 www 1484: </frameset>
1485:
1486:
1487:
1.16 albertel 1488: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>