Annotation of rat/client/parameter.html, revision 1.42
1.1 www 1: <html>
2: <!--
3: The LearningOnline Network with CAPA
4: Parameter Input Window
1.16 albertel 5: //
1.42 ! albertel 6: // $Id: parameter.html,v 1.41 2006/12/06 21:09:35 www Exp $
1.16 albertel 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: //
1.1 www 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='';
1.2 www 41: var pscat='';
42: var pmarker='';
1.1 www 43: var pname='';
44:
1.31 www 45: var defhour=0;
46: var defmin=0;
47: var defsec=0;
48:
1.1 www 49: var svalue;
1.2 www 50: var stype;
51: var smarker;
1.1 www 52:
53: var vars=new Array();
54:
1.2 www 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:
1.1 www 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:
1.2 www 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();
1.19 www 177: var nowdate=new Date();
178: var nowyear=nowdate.getFullYear();
1.33 albertel 179: if ( !thisyear ) { thisyear=nowyear; }
1.19 www 180: var loweryear=thisyear-2;
181: var upperyear=thisyear+5;
182: if (thisyear>nowyear) { loweryear=nowyear-2; }
183: if (thisyear<nowyear) { upperyear=nowyear+5; }
1.2 www 184: var i;
185: choicewrite('<select name=year onChange="parent.datecalc();">');
1.19 www 186: for (i=loweryear;i<=upperyear;i++) {
1.2 www 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:
1.6 www 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: }
1.12 www 284: if (pscat.indexOf('inrange')!=-1) {
1.10 www 285: var rangeparts=new Array;
286: rangeparts=split('_',pscat);
1.12 www 287: rangeparts=split(',',rangeparts[1]);
1.10 www 288: if (svalue<rangeparts[0]) { svalue=rangeparts[0]; }
289: if (svalue>rangeparts[1]) { svalue=rangeparts[1]; }
290: }
1.6 www 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:
1.25 www 309: function radiostringeval(newval) {
310: svalue=newval;
311: draw();
312: }
313:
1.29 www 314: function callradiostringeval(newval) {
315: return 'onChange="parent.radiostringeval(\''
316: +newval+'\')" onClick="parent.radiostringeval(\''
317: +newval+'\')"';
318: }
319:
1.2 www 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: }
1.21 www 331:
332: function pickcolor(picked) {
333: svalue=picked;
334: draw();
335: }
336:
337: function colorfield(ir,ig,ib) {
338: var col=new Array;
1.23 www 339: col=["00","11","22","44","66","88","AA","CC","DD","EE","FF"];
1.21 www 340: var color='#'+col[ir]+col[ig]+col[ib];
1.23 www 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>"; }
1.21 www 343: choicewrite('<td bgcolor="'+color+'"><a href="javascript:parent.pickcolor('+"'"+
344: color+"'"+')">'+selection+'</a></td>');
345:
346: }
347:
1.1 www 348: function draw() {
349: choicestart();
1.6 www 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('>');
1.1 www 361: if (ptype=='tolerance') {
1.2 www 362: // 0: pscat
363: if (pscat=='default') {
1.1 www 364: tablestart('Use default value or algorithm of resource');
365: }
1.2 www 366: if (pscat=='relative_sym') {
1.1 www 367: // 2: percentage
368: // 3: open
369: tablestart('Percentage error, symmetric around value');
370: valline('Percentage',2,3);
1.13 www 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: }
1.1 www 377: }
1.2 www 378: if (pscat=='relative') {
1.1 www 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);
1.17 matthew 386: var range1=new Array;
1.13 www 387: if ((svalue!='') && (typeof(svalue)!="undefined")) {
1.17 matthew 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) {
1.13 www 392: choices.document.forms.sch.val3.checked=true;
393: }
1.17 matthew 394: choices.document.forms.sch.val4.value=parseFloat(range1[1]);
395: if (range1[1].indexOf('+')!=-1) {
1.13 www 396: choices.document.forms.sch.val5.checked=true;
397: }
398: }
1.1 www 399: }
1.2 www 400: if (pscat=='absolute_sym') {
1.1 www 401: tablestart('Absolute error, symmetric around value');
402: valline('Value',2,3);
1.13 www 403: if ((svalue!='') && (typeof(svalue)!="undefined")) {
1.15 www 404: choices.document.forms.sch.val2.value=parseFloat(svalue);
1.13 www 405: if (svalue.indexOf('+')!=-1) {
406: choices.document.forms.sch.val3.checked=true;
407: }
408: }
1.1 www 409: }
1.2 www 410: if (pscat=='absolute') {
1.1 www 411: tablestart('Absolute error, asymmetric around value');
412: valline('Upper value',2,3);
413: valline('Lower value',4,5);
1.17 matthew 414: var range2=new Array;
1.13 www 415: if ((svalue!='') && (typeof(svalue)!="undefined")) {
416: range=svalue.split(',');
1.17 matthew 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) {
1.13 www 420: choices.document.forms.sch.val3.checked=true;
421: }
1.17 matthew 422: choices.document.forms.sch.val4.value=parseFloat(range2[1]);
423: if (range2[1].indexOf('+')!=-1) {
1.13 www 424: choices.document.forms.sch.val5.checked=true;
425: }
426: }
1.1 www 427: }
428: }
429:
430: if (ptype=='date') {
1.2 www 431: if (pscat=='default') {
432: tablestart('Default value or none');
433: choicewrite('</table>');
434: } else {
435: if (pscat=='start') {
1.24 www 436: tablestart('Date and time');
1.2 www 437: }
438: if (pscat=='end') {
1.24 www 439: tablestart('Date and time');
1.2 www 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: }
1.1 www 462: }
463:
1.6 www 464: if (ptype=='int') {
1.19 www 465: var pscatparts=new Array;
466: pscatparts=pscat.split(',');
467: pscat=pscatparts[0];
1.6 www 468: if (pscat=='default') {
469: tablestart('Default value or none');
1.14 www 470: choicewrite('</table>');
1.6 www 471: } else {
1.14 www 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 {
1.6 www 488: if (pscat=='pos') {
489: tablestart('Positive (non-zero) integer');
490: }
491: if (pscat=='zeropos') {
492: tablestart('Positive integer or zero');
493: }
1.12 www 494: if (pscat.indexOf('inrange')!=-1) {
1.10 www 495: var rangeparts=new Array;
1.12 www 496: rangeparts=split(',',pscat);
1.10 www 497: tablestart('Integer in the range ['+rangeparts[1]+']');
498: }
1.6 www 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: }
1.14 www 507: }
1.1 www 508: }
509:
1.6 www 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: }
1.1 www 529: }
530:
1.6 www 531: if (ptype=='string') {
1.42 ! albertel 532: if ((pscat=='any') || (pscat=='') || (pscat=='default') ||
! 533: (typeof(pscat)=='undefined')) {
1.6 www 534: tablestart('Text');
1.25 www 535: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
536: choicewrite('<input name="stringval" size="20" value="'+svalue+
537: '" type="text" onChange="parent.stringeval()">');
538: }
539: if (pscat=='yesno') {
540: tablestart('Yes/No');
541: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
1.32 albertel 542: choicewrite('<label><input name="stringval" value="yes"'+
1.29 www 543: ' type="radio" '+callradiostringeval('yes'));
1.25 www 544: if (svalue=='yes') { choicewrite(' checked'); }
1.32 albertel 545: choicewrite('> Yes</label><br />');
546: choicewrite('<label><input name="stringval" value="no"'+
1.29 www 547: ' type="radio" '+callradiostringeval('no'));
1.25 www 548: if (svalue=='no') { choicewrite(' checked'); }
1.32 albertel 549: choicewrite('> No</label><br />');
1.25 www 550: }
551: if (pscat=='examtype') {
552: tablestart('Exam Type');
553: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
1.32 albertel 554: choicewrite('<label><input name="stringval" value="online"'+
1.29 www 555: ' type="radio" '+callradiostringeval('online'));
1.25 www 556: if (svalue=='online') { choicewrite(' checked'); }
1.32 albertel 557: choicewrite('> Online</label><br />');
558: choicewrite('<label><input name="stringval" value="checkout"'+
1.29 www 559: ' type="radio" '+callradiostringeval('checkout'));
1.25 www 560: if (svalue=='checkout') { choicewrite(' checked'); }
1.32 albertel 561: choicewrite('> Check out</label><br />');
1.25 www 562: }
563: if (pscat=='questiontype') {
564: tablestart('Question Type');
565: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
1.32 albertel 566: choicewrite('<label><input name="stringval" value="problem"'+
1.29 www 567: ' type="radio" '+callradiostringeval('problem'));
1.25 www 568: if (svalue=='problem') { choicewrite(' checked'); }
1.32 albertel 569: choicewrite('> Standard Problem</label><br />');
1.36 albertel 570: // choicewrite('<label><input name="stringval" value="quiz"'+
571: // ' type="radio" '+callradiostringeval('quiz'));
572: // if (svalue=='quiz') { choicewrite(' checked'); }
573: // choicewrite('> Quiz</label><br />');
1.35 albertel 574: choicewrite('<label><input name="stringval" value="practice"'+
575: ' type="radio" '+callradiostringeval('practice'));
576: if (svalue=='practice') { choicewrite(' checked'); }
577: choicewrite('> Practice</label><br />');
1.32 albertel 578: choicewrite('<label><input name="stringval" value="exam"'+
1.29 www 579: ' type="radio" '+callradiostringeval('exam'));
1.25 www 580: if (svalue=='exam') { choicewrite(' checked'); }
1.32 albertel 581: choicewrite('> Exam</label><br />');
1.36 albertel 582: // choicewrite('<label><input name="stringval" value="assess"'+
583: // ' type="radio" '+callradiostringeval('assess'));
584: // if (svalue=='assess') { choicewrite(' checked'); }
585: // choicewrite('> Assessment</label><br />');
1.32 albertel 586: choicewrite('<label><input name="stringval" value="survey"'+
1.29 www 587: ' type="radio" '+callradiostringeval('survey'));
1.25 www 588: if (svalue=='survey') { choicewrite(' checked'); }
1.32 albertel 589: choicewrite('> Survey</label><br />');
1.36 albertel 590: // choicewrite('<label><input name="stringval" value="form"'+
591: // ' type="radio" '+callradiostringeval('form'));
592: // if (svalue=='form') { choicewrite(' checked'); }
593: // choicewrite('> Input Form</label><br />');
1.32 albertel 594: choicewrite('<label><input name="stringval" value="library"'+
1.29 www 595: ' type="radio" '+callradiostringeval('library'));
1.25 www 596: if (svalue=='library') { choicewrite(' checked'); }
1.32 albertel 597: choicewrite('> Library</label><br />');
1.25 www 598: }
599: if (pscat=='ip') {
600: tablestart('IP Number/Name');
601: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
1.26 www 602: choicewrite('<input name="stringval" size="20" value="'+svalue+
1.25 www 603: '" onChange="parent.stringeval()">');
1.6 www 604: }
1.26 www 605: if (pscat=='fileext') {
606: tablestart('Allowed File Extensions');
607: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
1.32 albertel 608: choicewrite('<label><input name="radstringval" value="txt"'+
1.29 www 609: ' type="radio" '+callradiostringeval('txt'));
1.26 www 610: if (svalue=='txt') { choicewrite(' checked'); }
1.32 albertel 611: choicewrite('> Plain Text</label><br />');
612: choicewrite('<label><input name="radstringval" value="png,jpg,jpeg,gif"'+
1.29 www 613: ' type="radio" '+callradiostringeval('png,jpg,jpeg,gif'));
1.26 www 614: if (svalue=='png,jpg,jpeg,gif') { choicewrite(' checked'); }
1.32 albertel 615: choicewrite('> Picture File</label><br />');
616: choicewrite('<label><input name="radstringval" value="doc,xls,ppt"'+
1.29 www 617: ' type="radio" '+callradiostringeval('doc,xls,ppt'));
1.26 www 618: if (svalue=='doc,xls,ppt') { choicewrite(' checked'); }
1.32 albertel 619: choicewrite('> Office Document</label><br />');
1.26 www 620: choicewrite('<input name="stringval" size="20" value="'+svalue+
621: '" onChange="parent.stringeval()">');
622: }
1.37 albertel 623: if (pscat=='useslots') {
624: tablestart('Slots control access');
625: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
626: choicewrite('<label><input name="stringval" value="no"'+
627: ' type="radio" '+callradiostringeval('no'));
628: if (svalue=='no') { choicewrite(' checked'); }
629: choicewrite('> No</label><br />');
630: choicewrite('<label><input name="stringval" value="resource"'+
631: ' type="radio" '+callradiostringeval('resource'));
632: if (svalue=='resource') { choicewrite(' checked'); }
633: choicewrite('> Yes, and the scope of student selected slot is a single resource.</label><br />');
1.38 albertel 634: choicewrite('<label><input name="stringval" value="map"'+
635: ' type="radio" '+callradiostringeval('map'));
636: if (svalue=='map') { choicewrite(' checked'); }
1.39 albertel 637: 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 />');
638: choicewrite('<label><input name="stringval" value="map_map"'+
1.40 albertel 639: ' type="radio" '+callradiostringeval('map_map'));
1.39 albertel 640: if (svalue=='map_map') { choicewrite(' checked'); }
641: 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 />');
1.6 www 642: choicewrite('</td></table>');
643: }
1.21 www 644: }
645:
646: if (ptype=='color') {
647: tablestart('Choose a Color');
648: choicewrite('<table>');
649: if (svalue) {
1.23 www 650: choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
651: svalue+'" colspan="2"> </td></tr>');
1.21 www 652: }
1.23 www 653: for (var ir=0; ir<=10; ir++) {
654: for (var ig=0; ig<=10; ig++) {
1.21 www 655: choicewrite('<tr>');
1.23 www 656: for (var ib=0; ib<=10; ib++) {
1.21 www 657: colorfield(ir,ig,ib);
658: }
659: choicewrite('</tr>');
660: }
661: }
662: choicewrite('</table></td></table>');
1.1 www 663: }
664:
1.40 albertel 665: choicewrite('</form>');
1.1 www 666: choiceend();
667: }
668:
669: function sopt(va,text) {
670: selwrite('<option value="'+va+'"');
1.2 www 671: if (va==pscat) {
1.1 www 672: selwrite(' selected');
673: }
674: selwrite('>'+text+'</option>');
675: }
676:
677: function catchange() {
678: var sform=selector.document.forms.fsel.fcat;
1.2 www 679: pscat=sform.options[sform.selectedIndex].value;
1.1 www 680: draw();
681: }
682:
683: function assemble() {
1.2 www 684: if ((ptype=='date') && (pscat!='interval')) {
1.41 www 685: svalue=Math.floor(cdate.getTime()/1000);
1.2 www 686: }
1.12 www 687: if (ptype=='tolerance') {
688: if (pscat=='relative_sym') {
689: svalue=choices.document.forms.sch.val2.value+'%';
690: if (choices.document.forms.sch.val3.checked) {
691: svalue+='+';
692: }
693: }
694: if (pscat=='absolute_sym') {
695: svalue=choices.document.forms.sch.val2.value;
696: if (choices.document.forms.sch.val3.checked) {
697: svalue+='+';
698: }
699: }
700: if (pscat=='absolute') {
701: svalue=choices.document.forms.sch.val2.value;
702: if (choices.document.forms.sch.val3.checked) {
703: svalue+='+';
704: }
705: svalue+=','+choices.document.forms.sch.val4.value;
706: if (choices.document.forms.sch.val5.checked) {
707: svalue+='+';
708: }
709: }
710: if (pscat=='relative') {
711: svalue=choices.document.forms.sch.val2.value+'%';
712: if (choices.document.forms.sch.val3.checked) {
713: svalue+='+';
714: }
715: svalue+=','+choices.document.forms.sch.val4.value+'%';
716: if (choices.document.forms.sch.val5.checked) {
717: svalue+='+';
718: }
719: }
1.14 www 720: }
721: if ((ptype=='int') && (pscat=='range')) {
722: svalue=choices.document.forms.sch.val2.value+','+
723: choices.document.forms.sch.val4.value;
1.12 www 724: }
1.6 www 725: if (pscat=='default') { svalue=''; }
1.2 www 726: stype=ptype+'_'+pscat;
1.1 www 727: }
728:
729:
730: function init() {
731: var i;
1.2 www 732: var subs=new Array();
1.1 www 733: var namevalue=this.window.location.search.split('&');
734: namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
735:
736: for (i=0;i<namevalue.length;i++) {
737: var pair=namevalue[i].split('=');
1.3 www 738: pair[1]=unescape(pair[1]);
1.1 www 739: if (pair[0]=='value') { pvalue=pair[1]; }
1.2 www 740: if (pair[0]=='type') { subs=pair[1].split('_');
741: ptype=subs[0];
742: pscat=subs[1];
1.11 www 743: if (typeof(subs[2])!="undefined") {
744: pscat+='_'+subs[2];
745: }
746: if ((pscat=='') || (typeof(pscat)=="undefined")) {
1.6 www 747: pscat='default';
748: }
1.2 www 749: }
1.1 www 750: if (pair[0]=='return') { preturn=pair[1]; }
751: if (pair[0]=='call') { pcode=pair[1]; }
1.2 www 752: if (pair[0]=='marker') { pmarker=pair[1]; }
1.1 www 753: if (pair[0]=='name') { pname=pair[1]; }
1.34 albertel 754: if (pair[0]=='defhour' && pair[1] >= 0 && pair[1] < 24 ) {
755: defhour=pair[1];
756: }
757: if (pair[0]=='defmin' && pair[1] >= 0 && pair[1] < 60) { defmin=pair[1]; }
758: if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; }
1.1 www 759: }
760:
761: svalue=pvalue;
1.6 www 762: if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
763: (pscat=='default') &&
1.11 www 764: (typeof(svalue)!="undefined") &&
765: (svalue!=0) && (svalue!='')) { pscat='any'; }
1.1 www 766:
1.13 www 767: if (ptype=='tolerance') {
768: var tperc=0;
769: var trange=0;
770: if (typeof(svalue)!='undefined') {
771: if (svalue.indexOf('%')!=-1) { tperc=1; }
772: if (svalue.indexOf(',')!=-1) { trange=1; }
773: if (trange) {
774: if (tperc) { pscat='relative'; } else { pscat='absolute'; }
775: } else {
776: if (tperc) { pscat='relative_sym'; } else { pscat='absolute_sym'; }
777: }
778: }
779: }
780:
1.1 www 781: this.window.selector.document.clear();
782: selwrite('<html><body bgcolor="#FFFFFF">');
783:
1.8 www 784: selwrite('<form name="fsel"><b>'+pname+'</b><br>');
1.1 www 785: selwrite('<select name="fcat" onChange="parent.catchange();">');
1.12 www 786:
1.1 www 787: if (ptype=='tolerance') {
788: sopt('default','Default');
789: sopt('relative_sym','Relative Tolerance, Symmetric (percent)');
790: sopt('relative','Relative Tolerance (percentages)');
791: sopt('absolute_sym','Absolute Tolerance, Symmetric (value)');
792: sopt('absolute','Absolute Tolerance (values)');
793: }
794:
795: if (ptype=='date') {
796: sopt('default','Default');
797: sopt('start','Starting Date');
798: sopt('end','Ending Date');
1.2 www 799: sopt('interval','Time Interval');
800:
1.11 www 801: if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
1.2 www 802: cdate.setTime(pvalue*1000);
1.30 www 803: } else {
1.31 www 804: cdate.setSeconds(defsec);
805: cdate.setMinutes(defmin);
806: cdate.setHours(defhour);
1.2 www 807: }
808:
809: months[0]='January';
810: months[1]='February';
811: months[2]='March';
812: months[3]='April';
813: months[4]='May';
814: months[5]='June';
815: months[6]='July';
816: months[7]='August';
817: months[8]='September';
818: months[9]='October';
819: months[10]='November';
820: months[11]='December';
1.1 www 821: }
1.2 www 822:
1.6 www 823: if (ptype=='int') {
824: sopt('default','Default');
825: sopt('pos','Positive Integer, Not Zero');
826: sopt('zeropos','Positive Integer or Zero');
1.13 www 827: sopt('inrange','Integer in Range');
828: sopt('range','Range of Integers');
1.6 www 829: sopt('any','Integer');
1.1 www 830: }
831:
1.6 www 832: if (ptype=='float') {
833: sopt('default','Default');
834: sopt('zeroone','Floating Point between 0 and 1');
835: sopt('pos','Positive Floating Point');
836: sopt('any','Floating Point');
1.1 www 837:
838: }
839:
1.6 www 840: if (ptype=='string') {
841: sopt('default','Default');
1.28 albertel 842: sopt('any','String Value');
1.22 www 843: }
844:
845: if (ptype=='color') {
846: sopt('default','Use Default Color');
847: sopt('custom','Use Custom Color');
1.1 www 848: }
849:
850: selwrite('</select></form>');
851:
1.2 www 852: selwrite('<a href="javascript:parent.assemble();');
1.1 www 853: if (preturn!='') {
1.4 www 854: selwrite(
855: 'parent.opener.document.'+preturn+'_value.value=parent.window.svalue;');
856: selwrite(
857: 'parent.opener.document.'+preturn+'_type.value=parent.window.stype;');
1.2 www 858: }
859: if (pmarker!='') {
1.4 www 860: selwrite(
861: 'parent.opener.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.1 www 862: }
863: if (pcode!='') {
1.4 www 864: selwrite('parent.opener.'+pcode+'();');
1.1 www 865: }
1.4 www 866: selwrite('">Store</a> ');
1.5 www 867:
868: selwrite('<a href="javascript:');
869: selwrite(
870: 'parent.opener.document.'+preturn+'_value.value='+"'';");
871: if (pmarker!='') {
872: selwrite(
873: 'parent.opener.document.'+preturn+'_marker.value=parent.window.pmarker;');
874: }
875: if (pcode!='') {
876: selwrite('parent.opener.'+pcode+'();');
877: }
878: selwrite('">Delete</a> ');
1.4 www 879:
880: selwrite('<a href="javascript:');
1.17 matthew 881: // Old code :
882: //----------------------------------------------------------------------
883: // if (preturn!='') {
884: // selwrite('parent.opener.document.'+preturn+'_value.value='+"'';");
885: // selwrite('parent.opener.document.'+preturn+'_type.value='+"'';");
886: // }
887: // if (pmarker!='') {
888: // selwrite('parent.opener.document.'+preturn+'_marker.value='+"'';");
889: // }
890: // if (pcode!='') {
891: // selwrite('parent.opener.'+pcode+'();');
892: // }
893: //----------------------------------------------------------------------
894: // Just close the window to 'cancel' the operation. There are javascript
895: // errors in the above commented out code that I have not been able to
896: // track down. I think they reside in 'parent.opener.'+pcode+'();'
897: //
898: selwrite('this.parent.close();');
1.4 www 899: selwrite('">Cancel</a>');
1.1 www 900:
901: selwrite('</body></html>');
902: this.window.selector.document.close();
1.2 www 903: draw();
1.1 www 904:
905: }
906:
907: </script>
908:
1.2 www 909: <frameset rows="120,*" onLoad="init();">
1.1 www 910: <frame name=selector src="empty.html">
911: <frame name=choices src="empty.html">
912: </frameset>
913:
914:
915:
1.16 albertel 916: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>