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