-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.htm
655 lines (608 loc) · 33.4 KB
/
default.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link type="text/css" rel="stylesheet" href="/static/styles.css" />
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<!-- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script> -->
<script type="text/javascript" src="/static/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/static/jquery-ui-1.7.2.min.js"></script>
<style type="text/css">
input
{
color: #781351;
background: #fee3ad;
border: 1px solid #781351
}
.columns:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
* html .columns {height: 1%;}
.columns{ display:inline-block; }
.columns{ display:block; }
.columns .column{
float:left;
display:inline;
min-height:360px;
}
.columns .last{ float:right; }
.columns .first{ width:180px; background-color:#ffeeee; }
.columns .second{ width:280px; margin-left:10px; background-color:#eeffee; }
.columns .last{ width:210px; background-color:#eeeeff}
.footers{ display:inline-block; }
.footers{ display:block; }
.footers .footer{
float:left;
display:inline;
}
.footers .last{ float:right; }
.footers .first{ width:180px; background-color:#eeeeee; }
.footers .second{ width:280px; margin-left:10px; background-color:#eeeeee; }
.footers .last{ width:210px; background-color:#eeeeee}
.formLineEdit { text-align: right; }
.optionLabel { float:right; text-align: right; }
.label { font-weight: bold; vertical-align: text-top; }
.formInput { text-align: right; vertical-align: text-top; }
.editHeader { text-align: right; }
.selectOption { text-align: right; }
#error { text-align: center; color: #ff0000; }
#success { text-align: center; color: #00ff00; }
#listForms { float: left; text-align: left; }
#viewHelp { float: right; text-align: right; }
#inputOptions { text-align: right; }
#detailHeader { text-align: right; }
#formName {background-color: #eeeeee; }
#formVersionNumber {background-color: #eeeeee; }
#formSubmitButton {text-align:right; background-color: #eeeeee; }
#chartType { font-size: 80%; }
</style>
<script>
function getRequestParameter ( parameterName ) {
var queryString = window.location.search.substring(1);
var parameterName = parameterName + "=";
if ( queryString.length > 0 ) {
begin = queryString.indexOf ( parameterName );
if ( begin != -1 ) {
begin += parameterName.length;
end = queryString.indexOf ( "&" , begin );
if ( end == -1 ) {
end = queryString.length
}
return unescape ( queryString.substring ( begin, end ) );
}
}
return "";
}
var totalItems=0;
var currentlyEditing=null;
var lastEdited=null;
var allIDs=null;
$(function() {
$(".formLineEdit").hide();
//load XML, if any
var projectKey=getRequestParameter("projectKey");
if (!projectKey)
projectKey="ahBlcGljb2xsZWN0c2VydmVycg4LEgdQcm9qZWN0GMplDA";
var formKey=getRequestParameter("formKey");
if (!formKey)
formKey="";
var formName=getRequestParameter("formName");
var formVersion=getRequestParameter("formVersion");
if (formKey.length>0 || (formName.length>0 && formVersion.length>0) || projectKey.length>0) {
var loadURL = "/getForm.asp?projectKey="+projectKey+"&formkey="+formKey+"&formName="+formName+"&formVersion="+formVersion;
$.ajax({
type: "GET",
url: loadURL,
dataType: "xml",
error: function (XMLHttpRequest, textStatus, errorThrown) {
var errorString = errorThrown ? errorThrown : textStatus;
if (XMLHttpRequest.responseText.indexOf("No form")!=0) //don't show an error if there's just no form
$("#error").text("Error: "+errorString);
},
success: function (xml) {
//OK, we've got an XML document. Now to populate form name, version number,
//and most importantly, the existing inputs.
var inputCount=0;
//dive down from document, to the root <xforms> element, to its children...
$(xml).children().children().each( function() {
if (this.tagName=="model") {
var formName=$(this).find("submission").attr("id");
$("input[name=formName]").val(formName);
var versionNumber=$(this).find("submission").attr("versionNumber");
setVersionNumbersFor(versionNumber);
}
else if (this.tagName=="input") {
var inputDiv='<div id="textInput'+(inputCount++)+'" class="formLine"';
inputDiv+=getInputFlagsFor($(this));
inputDiv+='><div class="label">';
inputDiv+=$(this).find("label").text();
inputDiv+='</div><div class="formInput"><input name="inputID" value="';
inputDiv+=$(this).attr("ref");
inputDiv+='" value="'+$(this).attr("ref");
inputDiv+='" /></div></div>';
$("#destination").append(inputDiv);
}
else if (this.tagName=="textarea") {
var inputDiv='<div id="longText'+(inputCount++)+'" class="formLine"';
inputDiv+=getInputFlagsFor($(this));
inputDiv+='><div class="label">';
inputDiv+=$(this).find("label").text();
inputDiv+='</div><div class="formInput"><textarea name="textarea">';
inputDiv+=$(this).attr("ref");
inputDiv+='</textarea></div></div>';
$("#destination").append(inputDiv);
}
else if ((this.tagName=="select1") || (this.tagName=="select")) {
var inputDiv='<div id="';
var isSelect1 = this.tagName=="select1";
if (isSelect1)
inputDiv+='selectOne'+(inputCount++);
else
inputDiv+='selectMultiple'+(inputCount++);
inputDiv+='" class="formLine"';
inputDiv+=getInputFlagsFor($(this));
inputDiv+='>';
var inputRef=$(this).attr("ref");
var doneFirst=false;
$(this).children().each( function() {
if (!doneFirst) {
inputDiv+='<div class="label">'+$(this).text()+'</div>';
doneFirst=true;
}
else {
inputDiv+='<div class="formInput">';
if (isSelect1)
inputDiv+='<input type="radio" name="'+inputRef+'" value="'
else
inputDiv+='<input type="checkbox" name="'+inputRef+'" value="'
inputDiv+=$(this).find("value").text()+'" />';
inputDiv+='<div class="optionLabel">'+$(this).find("label").text()+'</div></div>';
}
});
inputDiv+='</div>';
$("#destination").append(inputDiv);
}
});
},
}); //ajax call
}
//make divs created out of XML clickable
var destClicked=false;
$("#destination").mousedown( function() {
if (!destClicked) { //only do this once, or it might get messy
$("#destination").children().each( function() {
$(this).bind("click", function() {
showEditDetailsFor($(this));
});
});
}
destClicked=true;
});
//set up drag-and-drop stuff
$("#textInput").draggable(
{ connectToSortable:'#destination',
cursor:'move',
helper:'clone',
}
);
$("#longText").draggable(
{ connectToSortable:'#destination',
cursor:'move',
helper:'clone',
}
);
$("#selectMultiple").draggable(
{ connectToSortable:'#destination',
cursor:'move',
helper:'clone',
}
);
$("#selectOne").draggable(
{ connectToSortable:'#destination',
cursor:'move',
helper:'clone',
}
);
$("#destination").sortable(
{
change: function(event, ui) {
ui.placeholder.css({visibility: 'visible', border : '2px solid yellow'});
},
start: function(event, ui) {
ui.placeholder.css({visibility: 'visible', border : '2px solid yellow'});
var tempID=ui.item.attr("id");
if (tempID.indexOf("_")==-1) {
tempID=tempID+"_"+totalItems++;
ui.item.attr({id:tempID});
}
},
stop: function(event, ui) {
//load element details, and ensure they'll show up again when this item is clicked
showEditDetailsFor(ui.item);
ui.item.bind("click", function() {
showEditDetailsFor(ui.item);
});
},
}
);
//respond to inputs in the edit-details column
$("input[name=delete]").mouseup( function() {
var really = confirm ("Delete this element?")
if (really) {
$("#"+currentlyEditing).remove();
$(this).parent().hide();
}
});
$("input[name=textInputSubmit]").mouseup( function() {
var labelText=$("input[name=textInputLabel]").val();
var idText=$("input[name=textInputValue]").val();
$("#"+currentlyEditing+" > .label").text(labelText);
$("#"+currentlyEditing).find("input[name=inputID]").val(idText);
setFlagAttributes($('#'+currentlyEditing));
});
$("input[name=longTextSubmit]").mouseup( function() {
var labelText=$("input[name=longTextLabel]").val();
var idText=$("input[name=longTextValue]").val();
$("#"+currentlyEditing+" > .label").text(labelText);
$("#"+currentlyEditing).find("textarea[name=textarea]").val(idText);
setFlagAttributes($('#'+currentlyEditing));
});
$("input[name=addSelectMultiOption]").mouseup( function() {
optionClone=$("#selectMultiOption").clone();
cloneRemoveButton = optionClone.find("input[name=removeSelectMultiOption]");
cloneRemoveButton.bind("mouseup", function() {
$(this).parent().remove();
});
$("#selectMultiEdit").append(optionClone);
});
$("input[name=selectMultiSubmit]").mouseup( function() {
//set label, remove existing inputs
var labelText=$("input[name=selectMultiLabel]").val();
$("#"+currentlyEditing+" > .label").text(labelText);
$("#"+currentlyEditing).find(".formInput").remove();
$("#"+currentlyEditing).find(".optionLabel").remove();
$("#"+currentlyEditing).find("input[type=checkbox]").remove();
//plug in new ones
var idText=$("input[name=selectMultiValue]").val();
editDiv=$(this).parent().parent();
editDiv.find(".selectOption").each( function() {
var optionLabel=$(this).find("input[name=multiOptionLabel]").val();
var optionValue=$(this).find("input[name=multiOptionValue]").val();
var newOption = '<input type="checkbox" name="'+idText+'" value="'+optionValue+'" /><div class="optionLabel">'+optionLabel+'</div><BR/>'
$("#"+currentlyEditing).append(newOption);
});
setFlagAttributes($('#'+currentlyEditing));
});
$("input[name=addSelectOneOption]").mouseup( function() {
optionClone=$("#selectOneOption").clone();
cloneRemoveButton = optionClone.find("input[name=removeSelectOneOption]");
cloneRemoveButton.bind("mouseup", function() {
$(this).parent().remove();
});
$("#selectOneEdit").append(optionClone);
});
$("input[name=selectOneSubmit]").mouseup( function() {
//set label, remove existing inputs
var labelText=$("input[name=selectOneLabel]").val();
$("#"+currentlyEditing+" > .label").text(labelText);
$("#"+currentlyEditing).find(".formInput").remove();
$("#"+currentlyEditing).find(".optionLabel").remove();
$("#"+currentlyEditing).find("input[type=radio]").remove();
//plug in new ones
var idText=$("input[name=selectOneValue]").val();
editDiv=$(this).parent().parent();
editDiv.find(".selectOption").each( function() {
var optionLabel=$(this).find("input[name=oneOptionLabel]").val();
var optionValue=$(this).find("input[name=oneOptionValue]").val();
var newOption = '<input type="radio" name="'+idText+'" value="'+optionValue+'" /><div class="optionLabel">'+optionLabel+'</div><BR/>'
$("#"+currentlyEditing).append(newOption);
});
setFlagAttributes($('#'+currentlyEditing));
});
//respond to an element being made chartable or unchartable:
//former case - make it numeric, disable numeric option, activate pie/bar options, set to pie
//latter case - enable numeric option, disable pie/bar options
$("input[name=chart]").change( function() {
if ($("input[name=chart]").attr("checked")) {
$("input[name=numeric]").attr("checked", true);
$("input[name=numeric]").attr("disabled", true);
$("input[name=pie]").attr("disabled", false);
$("input[name=pie]").attr("checked", true);
$("input[name=bar]").attr("disabled", false);
$("input[name=bar]").attr("checked", false);
}
else {
$("input[name=numeric]").attr("disabled", false);
$("input[name=pie]").attr("disabled", true);
$("input[name=bar]").attr("disabled", true);
}
});
//ensure you've only ever got pie or bar
$("input[name=pie]").change( function() {
$("input[name=bar]").attr("checked", !$("input[name=pie]").attr("checked"));
});
$("input[name=bar]").change( function() {
$("input[name=pie]").attr("checked", !$("input[name=bar]").attr("checked"));
});
//convert form to XML, validate, save
$("input[name=saveForm]").mouseup( function() {
var xml="";
allIDs=new Array();
$("#success").text("");
$("#error").text("");
var error=validateID("Form Name", $("input[name=formName]").val());
//iterate over the form lines, creating XML and/or recording errors
$("#destination > .formLine").each( function() {
if ($(this).attr("id").indexOf("textInput")==0) {
var inputLabel = $(this).find(".label").text();
var inputID = $(this).find("input:first").val();
error+=validateID(inputLabel, inputID);
xml+='<input ref="'+inputID+'"'+getInputFlagsFor($(this))+'> <label>'+inputLabel+'</label> </input>\n';
}
else if ($(this).attr("id").indexOf("longText")==0) {
var inputLabel = $(this).find(".label").text();
var inputID = $(this).find("textarea").val();
error+=validateID(inputLabel, inputID);
xml+='<textarea ref="'+inputID+'"'+getInputFlagsFor($(this))+'> <label>'+inputLabel+'</label> </textarea>\n';
}
else if ($(this).attr("id").indexOf("selectMultiple")==0) {
var inputLabel = $(this).find(".label").text();
var inputID = $(this).find("input:first").attr("name");
error+=validateID(inputLabel, inputID);
xml+='<select ref="'+inputID+'"'+getInputFlagsFor($(this))+'> <label>'+inputLabel+'</label> ';
$(this).find("input").each( function() {
xml+='<item><label>'+$(this).next().text()+'</label><value>'+$(this).attr("value")+'</value></item> ';
});
xml+='</select>\n';
}
else if ($(this).attr("id").indexOf("selectOne")==0) {
var inputLabel = $(this).find(".label").text();
var inputID = $(this).find("input:first").attr("name");
error+=validateID(inputLabel, inputID);
xml+='<select1 ref="'+inputID+'"'+getInputFlagsFor($(this))+'> <label>'+inputLabel+'</label> ';
$(this).find("input").each( function() {
xml+='<item><label>'+$(this).next().text()+'</label><value>'+$(this).attr("value")+'</value></item> ';
});
xml+='</select1>\n';
}
});
//check XML for flag errors
if (xml.indexOf('required="true" readonly="true"')>=0)
error+="\nA form element may not be simultaneously flagged as required and read-only."
if (xml.indexOf(' title="true"') != xml.lastIndexOf(' title="true"'))
error+="\nA form may have only one title element."
if (xml.indexOf(' subtitle="true"') != xml.lastIndexOf(' subtitle="true"'))
error+="\nA form may have only one subtitle element."
if (xml.split('chart=').length>4)
error+="\nA form may have no more than three chartable elements."
//done - now, either report errors, or upload XML
if (error.length>0) {
$("#error").text("Error: "+error);
}
else {
//we're error-free, we've got the XML, now send it to server
$.ajax({
async: false,
cache: false,
type: "POST",
url: "/buildForm.asp",
data: {
"projectKey" : "ahBlcGljb2xsZWN0c2VydmVycg4LEgdQcm9qZWN0GMplDA",
"formKey" : formKey,
"formName" : $("input[name=formName]").val(),
"formVersion" : $("select[name=formVersion]").val(),
"formXML" : xml,
},
dataType: "string",
error: function (XMLHttpRequest, textStatus, errorThrown) {
$("#error").text("Error: "+errorThrown);
},
success: function (string) {
if (string.indexOf("Error:")>=0)
$("#error").text(string);
else {
formKey=$.trim(string);
$("#success").text("Save successful - this form is ready for use.");
}
},
});
//increment version number for future saves
setVersionNumbersFor($("select[name=formVersion]").val());
}
});
});
function setVersionNumbersFor(existingNumber) {
//handle version number - annoyingly tricky
var floatVersion = parseFloat(existingNumber);
if (!isNaN(floatVersion)) {
versionNumber1=floatVersion+0.1;
versionNumber2=parseInt(floatVersion)+1;
if ((""+versionNumber1).length>5) {
versionNumber1=(""+versionNumber1).substr(0,5);
while (versionNumber1.charAt(versionNumber1.length-1)=="0"
&& versionNumber1.charAt(versionNumber1.length-2)!=".") {
versionNumber1=versionNumber1.substr(0,versionNumber1.length-1);
}
}
$("select[name=formVersion]").find("option:first").attr("name",versionNumber1);
$("select[name=formVersion]").find("option:first").text(versionNumber1);
$("select[name=formVersion]").find("option:last").attr("name",versionNumber2+".0");
$("select[name=formVersion]").find("option:last").text(versionNumber2+".0");
$("select[name=formVersion]").val(versionNumber1);
}
}
function validateID(label, id) {
id=$.trim(id);
if (id.length<=1)
return "\nThe ID '"+id+"' for "+label+" is invalid: values must be at least 2 characters long.";
if (id.length>1 && id.substr(0,2)=="ec")
return "\nThe ID '"+id+"' for "+label+" is invalid: values beginning with 'ec' are reserved for the EpiCollect system.";
var re=new RegExp("^[a-zA-Z0-9]*$");
if (!re.test(id))
return "\nThe ID '"+id+"' for "+label+" is invalid: only numbers and ASCII letters are permitted. No other characters (including spaces) are allowed.";
if ($.inArray(id, allIDs)>=0)
return "\nThe ID '"+id+"' for "+label+" is invalid: IDs must be unique within a form, and must not be the same as the form name.";
allIDs.push(id);
return "";
}
function showEditDetailsFor ( object ) {
// object.effect("highlight", {}, 3000);
currentlyEditing=object.attr("id");
if (currentlyEditing==lastEdited)
return;
$(".formLineEdit").hide();
setDetailFlagsFor(object);
$("#inputOptions").show();
if (object.attr("id").indexOf("textInput")==0) {
var inputLabel = $.trim(object.find(".label").text());
var inputID = object.find("input[name=inputID]").val();
if (inputLabel!="Text Input" || object.find("input[name=inputID]").attr("name")!="inputID") {
$("#textInputEdit").find("input[name=textInputLabel]").val(inputLabel);
$("#textInputEdit").find("input[name=textInputValue]").val(inputID);
}
$("#textInputEdit").show();
$("#numericFlag").show();
$("input[name=numeric]").attr("disabled", false); // in case it's been previously disabled
}
else if (object.attr("id").indexOf("longText")==0) {
var inputLabel = $.trim(object.find(".label").text());
var inputID = object.find("textarea:first").val();
if (inputLabel!="Long Text" || inputID!="") {
$("#longTextEdit").find("input[name=longTextLabel]").val(inputLabel);
$("#longTextEdit").find("input[name=longTextValue]").val(inputID);
}
$("#longTextEdit").show();
$("#numericFlag").hide();
}
else if (object.attr("id").indexOf("selectMultiple")==0) {
var inputLabel = $.trim(object.find(".label:first").text());
var inputID = object.find("input:last").attr("name");
if (inputLabel!="Select Multiple" || inputID!="selectMulti") {
$("#selectMultiEdit").find("input[name=selectMultiLabel]").val(inputLabel);
$("#selectMultiEdit").find("input[name=selectMultiValue]").val(inputID);
blankOption=$("#selectMultiEdit > .selectOption").remove();
var addedChild=false;
object.children(".formInput").each( function() {
optionClone=blankOption.clone();
var optionLabel=$(this).find(".optionLabel").text();
optionClone.find("input[name=multiOptionLabel]").val(optionLabel);
var optionValue=$(this).find("input:first").attr("value");
optionClone.find("input[name=multiOptionValue]").val(optionValue);
cloneRemoveButton = optionClone.find("input[name=removeSelectMultiOption]");
cloneRemoveButton.bind("mouseup", function() {
$(this).parent().remove();
});
$("#selectMultiEdit").append(optionClone);
addedChild=true;
});
if (!addedChild)
$("#selectMultiEdit").append(blankOption);
} //don't show defaults
$("#selectMultiEdit").show();
$("#numericFlag").hide(); //not relevant to selects
}
else if (object.attr("id").indexOf("selectOne")==0) {
var inputLabel = $.trim(object.find(".label:first").text());
var inputID = object.find("input:last").attr("name");
if (inputLabel!="Select One" || inputID!="selectOne") {
$("#selectOneEdit").find("input[name=selectOneLabel]").val(inputLabel);
$("#selectOneEdit").find("input[name=selectOneValue]").val(inputID);
blankOption=$("#selectOneEdit > .selectOption").remove();
var addedChild=false;
object.children(".formInput").each( function() {
optionClone=blankOption.clone();
var optionLabel=$(this).find(".optionLabel").text();
optionClone.find("input[name=oneOptionLabel]").val(optionLabel);
var optionValue=$(this).find("input:first").attr("value");
optionClone.find("input[name=oneOptionValue]").val(optionValue);
cloneRemoveButton = optionClone.find("input[name=removeSelectOneOption]");
cloneRemoveButton.bind("mouseup", function() {
$(this).parent().remove();
});
$("#selectOneEdit").append(optionClone);
addedChild=true;
});
if (!addedChild)
$("#selectOneEdit").append(blankOption);
} //don't show defaults
$("#selectOneEdit").show();
$("#numericFlag").hide(); //not relevant to selects
}
lastEdited=currentlyEditing;
}
// converts an object's flags into a XML (or HTML div) attribute string
function getInputFlagsFor ( object ) {
var flags='';
if (object.attr("required")=="true")
flags+=' required="true"';
if (object.attr("readonly")=="true")
flags+=' readonly="true"';
if (object.attr("title")=="true")
flags+=' title="true"';
if (object.attr("subtitle")=="true")
flags+=' subtitle="true"';
if (object.tagName="input" && object.attr("numeric")=="true")
flags+=' numeric="true"';
if (object.attr("chart")=="pie")
flags+=' chart="pie"';
else if (object.attr("chart")=="bar")
flags+=' chart="bar"';
return flags;
}
function setDetailFlagsFor ( object ) {
//clear any existing flags
$("#inputOptions").find("input[name=required]").attr("checked",false);
$("#inputOptions").find("input[name=readonly]").attr("checked",false);
$("#inputOptions").find("input[name=title]").attr("checked",false);
$("#inputOptions").find("input[name=subtitle]").attr("checked",false);
$("#inputOptions").find("input[name=numeric]").attr("checked",false);
$("#inputOptions").find("input[name=chart]").attr("checked",false);
//reset them as appropriate
if (object.attr("required")=="true")
$("#inputOptions").find("input[name=required]").attr("checked",true);
if (object.attr("readonly")=="true")
$("#inputOptions").find("input[name=readonly]").attr("checked",true);
if (object.attr("title")=="true")
$("#inputOptions").find("input[name=title]").attr("checked",true);
if (object.attr("subtitle")=="true")
$("#inputOptions").find("input[name=subtitle]").attr("checked",true);
if (object.attr("numeric")=="true")
$("#inputOptions").find("input[name=numeric]").attr("checked",true);
if (object.attr("chart")=="pie") {
$("#inputOptions").find("input[name=chart]").attr("checked",true);
$("#inputOptions").find("input[name=pie]").attr("disabled",false);
$("#inputOptions").find("input[name=pie]").attr("checked",true);
$("#inputOptions").find("input[name=bar]").attr("checked",false);
}
else if (object.attr("chart")=="bar") {
$("#inputOptions").find("input[name=chart]").attr("checked",true);
$("#inputOptions").find("input[name=bar]").attr("disabled",false);
$("#inputOptions").find("input[name=bar]").attr("checked",true);
$("#inputOptions").find("input[name=pie]").attr("checked",false);
}
}
//set the element's attributes as per the checkboxes in the edit-details column
function setFlagAttributes ( object ) {
object.attr("required", $("#inputOptions").find("input[name=required]").attr("checked"));
object.attr("readonly", $("#inputOptions").find("input[name=readonly]").attr("checked"));
object.attr("title", $("#inputOptions").find("input[name=title]").attr("checked"));
object.attr("subtitle", $("#inputOptions").find("input[name=subtitle]").attr("checked"));
object.attr("numeric", $("#inputOptions").find("input[name=numeric]").attr("checked"));
if ($("#inputOptions").find("input[name=chart]").attr("checked"))
object.attr("chart", $("#inputOptions").find("input[name=pie]").attr("checked") ? "pie" : "bar");
}
</script>
<title>EpiCollect </title>
</head>
<table width="100%" height = "100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th align="center" valign="middle" scope="row">Coming shortly. For enquiries please <a href="mailto:[email protected]">email us. </a></th>
</tr>
</table>
</body>
</html>