Annotation of rat/client/parameter.html, revision 1.87
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.87 ! raeburn 8: // $Id: parameter.html,v 1.86 2021/08/04 19:59:12 raeburn Exp $
1.16 albertel 9: //
10: // Copyright Michigan State University Board of Trustees
11: //
12: // This file is part of the LearningOnline Network with CAPA (LON-CAPA).
13: //
14: // LON-CAPA is free software; you can redistribute it and/or modify
15: // it under the terms of the GNU General Public License as published by
16: // the Free Software Foundation; either version 2 of the License, or
17: // (at your option) any later version.
18: //
19: // LON-CAPA is distributed in the hope that it will be useful,
20: // but WITHOUT ANY WARRANTY; without even the implied warranty of
21: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22: // GNU General Public License for more details.
23: //
24: // You should have received a copy of the GNU General Public License
25: // along with LON-CAPA; if not, write to the Free Software
26: // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27: //
28: // /home/httpd/html/adm/gpl.txt
29: //
30: // http://www.lon-capa.org/
31: //
1.1 www 32: -->
33: <head>
1.56 raeburn 34: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
1.1 www 35: <title>LON-CAPA</title>
36:
1.46 albertel 37: <script type="text/javascript">
1.56 raeburn 38: // <![CDATA[
1.1 www 39:
40: var ptype='';
41: var pvalue='';
1.68 raeburn 42: var pmodval='';
1.70 raeburn 43: var pextraval='';
1.71 raeburn 44: var pextravaltwo='';
1.1 www 45: var preturn='';
46: var pcode='';
1.2 www 47: var pscat='';
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') {
404: if ((sform.donebutton_proctorkey.value == '') ||
405: (sform.donebutton_proctorkey.value == null)) {
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.72 raeburn 639: if ((sform.lenientrelwt.length != 'undefined') && (sform.lenientrelwt.length) != 'null') {
640: for (var i=0; i<sform.lenientrelwt.length; i++) {
641: var relweight = sform.lenientrelwt[i].value;
642: relweight = relweight.replace(/^\s+|\s+$/g,'');
643: if (!patternRelWeight.test(relweight)) {
644: if (i<2) {
645: relweight = '1.0';
646: } else {
647: relweight = '0.0';
648: }
649: }
650: sform.lenientrelwt[i].value = relweight;
651: if (i==0) {
652: svalue = relweight;
653: } else {
654: svalue += ','+relweight;
655: }
656: }
657: }
658: } else {
659: if (document.getElementById('lenientweighteddiv')) {
660: document.getElementById('lenientweighteddiv').style.display='none';
661: }
662: svalue=newval;
1.73 raeburn 663: }
1.72 raeburn 664: draw();
665: }
666:
667: function calllenientradioeval(newval) {
668: return 'onclick="parent.lenienteval(\''+newval+'\')"';
669: }
670:
1.68 raeburn 671: function callintervalpmodval() {
1.70 raeburn 672: return 'onclick="parent.intcalc();parent.toggleSecret()"';
1.79 raeburn 673: }
1.68 raeburn 674:
1.2 www 675: function intervaldis() {
676: csecs=svalue;
677: cdays=Math.floor(csecs/86400);
678: csecs-=cdays*86400;
679: chours=Math.floor(csecs/3600);
680: csecs-=chours*3600;
681: cmins=Math.floor(csecs/60);
682: csecs-=cmins*60;
1.69 musolffc 683: return cdays+' days '+chours+' hours '+cmins+' mins '+csecs+' secs';
1.2 www 684: }
1.21 www 685:
686: function pickcolor(picked) {
687: svalue=picked;
688: draw();
689: }
690:
691: function colorfield(ir,ig,ib) {
692: var col=new Array;
1.23 www 693: col=["00","11","22","44","66","88","AA","CC","DD","EE","FF"];
1.21 www 694: var color='#'+col[ir]+col[ig]+col[ib];
1.23 www 695: var selection="<font color='"+color+"'>X</font>";
696: if (color==svalue) { selection="<font color='#"+col[10-ir]+col[10-ig]+col[10-ib]+"'>X</font>"; }
1.21 www 697: choicewrite('<td bgcolor="'+color+'"><a href="javascript:parent.pickcolor('+"'"+
698: color+"'"+')">'+selection+'</a></td>');
1.80 raeburn 699: }
1.21 www 700:
1.1 www 701: function draw() {
702: choicestart();
1.51 bisitz 703: choicewrite('<form name="sch"');
1.6 www 704: if (ptype=='int') {
705: choicewrite(' action="javascript:integereval();"');
706: }
707: if (ptype=='float') {
708: choicewrite(' action="javascript:floateval();"');
709: }
710: if (ptype=='string') {
1.73 raeburn 711: if (pscat == 'ip') {
712: choicewrite(' action="javascript:ipstringeval();"');
713: } else {
714: choicewrite(' action="javascript:stringeval();"');
715: }
1.6 www 716: }
1.62 raeburn 717: if (ptype != 'int' && ptype != 'float' && ptype != 'string') {
718: choicewrite(' action=""');
719: }
1.6 www 720: choicewrite('>');
1.1 www 721: if (ptype=='tolerance') {
1.2 www 722: // 0: pscat
723: if (pscat=='default') {
1.1 www 724: tablestart('Use default value or algorithm of resource');
725: }
1.2 www 726: if (pscat=='relative_sym') {
1.1 www 727: // 2: percentage
728: // 3: open
729: tablestart('Percentage error, symmetric around value');
730: valline('Percentage',2,3);
1.13 www 731: if ((svalue!='') && (typeof(svalue)!="undefined")) {
732: choices.document.forms.sch.val2.value=parseInt(svalue);
733: if (svalue.indexOf('+')!=-1) {
734: choices.document.forms.sch.val3.checked=true;
735: }
736: }
1.1 www 737: }
1.2 www 738: if (pscat=='relative') {
1.1 www 739: // 2: left
740: // 3: open
741: // 4: right
742: // 5: open
743: tablestart('Percentage error, asymmetric around value');
744: valline('Upper percentage',2,3);
745: valline('Lower percentage',4,5);
1.17 matthew 746: var range1=new Array;
1.13 www 747: if ((svalue!='') && (typeof(svalue)!="undefined")) {
1.17 matthew 748: range1=svalue.split(',');
749: if (typeof(range1[1])=='undefined') { range1[1]=range1[0]; }
750: choices.document.forms.sch.val2.value=parseFloat(range1[0]);
751: if (range1[0].indexOf('+')!=-1) {
1.13 www 752: choices.document.forms.sch.val3.checked=true;
753: }
1.17 matthew 754: choices.document.forms.sch.val4.value=parseFloat(range1[1]);
755: if (range1[1].indexOf('+')!=-1) {
1.13 www 756: choices.document.forms.sch.val5.checked=true;
757: }
758: }
1.1 www 759: }
1.2 www 760: if (pscat=='absolute_sym') {
1.1 www 761: tablestart('Absolute error, symmetric around value');
762: valline('Value',2,3);
1.13 www 763: if ((svalue!='') && (typeof(svalue)!="undefined")) {
1.15 www 764: choices.document.forms.sch.val2.value=parseFloat(svalue);
1.13 www 765: if (svalue.indexOf('+')!=-1) {
766: choices.document.forms.sch.val3.checked=true;
767: }
768: }
1.1 www 769: }
1.2 www 770: if (pscat=='absolute') {
1.1 www 771: tablestart('Absolute error, asymmetric around value');
772: valline('Upper value',2,3);
773: valline('Lower value',4,5);
1.17 matthew 774: var range2=new Array;
1.13 www 775: if ((svalue!='') && (typeof(svalue)!="undefined")) {
776: range=svalue.split(',');
1.17 matthew 777: if (typeof(range2[1])=='undefined') { range2[1]=range2[0]; }
778: choices.document.forms.sch.val2.value=parseFloat(range2[0]);
779: if (range2[0].indexOf('+')!=-1) {
1.13 www 780: choices.document.forms.sch.val3.checked=true;
781: }
1.17 matthew 782: choices.document.forms.sch.val4.value=parseFloat(range2[1]);
783: if (range2[1].indexOf('+')!=-1) {
1.13 www 784: choices.document.forms.sch.val5.checked=true;
785: }
786: }
1.1 www 787: }
788: }
789:
790: if (ptype=='date') {
1.2 www 791: if (pscat=='default') {
792: tablestart('Default value or none');
793: choicewrite('</table>');
794: } else {
795: if (pscat=='start') {
1.24 www 796: tablestart('Date and time');
1.2 www 797: }
798: if (pscat=='end') {
1.24 www 799: tablestart('Date and time');
1.2 www 800: }
801: if (pscat=='interval') {
1.70 raeburn 802: var proctorkeytype = 'hidden';
1.71 raeburn 803: var donebuttontext = 'none';
1.70 raeburn 804: if (pmodval == '_done_proctor') {
805: proctorkeytype = 'text';
1.71 raeburn 806: donebuttontext = 'block';
807: }
808: if (pmodval == '_done') {
809: donebuttontext = 'block';
1.70 raeburn 810: }
1.2 www 811: tablestart('Time interval');
1.69 musolffc 812: choicewrite( [
813: '<tr><td colspan="3">'+intervaldis()+'</td></tr>',
814: '<tr><td>Time:</td><td colspan="2">',
815: '<span style="white-space:nowrap">'+intday()+' days </span>',
816: '<span style="white-space:nowrap">'+inthour()+' hours</span>',
817: '<span style="white-space:nowrap">'+intminute()+' mins</span>',
818: '<span style="white-space:nowrap">'+intsecond()+' secs</span>',
819: '</td></tr>',
820: '</table>',
821: '<br />',
822: ].join("\n"));
1.68 raeburn 823: tablestart('Provide a "Done" button to students?');
824: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.70 raeburn 825: choicewrite('<label><input name="donebutton" value=""'+
826: ' type="radio" '+callintervalpmodval());
827: if (pmodval == '') { choicewrite(' checked="checked"'); }
828: choicewrite(' /> No</label><br />');
1.68 raeburn 829: choicewrite('<label><input name="donebutton" value="_done"'+
830: ' type="radio" '+callintervalpmodval());
1.70 raeburn 831: if (pmodval == '_done') { choicewrite(' checked="checked"'); }
1.68 raeburn 832: choicewrite(' /> Yes</label><br />');
1.70 raeburn 833: choicewrite('<span style="white-space:nowrap">'+
834: '<label><input name="donebutton" value="_done_proctor"'+
1.68 raeburn 835: ' type="radio" '+callintervalpmodval());
1.70 raeburn 836: if (pmodval == '_done_proctor') { choicewrite(' checked="checked"'); }
837: choicewrite(' /> Yes, with proctor key</label>');
838: choicewrite(' <input name="donebutton_proctorkey" value='+
839: '"'+escapeHTML(pextraval)+'" type="'+proctorkeytype+
1.71 raeburn 840: '" id="done_proctorkey" size="10"'+
841: ' onblur="parent.intcalc();" /></span><br />'+
842: '<div id="donebuttontextdiv" style="display:'+donebuttontext+'">'+
843: '<br /><span style="white-space:nowrap">'+
844: 'Button text:'+
845: '<input name="donebutton_text" value='+
846: '"'+escapeHTML(pextravaltwo)+'" type="text" '+
847: 'size="10" onblur="parent.intcalc();" /></span></div>');
1.68 raeburn 848: choicewrite('</td></tr></table>');
849: } else {
1.52 bisitz 850: choicewrite('<tr><td colspan="3">'
1.2 www 851: +cdate.toString()+
1.52 bisitz 852: '</td></tr><tr><td>Date:</td><td colspan="2">');
1.2 www 853: month();date();year();
1.52 bisitz 854: choicewrite('</td></tr><tr><td>Time:'
1.51 bisitz 855: +'</td><td colspan="2">');hour();choicewrite('h ');minute();
1.2 www 856: choicewrite('m ');second();
857: choicewrite('s</td></tr></table>');
858: }
859: }
1.1 www 860: }
861:
1.6 www 862: if (ptype=='int') {
1.19 www 863: var pscatparts=new Array;
864: pscatparts=pscat.split(',');
865: pscat=pscatparts[0];
1.6 www 866: if (pscat=='default') {
867: tablestart('Default value or none');
1.14 www 868: choicewrite('</table>');
1.6 www 869: } else {
1.14 www 870: if (pscat=='range') {
871: tablestart('Integer range');
1.52 bisitz 872: choicewrite('<tr><td>Lower Value:'+
1.51 bisitz 873: '</td><td colspan="2"><input type="text" size="4" name="val2'+
1.53 bisitz 874: '" /></td></tr>');
1.52 bisitz 875: choicewrite('<tr><td>Upper Value:'+
1.51 bisitz 876: '</td><td colspan="2"><input type="text" size="4" name="val4'+
1.53 bisitz 877: '" /></td></tr></table>');
1.14 www 878: var range=new Array;
879: if ((svalue!='') && (typeof(svalue)!="undefined")) {
880: range=svalue.split(',');
881: if (typeof(range[1])=='undefined') { range[1]=range[0]; }
882: choices.document.forms.sch.val2.value=parseInt(range[0]);
883: choices.document.forms.sch.val4.value=parseInt(range[1]);
884: }
885: } else {
1.6 www 886: if (pscat=='pos') {
887: tablestart('Positive (non-zero) integer');
888: }
889: if (pscat=='zeropos') {
890: tablestart('Positive integer or zero');
891: }
1.12 www 892: if (pscat.indexOf('inrange')!=-1) {
1.10 www 893: var rangeparts=new Array;
1.12 www 894: rangeparts=split(',',pscat);
1.10 www 895: tablestart('Integer in the range ['+rangeparts[1]+']');
896: }
1.6 www 897: if (pscat=='any') {
898: tablestart('Integer');
899: }
1.52 bisitz 900: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.51 bisitz 901: choicewrite('<input name="intval" size="10" value="'+escapeHTML(svalue)+
1.53 bisitz 902: '" onchange="parent.integereval()" />');
1.54 bisitz 903: choicewrite('</td></tr></table>');
1.6 www 904: }
1.14 www 905: }
1.1 www 906: }
907:
1.6 www 908: if (ptype=='float') {
909: if (pscat=='default') {
910: tablestart('Default value or none');
1.79 raeburn 911: choicewrite('</table>');
1.6 www 912: } else {
913: if (pscat=='pos') {
914: tablestart('Positive floating point number or zero');
915: }
916: if (pscat=='zeroone') {
917: tablestart('Floating point number between zero and one');
918: }
919: if (pscat=='any') {
920: tablestart('Floating point number');
921: }
1.52 bisitz 922: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.51 bisitz 923: choicewrite('<input name="floatval" size="10" value="'+escapeHTML(svalue)+
1.53 bisitz 924: '" onchange="parent.floateval()" />');
1.54 bisitz 925: choicewrite('</td></tr></table>');
1.6 www 926: }
1.1 www 927: }
928:
1.6 www 929: if (ptype=='string') {
1.83 raeburn 930: if ((pscat=='any') || (pscat=='') || (pscat=='default') ||
1.42 albertel 931: (typeof(pscat)=='undefined')) {
1.6 www 932: tablestart('Text');
1.54 bisitz 933: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.46 albertel 934: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.53 bisitz 935: '" type="text" onchange="parent.stringeval()" />');
1.25 www 936: }
937: if (pscat=='yesno') {
938: tablestart('Yes/No');
1.52 bisitz 939: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32 albertel 940: choicewrite('<label><input name="stringval" value="yes"'+
1.29 www 941: ' type="radio" '+callradiostringeval('yes'));
1.53 bisitz 942: if (svalue=='yes') { choicewrite(' checked="checked"'); }
943: choicewrite(' /> Yes</label><br />');
1.32 albertel 944: choicewrite('<label><input name="stringval" value="no"'+
1.29 www 945: ' type="radio" '+callradiostringeval('no'));
1.53 bisitz 946: if (svalue=='no') { choicewrite(' checked="checked"'); }
947: choicewrite(' /> No</label><br />');
1.25 www 948: }
1.47 albertel 949: if (pscat=='problemstatus') {
950: tablestart('Problem Status');
1.52 bisitz 951: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.47 albertel 952: choicewrite('<label><input name="stringval" value="yes"'+
953: ' type="radio" '+callradiostringeval('yes'));
1.53 bisitz 954: if (svalue=='yes') { choicewrite(' checked="checked"'); }
955: choicewrite(' /> Yes</label><br />');
1.49 albertel 956: choicewrite('<label><input name="stringval" value="answer"'+
957: ' type="radio" '+callradiostringeval('answer'));
1.53 bisitz 958: if (svalue=='answer') { choicewrite(' checked="checked"'); }
959: choicewrite(' /> Yes, and show correct answer if they exceed the maximum number of tries.</label><br />');
1.47 albertel 960: choicewrite('<label><input name="stringval" value="no"'+
961: ' type="radio" '+callradiostringeval('no'));
1.53 bisitz 962: if (svalue=='no') { choicewrite(' checked="checked"'); }
963: choicewrite(' /> No, don\'t show correct/incorrect feedback.</label><br />');
1.47 albertel 964: choicewrite('<label><input name="stringval" value="no_feedback_ever"'+
965: ' type="radio" '+callradiostringeval('no_feedback_ever'));
1.53 bisitz 966: if (svalue=='no_feedback_ever') { choicewrite(' checked="checked"'); }
967: choicewrite(' /> No, show no feedback at all.</label><br />');
1.47 albertel 968: }
1.25 www 969: if (pscat=='examtype') {
970: tablestart('Exam Type');
1.52 bisitz 971: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32 albertel 972: choicewrite('<label><input name="stringval" value="online"'+
1.29 www 973: ' type="radio" '+callradiostringeval('online'));
1.53 bisitz 974: if (svalue=='online') { choicewrite(' checked="checked"'); }
975: choicewrite(' /> Online</label><br />');
1.32 albertel 976: choicewrite('<label><input name="stringval" value="checkout"'+
1.29 www 977: ' type="radio" '+callradiostringeval('checkout'));
1.53 bisitz 978: if (svalue=='checkout') { choicewrite(' checked="checked"'); }
979: choicewrite(' /> Check out</label><br />');
1.25 www 980: }
981: if (pscat=='questiontype') {
982: tablestart('Question Type');
1.52 bisitz 983: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32 albertel 984: choicewrite('<label><input name="stringval" value="problem"'+
1.29 www 985: ' type="radio" '+callradiostringeval('problem'));
1.53 bisitz 986: if (svalue=='problem') { choicewrite(' checked="checked"'); }
987: choicewrite(' /> Standard Problem</label><br />');
1.36 albertel 988: // choicewrite('<label><input name="stringval" value="quiz"'+
989: // ' type="radio" '+callradiostringeval('quiz'));
1.53 bisitz 990: // if (svalue=='quiz') { choicewrite(' checked="checked"'); }
991: // choicewrite(' /> Quiz</label><br />');
1.35 albertel 992: choicewrite('<label><input name="stringval" value="practice"'+
993: ' type="radio" '+callradiostringeval('practice'));
1.53 bisitz 994: if (svalue=='practice') { choicewrite(' checked="checked"'); }
995: choicewrite(' /> Practice</label><br />');
1.32 albertel 996: choicewrite('<label><input name="stringval" value="exam"'+
1.29 www 997: ' type="radio" '+callradiostringeval('exam'));
1.53 bisitz 998: if (svalue=='exam') { choicewrite(' checked="checked"'); }
1.65 bisitz 999: choicewrite(' /> Bubblesheet Exam</label><br />');
1.36 albertel 1000: // choicewrite('<label><input name="stringval" value="assess"'+
1001: // ' type="radio" '+callradiostringeval('assess'));
1.53 bisitz 1002: // if (svalue=='assess') { choicewrite(' checked="checked"'); }
1003: // choicewrite(' /> Assessment</label><br />');
1.32 albertel 1004: choicewrite('<label><input name="stringval" value="survey"'+
1.29 www 1005: ' type="radio" '+callradiostringeval('survey'));
1.53 bisitz 1006: if (svalue=='survey') { choicewrite(' checked="checked"'); }
1007: choicewrite(' /> Survey</label><br />');
1.36 albertel 1008: // choicewrite('<label><input name="stringval" value="form"'+
1009: // ' type="radio" '+callradiostringeval('form'));
1.53 bisitz 1010: // if (svalue=='form') { choicewrite(' checked="checked"'); }
1.36 albertel 1011: // choicewrite('> Input Form</label><br />');
1.57 raeburn 1012: choicewrite('<label><input name="stringval" value="surveycred"'+
1013: ' type="radio" '+callradiostringeval('surveycred'));
1014: if (svalue=='surveycred') { choicewrite(' checked="checked"'); }
1015: choicewrite('> Survey (credit for submission)</label><br />');
1016: choicewrite('<label><input name="stringval" value="anonsurvey"'+
1017: ' type="radio" '+callradiostringeval('anonsurvey'));
1018: if (svalue=='anonsurvey') { choicewrite(' checked="checked"'); }
1019: choicewrite('> Anonymous Survey</label><br />');
1020: choicewrite('<label><input name="stringval" value="anonsurveycred"'+
1021: ' type="radio" '+callradiostringeval('anonsurveycred'));
1022: if (svalue=='anonsurveycred') { choicewrite(' checked="checked"'); }
1023: choicewrite('> Anonymous Survey (credit for submission)</label><br />');
1.59 raeburn 1024: choicewrite('<label><input name="stringval" value="randomizetry"'+
1025: ' type="radio" '+callradiostringeval('randomizetry'));
1026: if (svalue=='randomizetry') { choicewrite(' checked="checked"'); }
1027: choicewrite('> New Randomization Each N Tries (default N=1)</label><br />');
1.32 albertel 1028: choicewrite('<label><input name="stringval" value="library"'+
1.29 www 1029: ' type="radio" '+callradiostringeval('library'));
1.53 bisitz 1030: if (svalue=='library') { choicewrite(' checked="checked"'); }
1031: choicewrite(' /> Library</label><br />');
1.25 www 1032: }
1.60 raeburn 1033: if (pscat=='lenient') {
1.72 raeburn 1034: var patternLenientStd = /^(yes|no|default)$/;
1035: var patternLenientRel = /^([\-\d\.]+)\,([\-\d\.]+)\,([\-\d\.]+)\,([\-\d\.]+)$/;
1036: var lenientweighted = 'none';
1037: var relatives = new Array;
1.60 raeburn 1038: tablestart('Lenient Grading (Partial Credit)');
1039: choicewrite('<tr><td>Value:</td><td colspan="2">');
1040: choicewrite('<label><input name="stringval" value="yes"'+
1.72 raeburn 1041: ' type="radio" '+calllenientradioeval('yes'));
1.60 raeburn 1042: if (svalue=='yes') { choicewrite(' checked="checked"'); }
1043: choicewrite(' /> Yes</label><br />');
1044: choicewrite('<label><input name="stringval" value="no"'+
1.72 raeburn 1045: ' type="radio" '+calllenientradioeval('no'));
1.60 raeburn 1046: if (svalue=='no') { choicewrite(' checked="checked"'); }
1047: choicewrite(' /> No</label><br />');
1048: choicewrite('<label><input name="stringval" value="default"'+
1.72 raeburn 1049: ' type="radio" '+calllenientradioeval('default'));
1.60 raeburn 1050: if (svalue=='default') { choicewrite(' checked="checked"'); }
1051: choicewrite(' /> Default (only bubblesheet grading is lenient)</label><br />');
1.72 raeburn 1052: choicewrite('<label><input name="stringval" value="weighted"'+
1053: ' type="radio" '+calllenientradioeval('weighted'));
1054: if (!patternLenientStd.test(svalue) && svalue != '') {
1055: choicewrite(' checked="checked"');
1056: lenientweighted='block';
1057: var relatives = svalue.match(patternLenientRel);
1058: }
1059: choicewrite(' />Yes, weighted (optionresponse in checkbox mode)</label><br /><br />'+
1060: '<div id="lenientweighteddiv" style="display:'+lenientweighted+'">'+
1061: '<table class="LC_parmsel_table"><tr bgcolor="#C5DB99">'+
1062: '<th colspan="2">Foil submission status</th><th>Points</th></tr>');
1063: var lenienttypes = ['Correct (checked)','Correct (unchecked)','Incorrect (checked)','Incorrect (unchecked)'];
1064: for (var i=0; i<lenienttypes.length; i++) {
1065: var j = i+1;
1066: if (relatives[j] == '') {
1067: if (i < 2) {
1068: relatives[j] = '1.0';
1069: } else {
1070: relatives[j] = '0.0';
1071: }
1072: }
1073: choicewrite('<tr><td colspan="2">'+lenienttypes[i]+'</td>'+
1074: '<td><input type="text" name="lenientrelwt" value="'+relatives[j]+'"'+
1075: ' size="3" onblur="parent.lenienteval(\'weighted\')" /></td></tr>');
1076: }
1077: choicewrite('</table></div>');
1.60 raeburn 1078: }
1.64 raeburn 1079: if (pscat=='discussvote') {
1080: tablestart('Discussion Voting');
1081: choicewrite('<tr><td>Value:</td><td colspan="2">');
1082: choicewrite('<label><input name="stringval" value="yes"'+
1083: ' type="radio" '+callradiostringeval('yes'));
1084: if (svalue=='yes') { choicewrite(' checked="checked"'); }
1085: choicewrite(' /> Yes</label><br />');
1086: choicewrite('<label><input name="stringval" value="notended"'+
1087: ' type="radio" '+callradiostringeval('notended'));
1088: if (svalue=='notended') { choicewrite(' checked="checked"'); }
1089: choicewrite(' /> Yes, unless discussion ended</label><br />');
1090: choicewrite('<label><input name="stringval" value="no"'+
1091: ' type="radio" '+callradiostringeval('no'));
1092: if (svalue=='no') { choicewrite(' checked="checked"'); }
1093: choicewrite(' /> No</label><br />');
1094: }
1.25 www 1095: if (pscat=='ip') {
1.83 raeburn 1096: var currallow = new Array;
1.73 raeburn 1097: var currdeny = new Array;
1098: if ((svalue != '') && (svalue != null)) {
1099: var patternComma = /,/;
1100: var patternAllow = /^([\[\]a-zA-Z\.\d\*\-]+)$/;
1101: var patternDeny = /^\!([\[\]a-zA-Z\.\d\*\-]+)$/;
1102: var current = new Array;
1.83 raeburn 1103: if (patternComma.test(svalue)) {
1.73 raeburn 1104: current = svalue.split(',');
1105: } else {
1.81 raeburn 1106: current = [svalue];
1.73 raeburn 1107: }
1108: for (var i=0; i<current.length; i++) {
1109: if (patternDeny.test(current[i])) {
1110: var denied = current[i].replace(/^!/,'');
1111: currdeny.push(denied);
1112: } else {
1113: if (patternAllow.test(current[i])) {
1114: currallow.push(current[i]);
1.83 raeburn 1115: }
1.73 raeburn 1116: }
1117: }
1118: }
1119: if (currdeny.length == 0) {
1120: currdeny = ('');
1121: }
1122: if (currallow.length == 0) {
1123: currallow = ('');
1124: }
1125: var curripaccess = [currallow,currdeny];
1126: tablestart('IP Number/Name');
1127: choicewrite('<tr><th>Allow from</th><th>Deny from</th></tr><tr>');
1128: var acctypes = ['allow','deny'];
1129: for (var i=0; i<acctypes.length; i++) {
1130: choicewrite('<td valign="top">'+
1131: '<div class="LC_string_ipacc_wrap" id="LC_string_ipacc_'+acctypes[i]+'">'+
1132: '<div class="LC_string_ipacc_inner" id="LC_string_ipacc_inner_'+acctypes[i]+'">');
1133: for (var j=0; j<curripaccess[i].length; j++) {
1134: choicewrite('<div><input type="text" size="10" name="setip'+acctypes[i]+'" value="'+curripaccess[i][j]+'" onblur="parent.ipstringeval();" />');
1.74 raeburn 1135: choicewrite('<a href="#" onclick="parent.removeIpRule(\''+acctypes[i]+'\',\''+j+'\')">Remove</a>');
1.73 raeburn 1136: choicewrite('</div>');
1137: }
1.74 raeburn 1138: choicewrite('</div><button onclick="parent.addIpRule(\''+acctypes[i]+'\');">Add item</button>');
1.73 raeburn 1139: }
1140: choicewrite('</div></td></tr></table>');
1.6 www 1141: }
1.26 www 1142: if (pscat=='fileext') {
1143: tablestart('Allowed File Extensions');
1.52 bisitz 1144: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32 albertel 1145: choicewrite('<label><input name="radstringval" value="txt"'+
1.29 www 1146: ' type="radio" '+callradiostringeval('txt'));
1.53 bisitz 1147: if (svalue=='txt') { choicewrite(' checked="checked"'); }
1148: choicewrite(' /> Plain Text</label><br />');
1.32 albertel 1149: choicewrite('<label><input name="radstringval" value="png,jpg,jpeg,gif"'+
1.29 www 1150: ' type="radio" '+callradiostringeval('png,jpg,jpeg,gif'));
1.53 bisitz 1151: if (svalue=='png,jpg,jpeg,gif') { choicewrite(' checked="checked"'); }
1152: choicewrite(' /> Picture File</label><br />');
1.58 raeburn 1153: choicewrite('<label><input name="radstringval" value="doc,docx,xls,xlsx,ppt,pptx"'+
1154: ' type="radio" '+callradiostringeval('doc,docx,xls,xlsx,ppt,pptx'));
1155: if (svalue=='doc,docx,xls,xlsx,ppt,pptx') { choicewrite(' checked="checked"'); }
1.53 bisitz 1156: if (svalue=='doc,xls,ppt') { choicewrite(' checked="checked"'); }
1157: choicewrite(' /> Office Document</label><br />');
1.46 albertel 1158: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.53 bisitz 1159: '" onchange="parent.stringeval()" />');
1.26 www 1160: }
1.37 albertel 1161: if (pscat=='useslots') {
1162: tablestart('Slots control access');
1.52 bisitz 1163: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.37 albertel 1164: choicewrite('<label><input name="stringval" value="no"'+
1165: ' type="radio" '+callradiostringeval('no'));
1.53 bisitz 1166: if (svalue=='no') { choicewrite(' checked="checked"'); }
1167: choicewrite(' /> No</label><br />');
1.37 albertel 1168: choicewrite('<label><input name="stringval" value="resource"'+
1169: ' type="radio" '+callradiostringeval('resource'));
1.53 bisitz 1170: if (svalue=='resource') { choicewrite(' checked="checked"'); }
1.82 raeburn 1171: choicewrite(' /> Yes, and the scope of the slot is a single resource.</label><br />');
1.38 albertel 1172: choicewrite('<label><input name="stringval" value="map"'+
1173: ' type="radio" '+callradiostringeval('map'));
1.53 bisitz 1174: if (svalue=='map') { choicewrite(' checked="checked"'); }
1.82 raeburn 1175: 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 1176: choicewrite('<label><input name="stringval" value="map_map"'+
1.40 albertel 1177: ' type="radio" '+callradiostringeval('map_map'));
1.53 bisitz 1178: if (svalue=='map_map') { choicewrite(' checked="checked"'); }
1.82 raeburn 1179: 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 1180: choicewrite('</td></tr></table>');
1.80 raeburn 1181: }
1182: if (pscat=='deeplink') {
1183: var deeplinkvals = new Array();
1.86 raeburn 1184: var linkprotectparts = new Array();
1185: var ltikeyRegExp = /^(ltic|ltid|key):(\w+)$/;
1.80 raeburn 1186: var dlinkkeysty = 'hidden';
1.84 raeburn 1187: var dlinkkeyval = '';
1.86 raeburn 1188: var dlinklticdivsty = 'none';
1189: var dlinkltiddivsty = 'none';
1.84 raeburn 1190: var dlinkmenusdivsty = 'none';
1.80 raeburn 1191: if ((svalue != '') && (svalue != null)) {
1192: deeplinkvals = svalue.split(',');
1.86 raeburn 1193: if (ltikeyRegExp.test(deeplinkvals[4])) {
1194: linkprotectparts = deeplinkvals[4].split(':');
1195: deeplinkvals[4] = linkprotectparts[0];
1196: if (linkprotectparts[0] == 'key') {
1.80 raeburn 1197: dlinkkeysty = 'text';
1.86 raeburn 1198: dlinkkeyval = linkprotectparts[1];
1199: } else if (linkprotectparts[0] == 'ltic') {
1200: dlinklticdivsty = 'block';
1201: } else if (linkprotectparts[0] == 'ltid') {
1202: dlinkltiddivsty = 'block';
1.80 raeburn 1203: }
1204: }
1.86 raeburn 1205: if (deeplinkvals[5] >= 1) {
1.84 raeburn 1206: dlinkmenusdivsty = 'inline-block';
1207: }
1.80 raeburn 1208: } else {
1.86 raeburn 1209: deeplinkvals = ['off','unhide','full','res','','0'];
1.80 raeburn 1210: }
1.86 raeburn 1211: var deeplinkstate = new Array();
1212: deeplinkstate = ['only','off','both'];
1213: var deeplinkstatetxt = new Array();
1214: deeplinkstatetxt = ['deep only','deeplink off','regular + deep'];
1215: var deeplinkothers = new Array();
1216: deeplinkothers = ['hide','unhide'];
1217: var deeplinkotherstxt = new Array();
1218: deeplinkotherstxt = ['Hidden','Unhidden'];
1.80 raeburn 1219: var deeplinklisting = new Array();
1220: deeplinklisting = ['full','absent','grades','details','datestatus'];
1221: var deeplinklisttxt = new Array();
1222: deeplinklisttxt = ['Listed (linked) in both','Not listed','Listed in grades only','Listed (unlinked) in both','Listed (unlinked) inc. status in both'];
1223: var deeplinkscopes = new Array();
1224: deeplinkscopes = ['res','map','rec'];
1225: var deeplinkscopetxt = new Array();
1226: deeplinkscopetxt = ['resource only','enclosing map/folder','recursive map/folder'];
1.86 raeburn 1227: var deeplinkprotect = new Array();
1228: deeplinkprotect = ['none','key','ltic','ltid'];
1.87 ! raeburn 1229: var deeplinktarget = new Array();
! 1230: deeplinktarget = ['_self','_top'];
! 1231: var deeplinktargettxt = new Array();
! 1232: deeplinktargettxt = ['Embedded','Not embedded'];
1.78 raeburn 1233: tablestart('Deep-linked items');
1.86 raeburn 1234: choicewrite('<tr><td>Access status?</td><td>');
1235: choicewrite('<select name="deeplinkstate">');
1236: for (var i=0; i<deeplinkstate.length; i++) {
1237: choicewrite('<option value="'+deeplinkstate[i]+'"');
1238: if (deeplinkvals[0] == deeplinkstate[i]) {
1239: choicewrite(' selected="selected"');
1240: }
1241: choicewrite('>'+deeplinkstatetxt[i]+'</option>');
1242: }
1243: choicewrite('</select></td></tr>');
1244: choicewrite('<tr><td>Hide other resources?</td><td>');
1245: choicewrite('<select name="deeplinkothers">');
1246: for (var i=0; i<deeplinkothers.length; i++) {
1247: choicewrite('<option value="'+deeplinkothers[i]+'"');
1248: if (deeplinkvals[1] == deeplinkothers[i]) {
1249: choicewrite(' selected="selected"');
1250: }
1251: choicewrite('>'+deeplinkotherstxt[i]+'</option>');
1252: }
1253: choicewrite('</select></td></tr>');
1.84 raeburn 1254: choicewrite('<tr><td>In Contents + Gradebook?</td><td>');
1.80 raeburn 1255: choicewrite('<select name="deeplinklisted">');
1256: for (var i=0; i<deeplinklisting.length; i++) {
1257: choicewrite('<option value="'+deeplinklisting[i]+'"');
1.86 raeburn 1258: if (deeplinkvals[2] == deeplinklisting[i]) {
1.80 raeburn 1259: choicewrite(' selected="selected"');
1260: }
1261: choicewrite('>'+deeplinklisttxt[i]+'</option>');
1262: }
1263: choicewrite('</select></td></tr>');
1.86 raeburn 1264: choicewrite('<tr><td>Access scope for link</td><td>');
1.80 raeburn 1265: choicewrite('<select name="deeplinkacc">');
1266: for (var i=0; i<deeplinkscopes.length; i++) {
1267: choicewrite('<option value="'+deeplinkscopes[i]+'"');
1.86 raeburn 1268: if (deeplinkvals[3] == deeplinkscopes[i]) {
1.80 raeburn 1269: choicewrite(' selected="selected"');
1270: }
1271: choicewrite('>'+deeplinkscopetxt[i]+'</option>');
1272: }
1273: choicewrite('</select></td></tr>');
1.86 raeburn 1274: choicewrite('<tr><td>Link protection</td><td>');
1.80 raeburn 1275: choicewrite('<span style="white-space: nowrap;"><label>');
1.86 raeburn 1276: choicewrite('<input name="deeplinkprotect" value="none"'+
1277: ' type="radio" '+calldeeplink('protect'));
1278: if (deeplinkvals[4]=='none') { choicewrite(' checked="checked"'); }
1279: choicewrite(' /> not in use</label>');
1280: choicewrite('<input name="deeplinkprotect" value="key"'+
1281: ' type="radio" '+calldeeplink('protect'));
1282: if (deeplinkvals[4]=='key') { choicewrite(' checked="checked"'); }
1283: choicewrite(' /> key access</label>');
1.84 raeburn 1284: choicewrite('<input type="'+dlinkkeysty+'" name="deeplinkkey" id="deeplinkkey" value="'+dlinkkeyval+'" size="10" />');
1.80 raeburn 1285: choicewrite('</span><br />');
1.84 raeburn 1286:
1287: var possmenus = new Array();
1.80 raeburn 1288: if ((pextra != '') && (pextra != null)) {
1.86 raeburn 1289: var lticRegExp = /^ltic_/;
1290: var ltidRegExp = /^ltid_/;
1.84 raeburn 1291: var menusRegExp = /^menus_/;
1292: var extras = pextra.split('&');
1293: for (var i=0; i<extras.length; i++) {
1.86 raeburn 1294: if (lticRegExp.test(extras[i])) {
1295: extras[i] = extras[i].replace(lticRegExp,'');
1296: var possltic = extras[i].split(',');
1297: if (possltic.length >= 1) {
1298: var lticnums = new Array();
1299: var ltictitles = new Array();
1300: for (var j=0; j<possltic.length; j++) {
1301: var entries = possltic[j].split(':');
1302: lticnums[j] = entries[0];
1303: ltictitles[j] = decodeURIComponent(entries[1]);
1.80 raeburn 1304: }
1.86 raeburn 1305: if (lticnums.length) {
1.84 raeburn 1306: choicewrite('<span style="white-space: nowrap;"><label>');
1.86 raeburn 1307: choicewrite('<input name="deeplinkprotect" value="ltic"'+
1308: ' type="radio" '+calldeeplink('protect'));
1309: if (deeplinkvals[4]=='ltic') { choicewrite(' checked="checked"'); }
1310: choicewrite(' /> course LTI launch</label>');
1311: choicewrite('<div id="deeplinklticdiv" style="display:'+dlinklticdivsty+'">');
1312: choicewrite('<select name="linkpossltic">');
1.84 raeburn 1313: var sel='';
1.86 raeburn 1314: if (deeplinkvals[4]!='ltic') {
1.84 raeburn 1315: sel = ' selected="selected"';
1316: }
1.86 raeburn 1317: if (lticnums.length > 1) {
1.84 raeburn 1318: choicewrite('<option value=""'+sel+'>Select</option>');
1319: }
1.86 raeburn 1320: for (var j=0; j<lticnums.length; j++) {
1.84 raeburn 1321: sel = '';
1.86 raeburn 1322: if (deeplinkvals[4]=='ltic') {
1323: if (linkprotectparts.length) {
1324: if (lticnums[j] == linkprotectparts[1]) {
1.84 raeburn 1325: sel = ' selected="selected"';
1326: }
1.80 raeburn 1327: }
1328: }
1.86 raeburn 1329: choicewrite('<option value="'+lticnums[j]+'"'+sel+'>'+ltictitles[j]+'</option>');
1.80 raeburn 1330: }
1.84 raeburn 1331: choicewrite('</select></div></span><br />');
1.80 raeburn 1332: }
1333: }
1.86 raeburn 1334: } else if (ltidRegExp.test(extras[i])) {
1335: extras[i] = extras[i].replace(ltidRegExp,'');
1336: var possltid = extras[i].split(',');
1337: if (possltid.length >= 1) {
1338: var ltidnums = new Array();
1339: var ltidtitles = new Array();
1340: for (var j=0; j<possltid.length; j++) {
1341: var entries = possltid[j].split(':');
1342: ltidnums[j] = entries[0];
1343: ltidtitles[j] = decodeURIComponent(entries[1]);
1344: }
1345: if (ltidnums.length) {
1346: choicewrite('<span style="white-space: nowrap;"><label>');
1347: choicewrite('<input name="deeplinkprotect" value="ltid"'+
1348: ' type="radio" '+calldeeplink('protect'));
1349: if (deeplinkvals[4]=='ltid') { choicewrite(' checked="checked"'); }
1350: choicewrite(' />domain LTI launch</label>');
1351: choicewrite('<div id="deeplinkltiddiv" style="display:'+dlinkltiddivsty+'">');
1352: choicewrite('<select name="linkpossltid">');
1353: var sel='';
1354: if (deeplinkvals[4]!='ltid') {
1355: sel = ' selected="selected"';
1356: }
1357: if (ltidnums.length > 1) {
1358: choicewrite('<option value=""'+sel+'>Select</option>');
1359: }
1360: for (var j=0; j<ltidnums.length; j++) {
1361: sel = '';
1362: if (deeplinkvals[4]=='ltid') {
1363: if (linkprotectparts.length) {
1364: if (ltidnums[j] == linkprotectparts[1]) {
1365: sel = ' selected="selected"';
1366: }
1367: }
1368: }
1369: choicewrite('<option value="'+ltidnums[j]+'"'+sel+'>'+ltidtitles[j]+'</option>');
1370: }
1371: choicewrite('</select></div></span><br />');
1372: }
1373: }
1374:
1.84 raeburn 1375: } else if (menusRegExp.test(extras[i])) {
1376: extras[i] = extras[i].replace(menusRegExp,'');
1377: possmenus = extras[i].split(',');
1.80 raeburn 1378: }
1379: }
1380: }
1.84 raeburn 1381: choicewrite('<tr><td>Menu Items Displayed</td><td>');
1382: choicewrite('<span style="white-space: nowrap;"><label>');
1383: choicewrite('<input name="deeplinkmenus" value="std"'+
1384: ' type="radio" '+calldeeplink('menus'));
1.86 raeburn 1385: if (deeplinkvals[5] == 0) {
1.84 raeburn 1386: choicewrite(' checked="checked"');
1387: }
1388: choicewrite(' /> Standard (all menus)</label></span><br />');
1389: if (possmenus.length >= 1) {
1390: choicewrite('<span style="white-space: nowrap;"><label>');
1391: choicewrite('<input name="deeplinkmenus" value="collnum"'+
1392: ' type="radio" '+calldeeplink('menus'));
1.86 raeburn 1393: if (deeplinkvals[5] > 0) { choicewrite(' checked="checked"'); }
1.84 raeburn 1394: choicewrite(' /> Numbered collection</label>');
1395: choicewrite('<div id="deeplinkmenusdiv" style="display:'+dlinkmenusdivsty+'">');
1396: choicewrite('<select name="linkpossmenu">');
1397: var sel='';
1.86 raeburn 1398: if (deeplinkvals[5] == 0) {
1.84 raeburn 1399: sel = ' selected="selected"';
1400: }
1401: if (possmenus.length > 1) {
1402: choicewrite('<option value=""'+sel+'>Select</option>');
1403: }
1404: for (var i=0; i<possmenus.length; i++) {
1405: sel = '';
1.86 raeburn 1406: if (deeplinkvals[5] == possmenus[i]) {
1.84 raeburn 1407: sel = ' selected="selected"';
1408: }
1409: choicewrite('<option value="'+possmenus[i]+'"'+sel+'>'+possmenus[i]+'</option>');
1410: }
1411: choicewrite('</select></div></span><br />');
1412: }
1.87 ! raeburn 1413: choicewrite('</td></tr>');
! 1414: choicewrite('<tr><td>Embedded?</td><td>');
! 1415: choicewrite('<select name="deeplinktarget">');
! 1416: for (var i=0; i<deeplinktarget.length; i++) {
! 1417: choicewrite('<option value="'+deeplinktarget[i]+'"');
! 1418: if (deeplinkvals[6] == deeplinktarget[i]) {
! 1419: choicewrite(' selected="selected"');
! 1420: }
! 1421: choicewrite('>'+deeplinktargettxt[i]+'</option>');
! 1422: }
! 1423: choicewrite('</select>');
1.78 raeburn 1424: choicewrite('</td></tr></table>');
1.80 raeburn 1425: }
1.21 www 1426: }
1.79 raeburn 1427:
1.21 www 1428: if (ptype=='color') {
1429: tablestart('Choose a Color');
1430: choicewrite('<table>');
1431: if (svalue) {
1.23 www 1432: choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
1.46 albertel 1433: escapeHTML(svalue)+'" colspan="2"> </td></tr>');
1.21 www 1434: }
1.23 www 1435: for (var ir=0; ir<=10; ir++) {
1436: for (var ig=0; ig<=10; ig++) {
1.21 www 1437: choicewrite('<tr>');
1.23 www 1438: for (var ib=0; ib<=10; ib++) {
1.21 www 1439: colorfield(ir,ig,ib);
1440: }
1441: choicewrite('</tr>');
1.79 raeburn 1442: }
1.21 www 1443: }
1444: choicewrite('</table></td></table>');
1.1 www 1445: }
1446:
1.40 albertel 1447: choicewrite('</form>');
1.1 www 1448: choiceend();
1449: }
1450:
1451: function sopt(va,text) {
1452: selwrite('<option value="'+va+'"');
1.2 www 1453: if (va==pscat) {
1.54 bisitz 1454: selwrite(' selected="selected"');
1.1 www 1455: }
1456: selwrite('>'+text+'</option>');
1457: }
1458:
1459: function catchange() {
1460: var sform=selector.document.forms.fsel.fcat;
1.2 www 1461: pscat=sform.options[sform.selectedIndex].value;
1.1 www 1462: draw();
1463: }
1464:
1.76 raeburn 1465: function recursechange() {
1466: var rform=selector.document.forms.frec;
1467: var count = rform.recurse.length;
1468: if (count > 0) {
1469: for (var i=0; i<count; i++) {
1470: if (rform.recurse[i].checked) {
1471: var colnum = pnonreccol;
1472: if (rform.recurse[i].value == 1) {
1473: colnum++;
1474: }
1.79 raeburn 1475: pmarker = pmarkerst+'_'+pparm+'&'+colnum;
1.76 raeburn 1476: }
1477: }
1478: }
1479: }
1480:
1.1 www 1481: function assemble() {
1.2 www 1482: if ((ptype=='date') && (pscat!='interval')) {
1.41 www 1483: svalue=Math.floor(cdate.getTime()/1000);
1.2 www 1484: }
1.12 www 1485: if (ptype=='tolerance') {
1486: if (pscat=='relative_sym') {
1487: svalue=choices.document.forms.sch.val2.value+'%';
1488: if (choices.document.forms.sch.val3.checked) {
1489: svalue+='+';
1490: }
1491: }
1492: if (pscat=='absolute_sym') {
1493: svalue=choices.document.forms.sch.val2.value;
1494: if (choices.document.forms.sch.val3.checked) {
1495: svalue+='+';
1496: }
1497: }
1498: if (pscat=='absolute') {
1499: svalue=choices.document.forms.sch.val2.value;
1500: if (choices.document.forms.sch.val3.checked) {
1501: svalue+='+';
1502: }
1503: svalue+=','+choices.document.forms.sch.val4.value;
1504: if (choices.document.forms.sch.val5.checked) {
1505: svalue+='+';
1506: }
1507: }
1508: if (pscat=='relative') {
1509: svalue=choices.document.forms.sch.val2.value+'%';
1510: if (choices.document.forms.sch.val3.checked) {
1511: svalue+='+';
1512: }
1513: svalue+=','+choices.document.forms.sch.val4.value+'%';
1514: if (choices.document.forms.sch.val5.checked) {
1515: svalue+='+';
1516: }
1517: }
1.14 www 1518: }
1519: if ((ptype=='int') && (pscat=='range')) {
1520: svalue=choices.document.forms.sch.val2.value+','+
1521: choices.document.forms.sch.val4.value;
1.12 www 1522: }
1.6 www 1523: if (pscat=='default') { svalue=''; }
1.2 www 1524: stype=ptype+'_'+pscat;
1.1 www 1525: }
1526:
1527:
1528: function init() {
1529: var i;
1.2 www 1530: var subs=new Array();
1.71 raeburn 1531: var doneRegExp = /_done(|\:[^\:]+\:)/;
1532: var doneproctorRegExp = /_done(|\:[^\:]+\:)_proctor/;
1.70 raeburn 1533: var proctorkeyRegExp = /^(\d+)_(.+)$/;
1.71 raeburn 1534: var donetextRegExp = /\:([^\:]+)\:/;
1.79 raeburn 1535: var markerRegExp = /^(.+)_([A-Za-z0-9]+)\&(\d+)$/;
1.1 www 1536: var namevalue=this.window.location.search.split('&');
1537: namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
1538:
1539: for (i=0;i<namevalue.length;i++) {
1540: var pair=namevalue[i].split('=');
1.3 www 1541: pair[1]=unescape(pair[1]);
1.1 www 1542: if (pair[0]=='value') { pvalue=pair[1]; }
1.2 www 1543: if (pair[0]=='type') { subs=pair[1].split('_');
1544: ptype=subs[0];
1545: pscat=subs[1];
1.79 raeburn 1546: if (typeof(subs[2])!="undefined") {
1547: pscat+='_'+subs[2];
1.11 www 1548: }
1.79 raeburn 1549: if ((pscat=='') || (typeof(pscat)=="undefined")) {
1.6 www 1550: pscat='default';
1551: }
1.2 www 1552: }
1.1 www 1553: if (pair[0]=='return') { preturn=pair[1]; }
1554: if (pair[0]=='call') { pcode=pair[1]; }
1.2 www 1555: if (pair[0]=='marker') { pmarker=pair[1]; }
1.1 www 1556: if (pair[0]=='name') { pname=pair[1]; }
1.63 www 1557: if (pair[0]=='modal') { pmodal=pair[1]; }
1.34 albertel 1558: if (pair[0]=='defhour' && pair[1] >= 0 && pair[1] < 24 ) {
1559: defhour=pair[1];
1560: }
1561: if (pair[0]=='defmin' && pair[1] >= 0 && pair[1] < 60) { defmin=pair[1]; }
1562: if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; }
1.80 raeburn 1563: if (pair[0]=='extra') { pextra=pair[1]; }
1.1 www 1564: }
1565:
1.79 raeburn 1566: var tablecol = '';
1.76 raeburn 1567: var ismap = '';
1568: if (markerRegExp.test(pmarker)) {
1569: var markerinfo = pmarker.match(markerRegExp);
1570: if (markerinfo.length == 4) {
1571: pmarkerst = markerinfo[1];
1572: pparm = markerinfo[2];
1.79 raeburn 1573: tablecol = markerinfo[3];
1.76 raeburn 1574: if (tablecol == 17 || tablecol == 16) {
1575: ismap = 1;
1576: if (tablecol == 17) {
1577: precursive = 1;
1578: }
1579: pnonreccol = 16;
1.79 raeburn 1580: } else if (tablecol == 11 || tablecol == 10) {
1.76 raeburn 1581: ismap = 1;
1582: if (tablecol == 11) {
1583: precursive = 1;
1584: }
1585: pnonreccol = 10;
1586: } else if (tablecol == 7 || tablecol == 6) {
1587: ismap = 1;
1588: if (tablecol == 7) {
1589: precursive = 1;
1590: }
1591: pnonreccol = 6;
1592: } else if (tablecol == 3 || tablecol == 2) {
1593: ismap = 1;
1594: if (tablecol == 3) {
1595: precursive = 1;
1596: }
1597: pnonreccol = 2;
1598: }
1599: }
1600: }
1.85 raeburn 1601: psmap = ismap;
1.76 raeburn 1602:
1603:
1.68 raeburn 1604: if (ptype=='date' && pscat == 'interval') {
1.70 raeburn 1605: if (doneproctorRegExp.test(pvalue)) {
1.71 raeburn 1606: var current = pvalue.match(doneproctorRegExp);
1607: if (current.length == 2) {
1608: var textstr = current[1];
1609: if (textstr != '') {
1610: var textvals = textstr.match(donetextRegExp);
1611: if (textvals.length == 2) {
1612: pextravaltwo = textvals[1];
1613: }
1614: }
1615: }
1.70 raeburn 1616: var intervalwithkey = pvalue.replace(doneproctorRegExp,'');
1617: if (proctorkeyRegExp.test(intervalwithkey)) {
1618: var currvals = intervalwithkey.match(proctorkeyRegExp);
1619: if (currvals.length == 3) {
1620: pvalue = currvals[1];
1621: pextraval = currvals[2];
1.71 raeburn 1622: pmodval = '_done_proctor';
1.70 raeburn 1623: } else {
1624: pmodval = '';
1625: }
1626: }
1627: } else {
1628: if (doneRegExp.test(pvalue)) {
1.79 raeburn 1629: var current = pvalue.match(doneRegExp);
1.71 raeburn 1630: if (current.length == 2) {
1631: var textstr = current[1];
1632: if (textstr != '') {
1633: var textvals = textstr.match(donetextRegExp);
1634: if (textvals.length == 2) {
1635: pextravaltwo = textvals[1];
1636: }
1637: }
1638: }
1.70 raeburn 1639: var pnumval = pvalue.replace(doneRegExp,'');
1.71 raeburn 1640: pmodval = '_done';
1.70 raeburn 1641: pvalue = pnumval;
1642: }
1.68 raeburn 1643: }
1644: }
1.1 www 1645: svalue=pvalue;
1.6 www 1646: if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
1.79 raeburn 1647: (pscat=='default') &&
1648: (typeof(svalue)!="undefined") &&
1.11 www 1649: (svalue!=0) && (svalue!='')) { pscat='any'; }
1.1 www 1650:
1.13 www 1651: if (ptype=='tolerance') {
1652: var tperc=0;
1653: var trange=0;
1654: if (typeof(svalue)!='undefined') {
1655: if (svalue.indexOf('%')!=-1) { tperc=1; }
1656: if (svalue.indexOf(',')!=-1) { trange=1; }
1657: if (trange) {
1658: if (tperc) { pscat='relative'; } else { pscat='absolute'; }
1659: } else {
1660: if (tperc) { pscat='relative_sym'; } else { pscat='absolute_sym'; }
1661: }
1662: }
1663: }
1664:
1.61 raeburn 1665: this.window.selector.document.open();
1.62 raeburn 1666: selwrite('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
1667: selwrite('<html xmlns="http://www.w3.org/1999/xhtml">');
1.55 bisitz 1668: selwrite('<head>');
1.62 raeburn 1669: selwrite('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
1670: selwrite('<title>LON-CAPA</title>');
1.55 bisitz 1671: selwrite('<style type="text/css">');
1672: selwrite('<!--');
1673: selwrite('body {');
1674: selwrite('font-family: Verdana,Arial,Helvetica,sans-serif;');
1675: selwrite('line-height:130%;');
1676: selwrite('font-size:0.83em;');
1677: selwrite('background: #FFFFFF;');
1678: selwrite('}');
1679: selwrite('-->');
1680: selwrite('</style>');
1681: selwrite('</head>');
1.62 raeburn 1682: selwrite('<body>');
1683: selwrite('<form name="fsel" action=""><b>'+pname+'</b><br />');
1.66 bisitz 1684: selwrite('Format of Value(s): <select name="fcat" onchange="parent.catchange();">');
1.12 www 1685:
1.1 www 1686: if (ptype=='tolerance') {
1687: sopt('default','Default');
1688: sopt('relative_sym','Relative Tolerance, Symmetric (percent)');
1689: sopt('relative','Relative Tolerance (percentages)');
1690: sopt('absolute_sym','Absolute Tolerance, Symmetric (value)');
1691: sopt('absolute','Absolute Tolerance (values)');
1692: }
1693:
1694: if (ptype=='date') {
1.48 albertel 1695: if (pscat != 'interval') {
1696: sopt('default','Default');
1697: sopt('start','Starting Date');
1698: sopt('end','Ending Date');
1699: } else {
1700: sopt('interval','Time Interval');
1701: }
1702:
1.11 www 1703: if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
1.2 www 1704: cdate.setTime(pvalue*1000);
1.30 www 1705: } else {
1.31 www 1706: cdate.setSeconds(defsec);
1707: cdate.setMinutes(defmin);
1708: cdate.setHours(defhour);
1.2 www 1709: }
1710:
1711: months[0]='January';
1712: months[1]='February';
1713: months[2]='March';
1714: months[3]='April';
1715: months[4]='May';
1716: months[5]='June';
1717: months[6]='July';
1718: months[7]='August';
1719: months[8]='September';
1720: months[9]='October';
1721: months[10]='November';
1722: months[11]='December';
1.1 www 1723: }
1.79 raeburn 1724:
1.6 www 1725: if (ptype=='int') {
1726: sopt('default','Default');
1727: sopt('pos','Positive Integer, Not Zero');
1728: sopt('zeropos','Positive Integer or Zero');
1.13 www 1729: sopt('inrange','Integer in Range');
1730: sopt('range','Range of Integers');
1.6 www 1731: sopt('any','Integer');
1.1 www 1732: }
1733:
1.6 www 1734: if (ptype=='float') {
1735: sopt('default','Default');
1736: sopt('zeroone','Floating Point between 0 and 1');
1737: sopt('pos','Positive Floating Point');
1738: sopt('any','Floating Point');
1.1 www 1739:
1740: }
1741:
1.6 www 1742: if (ptype=='string') {
1.44 albertel 1743: //sopt('default','Default');
1744: if (pscat == 'yesno') { sopt('yesno','Yes/No'); }
1.47 albertel 1745: else if (pscat == 'problemstatus'){ sopt('problemstatus','Problem Status'); }
1.45 albertel 1746: else if (pscat == 'examtype') { sopt('examtype','Exam Type'); }
1747: else if (pscat == 'questiontype') { sopt('questiontype','Question Type'); }
1.60 raeburn 1748: else if (pscat == 'lenient') { sopt('lenient','Lenient Grading (Partial Credit)'); }
1.64 raeburn 1749: else if (pscat == 'discussvote') { sopt('discussvote','Discussion Voting'); }
1.45 albertel 1750: else if (pscat == 'ip') { sopt('ip','IP Number/Name'); }
1751: else if (pscat == 'fileext') { sopt('fileext','File Extension'); }
1752: else if (pscat == 'useslots') { sopt('useslots','Slots control access'); }
1.78 raeburn 1753: else if (pscat == 'deeplink') { sopt('deeplink','Deep-linked items'); }
1.45 albertel 1754: else { pscat = 'any'; }
1.80 raeburn 1755: if (pscat != 'deeplink') { sopt('any','String Value'); }
1.22 www 1756: }
1757:
1758: if (ptype=='color') {
1759: sopt('default','Use Default Color');
1760: sopt('custom','Use Custom Color');
1.1 www 1761: }
1762:
1763: selwrite('</select></form>');
1.77 raeburn 1764: if (ismap == 1) {
1.76 raeburn 1765: if ((pparm != 'hiddenresource') && (pparm != 'encrypturl')) {
1766: selwrite('<form name="frec" action="">');
1767: selwrite('Recursive: <label><input type="radio" name="recurse" value="1" ');
1768: if (precursive == 1) {
1769: selwrite('checked="checked" ');
1770: }
1771: selwrite('onclick="parent.recursechange();" />Yes</label> ');
1772: selwrite('<label><input type="radio" name="recurse" value="0" ');
1773: if (precursive != 1) {
1774: selwrite('checked="checked" ');
1775: }
1.83 raeburn 1776: selwrite('onclick="parent.recursechange();" />No</label>');
1.76 raeburn 1777: selwrite('</form><br />');
1778: }
1779: }
1.63 www 1780: var targ='parent.opener';
1781: if (pmodal==1) {
1782: targ='parent.parent';
1.70 raeburn 1783: }
1784: if ((ptype=='date') && (pscat=='interval')) {
1785: selwrite('<a href="javascript:parent.validateInterval();');
1.80 raeburn 1786: } else if ((ptype=='string') && (pscat=='deeplink')) {
1787: selwrite('<a href="javascript:parent.validateDeepLink();');
1.70 raeburn 1788: } else {
1789: selwrite('<a href="javascript:parent.assemble();');
1790: }
1.1 www 1791: if (preturn!='') {
1.63 www 1792: selwrite(targ+'.document.'+preturn+'_value.value=parent.window.svalue;');
1793: selwrite(targ+'.document.'+preturn+'_type.value=parent.window.stype;');
1.2 www 1794: }
1795: if (pmarker!='') {
1.63 www 1796: selwrite(targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.1 www 1797: }
1798: if (pcode!='') {
1.63 www 1799: selwrite(targ+'.'+pcode+'();');
1.1 www 1800: }
1.43 albertel 1801: selwrite('">Save</a> ');
1.5 www 1802:
1803: selwrite('<a href="javascript:');
1.63 www 1804: selwrite(targ+'.document.'+preturn+'_value.value='+"'';");
1.5 www 1805: if (pmarker!='') {
1806: selwrite(
1.63 www 1807: targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.5 www 1808: }
1809: if (pcode!='') {
1.63 www 1810: selwrite(targ+'.'+pcode+'();');
1.5 www 1811: }
1812: selwrite('">Delete</a> ');
1.4 www 1813:
1.1 www 1814: selwrite('</body></html>');
1815: this.window.selector.document.close();
1.84 raeburn 1816: if (pscat == 'deeplink') {
1.85 raeburn 1817: if (psmap==1) {
1818: document.getElementById("LCparampopup").rows="100,*";
1819: } else {
1820: document.getElementById("LCparampopup").rows="60,*";
1821: }
1.84 raeburn 1822: }
1.2 www 1823: draw();
1.83 raeburn 1824:
1.1 www 1825: }
1826:
1.56 raeburn 1827: // ]]>
1.1 www 1828: </script>
1.56 raeburn 1829: </head>
1.1 www 1830:
1.84 raeburn 1831: <frameset id="LCparampopup" rows="125,*" onload="init();">
1.56 raeburn 1832: <frame name="selector" src="empty.html" />
1833: <frame name="choices" src="empty.html" />
1.1 www 1834: </frameset>
1835:
1836:
1837:
1.16 albertel 1838: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>