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
|
# File 'lib/rwd/rwd.rb', line 271
def prechildren(res, before, after, varshtml, , switches, help, oneormorefields, firstaction, tabs, tab, pda=false)
bef = before[-1]
res << Format % ["Before", @subtype] if ($rwd_debug and not bef.nil?)
res << bef if not bef.nil?
res << Format % ["Pre", @subtype] if $rwd_debug
align = AC
align = "align='#{@args["align"]}'" if @args.include?("align")
valign = VA
valign = "valign='#{@args["valign"]}'" if @args.include?("valign")
value1 = ""
value1 = varshtml[@args["name"]] if varshtml.include?(@args["name"])
value1 = @args["value"] if @args.include?("value")
value2 = ""
value2 = [@args["name"]] if .include?(@args["name"])
value2 = @args["value"] if @args.include?("value")
cellspacing = 3
cellspacing = 0 if pda
case @subtype
when "application"
when "window", "helpwindow"
args = @args.deep_dup
args["nohelpbutton"] = (not help)
template = $rwd_html_1
res << (template(template, args))
when "p" then res << "<p #{align}>"
when "pre" then res << "<pre #{align}>"
when "big" then res << "<p #{align}><big>"
when "small" then res << "<p #{align}><small>"
when "list" then res << "<ul #{align}>"
when "item" then res << "<li #{align}>"
when "empty" then res << "<p><br>"
when "image"
width = "width='#{@args["width"]}" if @args.include?("width")
height = "height='#{@args["height"]}'" if @args.include?("height")
res << "<img src='#{@args["src"]}' alt='#{@args["alt"]}' #{width} #{height}>"
when "progressbar"
width = 200
res << "<table>"
res << " <tr>"
res << " <td colspan='2'><img src='rwd_pixel.gif' height='1' width='#{width+5}'></td>"
res << " </tr>"
res << " <tr>"
res << " <td bgcolor='#DDDDDD'><img src='rwd_pixel.gif' height='10' width='#{(width*@args["value"].to_f).to_i}'></td>"
res << " <td bgcolor='#EEEEEE'><img src='rwd_pixel.gif' height='10' width='#{(width*(1.0-@args["value"].to_f)).to_i}'></td>"
res << " </tr>"
res << "</table>"
when "br" then res << "<br>"
when "hr" then res << "<hr>"
when "b" then res << "<b>"
when "i" then res << "<i>"
when "a"
if @args.include?("href")
res << "<a href='#{@args["href"]}' target='#{@args["target"] or "_blank"}'>"
else
res << "<a href='javascript:document.bodyform.rwd_action.value=\"#{@args["action"]}\";document.bodyform.submit();'>"
end
when "vertical" then res << "<table #{AC} border='#{$rwd_border}' cellspacing='#{cellspacing}' cellpadding='0'>"
when "horizontal" then res << "<table #{AC} border='#{$rwd_border}' cellspacing='#{cellspacing}' cellpadding='0'><tr #{align} #{valign}>"
when "table" then res << "<table #{AC} border='#{$rwd_border}' cellspacing='#{cellspacing}' cellpadding='0'>"
when "row" then res << "<tr #{align} #{valign}>"
when "hidden" then res << "<p #{align}><input name='#{@args["name"]}' value='#{value1}' type='hidden'>"
when "text"
maxlength = ""
maxlength = "maxlength='%s'" % @args["maxlength"] if @args.include?("maxlength")
size = ""
size = "size='%s'" % @args["size"] if @args.include?("size")
size = "size='%s'" % 10 if pda
res << "<p #{align}><input name='#{@args["name"]}' value='#{value1}' type='text' #{maxlength} #{size}>"
oneormorefields << "true"
when "textarea"
res << "<p #{align}><textarea name='#{@args["name"]}' rows='25' cols='80'>#{value2.crlf}</textarea>"
oneormorefields << "true"
when "password"
maxlength = ""
maxlength = "maxlength='%s'" % @args["maxlength"] if @args.include?("maxlength")
size = ""
size = "size='%s'" % 10 if pda
res << "<p #{align}><input name='#{@args["name"]}' value='#{value1}' type='password' #{maxlength} #{size}>"
oneormorefields << "true"
when "checkbox"
if varshtml[@args["name"]] == "on"
switches[@args["name"]] = true
res << "<p #{align}><input name='#{@args["name"]}' checked='on' type='checkbox'>"
else
switches[@args["name"]] = false
res << "<p #{align}><input name='#{@args["name"]}' type='checkbox'>"
end
oneormorefields << "true"
when "radio"
if varshtml[@args["name"]] == value1 res << "<p #{align}><input name='#{@args["name"]}' checked='on' value='#{value1}' type='radio'>"
else
res << "<p #{align}><input name='#{@args["name"]}' value='#{value1}' type='radio'>"
end
oneormorefields << "true"
when "select"
res << "<select #{align} name='#{@args["name"]}' width='#{@args["width"]} size='#{@args["size"]}'>" name = @args["name"]
$select = varshtml[name]
oneormorefields << "true"
when "option"
if $select == @children[0].text
res << "<option selected='true'>"
else
res << "<option>"
end
when "button"
res << "<input type='submit' value='#{@args["caption"]}' onclick='document.bodyform.rwd_action.value=\"#{@args["action"]}\";'>"
firstaction << @args["action"] if (firstaction.empty? and @args.include?("action"))
oneormorefields << "true"
when "back"
res << "<input type='submit' value='Back' onclick='document.bodyform.rwd_action.value=\"rwd_back\";'>"
firstaction << "rwd_back" if firstaction.empty?
oneormorefields << "true"
when "cancel"
res << "<input type='submit' value='Cancel' onclick='document.bodyform.rwd_action.value=\"rwd_cancel\";'>"
firstaction << "rwd_cancel" if firstaction.empty?
oneormorefields << "true"
when "help"
res << "<input type='submit' value='Help' onclick='document.bodyform.rwd_action.value=\"rwd_help\";'>"
firstaction << "rwd_help" if firstaction.empty?
oneormorefields << "true"
when "quit"
res << "<input type='submit' value='Quit' onclick='document.bodyform.rwd_action.value=\"rwd_quit\";'>"
firstaction << "rwd_quit" if firstaction.empty?
oneormorefields << "true"
when "close"
res << "<input type='submit' value='Close' onclick='window.close();'>"
firstaction << "rwd_quit" if firstaction.empty?
oneormorefields << "true"
when "main"
res << "<input type='submit' value='Main' onclick='document.bodyform.rwd_action.value=\"rwd_main\";'>"
firstaction << "rwd_main" if firstaction.empty?
oneormorefields << "true"
when "reset"
res << "<input type='reset' value='Reset'>"
firstaction << "rwd_quit" if firstaction.empty? oneormorefields << "true"
when "closewindow"
when "tabs"
res << "<table #{AC} border='#{$rwd_border}' cellspacing='0' cellpadding='0'>"
res << " <tr #{AL}>"
res << " <td #{AL} class='tabs'>"
res << " <table #{AL} border='#{$rwd_border}' cellspacing='0' cellpadding='0'>"
res << " <tr #{AL}>"
tabs.each do |obj|
name = obj.args["name"]
caption = obj.args["caption"]
res << "<td #{AL} class='notab'> </td>" unless obj == tabs[0]
if name == tab
res << "<td #{AC} class='activetab'><tt> #{caption} </tt></td>"
else
res << "<td #{AC} class='passivetab'><a href='javascript:document.bodyform.rwd_action.value=\"rwd_tab_#{name}\";document.bodyform.submit();'><tt> #{caption} </tt></a></td>"
end
end
res << " <td class='notab' width='100%'> </td>"
res << " </tr>"
res << " </table>"
res << " </td>"
res << " </tr>"
res << " <tr #{align}>"
res << " <td #{align} class='tabblad'>"
when "tab"
res << "<table #{AC} border='#{$rwd_border}' cellspacing='3' cellpadding='0'>"
when "panel"
level = (@args["level"] or "normal")
res << "<table #{AC} border='#{$rwd_border}' cellspacing='0' cellpadding='0'>"
res << " <tr #{align}>"
res << " <td #{align} class='panel1'>" if level == "normal"
res << " <td #{align} class='panel1high'>" if level == "high"
res << " <td #{align} class='panel1low'>" if level == "low"
res << " <table #{AC} border='#{$rwd_border}' cellspacing='0' cellpadding='0'>"
res << " <tr #{align}>"
res << " <td #{align} class='panel2'>" if level == "normal"
res << " <td #{align} class='panel2high'>" if level == "high"
res << " <td #{align} class='panel2low'>" if level == "low"
res << " <table #{AC} border='#{$rwd_border}' cellspacing='3' cellpadding='0'>"
else
puts "<#{@subtype}>"
res << "<#{@subtype}>"
end
bef = nil
aft = nil
case @subtype
when "vertical", "window", "helpwindow", "tab", "panel"
res << Format % ["AftPre", @subtype] if $rwd_debug
if @args.include?("spacing")
s = "<tr><td> </td></tr>" * (@args["spacing"].to_i)
else
s = ""
end
bef = "#{s}<tr #{align} #{valign}><td #{align}>"
aft = "</td></tr>"
when "horizontal", "row"
res << Format % ["AftPre", @subtype] if $rwd_debug
bef = "<td #{align}>"
aft = "</td>"
end
before.push(bef)
after.push(aft)
end
|