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