Annotation of rat/client/parameter.html, revision 1.88
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.88 ! raeburn 8: // $Id: parameter.html,v 1.87 2022/05/24 16:23:04 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='';
1.85 raeburn 48: var psmap='';
1.2 www 49: var pmarker='';
1.63 www 50: var pmodal='';
1.1 www 51: var pname='';
1.76 raeburn 52: var precursive='';
53: var pnonreccol='';
54: var pmarkerst='';
55: var pparm='';
1.80 raeburn 56: var pextra='';
1.1 www 57:
1.31 www 58: var defhour=0;
59: var defmin=0;
60: var defsec=0;
61:
1.1 www 62: var svalue;
1.2 www 63: var stype;
64: var smarker;
1.1 www 65:
66: var vars=new Array();
67:
1.2 www 68: var cdate=new Date();
69:
70: var csec;
71: var cmin;
72: var chour;
73: var cday;
74:
75: var months=new Array();
76:
77:
1.1 www 78: function selwrite(text) {
79: this.window.selector.document.write(text);
80: }
81:
82: function choicestart() {
1.61 raeburn 83: this.window.choices.document.open();
1.62 raeburn 84: choicewrite('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
85: choicewrite('<html xmlns="http://www.w3.org/1999/xhtml">');
1.55 bisitz 86: choicewrite('<head>');
1.62 raeburn 87: choicewrite('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
88: choicewrite('<title>LON-CAPA</title>');
1.55 bisitz 89: choicewrite('<style type="text/css">');
90: choicewrite('<!--');
91: choicewrite('body {');
92: choicewrite('font-family: Verdana,Arial,Helvetica,sans-serif;');
93: choicewrite('line-height:130%;');
94: choicewrite('font-size:0.83em;');
95: choicewrite('background: #FFFFFF;');
96: choicewrite('}');
97: choicewrite('table.LC_parmsel_table {font-size: 90%;}');
98: choicewrite('table.LC_parmsel_table tr td { padding: 5px; border: 1px solid #C8C8C8;}');
99: choicewrite('-->');
100: choicewrite('</style>');
101: choicewrite('</head>');
1.62 raeburn 102: choicewrite('<body>');
1.1 www 103: }
104:
105: function choiceend() {
106: choicewrite('</body></html>');
107: this.window.choices.document.close();
108: }
109:
110: function choicewrite(text) {
111: this.window.choices.document.write(text);
112: }
113:
114: function tablestart(headtext) {
1.55 bisitz 115: choicewrite('<table class="LC_parmsel_table"><tr bgcolor="#C5DB99"><th colspan="3">'+
1.1 www 116: headtext+'</th></tr>');
117: }
118:
119: function valline(text,id1,id2) {
1.52 bisitz 120: choicewrite('<tr><td>'+text+
1.51 bisitz 121: '</td><td><input type="text" size="4" name="val'+
1.53 bisitz 122: id1+'" /></td><td>incl:<input type="checkbox" name="val'+
123: id2+'" /></td></tr>');
1.1 www 124: }
125:
1.46 albertel 126: function escapeHTML(text) {
127: text = text.replace(/&/g, '&');
128: text = text.replace(/"/g, '"');
129: text = text.replace(/</g, '<');
130: text = text.replace(/>/g, '>');
131: return text;
132: }
133:
1.2 www 134: function datecalc() {
135: var sform=choices.document.forms.sch;
136:
137: cdate.setHours(sform.hours.options[sform.hours.selectedIndex].value);
138: cdate.setMinutes(sform.minutes.options[sform.minutes.selectedIndex].value);
139: cdate.setSeconds(sform.minutes.options[sform.seconds.selectedIndex].value);
140: cdate.setDate(sform.date.options[sform.date.selectedIndex].value);
141: cdate.setMonth(sform.month.options[sform.month.selectedIndex].value);
142: cdate.setFullYear(sform.year.options[sform.year.selectedIndex].value);
143:
144: draw();
145: }
146:
147: function hour() {
148: var thishour=cdate.getHours();
149: var i; var j;
1.53 bisitz 150: choicewrite('<select name="hours" onchange="parent.datecalc();">');
1.2 www 151: for (i=0;i<=23;i++) {
1.54 bisitz 152: choicewrite('<option value="'+i+'"');
1.2 www 153: if (i==thishour) {
1.54 bisitz 154: choicewrite(' selected="selected"');
1.2 www 155: }
156: choicewrite('>');
157: if (i==12) { choicewrite('noon'); } else {
158: if (i==0) { choicewrite('midnight') } else {
159:
160: if (i<12) { choicewrite(i+' am'); } else {
161: j=i-12; choicewrite(j+' pm');
162: }
163:
164: }
165: }
166: choicewrite('</option>');
167: }
168: choicewrite('</select>');
169: }
170:
171: function minute() {
172: var thisminutes=cdate.getMinutes();
173: var i;
1.53 bisitz 174: choicewrite('<select name="minutes" onchange="parent.datecalc();">');
1.2 www 175: for (i=0;i<=59;i++) {
1.54 bisitz 176: choicewrite('<option value="'+i+'"');
1.2 www 177: if (i==thisminutes) {
1.54 bisitz 178: choicewrite(' selected="selected"');
1.2 www 179: }
180: choicewrite('>'+i+'</option>');
181: }
182: choicewrite('</select>');
183: }
184:
185: function second() {
186: var thisseconds=cdate.getSeconds();
187: var i;
1.53 bisitz 188: choicewrite('<select name="seconds" onchange="parent.datecalc();">');
1.2 www 189: for (i=0;i<=59;i++) {
1.54 bisitz 190: choicewrite('<option value="'+i+'"');
1.2 www 191: if (i==thisseconds) {
1.54 bisitz 192: choicewrite(' selected="selected"');
1.2 www 193: }
194: choicewrite('>'+i+'</option>');
195: }
196: choicewrite('</select>');
1.79 raeburn 197: }
1.2 www 198:
199:
200: function date() {
201: var thisdate=cdate.getDate();
202: var i;
1.53 bisitz 203: choicewrite('<select name="date" onchange="parent.datecalc();">');
1.2 www 204: for (i=1;i<=31;i++) {
1.54 bisitz 205: choicewrite('<option value="'+i+'"');
1.2 www 206: if (i==thisdate) {
1.54 bisitz 207: choicewrite(' selected="selected"');
1.2 www 208: }
209: choicewrite('>'+i+'</option>');
210: }
211: choicewrite('</select>');
212: }
213:
214: function year() {
215: var thisyear=cdate.getFullYear();
1.19 www 216: var nowdate=new Date();
217: var nowyear=nowdate.getFullYear();
1.33 albertel 218: if ( !thisyear ) { thisyear=nowyear; }
1.19 www 219: var loweryear=thisyear-2;
220: var upperyear=thisyear+5;
221: if (thisyear>nowyear) { loweryear=nowyear-2; }
222: if (thisyear<nowyear) { upperyear=nowyear+5; }
1.2 www 223: var i;
1.53 bisitz 224: choicewrite('<select name="year" onchange="parent.datecalc();">');
1.19 www 225: for (i=loweryear;i<=upperyear;i++) {
1.54 bisitz 226: choicewrite('<option value="'+i+'"');
1.2 www 227: if (i==thisyear) {
1.54 bisitz 228: choicewrite(' selected="selected"');
1.2 www 229: }
230: choicewrite('>'+i+'</option>');
231: }
232: choicewrite('</select>');
233: }
234:
235: function month() {
236: var thismonth=cdate.getMonth();
237: var i;
1.53 bisitz 238: choicewrite('<select name="month" onchange="parent.datecalc();">');
1.2 www 239: for (i=0;i<=11;i++) {
1.54 bisitz 240: choicewrite('<option value="'+i+'"');
1.2 www 241: if (i==thismonth) {
1.54 bisitz 242: choicewrite(' selected="selected"');
1.2 www 243: }
244: choicewrite('>'+months[i]+'</option>');
245: }
246: choicewrite('</select>');
247: }
1.79 raeburn 248:
249:
1.2 www 250: function intminute() {
251: var thisminutes=cmins;
252: var i;
1.69 musolffc 253: var result = '';
254: result += '<select name="minutes" onchange="parent.intcalc();">';
1.2 www 255: for (i=0;i<=59;i++) {
1.69 musolffc 256: result += '<option value="'+i+'"';
1.2 www 257: if (i==thisminutes) {
1.69 musolffc 258: result += ' selected="selected"';
1.2 www 259: }
1.69 musolffc 260: result += '>'+i+'</option>';
1.2 www 261: }
1.69 musolffc 262: result += '</select>';
263: return result;
1.2 www 264: }
265:
266: function inthour() {
267: var thishours=chours;
268: var i;
1.69 musolffc 269: var result = '';
270: result += '<select name="hours" onchange="parent.intcalc();">';
1.2 www 271: for (i=0;i<=23;i++) {
1.69 musolffc 272: result += '<option value="'+i+'"';
1.2 www 273: if (i==thishours) {
1.69 musolffc 274: result += ' selected="selected"';
1.2 www 275: }
1.69 musolffc 276: result += '>'+i+'</option>';
1.2 www 277: }
1.69 musolffc 278: result += '</select>';
279: return result;
1.71 raeburn 280: }
1.2 www 281:
282: function intsecond() {
1.69 musolffc 283: var thisseconds=csecs;
1.2 www 284: var i;
1.69 musolffc 285: var result = '';
286: result += '<select name="seconds" onchange="parent.intcalc();">';
1.2 www 287: for (i=0;i<=59;i++) {
1.69 musolffc 288: result += '<option value="'+i+'"';
1.2 www 289: if (i==thisseconds) {
1.69 musolffc 290: result += ' selected="selected"';
1.2 www 291: }
1.69 musolffc 292: result += '>'+i+'</option>';
1.2 www 293: }
1.69 musolffc 294: result += '</select>';
295: return result;
1.2 www 296: }
297:
298:
299: function intday() {
300: var thisdate=cdays;
301: var i;
1.69 musolffc 302: var result ='';
303: result += '<select name="date" onchange="parent.intcalc();">';
1.2 www 304: for (i=0;i<=31;i++) {
1.69 musolffc 305: result += '<option value="'+i+'"';
1.2 www 306: if (i==thisdate) {
1.69 musolffc 307: result += ' selected="selected"';
1.2 www 308: }
1.69 musolffc 309: result += '>'+i+'</option>';
1.2 www 310: }
1.69 musolffc 311: result += '</select>';
312: return result;
1.2 www 313: }
314:
315: function intcalc() {
316: var sform=choices.document.forms.sch;
317: svalue=((sform.date.options[sform.date.selectedIndex].value*24+
318: sform.hours.options[sform.hours.selectedIndex].value*1)*60+
319: sform.minutes.options[sform.minutes.selectedIndex].value*1)*60+
320: sform.seconds.options[sform.seconds.selectedIndex].value*1;
1.68 raeburn 321: if ((ptype=='date') && (pscat=='interval')) {
322: var newpmodval = '';
1.70 raeburn 323: var newpextraval = '';
1.71 raeburn 324: var newpextravaltwo = 'Done';
1.68 raeburn 325: if (sform.donebutton.length) {
326: for (var i=0; i<sform.donebutton.length; i++) {
327: if (sform.donebutton[i].checked) {
328: if (sform.donebutton[i].value == '_done') {
329: newpmodval = sform.donebutton[i].value;
1.71 raeburn 330: newpextravaltwo = sform.donebutton_text.value;
1.70 raeburn 331: } else {
332: if (sform.donebutton[i].value == '_done_proctor') {
333: newpmodval = sform.donebutton[i].value;
334: newpextraval = sform.donebutton_proctorkey.value;
1.71 raeburn 335: newpextravaltwo = sform.donebutton_text.value;
336: newpextravaltwo = newpextravaltwo.replace(/:/g,'');
1.70 raeburn 337: }
1.68 raeburn 338: }
339: }
340: }
341: }
342: pmodval = newpmodval;
1.70 raeburn 343: pextraval = newpextraval;
1.71 raeburn 344: pextravaltwo = newpextravaltwo;
1.68 raeburn 345: draw();
346: if (pmodval) {
1.71 raeburn 347: var doneRegExp = /^(_done)(|_proctor)$/;
348: var donevals = pmodval.match(doneRegExp);
349: if (donevals.length == 3) {
350: svalue += donevals[1];
351: }
352: if (newpextravaltwo) {
353: if (newpextravaltwo != 'Done') {
354: svalue += ':'+newpextravaltwo+':';
355: }
356: }
357: if (donevals[2] != '') {
358: svalue += donevals[2];
359: if (pextraval != '') {
360: svalue += '_'+pextraval;
361: }
362: }
1.70 raeburn 363: }
1.68 raeburn 364: } else {
365: draw();
366: }
1.2 www 367: }
368:
1.70 raeburn 369: function toggleSecret() {
370: var sform=choices.document.forms.sch;
371: if (sform.donebutton.length) {
372: for (var i=0; i<sform.donebutton.length; i++) {
373: if (sform.donebutton[i].checked) {
1.71 raeburn 374: if (sform.donebutton[i].value == '') {
375: if (document.getElementById('donebuttontextdiv')) {
376: document.getElementById('donebuttontextdiv').style.display='none';
377: }
378: } else {
379: if (document.getElementById('donebuttontextdiv')) {
380: document.getElementById('donebuttontextdiv').style.display='block';
381: }
382: }
1.70 raeburn 383: if (sform.donebutton[i].value == '_done_proctor') {
384: if (document.getElementById('done_proctorkey')) {
385: document.getElementById('done_proctorkey').type='text';
386: }
387: } else {
388: if (document.getElementById('done_proctorkey')) {
389: document.getElementById('done_proctorkey').type='hidden';
390: document.getElementById('done_proctorkey').value='';
391: }
392: }
393: }
394: }
395: }
396: }
397:
398: function validateInterval() {
399: var sform=choices.document.forms.sch;
400: if (sform.donebutton.length) {
401: for (var i=0; i<sform.donebutton.length; i++) {
402: if (sform.donebutton[i].checked) {
403: if (sform.donebutton[i].value == '_done_proctor') {
1.88 ! raeburn 404: var keyval = sform.donebutton_proctorkey.value;
! 405: if ((keyval == '') || (typeof(keyval) == 'undefined')) {
1.84 raeburn 406: alert('Please enter a key for a proctor to enter when a student uses the "Done" button.');
1.70 raeburn 407: return;
408: }
409: }
410: }
411: }
412: }
413: intcalc();
414: assemble();
415: }
416:
1.80 raeburn 417: function validateDeepLink() {
418: var sform=choices.document.forms.sch;
1.86 raeburn 419: svalue = sform.deeplinkstate.options[sform.deeplinkstate.selectedIndex].value+',';
420: svalue += sform.deeplinkothers.options[sform.deeplinkothers.selectedIndex].value+',';
421: svalue += sform.deeplinklisted.options[sform.deeplinklisted.selectedIndex].value+',';
1.80 raeburn 422: svalue += sform.deeplinkacc.options[sform.deeplinkacc.selectedIndex].value+',';
1.84 raeburn 423: var keyRegExp = /^[a-zA-Z\d_.!@#$%^&*()+=-]+$/;
424: var numRegExp = /^\d+$/;
1.86 raeburn 425: if (sform.deeplinkprotect.length) {
426: for (var i=0; i<sform.deeplinkprotect.length; i++) {
427: if (sform.deeplinkprotect[i].checked) {
428: svalue += sform.deeplinkprotect[i].value;
429: if (sform.deeplinkprotect[i].value == 'key') {
1.80 raeburn 430: var posskey = sform.deeplinkkey.value;
431: posskey = posskey.replace(/^\s+|\s+$/g,'');
432: if (keyRegExp.test(posskey)) {
433: svalue += ':'+posskey;
1.84 raeburn 434: } else {
435: alert('Please enter a value for the key containing one or more of: a-zA-Z0-9_.!@#$%^&*()+=-\n'+
436: 'or choose a different supported link type.');
437: return;
1.80 raeburn 438: }
1.86 raeburn 439: } else if (sform.deeplinkprotect[i].value == 'ltic') {
440: var possltic = sform.linkpossltic.options[sform.linkpossltic.selectedIndex].value;
441: if ((numRegExp.test(possltic)) && (possltic > 0)) {
442: svalue += ':'+possltic;
443: } else {
444: alert('Please select an LTI launcher, or choose a different supported link type.');
445: return;
446: }
447: } else if (sform.deeplinkprotect[i].value == 'ltid') {
448: var possltid = sform.linkpossltid.options[sform.linkpossltid.selectedIndex].value;
449: if ((numRegExp.test(possltid)) && (possltid > 0)) {
450: svalue += ':'+possltid;
1.84 raeburn 451: } else {
452: alert('Please select an LTI launcher, or choose a different supported link type.');
453: return;
454: }
455: }
456: break;
457: }
458: }
459: }
460: svalue += ',';
461: if (sform.deeplinkmenus.length) {
462: for (var i=0; i<sform.deeplinkmenus.length; i++) {
463: if (sform.deeplinkmenus[i].checked) {
464: if (sform.deeplinkmenus[i].value == 'std') {
465: svalue += '0';
466: } else if (sform.deeplinkmenus[i].value == 'collnum') {
467: var posscoll = sform.linkpossmenu.options[sform.linkpossmenu.selectedIndex].value;
468: if ((numRegExp.test(posscoll)) && (posscoll > 0)) {
469: svalue += posscoll;
470: } else {
471: alert("Please select either a numbered collection or check 'Standard (all menus)'.");
472: return;
1.80 raeburn 473: }
474: }
475: break;
476: }
477: }
478: }
1.87 raeburn 479: svalue += ',';
480: svalue += sform.deeplinktarget.options[sform.deeplinktarget.selectedIndex].value;
1.80 raeburn 481: assemble();
482: }
483:
1.84 raeburn 484: function toggleDeepLink(caller) {
1.80 raeburn 485: var sform=choices.document.forms.sch;
1.86 raeburn 486: if ((caller == 'protect') && (sform.deeplinkprotect.length)) {
1.80 raeburn 487: var frame = window.frames["choices"];
1.86 raeburn 488: for (var i=0; i<sform.deeplinkprotect.length; i++) {
489: if (sform.deeplinkprotect[i].checked) {
490: if (frame.document.getElementById('deeplinkkey')) {
491: if (sform.deeplinkprotect[i].value == 'key') {
1.80 raeburn 492: frame.document.getElementById('deeplinkkey').type='text';
1.86 raeburn 493: } else {
494: frame.document.getElementById('deeplinkkey').type='hidden';
1.80 raeburn 495: }
1.86 raeburn 496: }
497: if (frame.document.getElementById('deeplinklticdiv')) {
498: if (sform.deeplinkprotect[i].value == 'ltic') {
499: frame.document.getElementById('deeplinklticdiv').style.display='block';
500: } else {
501: frame.document.getElementById('deeplinklticdiv').style.display='none';
1.80 raeburn 502: }
1.86 raeburn 503: }
504: if (frame.document.getElementById('deeplinkltiddiv')) {
505: if (sform.deeplinkprotect[i].value == 'ltid') {
506: frame.document.getElementById('deeplinkltiddiv').style.display='block';
507: } else {
508: frame.document.getElementById('deeplinkltiddiv').style.display='none';
1.80 raeburn 509: }
510: }
511: break;
512: }
513: }
514: }
1.84 raeburn 515: if ((caller == 'menus') && (sform.deeplinkmenus.length)) {
516: var frame = window.frames["choices"];
517: for (var i=0; i<sform.deeplinkmenus.length; i++) {
518: if (sform.deeplinkmenus[i].checked) {
519: if (frame.document.getElementById('deeplinkmenusdiv')) {
520: if (sform.deeplinkmenus[i].value == 'collnum') {
521: frame.document.getElementById('deeplinkmenusdiv').style.display='inline-block';
522: } else {
523: frame.document.getElementById('deeplinkmenusdiv').style.display='none';
524: }
525: }
526: break;
527: }
528: }
529: }
1.80 raeburn 530: }
531:
1.84 raeburn 532: function calldeeplink(caller) {
533: return 'onclick="parent.toggleDeepLink(\''+caller+'\')"';
1.80 raeburn 534: }
535:
1.6 www 536: function integereval() {
537: svalue=choices.document.forms.sch.intval.value;
538: svalue=Math.round(svalue);
539: if (pscat=='zeropos') { svalue=Math.abs(svalue); }
540: if ((pscat=='pos') && (svalue==0)) {
541: svalue='';
542: }
1.12 www 543: if (pscat.indexOf('inrange')!=-1) {
1.10 www 544: var rangeparts=new Array;
545: rangeparts=split('_',pscat);
1.12 www 546: rangeparts=split(',',rangeparts[1]);
1.10 www 547: if (svalue<rangeparts[0]) { svalue=rangeparts[0]; }
548: if (svalue>rangeparts[1]) { svalue=rangeparts[1]; }
549: }
1.6 www 550: draw();
551: }
552:
553: function floateval() {
554: svalue=choices.document.forms.sch.floatval.value;
555: svalue=1.0*svalue;
556: if (pscat=='pos') { svalue=Math.abs(svalue); }
557: if ((pscat=='zeroone') && ((svalue<0) || (svalue>1))) {
558: svalue='';
559: }
560: draw();
561: }
562:
563: function stringeval() {
564: svalue=choices.document.forms.sch.stringval.value;
565: draw();
566: }
567:
1.73 raeburn 568: function ipstringeval() {
569: var patternIp = /^([\[\]a-zA-Z\.\d\*\-]+)$/;
570: var acctypes = new Array;
571: acctypes = ['allow','deny'];
572: svalue = '';
573: for (var i=0; i<acctypes.length; i++) {
574: var items = choices.document.getElementsByName('setip'+acctypes[i]);
1.74 raeburn 575: if (items.length > 0) {
1.73 raeburn 576: for (var j=0; j<items.length; j++) {
577: if (items[j].type == "text") {
1.79 raeburn 578: var possip = items[j].value;
1.73 raeburn 579: possip = possip.replace(/^\s+|\s+$/g,'');
580: if (patternIp.test(possip)) {
581: if (acctypes[i] == 'deny') {
582: possip = '!'+possip;
583: }
584: if (svalue == '') {
585: svalue = possip;
586: } else {
587: svalue += ','+possip;
588: }
589: }
590: }
591: }
592: }
593: }
594: }
595:
596: function addIpRule(iptype) {
597: var frame = window.frames["choices"];
598: if (frame.document.getElementById('LC_string_ipacc_inner_'+iptype)) {
599: var innerDiv = frame.document.getElementById('LC_string_ipacc_inner_'+iptype);
600: var count = innerDiv.childNodes.length
601: var ipDiv = frame.document.createElement('div');
602: ipDiv.innerHTML = '<input type="text" size="10" name="setip'+iptype+'" onblur="parent.ipstringeval();" />'+
603: '<a href="#" onclick="parent.removeIpRule(\''+iptype+'\',\''+count+'\')">Remove</a>';
604: frame.document.getElementById('LC_string_ipacc_inner_'+iptype).appendChild(ipDiv);
605: }
606: return false;
607: }
608:
609: function removeIpRule(iptype,num) {
610: var frame = window.frames["choices"];
611: if (frame.document.getElementById('LC_string_ipacc_inner_'+iptype)) {
612: var innerDiv = frame.document.getElementById('LC_string_ipacc_inner_'+iptype);
613: for (var i=0; i<innerDiv.childNodes.length; i++) {
614: if (i==num) {
615: innerDiv.removeChild(innerDiv.childNodes[i]);
616: ipstringeval();
617: break;
618: }
619: }
620: }
621: }
622:
1.25 www 623: function radiostringeval(newval) {
624: svalue=newval;
625: draw();
626: }
627:
1.29 www 628: function callradiostringeval(newval) {
1.67 raeburn 629: return 'onclick="parent.radiostringeval(\''+newval+'\')"';
1.29 www 630: }
631:
1.72 raeburn 632: function lenienteval(newval) {
633: if (newval == 'weighted') {
634: if (document.getElementById('lenientweighteddiv')) {
635: document.getElementById('lenientweighteddiv').style.display='block';
636: }
637: var patternRelWeight = /^\-?[\d.]+$/;
1.79 raeburn 638: var sform=choices.document.forms.sch;
1.88 ! raeburn 639: var relwtlength = sform.lenientrelwt.length;
! 640: if ((relwtlength != '') && (typeof(relwtlength) != 'undefined')) {
1.72 raeburn 641: for (var i=0; i<sform.lenientrelwt.length; i++) {
642: var relweight = sform.lenientrelwt[i].value;
643: relweight = relweight.replace(/^\s+|\s+$/g,'');
644: if (!patternRelWeight.test(relweight)) {
645: if (i<2) {
646: relweight = '1.0';
647: } else {
648: relweight = '0.0';
649: }
650: }
651: sform.lenientrelwt[i].value = relweight;
652: if (i==0) {
653: svalue = relweight;
654: } else {
655: svalue += ','+relweight;
656: }
657: }
658: }
659: } else {
660: if (document.getElementById('lenientweighteddiv')) {
661: document.getElementById('lenientweighteddiv').style.display='none';
662: }
663: svalue=newval;
1.73 raeburn 664: }
1.72 raeburn 665: draw();
666: }
667:
668: function calllenientradioeval(newval) {
669: return 'onclick="parent.lenienteval(\''+newval+'\')"';
670: }
671:
1.68 raeburn 672: function callintervalpmodval() {
1.70 raeburn 673: return 'onclick="parent.intcalc();parent.toggleSecret()"';
1.79 raeburn 674: }
1.68 raeburn 675:
1.2 www 676: function intervaldis() {
677: csecs=svalue;
678: cdays=Math.floor(csecs/86400);
679: csecs-=cdays*86400;
680: chours=Math.floor(csecs/3600);
681: csecs-=chours*3600;
682: cmins=Math.floor(csecs/60);
683: csecs-=cmins*60;
1.69 musolffc 684: return cdays+' days '+chours+' hours '+cmins+' mins '+csecs+' secs';
1.2 www 685: }
1.21 www 686:
687: function pickcolor(picked) {
688: svalue=picked;
689: draw();
690: }
691:
692: function colorfield(ir,ig,ib) {
693: var col=new Array;
1.23 www 694: col=["00","11","22","44","66","88","AA","CC","DD","EE","FF"];
1.21 www 695: var color='#'+col[ir]+col[ig]+col[ib];
1.23 www 696: var selection="<font color='"+color+"'>X</font>";
697: if (color==svalue) { selection="<font color='#"+col[10-ir]+col[10-ig]+col[10-ib]+"'>X</font>"; }
1.21 www 698: choicewrite('<td bgcolor="'+color+'"><a href="javascript:parent.pickcolor('+"'"+
699: color+"'"+')">'+selection+'</a></td>');
1.80 raeburn 700: }
1.21 www 701:
1.1 www 702: function draw() {
703: choicestart();
1.51 bisitz 704: choicewrite('<form name="sch"');
1.6 www 705: if (ptype=='int') {
706: choicewrite(' action="javascript:integereval();"');
707: }
708: if (ptype=='float') {
709: choicewrite(' action="javascript:floateval();"');
710: }
711: if (ptype=='string') {
1.73 raeburn 712: if (pscat == 'ip') {
713: choicewrite(' action="javascript:ipstringeval();"');
714: } else {
715: choicewrite(' action="javascript:stringeval();"');
716: }
1.6 www 717: }
1.62 raeburn 718: if (ptype != 'int' && ptype != 'float' && ptype != 'string') {
719: choicewrite(' action=""');
720: }
1.6 www 721: choicewrite('>');
1.1 www 722: if (ptype=='tolerance') {
1.2 www 723: // 0: pscat
724: if (pscat=='default') {
1.1 www 725: tablestart('Use default value or algorithm of resource');
726: }
1.2 www 727: if (pscat=='relative_sym') {
1.1 www 728: // 2: percentage
729: // 3: open
730: tablestart('Percentage error, symmetric around value');
731: valline('Percentage',2,3);
1.13 www 732: if ((svalue!='') && (typeof(svalue)!="undefined")) {
733: choices.document.forms.sch.val2.value=parseInt(svalue);
734: if (svalue.indexOf('+')!=-1) {
735: choices.document.forms.sch.val3.checked=true;
736: }
737: }
1.1 www 738: }
1.2 www 739: if (pscat=='relative') {
1.1 www 740: // 2: left
741: // 3: open
742: // 4: right
743: // 5: open
744: tablestart('Percentage error, asymmetric around value');
745: valline('Upper percentage',2,3);
746: valline('Lower percentage',4,5);
1.17 matthew 747: var range1=new Array;
1.13 www 748: if ((svalue!='') && (typeof(svalue)!="undefined")) {
1.17 matthew 749: range1=svalue.split(',');
750: if (typeof(range1[1])=='undefined') { range1[1]=range1[0]; }
751: choices.document.forms.sch.val2.value=parseFloat(range1[0]);
752: if (range1[0].indexOf('+')!=-1) {
1.13 www 753: choices.document.forms.sch.val3.checked=true;
754: }
1.17 matthew 755: choices.document.forms.sch.val4.value=parseFloat(range1[1]);
756: if (range1[1].indexOf('+')!=-1) {
1.13 www 757: choices.document.forms.sch.val5.checked=true;
758: }
759: }
1.1 www 760: }
1.2 www 761: if (pscat=='absolute_sym') {
1.1 www 762: tablestart('Absolute error, symmetric around value');
763: valline('Value',2,3);
1.13 www 764: if ((svalue!='') && (typeof(svalue)!="undefined")) {
1.15 www 765: choices.document.forms.sch.val2.value=parseFloat(svalue);
1.13 www 766: if (svalue.indexOf('+')!=-1) {
767: choices.document.forms.sch.val3.checked=true;
768: }
769: }
1.1 www 770: }
1.2 www 771: if (pscat=='absolute') {
1.1 www 772: tablestart('Absolute error, asymmetric around value');
773: valline('Upper value',2,3);
774: valline('Lower value',4,5);
1.17 matthew 775: var range2=new Array;
1.13 www 776: if ((svalue!='') && (typeof(svalue)!="undefined")) {
777: range=svalue.split(',');
1.17 matthew 778: if (typeof(range2[1])=='undefined') { range2[1]=range2[0]; }
779: choices.document.forms.sch.val2.value=parseFloat(range2[0]);
780: if (range2[0].indexOf('+')!=-1) {
1.13 www 781: choices.document.forms.sch.val3.checked=true;
782: }
1.17 matthew 783: choices.document.forms.sch.val4.value=parseFloat(range2[1]);
784: if (range2[1].indexOf('+')!=-1) {
1.13 www 785: choices.document.forms.sch.val5.checked=true;
786: }
787: }
1.1 www 788: }
789: }
790:
791: if (ptype=='date') {
1.2 www 792: if (pscat=='default') {
793: tablestart('Default value or none');
794: choicewrite('</table>');
795: } else {
796: if (pscat=='start') {
1.24 www 797: tablestart('Date and time');
1.2 www 798: }
799: if (pscat=='end') {
1.24 www 800: tablestart('Date and time');
1.2 www 801: }
802: if (pscat=='interval') {
1.70 raeburn 803: var proctorkeytype = 'hidden';
1.71 raeburn 804: var donebuttontext = 'none';
1.70 raeburn 805: if (pmodval == '_done_proctor') {
806: proctorkeytype = 'text';
1.71 raeburn 807: donebuttontext = 'block';
808: }
809: if (pmodval == '_done') {
810: donebuttontext = 'block';
1.70 raeburn 811: }
1.2 www 812: tablestart('Time interval');
1.69 musolffc 813: choicewrite( [
814: '<tr><td colspan="3">'+intervaldis()+'</td></tr>',
815: '<tr><td>Time:</td><td colspan="2">',
816: '<span style="white-space:nowrap">'+intday()+' days </span>',
817: '<span style="white-space:nowrap">'+inthour()+' hours</span>',
818: '<span style="white-space:nowrap">'+intminute()+' mins</span>',
819: '<span style="white-space:nowrap">'+intsecond()+' secs</span>',
820: '</td></tr>',
821: '</table>',
822: '<br />',
823: ].join("\n"));
1.68 raeburn 824: tablestart('Provide a "Done" button to students?');
825: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.70 raeburn 826: choicewrite('<label><input name="donebutton" value=""'+
827: ' type="radio" '+callintervalpmodval());
828: if (pmodval == '') { choicewrite(' checked="checked"'); }
829: choicewrite(' /> No</label><br />');
1.68 raeburn 830: choicewrite('<label><input name="donebutton" value="_done"'+
831: ' type="radio" '+callintervalpmodval());
1.70 raeburn 832: if (pmodval == '_done') { choicewrite(' checked="checked"'); }
1.68 raeburn 833: choicewrite(' /> Yes</label><br />');
1.70 raeburn 834: choicewrite('<span style="white-space:nowrap">'+
835: '<label><input name="donebutton" value="_done_proctor"'+
1.68 raeburn 836: ' type="radio" '+callintervalpmodval());
1.70 raeburn 837: if (pmodval == '_done_proctor') { choicewrite(' checked="checked"'); }
838: choicewrite(' /> Yes, with proctor key</label>');
839: choicewrite(' <input name="donebutton_proctorkey" value='+
840: '"'+escapeHTML(pextraval)+'" type="'+proctorkeytype+
1.71 raeburn 841: '" id="done_proctorkey" size="10"'+
842: ' onblur="parent.intcalc();" /></span><br />'+
843: '<div id="donebuttontextdiv" style="display:'+donebuttontext+'">'+
844: '<br /><span style="white-space:nowrap">'+
845: 'Button text:'+
846: '<input name="donebutton_text" value='+
847: '"'+escapeHTML(pextravaltwo)+'" type="text" '+
848: 'size="10" onblur="parent.intcalc();" /></span></div>');
1.68 raeburn 849: choicewrite('</td></tr></table>');
850: } else {
1.52 bisitz 851: choicewrite('<tr><td colspan="3">'
1.2 www 852: +cdate.toString()+
1.52 bisitz 853: '</td></tr><tr><td>Date:</td><td colspan="2">');
1.2 www 854: month();date();year();
1.52 bisitz 855: choicewrite('</td></tr><tr><td>Time:'
1.51 bisitz 856: +'</td><td colspan="2">');hour();choicewrite('h ');minute();
1.2 www 857: choicewrite('m ');second();
858: choicewrite('s</td></tr></table>');
859: }
860: }
1.1 www 861: }
862:
1.6 www 863: if (ptype=='int') {
1.19 www 864: var pscatparts=new Array;
865: pscatparts=pscat.split(',');
866: pscat=pscatparts[0];
1.6 www 867: if (pscat=='default') {
868: tablestart('Default value or none');
1.14 www 869: choicewrite('</table>');
1.6 www 870: } else {
1.14 www 871: if (pscat=='range') {
872: tablestart('Integer range');
1.52 bisitz 873: choicewrite('<tr><td>Lower Value:'+
1.51 bisitz 874: '</td><td colspan="2"><input type="text" size="4" name="val2'+
1.53 bisitz 875: '" /></td></tr>');
1.52 bisitz 876: choicewrite('<tr><td>Upper Value:'+
1.51 bisitz 877: '</td><td colspan="2"><input type="text" size="4" name="val4'+
1.53 bisitz 878: '" /></td></tr></table>');
1.14 www 879: var range=new Array;
880: if ((svalue!='') && (typeof(svalue)!="undefined")) {
881: range=svalue.split(',');
882: if (typeof(range[1])=='undefined') { range[1]=range[0]; }
883: choices.document.forms.sch.val2.value=parseInt(range[0]);
884: choices.document.forms.sch.val4.value=parseInt(range[1]);
885: }
886: } else {
1.6 www 887: if (pscat=='pos') {
888: tablestart('Positive (non-zero) integer');
889: }
890: if (pscat=='zeropos') {
891: tablestart('Positive integer or zero');
892: }
1.12 www 893: if (pscat.indexOf('inrange')!=-1) {
1.10 www 894: var rangeparts=new Array;
1.12 www 895: rangeparts=split(',',pscat);
1.10 www 896: tablestart('Integer in the range ['+rangeparts[1]+']');
897: }
1.6 www 898: if (pscat=='any') {
899: tablestart('Integer');
900: }
1.52 bisitz 901: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.51 bisitz 902: choicewrite('<input name="intval" size="10" value="'+escapeHTML(svalue)+
1.53 bisitz 903: '" onchange="parent.integereval()" />');
1.54 bisitz 904: choicewrite('</td></tr></table>');
1.6 www 905: }
1.14 www 906: }
1.1 www 907: }
908:
1.6 www 909: if (ptype=='float') {
910: if (pscat=='default') {
911: tablestart('Default value or none');
1.79 raeburn 912: choicewrite('</table>');
1.6 www 913: } else {
914: if (pscat=='pos') {
915: tablestart('Positive floating point number or zero');
916: }
917: if (pscat=='zeroone') {
918: tablestart('Floating point number between zero and one');
919: }
920: if (pscat=='any') {
921: tablestart('Floating point number');
922: }
1.52 bisitz 923: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.51 bisitz 924: choicewrite('<input name="floatval" size="10" value="'+escapeHTML(svalue)+
1.53 bisitz 925: '" onchange="parent.floateval()" />');
1.54 bisitz 926: choicewrite('</td></tr></table>');
1.6 www 927: }
1.1 www 928: }
929:
1.6 www 930: if (ptype=='string') {
1.83 raeburn 931: if ((pscat=='any') || (pscat=='') || (pscat=='default') ||
1.42 albertel 932: (typeof(pscat)=='undefined')) {
1.6 www 933: tablestart('Text');
1.54 bisitz 934: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.46 albertel 935: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.53 bisitz 936: '" type="text" onchange="parent.stringeval()" />');
1.25 www 937: }
938: if (pscat=='yesno') {
939: tablestart('Yes/No');
1.52 bisitz 940: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32 albertel 941: choicewrite('<label><input name="stringval" value="yes"'+
1.29 www 942: ' type="radio" '+callradiostringeval('yes'));
1.53 bisitz 943: if (svalue=='yes') { choicewrite(' checked="checked"'); }
944: choicewrite(' /> Yes</label><br />');
1.32 albertel 945: choicewrite('<label><input name="stringval" value="no"'+
1.29 www 946: ' type="radio" '+callradiostringeval('no'));
1.53 bisitz 947: if (svalue=='no') { choicewrite(' checked="checked"'); }
948: choicewrite(' /> No</label><br />');
1.25 www 949: }
1.47 albertel 950: if (pscat=='problemstatus') {
951: tablestart('Problem Status');
1.52 bisitz 952: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.47 albertel 953: choicewrite('<label><input name="stringval" value="yes"'+
954: ' type="radio" '+callradiostringeval('yes'));
1.53 bisitz 955: if (svalue=='yes') { choicewrite(' checked="checked"'); }
956: choicewrite(' /> Yes</label><br />');
1.49 albertel 957: choicewrite('<label><input name="stringval" value="answer"'+
958: ' type="radio" '+callradiostringeval('answer'));
1.53 bisitz 959: if (svalue=='answer') { choicewrite(' checked="checked"'); }
960: choicewrite(' /> Yes, and show correct answer if they exceed the maximum number of tries.</label><br />');
1.47 albertel 961: choicewrite('<label><input name="stringval" value="no"'+
962: ' type="radio" '+callradiostringeval('no'));
1.53 bisitz 963: if (svalue=='no') { choicewrite(' checked="checked"'); }
964: choicewrite(' /> No, don\'t show correct/incorrect feedback.</label><br />');
1.47 albertel 965: choicewrite('<label><input name="stringval" value="no_feedback_ever"'+
966: ' type="radio" '+callradiostringeval('no_feedback_ever'));
1.53 bisitz 967: if (svalue=='no_feedback_ever') { choicewrite(' checked="checked"'); }
968: choicewrite(' /> No, show no feedback at all.</label><br />');
1.47 albertel 969: }
1.25 www 970: if (pscat=='examtype') {
971: tablestart('Exam Type');
1.52 bisitz 972: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32 albertel 973: choicewrite('<label><input name="stringval" value="online"'+
1.29 www 974: ' type="radio" '+callradiostringeval('online'));
1.53 bisitz 975: if (svalue=='online') { choicewrite(' checked="checked"'); }
976: choicewrite(' /> Online</label><br />');
1.32 albertel 977: choicewrite('<label><input name="stringval" value="checkout"'+
1.29 www 978: ' type="radio" '+callradiostringeval('checkout'));
1.53 bisitz 979: if (svalue=='checkout') { choicewrite(' checked="checked"'); }
980: choicewrite(' /> Check out</label><br />');
1.25 www 981: }
982: if (pscat=='questiontype') {
983: tablestart('Question Type');
1.52 bisitz 984: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32 albertel 985: choicewrite('<label><input name="stringval" value="problem"'+
1.29 www 986: ' type="radio" '+callradiostringeval('problem'));
1.53 bisitz 987: if (svalue=='problem') { choicewrite(' checked="checked"'); }
988: choicewrite(' /> Standard Problem</label><br />');
1.36 albertel 989: // choicewrite('<label><input name="stringval" value="quiz"'+
990: // ' type="radio" '+callradiostringeval('quiz'));
1.53 bisitz 991: // if (svalue=='quiz') { choicewrite(' checked="checked"'); }
992: // choicewrite(' /> Quiz</label><br />');
1.35 albertel 993: choicewrite('<label><input name="stringval" value="practice"'+
994: ' type="radio" '+callradiostringeval('practice'));
1.53 bisitz 995: if (svalue=='practice') { choicewrite(' checked="checked"'); }
996: choicewrite(' /> Practice</label><br />');
1.32 albertel 997: choicewrite('<label><input name="stringval" value="exam"'+
1.29 www 998: ' type="radio" '+callradiostringeval('exam'));
1.53 bisitz 999: if (svalue=='exam') { choicewrite(' checked="checked"'); }
1.65 bisitz 1000: choicewrite(' /> Bubblesheet Exam</label><br />');
1.36 albertel 1001: // choicewrite('<label><input name="stringval" value="assess"'+
1002: // ' type="radio" '+callradiostringeval('assess'));
1.53 bisitz 1003: // if (svalue=='assess') { choicewrite(' checked="checked"'); }
1004: // choicewrite(' /> Assessment</label><br />');
1.32 albertel 1005: choicewrite('<label><input name="stringval" value="survey"'+
1.29 www 1006: ' type="radio" '+callradiostringeval('survey'));
1.53 bisitz 1007: if (svalue=='survey') { choicewrite(' checked="checked"'); }
1008: choicewrite(' /> Survey</label><br />');
1.36 albertel 1009: // choicewrite('<label><input name="stringval" value="form"'+
1010: // ' type="radio" '+callradiostringeval('form'));
1.53 bisitz 1011: // if (svalue=='form') { choicewrite(' checked="checked"'); }
1.36 albertel 1012: // choicewrite('> Input Form</label><br />');
1.57 raeburn 1013: choicewrite('<label><input name="stringval" value="surveycred"'+
1014: ' type="radio" '+callradiostringeval('surveycred'));
1015: if (svalue=='surveycred') { choicewrite(' checked="checked"'); }
1016: choicewrite('> Survey (credit for submission)</label><br />');
1017: choicewrite('<label><input name="stringval" value="anonsurvey"'+
1018: ' type="radio" '+callradiostringeval('anonsurvey'));
1019: if (svalue=='anonsurvey') { choicewrite(' checked="checked"'); }
1020: choicewrite('> Anonymous Survey</label><br />');
1021: choicewrite('<label><input name="stringval" value="anonsurveycred"'+
1022: ' type="radio" '+callradiostringeval('anonsurveycred'));
1023: if (svalue=='anonsurveycred') { choicewrite(' checked="checked"'); }
1024: choicewrite('> Anonymous Survey (credit for submission)</label><br />');
1.59 raeburn 1025: choicewrite('<label><input name="stringval" value="randomizetry"'+
1026: ' type="radio" '+callradiostringeval('randomizetry'));
1027: if (svalue=='randomizetry') { choicewrite(' checked="checked"'); }
1028: choicewrite('> New Randomization Each N Tries (default N=1)</label><br />');
1.32 albertel 1029: choicewrite('<label><input name="stringval" value="library"'+
1.29 www 1030: ' type="radio" '+callradiostringeval('library'));
1.53 bisitz 1031: if (svalue=='library') { choicewrite(' checked="checked"'); }
1032: choicewrite(' /> Library</label><br />');
1.25 www 1033: }
1.60 raeburn 1034: if (pscat=='lenient') {
1.72 raeburn 1035: var patternLenientStd = /^(yes|no|default)$/;
1036: var patternLenientRel = /^([\-\d\.]+)\,([\-\d\.]+)\,([\-\d\.]+)\,([\-\d\.]+)$/;
1037: var lenientweighted = 'none';
1038: var relatives = new Array;
1.60 raeburn 1039: tablestart('Lenient Grading (Partial Credit)');
1040: choicewrite('<tr><td>Value:</td><td colspan="2">');
1041: choicewrite('<label><input name="stringval" value="yes"'+
1.72 raeburn 1042: ' type="radio" '+calllenientradioeval('yes'));
1.60 raeburn 1043: if (svalue=='yes') { choicewrite(' checked="checked"'); }
1044: choicewrite(' /> Yes</label><br />');
1045: choicewrite('<label><input name="stringval" value="no"'+
1.72 raeburn 1046: ' type="radio" '+calllenientradioeval('no'));
1.60 raeburn 1047: if (svalue=='no') { choicewrite(' checked="checked"'); }
1048: choicewrite(' /> No</label><br />');
1049: choicewrite('<label><input name="stringval" value="default"'+
1.72 raeburn 1050: ' type="radio" '+calllenientradioeval('default'));
1.60 raeburn 1051: if (svalue=='default') { choicewrite(' checked="checked"'); }
1052: choicewrite(' /> Default (only bubblesheet grading is lenient)</label><br />');
1.72 raeburn 1053: choicewrite('<label><input name="stringval" value="weighted"'+
1054: ' type="radio" '+calllenientradioeval('weighted'));
1055: if (!patternLenientStd.test(svalue) && svalue != '') {
1056: choicewrite(' checked="checked"');
1057: lenientweighted='block';
1058: var relatives = svalue.match(patternLenientRel);
1059: }
1060: choicewrite(' />Yes, weighted (optionresponse in checkbox mode)</label><br /><br />'+
1061: '<div id="lenientweighteddiv" style="display:'+lenientweighted+'">'+
1062: '<table class="LC_parmsel_table"><tr bgcolor="#C5DB99">'+
1063: '<th colspan="2">Foil submission status</th><th>Points</th></tr>');
1064: var lenienttypes = ['Correct (checked)','Correct (unchecked)','Incorrect (checked)','Incorrect (unchecked)'];
1065: for (var i=0; i<lenienttypes.length; i++) {
1066: var j = i+1;
1067: if (relatives[j] == '') {
1068: if (i < 2) {
1069: relatives[j] = '1.0';
1070: } else {
1071: relatives[j] = '0.0';
1072: }
1073: }
1074: choicewrite('<tr><td colspan="2">'+lenienttypes[i]+'</td>'+
1075: '<td><input type="text" name="lenientrelwt" value="'+relatives[j]+'"'+
1076: ' size="3" onblur="parent.lenienteval(\'weighted\')" /></td></tr>');
1077: }
1078: choicewrite('</table></div>');
1.60 raeburn 1079: }
1.64 raeburn 1080: if (pscat=='discussvote') {
1081: tablestart('Discussion Voting');
1082: choicewrite('<tr><td>Value:</td><td colspan="2">');
1083: choicewrite('<label><input name="stringval" value="yes"'+
1084: ' type="radio" '+callradiostringeval('yes'));
1085: if (svalue=='yes') { choicewrite(' checked="checked"'); }
1086: choicewrite(' /> Yes</label><br />');
1087: choicewrite('<label><input name="stringval" value="notended"'+
1088: ' type="radio" '+callradiostringeval('notended'));
1089: if (svalue=='notended') { choicewrite(' checked="checked"'); }
1090: choicewrite(' /> Yes, unless discussion ended</label><br />');
1091: choicewrite('<label><input name="stringval" value="no"'+
1092: ' type="radio" '+callradiostringeval('no'));
1093: if (svalue=='no') { choicewrite(' checked="checked"'); }
1094: choicewrite(' /> No</label><br />');
1095: }
1.25 www 1096: if (pscat=='ip') {
1.83 raeburn 1097: var currallow = new Array;
1.73 raeburn 1098: var currdeny = new Array;
1.88 ! raeburn 1099: if ((svalue != '') && (typeof(svalue) != 'undefined')) {
1.73 raeburn 1100: var patternComma = /,/;
1101: var patternAllow = /^([\[\]a-zA-Z\.\d\*\-]+)$/;
1102: var patternDeny = /^\!([\[\]a-zA-Z\.\d\*\-]+)$/;
1103: var current = new Array;
1.83 raeburn 1104: if (patternComma.test(svalue)) {
1.73 raeburn 1105: current = svalue.split(',');
1106: } else {
1.81 raeburn 1107: current = [svalue];
1.73 raeburn 1108: }
1109: for (var i=0; i<current.length; i++) {
1110: if (patternDeny.test(current[i])) {
1111: var denied = current[i].replace(/^!/,'');
1112: currdeny.push(denied);
1113: } else {
1114: if (patternAllow.test(current[i])) {
1115: currallow.push(current[i]);
1.83 raeburn 1116: }
1.73 raeburn 1117: }
1118: }
1119: }
1120: if (currdeny.length == 0) {
1121: currdeny = ('');
1122: }
1123: if (currallow.length == 0) {
1124: currallow = ('');
1125: }
1126: var curripaccess = [currallow,currdeny];
1127: tablestart('IP Number/Name');
1128: choicewrite('<tr><th>Allow from</th><th>Deny from</th></tr><tr>');
1129: var acctypes = ['allow','deny'];
1130: for (var i=0; i<acctypes.length; i++) {
1131: choicewrite('<td valign="top">'+
1132: '<div class="LC_string_ipacc_wrap" id="LC_string_ipacc_'+acctypes[i]+'">'+
1133: '<div class="LC_string_ipacc_inner" id="LC_string_ipacc_inner_'+acctypes[i]+'">');
1134: for (var j=0; j<curripaccess[i].length; j++) {
1135: choicewrite('<div><input type="text" size="10" name="setip'+acctypes[i]+'" value="'+curripaccess[i][j]+'" onblur="parent.ipstringeval();" />');
1.74 raeburn 1136: choicewrite('<a href="#" onclick="parent.removeIpRule(\''+acctypes[i]+'\',\''+j+'\')">Remove</a>');
1.73 raeburn 1137: choicewrite('</div>');
1138: }
1.74 raeburn 1139: choicewrite('</div><button onclick="parent.addIpRule(\''+acctypes[i]+'\');">Add item</button>');
1.73 raeburn 1140: }
1141: choicewrite('</div></td></tr></table>');
1.6 www 1142: }
1.26 www 1143: if (pscat=='fileext') {
1144: tablestart('Allowed File Extensions');
1.52 bisitz 1145: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32 albertel 1146: choicewrite('<label><input name="radstringval" value="txt"'+
1.29 www 1147: ' type="radio" '+callradiostringeval('txt'));
1.53 bisitz 1148: if (svalue=='txt') { choicewrite(' checked="checked"'); }
1149: choicewrite(' /> Plain Text</label><br />');
1.32 albertel 1150: choicewrite('<label><input name="radstringval" value="png,jpg,jpeg,gif"'+
1.29 www 1151: ' type="radio" '+callradiostringeval('png,jpg,jpeg,gif'));
1.53 bisitz 1152: if (svalue=='png,jpg,jpeg,gif') { choicewrite(' checked="checked"'); }
1153: choicewrite(' /> Picture File</label><br />');
1.58 raeburn 1154: choicewrite('<label><input name="radstringval" value="doc,docx,xls,xlsx,ppt,pptx"'+
1155: ' type="radio" '+callradiostringeval('doc,docx,xls,xlsx,ppt,pptx'));
1156: if (svalue=='doc,docx,xls,xlsx,ppt,pptx') { choicewrite(' checked="checked"'); }
1.53 bisitz 1157: if (svalue=='doc,xls,ppt') { choicewrite(' checked="checked"'); }
1158: choicewrite(' /> Office Document</label><br />');
1.46 albertel 1159: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.53 bisitz 1160: '" onchange="parent.stringeval()" />');
1.26 www 1161: }
1.37 albertel 1162: if (pscat=='useslots') {
1163: tablestart('Slots control access');
1.52 bisitz 1164: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.37 albertel 1165: choicewrite('<label><input name="stringval" value="no"'+
1166: ' type="radio" '+callradiostringeval('no'));
1.53 bisitz 1167: if (svalue=='no') { choicewrite(' checked="checked"'); }
1168: choicewrite(' /> No</label><br />');
1.37 albertel 1169: choicewrite('<label><input name="stringval" value="resource"'+
1170: ' type="radio" '+callradiostringeval('resource'));
1.53 bisitz 1171: if (svalue=='resource') { choicewrite(' checked="checked"'); }
1.82 raeburn 1172: choicewrite(' /> Yes, and the scope of the slot is a single resource.</label><br />');
1.38 albertel 1173: choicewrite('<label><input name="stringval" value="map"'+
1174: ' type="radio" '+callradiostringeval('map'));
1.53 bisitz 1175: if (svalue=='map') { choicewrite(' checked="checked"'); }
1.82 raeburn 1176: choicewrite(' /> Yes, and the scope of the slot is the enclosing map/folder. When checking in, it applies to only one resource.</label><br />');
1.39 albertel 1177: choicewrite('<label><input name="stringval" value="map_map"'+
1.40 albertel 1178: ' type="radio" '+callradiostringeval('map_map'));
1.53 bisitz 1179: if (svalue=='map_map') { choicewrite(' checked="checked"'); }
1.82 raeburn 1180: choicewrite(' /> Yes, and the scope of the slot is the enclosing map/folder. When checking in, all resources in the map/folder are checked in.</label><br />');
1.79 raeburn 1181: choicewrite('</td></tr></table>');
1.80 raeburn 1182: }
1183: if (pscat=='deeplink') {
1184: var deeplinkvals = new Array();
1.86 raeburn 1185: var linkprotectparts = new Array();
1186: var ltikeyRegExp = /^(ltic|ltid|key):(\w+)$/;
1.80 raeburn 1187: var dlinkkeysty = 'hidden';
1.84 raeburn 1188: var dlinkkeyval = '';
1.86 raeburn 1189: var dlinklticdivsty = 'none';
1190: var dlinkltiddivsty = 'none';
1.84 raeburn 1191: var dlinkmenusdivsty = 'none';
1.88 ! raeburn 1192: if ((svalue != '') && (typeof(svalue) != 'undefined')) {
1.80 raeburn 1193: deeplinkvals = svalue.split(',');
1.86 raeburn 1194: if (ltikeyRegExp.test(deeplinkvals[4])) {
1195: linkprotectparts = deeplinkvals[4].split(':');
1196: deeplinkvals[4] = linkprotectparts[0];
1197: if (linkprotectparts[0] == 'key') {
1.80 raeburn 1198: dlinkkeysty = 'text';
1.86 raeburn 1199: dlinkkeyval = linkprotectparts[1];
1200: } else if (linkprotectparts[0] == 'ltic') {
1201: dlinklticdivsty = 'block';
1202: } else if (linkprotectparts[0] == 'ltid') {
1203: dlinkltiddivsty = 'block';
1.80 raeburn 1204: }
1205: }
1.86 raeburn 1206: if (deeplinkvals[5] >= 1) {
1.84 raeburn 1207: dlinkmenusdivsty = 'inline-block';
1208: }
1.80 raeburn 1209: } else {
1.86 raeburn 1210: deeplinkvals = ['off','unhide','full','res','','0'];
1.80 raeburn 1211: }
1.86 raeburn 1212: var deeplinkstate = new Array();
1213: deeplinkstate = ['only','off','both'];
1214: var deeplinkstatetxt = new Array();
1215: deeplinkstatetxt = ['deep only','deeplink off','regular + deep'];
1216: var deeplinkothers = new Array();
1217: deeplinkothers = ['hide','unhide'];
1218: var deeplinkotherstxt = new Array();
1219: deeplinkotherstxt = ['Hidden','Unhidden'];
1.80 raeburn 1220: var deeplinklisting = new Array();
1221: deeplinklisting = ['full','absent','grades','details','datestatus'];
1222: var deeplinklisttxt = new Array();
1223: deeplinklisttxt = ['Listed (linked) in both','Not listed','Listed in grades only','Listed (unlinked) in both','Listed (unlinked) inc. status in both'];
1224: var deeplinkscopes = new Array();
1225: deeplinkscopes = ['res','map','rec'];
1226: var deeplinkscopetxt = new Array();
1227: deeplinkscopetxt = ['resource only','enclosing map/folder','recursive map/folder'];
1.86 raeburn 1228: var deeplinkprotect = new Array();
1229: deeplinkprotect = ['none','key','ltic','ltid'];
1.87 raeburn 1230: var deeplinktarget = new Array();
1231: deeplinktarget = ['_self','_top'];
1232: var deeplinktargettxt = new Array();
1233: deeplinktargettxt = ['Embedded','Not embedded'];
1.78 raeburn 1234: tablestart('Deep-linked items');
1.86 raeburn 1235: choicewrite('<tr><td>Access status?</td><td>');
1236: choicewrite('<select name="deeplinkstate">');
1237: for (var i=0; i<deeplinkstate.length; i++) {
1238: choicewrite('<option value="'+deeplinkstate[i]+'"');
1239: if (deeplinkvals[0] == deeplinkstate[i]) {
1240: choicewrite(' selected="selected"');
1241: }
1242: choicewrite('>'+deeplinkstatetxt[i]+'</option>');
1243: }
1244: choicewrite('</select></td></tr>');
1245: choicewrite('<tr><td>Hide other resources?</td><td>');
1246: choicewrite('<select name="deeplinkothers">');
1247: for (var i=0; i<deeplinkothers.length; i++) {
1248: choicewrite('<option value="'+deeplinkothers[i]+'"');
1249: if (deeplinkvals[1] == deeplinkothers[i]) {
1250: choicewrite(' selected="selected"');
1251: }
1252: choicewrite('>'+deeplinkotherstxt[i]+'</option>');
1253: }
1254: choicewrite('</select></td></tr>');
1.84 raeburn 1255: choicewrite('<tr><td>In Contents + Gradebook?</td><td>');
1.80 raeburn 1256: choicewrite('<select name="deeplinklisted">');
1257: for (var i=0; i<deeplinklisting.length; i++) {
1258: choicewrite('<option value="'+deeplinklisting[i]+'"');
1.86 raeburn 1259: if (deeplinkvals[2] == deeplinklisting[i]) {
1.80 raeburn 1260: choicewrite(' selected="selected"');
1261: }
1262: choicewrite('>'+deeplinklisttxt[i]+'</option>');
1263: }
1264: choicewrite('</select></td></tr>');
1.86 raeburn 1265: choicewrite('<tr><td>Access scope for link</td><td>');
1.80 raeburn 1266: choicewrite('<select name="deeplinkacc">');
1267: for (var i=0; i<deeplinkscopes.length; i++) {
1268: choicewrite('<option value="'+deeplinkscopes[i]+'"');
1.86 raeburn 1269: if (deeplinkvals[3] == deeplinkscopes[i]) {
1.80 raeburn 1270: choicewrite(' selected="selected"');
1271: }
1272: choicewrite('>'+deeplinkscopetxt[i]+'</option>');
1273: }
1274: choicewrite('</select></td></tr>');
1.86 raeburn 1275: choicewrite('<tr><td>Link protection</td><td>');
1.80 raeburn 1276: choicewrite('<span style="white-space: nowrap;"><label>');
1.86 raeburn 1277: choicewrite('<input name="deeplinkprotect" value="none"'+
1278: ' type="radio" '+calldeeplink('protect'));
1279: if (deeplinkvals[4]=='none') { choicewrite(' checked="checked"'); }
1280: choicewrite(' /> not in use</label>');
1281: choicewrite('<input name="deeplinkprotect" value="key"'+
1282: ' type="radio" '+calldeeplink('protect'));
1283: if (deeplinkvals[4]=='key') { choicewrite(' checked="checked"'); }
1284: choicewrite(' /> key access</label>');
1.84 raeburn 1285: choicewrite('<input type="'+dlinkkeysty+'" name="deeplinkkey" id="deeplinkkey" value="'+dlinkkeyval+'" size="10" />');
1.80 raeburn 1286: choicewrite('</span><br />');
1.84 raeburn 1287:
1288: var possmenus = new Array();
1.88 ! raeburn 1289: if ((pextra != '') && (typeof(pextra) != 'undefined')) {
1.86 raeburn 1290: var lticRegExp = /^ltic_/;
1291: var ltidRegExp = /^ltid_/;
1.84 raeburn 1292: var menusRegExp = /^menus_/;
1293: var extras = pextra.split('&');
1294: for (var i=0; i<extras.length; i++) {
1.86 raeburn 1295: if (lticRegExp.test(extras[i])) {
1296: extras[i] = extras[i].replace(lticRegExp,'');
1297: var possltic = extras[i].split(',');
1298: if (possltic.length >= 1) {
1299: var lticnums = new Array();
1300: var ltictitles = new Array();
1301: for (var j=0; j<possltic.length; j++) {
1302: var entries = possltic[j].split(':');
1303: lticnums[j] = entries[0];
1304: ltictitles[j] = decodeURIComponent(entries[1]);
1.80 raeburn 1305: }
1.86 raeburn 1306: if (lticnums.length) {
1.84 raeburn 1307: choicewrite('<span style="white-space: nowrap;"><label>');
1.86 raeburn 1308: choicewrite('<input name="deeplinkprotect" value="ltic"'+
1309: ' type="radio" '+calldeeplink('protect'));
1310: if (deeplinkvals[4]=='ltic') { choicewrite(' checked="checked"'); }
1311: choicewrite(' /> course LTI launch</label>');
1312: choicewrite('<div id="deeplinklticdiv" style="display:'+dlinklticdivsty+'">');
1313: choicewrite('<select name="linkpossltic">');
1.84 raeburn 1314: var sel='';
1.86 raeburn 1315: if (deeplinkvals[4]!='ltic') {
1.84 raeburn 1316: sel = ' selected="selected"';
1317: }
1.86 raeburn 1318: if (lticnums.length > 1) {
1.84 raeburn 1319: choicewrite('<option value=""'+sel+'>Select</option>');
1320: }
1.86 raeburn 1321: for (var j=0; j<lticnums.length; j++) {
1.84 raeburn 1322: sel = '';
1.86 raeburn 1323: if (deeplinkvals[4]=='ltic') {
1324: if (linkprotectparts.length) {
1325: if (lticnums[j] == linkprotectparts[1]) {
1.84 raeburn 1326: sel = ' selected="selected"';
1327: }
1.80 raeburn 1328: }
1329: }
1.86 raeburn 1330: choicewrite('<option value="'+lticnums[j]+'"'+sel+'>'+ltictitles[j]+'</option>');
1.80 raeburn 1331: }
1.84 raeburn 1332: choicewrite('</select></div></span><br />');
1.80 raeburn 1333: }
1334: }
1.86 raeburn 1335: } else if (ltidRegExp.test(extras[i])) {
1336: extras[i] = extras[i].replace(ltidRegExp,'');
1337: var possltid = extras[i].split(',');
1338: if (possltid.length >= 1) {
1339: var ltidnums = new Array();
1340: var ltidtitles = new Array();
1341: for (var j=0; j<possltid.length; j++) {
1342: var entries = possltid[j].split(':');
1343: ltidnums[j] = entries[0];
1344: ltidtitles[j] = decodeURIComponent(entries[1]);
1345: }
1346: if (ltidnums.length) {
1347: choicewrite('<span style="white-space: nowrap;"><label>');
1348: choicewrite('<input name="deeplinkprotect" value="ltid"'+
1349: ' type="radio" '+calldeeplink('protect'));
1350: if (deeplinkvals[4]=='ltid') { choicewrite(' checked="checked"'); }
1351: choicewrite(' />domain LTI launch</label>');
1352: choicewrite('<div id="deeplinkltiddiv" style="display:'+dlinkltiddivsty+'">');
1353: choicewrite('<select name="linkpossltid">');
1354: var sel='';
1355: if (deeplinkvals[4]!='ltid') {
1356: sel = ' selected="selected"';
1357: }
1358: if (ltidnums.length > 1) {
1359: choicewrite('<option value=""'+sel+'>Select</option>');
1360: }
1361: for (var j=0; j<ltidnums.length; j++) {
1362: sel = '';
1363: if (deeplinkvals[4]=='ltid') {
1364: if (linkprotectparts.length) {
1365: if (ltidnums[j] == linkprotectparts[1]) {
1366: sel = ' selected="selected"';
1367: }
1368: }
1369: }
1370: choicewrite('<option value="'+ltidnums[j]+'"'+sel+'>'+ltidtitles[j]+'</option>');
1371: }
1372: choicewrite('</select></div></span><br />');
1373: }
1374: }
1375:
1.84 raeburn 1376: } else if (menusRegExp.test(extras[i])) {
1377: extras[i] = extras[i].replace(menusRegExp,'');
1378: possmenus = extras[i].split(',');
1.80 raeburn 1379: }
1380: }
1381: }
1.84 raeburn 1382: choicewrite('<tr><td>Menu Items Displayed</td><td>');
1383: choicewrite('<span style="white-space: nowrap;"><label>');
1384: choicewrite('<input name="deeplinkmenus" value="std"'+
1385: ' type="radio" '+calldeeplink('menus'));
1.86 raeburn 1386: if (deeplinkvals[5] == 0) {
1.84 raeburn 1387: choicewrite(' checked="checked"');
1388: }
1389: choicewrite(' /> Standard (all menus)</label></span><br />');
1390: if (possmenus.length >= 1) {
1391: choicewrite('<span style="white-space: nowrap;"><label>');
1392: choicewrite('<input name="deeplinkmenus" value="collnum"'+
1393: ' type="radio" '+calldeeplink('menus'));
1.86 raeburn 1394: if (deeplinkvals[5] > 0) { choicewrite(' checked="checked"'); }
1.84 raeburn 1395: choicewrite(' /> Numbered collection</label>');
1396: choicewrite('<div id="deeplinkmenusdiv" style="display:'+dlinkmenusdivsty+'">');
1397: choicewrite('<select name="linkpossmenu">');
1398: var sel='';
1.86 raeburn 1399: if (deeplinkvals[5] == 0) {
1.84 raeburn 1400: sel = ' selected="selected"';
1401: }
1402: if (possmenus.length > 1) {
1403: choicewrite('<option value=""'+sel+'>Select</option>');
1404: }
1405: for (var i=0; i<possmenus.length; i++) {
1406: sel = '';
1.86 raeburn 1407: if (deeplinkvals[5] == possmenus[i]) {
1.84 raeburn 1408: sel = ' selected="selected"';
1409: }
1410: choicewrite('<option value="'+possmenus[i]+'"'+sel+'>'+possmenus[i]+'</option>');
1411: }
1412: choicewrite('</select></div></span><br />');
1413: }
1.87 raeburn 1414: choicewrite('</td></tr>');
1415: choicewrite('<tr><td>Embedded?</td><td>');
1416: choicewrite('<select name="deeplinktarget">');
1417: for (var i=0; i<deeplinktarget.length; i++) {
1418: choicewrite('<option value="'+deeplinktarget[i]+'"');
1419: if (deeplinkvals[6] == deeplinktarget[i]) {
1420: choicewrite(' selected="selected"');
1421: }
1422: choicewrite('>'+deeplinktargettxt[i]+'</option>');
1423: }
1424: choicewrite('</select>');
1.78 raeburn 1425: choicewrite('</td></tr></table>');
1.80 raeburn 1426: }
1.21 www 1427: }
1.79 raeburn 1428:
1.21 www 1429: if (ptype=='color') {
1430: tablestart('Choose a Color');
1431: choicewrite('<table>');
1432: if (svalue) {
1.23 www 1433: choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
1.46 albertel 1434: escapeHTML(svalue)+'" colspan="2"> </td></tr>');
1.21 www 1435: }
1.23 www 1436: for (var ir=0; ir<=10; ir++) {
1437: for (var ig=0; ig<=10; ig++) {
1.21 www 1438: choicewrite('<tr>');
1.23 www 1439: for (var ib=0; ib<=10; ib++) {
1.21 www 1440: colorfield(ir,ig,ib);
1441: }
1442: choicewrite('</tr>');
1.79 raeburn 1443: }
1.21 www 1444: }
1445: choicewrite('</table></td></table>');
1.1 www 1446: }
1447:
1.40 albertel 1448: choicewrite('</form>');
1.1 www 1449: choiceend();
1450: }
1451:
1452: function sopt(va,text) {
1453: selwrite('<option value="'+va+'"');
1.2 www 1454: if (va==pscat) {
1.54 bisitz 1455: selwrite(' selected="selected"');
1.1 www 1456: }
1457: selwrite('>'+text+'</option>');
1458: }
1459:
1460: function catchange() {
1461: var sform=selector.document.forms.fsel.fcat;
1.2 www 1462: pscat=sform.options[sform.selectedIndex].value;
1.1 www 1463: draw();
1464: }
1465:
1.76 raeburn 1466: function recursechange() {
1467: var rform=selector.document.forms.frec;
1468: var count = rform.recurse.length;
1469: if (count > 0) {
1470: for (var i=0; i<count; i++) {
1471: if (rform.recurse[i].checked) {
1472: var colnum = pnonreccol;
1473: if (rform.recurse[i].value == 1) {
1474: colnum++;
1475: }
1.79 raeburn 1476: pmarker = pmarkerst+'_'+pparm+'&'+colnum;
1.76 raeburn 1477: }
1478: }
1479: }
1480: }
1481:
1.1 www 1482: function assemble() {
1.2 www 1483: if ((ptype=='date') && (pscat!='interval')) {
1.41 www 1484: svalue=Math.floor(cdate.getTime()/1000);
1.2 www 1485: }
1.12 www 1486: if (ptype=='tolerance') {
1487: if (pscat=='relative_sym') {
1488: svalue=choices.document.forms.sch.val2.value+'%';
1489: if (choices.document.forms.sch.val3.checked) {
1490: svalue+='+';
1491: }
1492: }
1493: if (pscat=='absolute_sym') {
1494: svalue=choices.document.forms.sch.val2.value;
1495: if (choices.document.forms.sch.val3.checked) {
1496: svalue+='+';
1497: }
1498: }
1499: if (pscat=='absolute') {
1500: svalue=choices.document.forms.sch.val2.value;
1501: if (choices.document.forms.sch.val3.checked) {
1502: svalue+='+';
1503: }
1504: svalue+=','+choices.document.forms.sch.val4.value;
1505: if (choices.document.forms.sch.val5.checked) {
1506: svalue+='+';
1507: }
1508: }
1509: if (pscat=='relative') {
1510: svalue=choices.document.forms.sch.val2.value+'%';
1511: if (choices.document.forms.sch.val3.checked) {
1512: svalue+='+';
1513: }
1514: svalue+=','+choices.document.forms.sch.val4.value+'%';
1515: if (choices.document.forms.sch.val5.checked) {
1516: svalue+='+';
1517: }
1518: }
1.14 www 1519: }
1520: if ((ptype=='int') && (pscat=='range')) {
1521: svalue=choices.document.forms.sch.val2.value+','+
1522: choices.document.forms.sch.val4.value;
1.12 www 1523: }
1.6 www 1524: if (pscat=='default') { svalue=''; }
1.2 www 1525: stype=ptype+'_'+pscat;
1.1 www 1526: }
1527:
1528:
1529: function init() {
1530: var i;
1.2 www 1531: var subs=new Array();
1.71 raeburn 1532: var doneRegExp = /_done(|\:[^\:]+\:)/;
1533: var doneproctorRegExp = /_done(|\:[^\:]+\:)_proctor/;
1.70 raeburn 1534: var proctorkeyRegExp = /^(\d+)_(.+)$/;
1.71 raeburn 1535: var donetextRegExp = /\:([^\:]+)\:/;
1.79 raeburn 1536: var markerRegExp = /^(.+)_([A-Za-z0-9]+)\&(\d+)$/;
1.1 www 1537: var namevalue=this.window.location.search.split('&');
1538: namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
1539:
1540: for (i=0;i<namevalue.length;i++) {
1541: var pair=namevalue[i].split('=');
1.3 www 1542: pair[1]=unescape(pair[1]);
1.1 www 1543: if (pair[0]=='value') { pvalue=pair[1]; }
1.2 www 1544: if (pair[0]=='type') { subs=pair[1].split('_');
1545: ptype=subs[0];
1546: pscat=subs[1];
1.79 raeburn 1547: if (typeof(subs[2])!="undefined") {
1548: pscat+='_'+subs[2];
1.11 www 1549: }
1.79 raeburn 1550: if ((pscat=='') || (typeof(pscat)=="undefined")) {
1.6 www 1551: pscat='default';
1552: }
1.2 www 1553: }
1.1 www 1554: if (pair[0]=='return') { preturn=pair[1]; }
1555: if (pair[0]=='call') { pcode=pair[1]; }
1.2 www 1556: if (pair[0]=='marker') { pmarker=pair[1]; }
1.1 www 1557: if (pair[0]=='name') { pname=pair[1]; }
1.63 www 1558: if (pair[0]=='modal') { pmodal=pair[1]; }
1.34 albertel 1559: if (pair[0]=='defhour' && pair[1] >= 0 && pair[1] < 24 ) {
1560: defhour=pair[1];
1561: }
1562: if (pair[0]=='defmin' && pair[1] >= 0 && pair[1] < 60) { defmin=pair[1]; }
1563: if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; }
1.80 raeburn 1564: if (pair[0]=='extra') { pextra=pair[1]; }
1.1 www 1565: }
1566:
1.79 raeburn 1567: var tablecol = '';
1.76 raeburn 1568: var ismap = '';
1569: if (markerRegExp.test(pmarker)) {
1570: var markerinfo = pmarker.match(markerRegExp);
1571: if (markerinfo.length == 4) {
1572: pmarkerst = markerinfo[1];
1573: pparm = markerinfo[2];
1.79 raeburn 1574: tablecol = markerinfo[3];
1.76 raeburn 1575: if (tablecol == 17 || tablecol == 16) {
1576: ismap = 1;
1577: if (tablecol == 17) {
1578: precursive = 1;
1579: }
1580: pnonreccol = 16;
1.79 raeburn 1581: } else if (tablecol == 11 || tablecol == 10) {
1.76 raeburn 1582: ismap = 1;
1583: if (tablecol == 11) {
1584: precursive = 1;
1585: }
1586: pnonreccol = 10;
1587: } else if (tablecol == 7 || tablecol == 6) {
1588: ismap = 1;
1589: if (tablecol == 7) {
1590: precursive = 1;
1591: }
1592: pnonreccol = 6;
1593: } else if (tablecol == 3 || tablecol == 2) {
1594: ismap = 1;
1595: if (tablecol == 3) {
1596: precursive = 1;
1597: }
1598: pnonreccol = 2;
1599: }
1600: }
1601: }
1.85 raeburn 1602: psmap = ismap;
1.76 raeburn 1603:
1604:
1.68 raeburn 1605: if (ptype=='date' && pscat == 'interval') {
1.70 raeburn 1606: if (doneproctorRegExp.test(pvalue)) {
1.71 raeburn 1607: var current = pvalue.match(doneproctorRegExp);
1608: if (current.length == 2) {
1609: var textstr = current[1];
1610: if (textstr != '') {
1611: var textvals = textstr.match(donetextRegExp);
1612: if (textvals.length == 2) {
1613: pextravaltwo = textvals[1];
1614: }
1615: }
1616: }
1.70 raeburn 1617: var intervalwithkey = pvalue.replace(doneproctorRegExp,'');
1618: if (proctorkeyRegExp.test(intervalwithkey)) {
1619: var currvals = intervalwithkey.match(proctorkeyRegExp);
1620: if (currvals.length == 3) {
1621: pvalue = currvals[1];
1622: pextraval = currvals[2];
1.71 raeburn 1623: pmodval = '_done_proctor';
1.70 raeburn 1624: } else {
1625: pmodval = '';
1626: }
1627: }
1628: } else {
1629: if (doneRegExp.test(pvalue)) {
1.79 raeburn 1630: var current = pvalue.match(doneRegExp);
1.71 raeburn 1631: if (current.length == 2) {
1632: var textstr = current[1];
1633: if (textstr != '') {
1634: var textvals = textstr.match(donetextRegExp);
1635: if (textvals.length == 2) {
1636: pextravaltwo = textvals[1];
1637: }
1638: }
1639: }
1.70 raeburn 1640: var pnumval = pvalue.replace(doneRegExp,'');
1.71 raeburn 1641: pmodval = '_done';
1.70 raeburn 1642: pvalue = pnumval;
1643: }
1.68 raeburn 1644: }
1645: }
1.1 www 1646: svalue=pvalue;
1.6 www 1647: if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
1.79 raeburn 1648: (pscat=='default') &&
1649: (typeof(svalue)!="undefined") &&
1.11 www 1650: (svalue!=0) && (svalue!='')) { pscat='any'; }
1.1 www 1651:
1.13 www 1652: if (ptype=='tolerance') {
1653: var tperc=0;
1654: var trange=0;
1655: if (typeof(svalue)!='undefined') {
1656: if (svalue.indexOf('%')!=-1) { tperc=1; }
1657: if (svalue.indexOf(',')!=-1) { trange=1; }
1658: if (trange) {
1659: if (tperc) { pscat='relative'; } else { pscat='absolute'; }
1660: } else {
1661: if (tperc) { pscat='relative_sym'; } else { pscat='absolute_sym'; }
1662: }
1663: }
1664: }
1665:
1.61 raeburn 1666: this.window.selector.document.open();
1.62 raeburn 1667: selwrite('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
1668: selwrite('<html xmlns="http://www.w3.org/1999/xhtml">');
1.55 bisitz 1669: selwrite('<head>');
1.62 raeburn 1670: selwrite('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
1671: selwrite('<title>LON-CAPA</title>');
1.55 bisitz 1672: selwrite('<style type="text/css">');
1673: selwrite('<!--');
1674: selwrite('body {');
1675: selwrite('font-family: Verdana,Arial,Helvetica,sans-serif;');
1676: selwrite('line-height:130%;');
1677: selwrite('font-size:0.83em;');
1678: selwrite('background: #FFFFFF;');
1679: selwrite('}');
1680: selwrite('-->');
1681: selwrite('</style>');
1682: selwrite('</head>');
1.62 raeburn 1683: selwrite('<body>');
1684: selwrite('<form name="fsel" action=""><b>'+pname+'</b><br />');
1.66 bisitz 1685: selwrite('Format of Value(s): <select name="fcat" onchange="parent.catchange();">');
1.12 www 1686:
1.1 www 1687: if (ptype=='tolerance') {
1688: sopt('default','Default');
1689: sopt('relative_sym','Relative Tolerance, Symmetric (percent)');
1690: sopt('relative','Relative Tolerance (percentages)');
1691: sopt('absolute_sym','Absolute Tolerance, Symmetric (value)');
1692: sopt('absolute','Absolute Tolerance (values)');
1693: }
1694:
1695: if (ptype=='date') {
1.48 albertel 1696: if (pscat != 'interval') {
1697: sopt('default','Default');
1698: sopt('start','Starting Date');
1699: sopt('end','Ending Date');
1700: } else {
1701: sopt('interval','Time Interval');
1702: }
1703:
1.11 www 1704: if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
1.2 www 1705: cdate.setTime(pvalue*1000);
1.30 www 1706: } else {
1.31 www 1707: cdate.setSeconds(defsec);
1708: cdate.setMinutes(defmin);
1709: cdate.setHours(defhour);
1.2 www 1710: }
1711:
1712: months[0]='January';
1713: months[1]='February';
1714: months[2]='March';
1715: months[3]='April';
1716: months[4]='May';
1717: months[5]='June';
1718: months[6]='July';
1719: months[7]='August';
1720: months[8]='September';
1721: months[9]='October';
1722: months[10]='November';
1723: months[11]='December';
1.1 www 1724: }
1.79 raeburn 1725:
1.6 www 1726: if (ptype=='int') {
1727: sopt('default','Default');
1728: sopt('pos','Positive Integer, Not Zero');
1729: sopt('zeropos','Positive Integer or Zero');
1.13 www 1730: sopt('inrange','Integer in Range');
1731: sopt('range','Range of Integers');
1.6 www 1732: sopt('any','Integer');
1.1 www 1733: }
1734:
1.6 www 1735: if (ptype=='float') {
1736: sopt('default','Default');
1737: sopt('zeroone','Floating Point between 0 and 1');
1738: sopt('pos','Positive Floating Point');
1739: sopt('any','Floating Point');
1.1 www 1740:
1741: }
1742:
1.6 www 1743: if (ptype=='string') {
1.44 albertel 1744: //sopt('default','Default');
1745: if (pscat == 'yesno') { sopt('yesno','Yes/No'); }
1.47 albertel 1746: else if (pscat == 'problemstatus'){ sopt('problemstatus','Problem Status'); }
1.45 albertel 1747: else if (pscat == 'examtype') { sopt('examtype','Exam Type'); }
1748: else if (pscat == 'questiontype') { sopt('questiontype','Question Type'); }
1.60 raeburn 1749: else if (pscat == 'lenient') { sopt('lenient','Lenient Grading (Partial Credit)'); }
1.64 raeburn 1750: else if (pscat == 'discussvote') { sopt('discussvote','Discussion Voting'); }
1.45 albertel 1751: else if (pscat == 'ip') { sopt('ip','IP Number/Name'); }
1752: else if (pscat == 'fileext') { sopt('fileext','File Extension'); }
1753: else if (pscat == 'useslots') { sopt('useslots','Slots control access'); }
1.78 raeburn 1754: else if (pscat == 'deeplink') { sopt('deeplink','Deep-linked items'); }
1.45 albertel 1755: else { pscat = 'any'; }
1.80 raeburn 1756: if (pscat != 'deeplink') { sopt('any','String Value'); }
1.22 www 1757: }
1758:
1759: if (ptype=='color') {
1760: sopt('default','Use Default Color');
1761: sopt('custom','Use Custom Color');
1.1 www 1762: }
1763:
1764: selwrite('</select></form>');
1.77 raeburn 1765: if (ismap == 1) {
1.76 raeburn 1766: if ((pparm != 'hiddenresource') && (pparm != 'encrypturl')) {
1767: selwrite('<form name="frec" action="">');
1768: selwrite('Recursive: <label><input type="radio" name="recurse" value="1" ');
1769: if (precursive == 1) {
1770: selwrite('checked="checked" ');
1771: }
1772: selwrite('onclick="parent.recursechange();" />Yes</label> ');
1773: selwrite('<label><input type="radio" name="recurse" value="0" ');
1774: if (precursive != 1) {
1775: selwrite('checked="checked" ');
1776: }
1.83 raeburn 1777: selwrite('onclick="parent.recursechange();" />No</label>');
1.76 raeburn 1778: selwrite('</form><br />');
1779: }
1780: }
1.63 www 1781: var targ='parent.opener';
1782: if (pmodal==1) {
1783: targ='parent.parent';
1.70 raeburn 1784: }
1785: if ((ptype=='date') && (pscat=='interval')) {
1786: selwrite('<a href="javascript:parent.validateInterval();');
1.80 raeburn 1787: } else if ((ptype=='string') && (pscat=='deeplink')) {
1788: selwrite('<a href="javascript:parent.validateDeepLink();');
1.70 raeburn 1789: } else {
1790: selwrite('<a href="javascript:parent.assemble();');
1791: }
1.1 www 1792: if (preturn!='') {
1.63 www 1793: selwrite(targ+'.document.'+preturn+'_value.value=parent.window.svalue;');
1794: selwrite(targ+'.document.'+preturn+'_type.value=parent.window.stype;');
1.2 www 1795: }
1796: if (pmarker!='') {
1.63 www 1797: selwrite(targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.1 www 1798: }
1799: if (pcode!='') {
1.63 www 1800: selwrite(targ+'.'+pcode+'();');
1.1 www 1801: }
1.43 albertel 1802: selwrite('">Save</a> ');
1.5 www 1803:
1804: selwrite('<a href="javascript:');
1.63 www 1805: selwrite(targ+'.document.'+preturn+'_value.value='+"'';");
1.5 www 1806: if (pmarker!='') {
1807: selwrite(
1.63 www 1808: targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.5 www 1809: }
1810: if (pcode!='') {
1.63 www 1811: selwrite(targ+'.'+pcode+'();');
1.5 www 1812: }
1813: selwrite('">Delete</a> ');
1.4 www 1814:
1.1 www 1815: selwrite('</body></html>');
1816: this.window.selector.document.close();
1.84 raeburn 1817: if (pscat == 'deeplink') {
1.85 raeburn 1818: if (psmap==1) {
1819: document.getElementById("LCparampopup").rows="100,*";
1820: } else {
1821: document.getElementById("LCparampopup").rows="60,*";
1822: }
1.84 raeburn 1823: }
1.2 www 1824: draw();
1.83 raeburn 1825:
1.1 www 1826: }
1827:
1.56 raeburn 1828: // ]]>
1.1 www 1829: </script>
1.56 raeburn 1830: </head>
1.1 www 1831:
1.84 raeburn 1832: <frameset id="LCparampopup" rows="125,*" onload="init();">
1.56 raeburn 1833: <frame name="selector" src="empty.html" />
1834: <frame name="choices" src="empty.html" />
1.1 www 1835: </frameset>
1836:
1837:
1838:
1.16 albertel 1839: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>