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