File:
[LON-CAPA] /
rat /
client /
parameter.html
Revision
1.40:
download - view:
text,
annotated -
select for diffs
Fri Jun 30 03:12:21 2006 UTC (18 years, 2 months ago) by
albertel
Branches:
MAIN
CVS tags:
version_2_2_X,
version_2_2_2,
version_2_2_1,
version_2_2_0,
version_2_1_99_3,
version_2_1_99_2,
version_2_1_99_1,
version_2_1_99_0,
HEAD
- missed a map_map BUG#4884
- extraneous </table>
1: <html>
2: <!--
3: The LearningOnline Network with CAPA
4: Parameter Input Window
5: //
6: // $Id: parameter.html,v 1.40 2006/06/30 03:12:21 albertel Exp $
7: //
8: // Copyright Michigan State University Board of Trustees
9: //
10: // This file is part of the LearningOnline Network with CAPA (LON-CAPA).
11: //
12: // LON-CAPA is free software; you can redistribute it and/or modify
13: // it under the terms of the GNU General Public License as published by
14: // the Free Software Foundation; either version 2 of the License, or
15: // (at your option) any later version.
16: //
17: // LON-CAPA is distributed in the hope that it will be useful,
18: // but WITHOUT ANY WARRANTY; without even the implied warranty of
19: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20: // GNU General Public License for more details.
21: //
22: // You should have received a copy of the GNU General Public License
23: // along with LON-CAPA; if not, write to the Free Software
24: // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25: //
26: // /home/httpd/html/adm/gpl.txt
27: //
28: // http://www.lon-capa.org/
29: //
30: -->
31: <head>
32: <title>LON-CAPA</title>
33: </head>
34:
35: <script>
36:
37: var ptype='';
38: var pvalue='';
39: var preturn='';
40: var pcode='';
41: var pscat='';
42: var pmarker='';
43: var pname='';
44:
45: var defhour=0;
46: var defmin=0;
47: var defsec=0;
48:
49: var svalue;
50: var stype;
51: var smarker;
52:
53: var vars=new Array();
54:
55: var cdate=new Date();
56:
57: var csec;
58: var cmin;
59: var chour;
60: var cday;
61:
62: var months=new Array();
63:
64:
65: function selwrite(text) {
66: this.window.selector.document.write(text);
67: }
68:
69: function choicestart() {
70: this.window.choices.document.clear();
71: choicewrite('<html><body bgcolor="#FFFFFF">');
72: }
73:
74: function choiceend() {
75: choicewrite('</body></html>');
76: this.window.choices.document.close();
77: }
78:
79: function choicewrite(text) {
80: this.window.choices.document.write(text);
81: }
82:
83: function tablestart(headtext) {
84: choicewrite('<table><tr bgcolor="#AAFFAA"><th colspan=3>'+
85: headtext+'</th></tr>');
86: }
87:
88: function valline(text,id1,id2) {
89: choicewrite('<tr bgcolor="#AAFFAA"><td>'+text+
90: '</td><td><input type=text size=4 name=val'+
91: id1+'></td><td>incl:<input type=checkbox name=val'+
92: id2+'></td></tr>');
93: }
94:
95: function datecalc() {
96: var sform=choices.document.forms.sch;
97:
98: cdate.setHours(sform.hours.options[sform.hours.selectedIndex].value);
99: cdate.setMinutes(sform.minutes.options[sform.minutes.selectedIndex].value);
100: cdate.setSeconds(sform.minutes.options[sform.seconds.selectedIndex].value);
101: cdate.setDate(sform.date.options[sform.date.selectedIndex].value);
102: cdate.setMonth(sform.month.options[sform.month.selectedIndex].value);
103: cdate.setFullYear(sform.year.options[sform.year.selectedIndex].value);
104:
105: draw();
106: }
107:
108: function hour() {
109: var thishour=cdate.getHours();
110: var i; var j;
111: choicewrite('<select name=hours onChange="parent.datecalc();">');
112: for (i=0;i<=23;i++) {
113: choicewrite('<option value='+i);
114: if (i==thishour) {
115: choicewrite(' selected');
116: }
117: choicewrite('>');
118: if (i==12) { choicewrite('noon'); } else {
119: if (i==0) { choicewrite('midnight') } else {
120:
121: if (i<12) { choicewrite(i+' am'); } else {
122: j=i-12; choicewrite(j+' pm');
123: }
124:
125: }
126: }
127: choicewrite('</option>');
128: }
129: choicewrite('</select>');
130: }
131:
132: function minute() {
133: var thisminutes=cdate.getMinutes();
134: var i;
135: choicewrite('<select name=minutes onChange="parent.datecalc();">');
136: for (i=0;i<=59;i++) {
137: choicewrite('<option value='+i);
138: if (i==thisminutes) {
139: choicewrite(' selected');
140: }
141: choicewrite('>'+i+'</option>');
142: }
143: choicewrite('</select>');
144: }
145:
146: function second() {
147: var thisseconds=cdate.getSeconds();
148: var i;
149: choicewrite('<select name=seconds onChange="parent.datecalc();">');
150: for (i=0;i<=59;i++) {
151: choicewrite('<option value='+i);
152: if (i==thisseconds) {
153: choicewrite(' selected');
154: }
155: choicewrite('>'+i+'</option>');
156: }
157: choicewrite('</select>');
158: }
159:
160:
161: function date() {
162: var thisdate=cdate.getDate();
163: var i;
164: choicewrite('<select name=date onChange="parent.datecalc();">');
165: for (i=1;i<=31;i++) {
166: choicewrite('<option value='+i);
167: if (i==thisdate) {
168: choicewrite(' selected');
169: }
170: choicewrite('>'+i+'</option>');
171: }
172: choicewrite('</select>');
173: }
174:
175: function year() {
176: var thisyear=cdate.getFullYear();
177: var nowdate=new Date();
178: var nowyear=nowdate.getFullYear();
179: if ( !thisyear ) { thisyear=nowyear; }
180: var loweryear=thisyear-2;
181: var upperyear=thisyear+5;
182: if (thisyear>nowyear) { loweryear=nowyear-2; }
183: if (thisyear<nowyear) { upperyear=nowyear+5; }
184: var i;
185: choicewrite('<select name=year onChange="parent.datecalc();">');
186: for (i=loweryear;i<=upperyear;i++) {
187: choicewrite('<option value='+i);
188: if (i==thisyear) {
189: choicewrite(' selected');
190: }
191: choicewrite('>'+i+'</option>');
192: }
193: choicewrite('</select>');
194: }
195:
196: function month() {
197: var thismonth=cdate.getMonth();
198: var i;
199: choicewrite('<select name=month onChange="parent.datecalc();">');
200: for (i=0;i<=11;i++) {
201: choicewrite('<option value='+i);
202: if (i==thismonth) {
203: choicewrite(' selected');
204: }
205: choicewrite('>'+months[i]+'</option>');
206: }
207: choicewrite('</select>');
208: }
209:
210:
211: function intminute() {
212: var thisminutes=cmins;
213: var i;
214: choicewrite('<select name=minutes onChange="parent.intcalc();">');
215: for (i=0;i<=59;i++) {
216: choicewrite('<option value='+i);
217: if (i==thisminutes) {
218: choicewrite(' selected');
219: }
220: choicewrite('>'+i+'</option>');
221: }
222: choicewrite('</select>');
223: }
224:
225: function inthour() {
226: var thishours=chours;
227: var i;
228: choicewrite('<select name=hours onChange="parent.intcalc();">');
229: for (i=0;i<=23;i++) {
230: choicewrite('<option value='+i);
231: if (i==thishours) {
232: choicewrite(' selected');
233: }
234: choicewrite('>'+i+'</option>');
235: }
236: choicewrite('</select>');
237: }
238:
239: function intsecond() {
240: var thisseconds=csecs;
241: var i;
242: choicewrite('<select name=seconds onChange="parent.intcalc();">');
243: for (i=0;i<=59;i++) {
244: choicewrite('<option value='+i);
245: if (i==thisseconds) {
246: choicewrite(' selected');
247: }
248: choicewrite('>'+i+'</option>');
249: }
250: choicewrite('</select>');
251: }
252:
253:
254: function intday() {
255: var thisdate=cdays;
256: var i;
257: choicewrite('<select name=date onChange="parent.intcalc();">');
258: for (i=0;i<=31;i++) {
259: choicewrite('<option value='+i);
260: if (i==thisdate) {
261: choicewrite(' selected');
262: }
263: choicewrite('>'+i+'</option>');
264: }
265: choicewrite('</select>');
266: }
267:
268: function intcalc() {
269: var sform=choices.document.forms.sch;
270: svalue=((sform.date.options[sform.date.selectedIndex].value*24+
271: sform.hours.options[sform.hours.selectedIndex].value*1)*60+
272: sform.minutes.options[sform.minutes.selectedIndex].value*1)*60+
273: sform.seconds.options[sform.seconds.selectedIndex].value*1;
274: draw();
275: }
276:
277: function integereval() {
278: svalue=choices.document.forms.sch.intval.value;
279: svalue=Math.round(svalue);
280: if (pscat=='zeropos') { svalue=Math.abs(svalue); }
281: if ((pscat=='pos') && (svalue==0)) {
282: svalue='';
283: }
284: if (pscat.indexOf('inrange')!=-1) {
285: var rangeparts=new Array;
286: rangeparts=split('_',pscat);
287: rangeparts=split(',',rangeparts[1]);
288: if (svalue<rangeparts[0]) { svalue=rangeparts[0]; }
289: if (svalue>rangeparts[1]) { svalue=rangeparts[1]; }
290: }
291: draw();
292: }
293:
294: function floateval() {
295: svalue=choices.document.forms.sch.floatval.value;
296: svalue=1.0*svalue;
297: if (pscat=='pos') { svalue=Math.abs(svalue); }
298: if ((pscat=='zeroone') && ((svalue<0) || (svalue>1))) {
299: svalue='';
300: }
301: draw();
302: }
303:
304: function stringeval() {
305: svalue=choices.document.forms.sch.stringval.value;
306: draw();
307: }
308:
309: function radiostringeval(newval) {
310: svalue=newval;
311: draw();
312: }
313:
314: function callradiostringeval(newval) {
315: return 'onChange="parent.radiostringeval(\''
316: +newval+'\')" onClick="parent.radiostringeval(\''
317: +newval+'\')"';
318: }
319:
320: function intervaldis() {
321: csecs=svalue;
322: cdays=Math.floor(csecs/86400);
323: csecs-=cdays*86400;
324: chours=Math.floor(csecs/3600);
325: csecs-=chours*3600;
326: cmins=Math.floor(csecs/60);
327: csecs-=cmins*60;
328: choicewrite(cdays+' days '+chours+' hours '
329: +cmins+' mins '+csecs+' secs');
330: }
331:
332: function pickcolor(picked) {
333: svalue=picked;
334: draw();
335: }
336:
337: function colorfield(ir,ig,ib) {
338: var col=new Array;
339: col=["00","11","22","44","66","88","AA","CC","DD","EE","FF"];
340: var color='#'+col[ir]+col[ig]+col[ib];
341: var selection="<font color='"+color+"'>X</font>";
342: if (color==svalue) { selection="<font color='#"+col[10-ir]+col[10-ig]+col[10-ib]+"'>X</font>"; }
343: choicewrite('<td bgcolor="'+color+'"><a href="javascript:parent.pickcolor('+"'"+
344: color+"'"+')">'+selection+'</a></td>');
345:
346: }
347:
348: function draw() {
349: choicestart();
350: choicewrite('<form name=sch');
351: if (ptype=='int') {
352: choicewrite(' action="javascript:integereval();"');
353: }
354: if (ptype=='float') {
355: choicewrite(' action="javascript:floateval();"');
356: }
357: if (ptype=='string') {
358: choicewrite(' action="javascript:stringeval();"');
359: }
360: choicewrite('>');
361: if (ptype=='tolerance') {
362: // 0: pscat
363: if (pscat=='default') {
364: tablestart('Use default value or algorithm of resource');
365: }
366: if (pscat=='relative_sym') {
367: // 2: percentage
368: // 3: open
369: tablestart('Percentage error, symmetric around value');
370: valline('Percentage',2,3);
371: if ((svalue!='') && (typeof(svalue)!="undefined")) {
372: choices.document.forms.sch.val2.value=parseInt(svalue);
373: if (svalue.indexOf('+')!=-1) {
374: choices.document.forms.sch.val3.checked=true;
375: }
376: }
377: }
378: if (pscat=='relative') {
379: // 2: left
380: // 3: open
381: // 4: right
382: // 5: open
383: tablestart('Percentage error, asymmetric around value');
384: valline('Upper percentage',2,3);
385: valline('Lower percentage',4,5);
386: var range1=new Array;
387: if ((svalue!='') && (typeof(svalue)!="undefined")) {
388: range1=svalue.split(',');
389: if (typeof(range1[1])=='undefined') { range1[1]=range1[0]; }
390: choices.document.forms.sch.val2.value=parseFloat(range1[0]);
391: if (range1[0].indexOf('+')!=-1) {
392: choices.document.forms.sch.val3.checked=true;
393: }
394: choices.document.forms.sch.val4.value=parseFloat(range1[1]);
395: if (range1[1].indexOf('+')!=-1) {
396: choices.document.forms.sch.val5.checked=true;
397: }
398: }
399: }
400: if (pscat=='absolute_sym') {
401: tablestart('Absolute error, symmetric around value');
402: valline('Value',2,3);
403: if ((svalue!='') && (typeof(svalue)!="undefined")) {
404: choices.document.forms.sch.val2.value=parseFloat(svalue);
405: if (svalue.indexOf('+')!=-1) {
406: choices.document.forms.sch.val3.checked=true;
407: }
408: }
409: }
410: if (pscat=='absolute') {
411: tablestart('Absolute error, asymmetric around value');
412: valline('Upper value',2,3);
413: valline('Lower value',4,5);
414: var range2=new Array;
415: if ((svalue!='') && (typeof(svalue)!="undefined")) {
416: range=svalue.split(',');
417: if (typeof(range2[1])=='undefined') { range2[1]=range2[0]; }
418: choices.document.forms.sch.val2.value=parseFloat(range2[0]);
419: if (range2[0].indexOf('+')!=-1) {
420: choices.document.forms.sch.val3.checked=true;
421: }
422: choices.document.forms.sch.val4.value=parseFloat(range2[1]);
423: if (range2[1].indexOf('+')!=-1) {
424: choices.document.forms.sch.val5.checked=true;
425: }
426: }
427: }
428: }
429:
430: if (ptype=='date') {
431: if (pscat=='default') {
432: tablestart('Default value or none');
433: choicewrite('</table>');
434: } else {
435: if (pscat=='start') {
436: tablestart('Date and time');
437: }
438: if (pscat=='end') {
439: tablestart('Date and time');
440: }
441: if (pscat=='interval') {
442: tablestart('Time interval');
443: choicewrite('<tr bgcolor="#AAFFAA"><td colspan=3>');
444: intervaldis();
445: choicewrite('</td></tr><tr bgcolor="#AAFFAA"><td>Time:'
446: +'</td><td colspan=2>');
447: intday();choicewrite('days ');
448: inthour();choicewrite('hours ');
449: intminute(); choicewrite('mins '); intsecond();
450: choicewrite('secs</td></tr></table>');
451: } else {
452: choicewrite('<tr bgcolor="#AAFFAA"><td colspan=3>'
453: +cdate.toString()+
454: '</td></tr><tr bgcolor="#AAFFAA"><td>Date:</td><td colspan=2>');
455: month();date();year();
456: choicewrite('</td></tr><tr bgcolor="#AAFFAA"><td>Time:'
457: +'</td><td colspan=2>');hour();choicewrite('h ');minute();
458: choicewrite('m ');second();
459: choicewrite('s</td></tr></table>');
460: }
461: }
462: }
463:
464: if (ptype=='int') {
465: var pscatparts=new Array;
466: pscatparts=pscat.split(',');
467: pscat=pscatparts[0];
468: if (pscat=='default') {
469: tablestart('Default value or none');
470: choicewrite('</table>');
471: } else {
472: if (pscat=='range') {
473: tablestart('Integer range');
474: choicewrite('<tr bgcolor="#AAFFAA"><td>Lower Value:'+
475: '</td><td colspan=2><input type=text size=4 name=val2'+
476: '></td></tr>');
477: choicewrite('<tr bgcolor="#AAFFAA"><td>Upper Value:'+
478: '</td><td colspan=2><input type=text size=4 name=val4'+
479: '></td></tr></table>');
480: var range=new Array;
481: if ((svalue!='') && (typeof(svalue)!="undefined")) {
482: range=svalue.split(',');
483: if (typeof(range[1])=='undefined') { range[1]=range[0]; }
484: choices.document.forms.sch.val2.value=parseInt(range[0]);
485: choices.document.forms.sch.val4.value=parseInt(range[1]);
486: }
487: } else {
488: if (pscat=='pos') {
489: tablestart('Positive (non-zero) integer');
490: }
491: if (pscat=='zeropos') {
492: tablestart('Positive integer or zero');
493: }
494: if (pscat.indexOf('inrange')!=-1) {
495: var rangeparts=new Array;
496: rangeparts=split(',',pscat);
497: tablestart('Integer in the range ['+rangeparts[1]+']');
498: }
499: if (pscat=='any') {
500: tablestart('Integer');
501: }
502: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
503: choicewrite('<input name=intval size=10 value="'+svalue+
504: '" name=intval onChange="parent.integereval()">');
505: choicewrite('</td></table>');
506: }
507: }
508: }
509:
510: if (ptype=='float') {
511: if (pscat=='default') {
512: tablestart('Default value or none');
513: choicewrite('</table>');
514: } else {
515: if (pscat=='pos') {
516: tablestart('Positive floating point number or zero');
517: }
518: if (pscat=='zeroone') {
519: tablestart('Floating point number between zero and one');
520: }
521: if (pscat=='any') {
522: tablestart('Floating point number');
523: }
524: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
525: choicewrite('<input name=floatval size=10 value="'+svalue+
526: '" name=floatval onChange="parent.floateval()">');
527: choicewrite('</td></table>');
528: }
529: }
530:
531: if (ptype=='string') {
532: if (pscat=='default') {
533: tablestart('Default value or none');
534: choicewrite('</table>');
535: } else {
536: if ((pscat=='any') || (pscat=='') || (typeof(pscat)=='undefined')) {
537: tablestart('Text');
538: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
539: choicewrite('<input name="stringval" size="20" value="'+svalue+
540: '" type="text" onChange="parent.stringeval()">');
541: }
542: if (pscat=='yesno') {
543: tablestart('Yes/No');
544: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
545: choicewrite('<label><input name="stringval" value="yes"'+
546: ' type="radio" '+callradiostringeval('yes'));
547: if (svalue=='yes') { choicewrite(' checked'); }
548: choicewrite('> Yes</label><br />');
549: choicewrite('<label><input name="stringval" value="no"'+
550: ' type="radio" '+callradiostringeval('no'));
551: if (svalue=='no') { choicewrite(' checked'); }
552: choicewrite('> No</label><br />');
553: }
554: if (pscat=='examtype') {
555: tablestart('Exam Type');
556: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
557: choicewrite('<label><input name="stringval" value="online"'+
558: ' type="radio" '+callradiostringeval('online'));
559: if (svalue=='online') { choicewrite(' checked'); }
560: choicewrite('> Online</label><br />');
561: choicewrite('<label><input name="stringval" value="checkout"'+
562: ' type="radio" '+callradiostringeval('checkout'));
563: if (svalue=='checkout') { choicewrite(' checked'); }
564: choicewrite('> Check out</label><br />');
565: }
566: if (pscat=='questiontype') {
567: tablestart('Question Type');
568: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
569: choicewrite('<label><input name="stringval" value="problem"'+
570: ' type="radio" '+callradiostringeval('problem'));
571: if (svalue=='problem') { choicewrite(' checked'); }
572: choicewrite('> Standard Problem</label><br />');
573: // choicewrite('<label><input name="stringval" value="quiz"'+
574: // ' type="radio" '+callradiostringeval('quiz'));
575: // if (svalue=='quiz') { choicewrite(' checked'); }
576: // choicewrite('> Quiz</label><br />');
577: choicewrite('<label><input name="stringval" value="practice"'+
578: ' type="radio" '+callradiostringeval('practice'));
579: if (svalue=='practice') { choicewrite(' checked'); }
580: choicewrite('> Practice</label><br />');
581: choicewrite('<label><input name="stringval" value="exam"'+
582: ' type="radio" '+callradiostringeval('exam'));
583: if (svalue=='exam') { choicewrite(' checked'); }
584: choicewrite('> Exam</label><br />');
585: // choicewrite('<label><input name="stringval" value="assess"'+
586: // ' type="radio" '+callradiostringeval('assess'));
587: // if (svalue=='assess') { choicewrite(' checked'); }
588: // choicewrite('> Assessment</label><br />');
589: choicewrite('<label><input name="stringval" value="survey"'+
590: ' type="radio" '+callradiostringeval('survey'));
591: if (svalue=='survey') { choicewrite(' checked'); }
592: choicewrite('> Survey</label><br />');
593: // choicewrite('<label><input name="stringval" value="form"'+
594: // ' type="radio" '+callradiostringeval('form'));
595: // if (svalue=='form') { choicewrite(' checked'); }
596: // choicewrite('> Input Form</label><br />');
597: choicewrite('<label><input name="stringval" value="library"'+
598: ' type="radio" '+callradiostringeval('library'));
599: if (svalue=='library') { choicewrite(' checked'); }
600: choicewrite('> Library</label><br />');
601: }
602: if (pscat=='ip') {
603: tablestart('IP Number/Name');
604: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
605: choicewrite('<input name="stringval" size="20" value="'+svalue+
606: '" onChange="parent.stringeval()">');
607: }
608: if (pscat=='fileext') {
609: tablestart('Allowed File Extensions');
610: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
611: choicewrite('<label><input name="radstringval" value="txt"'+
612: ' type="radio" '+callradiostringeval('txt'));
613: if (svalue=='txt') { choicewrite(' checked'); }
614: choicewrite('> Plain Text</label><br />');
615: choicewrite('<label><input name="radstringval" value="png,jpg,jpeg,gif"'+
616: ' type="radio" '+callradiostringeval('png,jpg,jpeg,gif'));
617: if (svalue=='png,jpg,jpeg,gif') { choicewrite(' checked'); }
618: choicewrite('> Picture File</label><br />');
619: choicewrite('<label><input name="radstringval" value="doc,xls,ppt"'+
620: ' type="radio" '+callradiostringeval('doc,xls,ppt'));
621: if (svalue=='doc,xls,ppt') { choicewrite(' checked'); }
622: choicewrite('> Office Document</label><br />');
623: choicewrite('<input name="stringval" size="20" value="'+svalue+
624: '" onChange="parent.stringeval()">');
625: }
626: if (pscat=='useslots') {
627: tablestart('Slots control access');
628: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
629: choicewrite('<label><input name="stringval" value="no"'+
630: ' type="radio" '+callradiostringeval('no'));
631: if (svalue=='no') { choicewrite(' checked'); }
632: choicewrite('> No</label><br />');
633: choicewrite('<label><input name="stringval" value="resource"'+
634: ' type="radio" '+callradiostringeval('resource'));
635: if (svalue=='resource') { choicewrite(' checked'); }
636: choicewrite('> Yes, and the scope of student selected slot is a single resource.</label><br />');
637: choicewrite('<label><input name="stringval" value="map"'+
638: ' type="radio" '+callradiostringeval('map'));
639: if (svalue=='map') { choicewrite(' checked'); }
640: choicewrite('> Yes, and the scope of student selected slot is the enclosing map/folder. When checking in, it applies to only one resource.</label><br />');
641: choicewrite('<label><input name="stringval" value="map_map"'+
642: ' type="radio" '+callradiostringeval('map_map'));
643: if (svalue=='map_map') { choicewrite(' checked'); }
644: choicewrite('> Yes, and the scope of student selected slot is the enclosing map/folder. When checking in, all resources in the map/folder are checked in..</label><br />');
645: }
646: choicewrite('</td></table>');
647: }
648: }
649:
650: if (ptype=='color') {
651: tablestart('Choose a Color');
652: choicewrite('<table>');
653: if (svalue) {
654: choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
655: svalue+'" colspan="2"> </td></tr>');
656: }
657: for (var ir=0; ir<=10; ir++) {
658: for (var ig=0; ig<=10; ig++) {
659: choicewrite('<tr>');
660: for (var ib=0; ib<=10; ib++) {
661: colorfield(ir,ig,ib);
662: }
663: choicewrite('</tr>');
664: }
665: }
666: choicewrite('</table></td></table>');
667: }
668:
669: choicewrite('</form>');
670: choiceend();
671: }
672:
673: function sopt(va,text) {
674: selwrite('<option value="'+va+'"');
675: if (va==pscat) {
676: selwrite(' selected');
677: }
678: selwrite('>'+text+'</option>');
679: }
680:
681: function catchange() {
682: var sform=selector.document.forms.fsel.fcat;
683: pscat=sform.options[sform.selectedIndex].value;
684: draw();
685: }
686:
687: function assemble() {
688: if ((ptype=='date') && (pscat!='interval')) {
689: svalue=Math.round(cdate.getTime()/1000);
690: }
691: if (ptype=='tolerance') {
692: if (pscat=='relative_sym') {
693: svalue=choices.document.forms.sch.val2.value+'%';
694: if (choices.document.forms.sch.val3.checked) {
695: svalue+='+';
696: }
697: }
698: if (pscat=='absolute_sym') {
699: svalue=choices.document.forms.sch.val2.value;
700: if (choices.document.forms.sch.val3.checked) {
701: svalue+='+';
702: }
703: }
704: if (pscat=='absolute') {
705: svalue=choices.document.forms.sch.val2.value;
706: if (choices.document.forms.sch.val3.checked) {
707: svalue+='+';
708: }
709: svalue+=','+choices.document.forms.sch.val4.value;
710: if (choices.document.forms.sch.val5.checked) {
711: svalue+='+';
712: }
713: }
714: if (pscat=='relative') {
715: svalue=choices.document.forms.sch.val2.value+'%';
716: if (choices.document.forms.sch.val3.checked) {
717: svalue+='+';
718: }
719: svalue+=','+choices.document.forms.sch.val4.value+'%';
720: if (choices.document.forms.sch.val5.checked) {
721: svalue+='+';
722: }
723: }
724: }
725: if ((ptype=='int') && (pscat=='range')) {
726: svalue=choices.document.forms.sch.val2.value+','+
727: choices.document.forms.sch.val4.value;
728: }
729: if (pscat=='default') { svalue=''; }
730: stype=ptype+'_'+pscat;
731: }
732:
733:
734: function init() {
735: var i;
736: var subs=new Array();
737: var namevalue=this.window.location.search.split('&');
738: namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
739:
740: for (i=0;i<namevalue.length;i++) {
741: var pair=namevalue[i].split('=');
742: pair[1]=unescape(pair[1]);
743: if (pair[0]=='value') { pvalue=pair[1]; }
744: if (pair[0]=='type') { subs=pair[1].split('_');
745: ptype=subs[0];
746: pscat=subs[1];
747: if (typeof(subs[2])!="undefined") {
748: pscat+='_'+subs[2];
749: }
750: if ((pscat=='') || (typeof(pscat)=="undefined")) {
751: pscat='default';
752: }
753: }
754: if (pair[0]=='return') { preturn=pair[1]; }
755: if (pair[0]=='call') { pcode=pair[1]; }
756: if (pair[0]=='marker') { pmarker=pair[1]; }
757: if (pair[0]=='name') { pname=pair[1]; }
758: if (pair[0]=='defhour' && pair[1] >= 0 && pair[1] < 24 ) {
759: defhour=pair[1];
760: }
761: if (pair[0]=='defmin' && pair[1] >= 0 && pair[1] < 60) { defmin=pair[1]; }
762: if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; }
763: }
764:
765: svalue=pvalue;
766: if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
767: (pscat=='default') &&
768: (typeof(svalue)!="undefined") &&
769: (svalue!=0) && (svalue!='')) { pscat='any'; }
770:
771: if (ptype=='tolerance') {
772: var tperc=0;
773: var trange=0;
774: if (typeof(svalue)!='undefined') {
775: if (svalue.indexOf('%')!=-1) { tperc=1; }
776: if (svalue.indexOf(',')!=-1) { trange=1; }
777: if (trange) {
778: if (tperc) { pscat='relative'; } else { pscat='absolute'; }
779: } else {
780: if (tperc) { pscat='relative_sym'; } else { pscat='absolute_sym'; }
781: }
782: }
783: }
784:
785: this.window.selector.document.clear();
786: selwrite('<html><body bgcolor="#FFFFFF">');
787:
788: selwrite('<form name="fsel"><b>'+pname+'</b><br>');
789: selwrite('<select name="fcat" onChange="parent.catchange();">');
790:
791: if (ptype=='tolerance') {
792: sopt('default','Default');
793: sopt('relative_sym','Relative Tolerance, Symmetric (percent)');
794: sopt('relative','Relative Tolerance (percentages)');
795: sopt('absolute_sym','Absolute Tolerance, Symmetric (value)');
796: sopt('absolute','Absolute Tolerance (values)');
797: }
798:
799: if (ptype=='date') {
800: sopt('default','Default');
801: sopt('start','Starting Date');
802: sopt('end','Ending Date');
803: sopt('interval','Time Interval');
804:
805: if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
806: cdate.setTime(pvalue*1000);
807: } else {
808: cdate.setSeconds(defsec);
809: cdate.setMinutes(defmin);
810: cdate.setHours(defhour);
811: }
812:
813: months[0]='January';
814: months[1]='February';
815: months[2]='March';
816: months[3]='April';
817: months[4]='May';
818: months[5]='June';
819: months[6]='July';
820: months[7]='August';
821: months[8]='September';
822: months[9]='October';
823: months[10]='November';
824: months[11]='December';
825: }
826:
827: if (ptype=='int') {
828: sopt('default','Default');
829: sopt('pos','Positive Integer, Not Zero');
830: sopt('zeropos','Positive Integer or Zero');
831: sopt('inrange','Integer in Range');
832: sopt('range','Range of Integers');
833: sopt('any','Integer');
834: }
835:
836: if (ptype=='float') {
837: sopt('default','Default');
838: sopt('zeroone','Floating Point between 0 and 1');
839: sopt('pos','Positive Floating Point');
840: sopt('any','Floating Point');
841:
842: }
843:
844: if (ptype=='string') {
845: sopt('default','Default');
846: sopt('any','String Value');
847: }
848:
849: if (ptype=='color') {
850: sopt('default','Use Default Color');
851: sopt('custom','Use Custom Color');
852: }
853:
854: selwrite('</select></form>');
855:
856: selwrite('<a href="javascript:parent.assemble();');
857: if (preturn!='') {
858: selwrite(
859: 'parent.opener.document.'+preturn+'_value.value=parent.window.svalue;');
860: selwrite(
861: 'parent.opener.document.'+preturn+'_type.value=parent.window.stype;');
862: }
863: if (pmarker!='') {
864: selwrite(
865: 'parent.opener.document.'+preturn+'_marker.value=parent.window.pmarker;');
866: }
867: if (pcode!='') {
868: selwrite('parent.opener.'+pcode+'();');
869: }
870: selwrite('">Store</a> ');
871:
872: selwrite('<a href="javascript:');
873: selwrite(
874: 'parent.opener.document.'+preturn+'_value.value='+"'';");
875: if (pmarker!='') {
876: selwrite(
877: 'parent.opener.document.'+preturn+'_marker.value=parent.window.pmarker;');
878: }
879: if (pcode!='') {
880: selwrite('parent.opener.'+pcode+'();');
881: }
882: selwrite('">Delete</a> ');
883:
884: selwrite('<a href="javascript:');
885: // Old code :
886: //----------------------------------------------------------------------
887: // if (preturn!='') {
888: // selwrite('parent.opener.document.'+preturn+'_value.value='+"'';");
889: // selwrite('parent.opener.document.'+preturn+'_type.value='+"'';");
890: // }
891: // if (pmarker!='') {
892: // selwrite('parent.opener.document.'+preturn+'_marker.value='+"'';");
893: // }
894: // if (pcode!='') {
895: // selwrite('parent.opener.'+pcode+'();');
896: // }
897: //----------------------------------------------------------------------
898: // Just close the window to 'cancel' the operation. There are javascript
899: // errors in the above commented out code that I have not been able to
900: // track down. I think they reside in 'parent.opener.'+pcode+'();'
901: //
902: selwrite('this.parent.close();');
903: selwrite('">Cancel</a>');
904:
905: selwrite('</body></html>');
906: this.window.selector.document.close();
907: draw();
908:
909: }
910:
911: </script>
912:
913: <frameset rows="120,*" onLoad="init();">
914: <frame name=selector src="empty.html">
915: <frame name=choices src="empty.html">
916: </frameset>
917:
918:
919:
920: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>