summaryrefslogtreecommitdiffstats
path: root/webui_templates/system_edit.tmpl
blob: 812ea43989ddd280e81abcc2686967d9e869e654 (plain)
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
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
#extends cobbler.webui.master

#import time

#block body

<script language="javascript">

#if $system
function disablename(value)
{
    document.getElementById("name").disabled=value;
    if (value) {
        document.getElementById("name").value = "$system.name";
    }
}
#end if

function get_random_mac()
{
    xmlHttp = new XMLHttpRequest();
    xmlHttp.open("GET", "$base_url?mode=random_mac", true);
    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var mac_field = document.getElementById("macaddress")
            var result = xmlHttp.responseText;
            if (result.charAt(2) == ':' && result.charAt(5) == ':') {
                mac_field.value = result;
            }
        }
    };
    xmlHttp.send(null);
}

#raw
function intf_enable_field(field,enabled)
{
    if (enabled) {
        document.getElementById(field + "_row").style.display="table-row"
    } else {
        document.getElementById(field + "_row").style.display="none"
    }
}

function intf_update_visibility()
{
    is_slave=document.getElementById("bonding_is_slave").checked
    is_master=document.getElementById("bonding_is_master").checked
    is_static = document.getElementById("static_true").checked
 
    intf_enable_field("static",!is_slave)
    intf_enable_field("ipaddress",(!is_slave))
    intf_enable_field("subnet",(!is_slave) && is_static)
    intf_enable_field("dns_name",!is_slave)
    intf_enable_field("static_routes",!is_slave)
    intf_enable_field("dhcptag",!is_slave)
    intf_enable_field("virtbridge",!is_master)
    intf_enable_field("bondingopts",is_master)
    intf_enable_field("bondingmaster",is_slave)
}

function get_selected_interface()
{
   return document.getElementById("interfaces").value
}

function on_interface_change()
{
    // called when the user picks something new from the interface selector
    save_intf(last_interface)
    clear_intf()
    last_interface = get_selected_interface()
    load_intf()
}

function on_interface_add()
{
   // called when the user hits the "new interface" button

   var iname = document.getElementById("newinterfacename").value
   if ((iname == "") || (iname == " ")) {
      alert("invalid interface name")
      return
   }

   if (interface_table[iname] != null) {
      alert("interface already exists")
      return
   }

   if (interface_table[iname] == null) {
      interface_table[iname] = new Array()
   }

   interface_table[iname]["macaddress"] = ""
   interface_table[iname]["bonding"] = ""
   interface_table[iname]["bondingmaster"] = ""
   interface_table[iname]["bondingopts"] = ""
   interface_table[iname]["ipaddress"] = ""
   interface_table[iname]["dns_name"] = ""
   interface_table[iname]["static_routes"] = ""
   interface_table[iname]["dhcptag"] = ""
   interface_table[iname]["virtbridge"] = ""
   interface_table[iname]["subnet"] = ""
   interface_table[iname]["static"] = false
   interface_table[iname]["present"] = "1"
   interface_table[iname]["original"] = "0"

   var interfaces = document.getElementById("interfaces")
   ilen = interfaces.length
   var new_option = new Option(iname,iname)
   interfaces.options[ilen] = new_option
   interfaces.selectedIndex = ilen
   on_interface_change() // explicit firing required   

}

function on_interface_delete()
{
   selected = get_selected_interface()
   interfaces = document.getElementById("interfaces")


   if (interfaces.value == no_delete) {
      alert("the default interface cannot be deleted")
      return
   }
   
   if (interfaces.length == 1) {
      alert("systems must always have at least one interface")
      return
   } 
   
   clear_intf()
   for (i = interfaces.options.length - 1; i>=0; i--) {
     if (interfaces.options[i].value == selected) {
        interfaces.remove(i)
     }
   }
   interface_table[selected]["present"] = 0
   interfaces.selectedIndex = 0
   load_intf()
} 

function get_enabled_field(field,enabled)
{
    if (enabled) {
        return document.getElementById(field).value
    } else {
        return ""
    }
}

function save_intf(which) 
{
    // this populates the interface widget with the data for the currently selected interface
    // and is called when the user picks a certain interface from the drop-down

    iname = which
    var itable = interface_table[iname]
    if (itable == null) {
       interface_table[iname] = new Array()
       itable = interface_table[iname]
    }

    is_slave=document.getElementById("bonding_is_slave").checked
    is_master=document.getElementById("bonding_is_master").checked
    is_static=document.getElementById("static_true").checked

    itable["name"]       = iname
    itable["macaddress"] = document.getElementById("macaddress").value

    var bond = "na"
    if (document.getElementById("bonding_is_master").checked == true) {
       bond = "master"
    } else if (document.getElementById("bonding_is_slave").checked == true) {
       bond = "slave"
    }
    itable["bonding"]    = bond
    
    itable["bondingmaster"] = get_enabled_field("bondingmaster",is_slave)
    itable["bondingopts"]   = get_enabled_field("bondingopts",is_master)
    itable["static"]     = document.getElementById("static_true").checked
    itable["ipaddress"]  = get_enabled_field("ipaddress",(!is_slave))
    itable["subnet"]     = get_enabled_field("subnet",(!is_slave) && is_static)
    itable["dns_name"]   = get_enabled_field("dns_name",!is_slave)
    itable["static_routes"]   = get_enabled_field("static_routes",!is_slave)
    itable["dhcptag"]    = get_enabled_field("dhcptag",!is_slave)
    itable["virtbridge"] = get_enabled_field("virtbridge",!is_master)
    itable["present"]    = document.getElementById("present").value
    itable["original"]   = document.getElementById("original").value

}

function load_intf()
{
    // this populates the interface widget with the data for the currently selected interface
    // and is called when the user picks a certain interface from the drop-down
    intf = get_selected_interface()
    document.getElementById("macaddress").value    = interface_table[intf]["macaddress"]
    if (interface_table[intf]["bonding"] == "master") {
       document.getElementById("bonding_is_master").checked = true       
    } else if (interface_table[intf]["bonding"] == "slave") {
       document.getElementById("bonding_is_slave").checked = true       
    } else {
       document.getElementById("bonding_is_na").checked = true       
    }
    document.getElementById("bondingmaster").value = interface_table[intf]["bondingmaster"]
    document.getElementById("bondingopts").value   = interface_table[intf]["bondingopts"]
    if (interface_table[intf]["static"]) {
        document.getElementById("static_true").checked = true
    } else {
        document.getElementById("static_false").checked = true
    }
    document.getElementById("ipaddress").value     = interface_table[intf]["ipaddress"]
    document.getElementById("subnet").value        = interface_table[intf]["subnet"]
    document.getElementById("dns_name").value      = interface_table[intf]["dns_name"]
    document.getElementById("static_routes").value = interface_table[intf]["static_routes"]
    document.getElementById("dhcptag").value       = interface_table[intf]["dhcptag"]
    document.getElementById("virtbridge").value    = interface_table[intf]["virtbridge"]
    document.getElementById("present").value       = interface_table[intf]["present"]
    document.getElementById("original").value      = interface_table[intf]["original"]
    
    intf_update_visibility()
}

function clear_intf()
{
    // this clears the interface list and populates it with the currently selected interface data

    document.getElementById("macaddress").value    = ""
    document.getElementById("bonding_is_na").checked = true
    document.getElementById("bondingmaster").value = ""
    document.getElementById("bondingopts").value   = ""
    document.getElementById("static_false").checked = true
    document.getElementById("ipaddress").value     = ""
    document.getElementById("subnet").value        = ""
    document.getElementById("dns_name").value      = ""
    document.getElementById("static_routes").value = ""
    document.getElementById("dhcptag").value       = ""
    document.getElementById("virtbridge").value    = ""
    document.getElementById("present").value       = "1"
    document.getElementById("original").value      = "0"

}
#end raw

function build_interface_table()
{
    // called during onload, this stores all of the interfaces from Cheetah in javascript
    // so that we can manipulate them dynamically in more interesting ways
    //alert("building interface table")
    interface_table = new Array()
    var last = ""
    #if $system
       var ifound = 0
       #for $iname in $system.interfaces.keys()
           interface_table['$iname'] = new Array()
           interface_table['$iname']["macaddress"] = "$system.interfaces[$iname]['mac_address']"
           //alert("$iname has a mac:" + interface_table["$iname"]["macaddress"])
           interface_table['$iname']["bonding"]    = "$system.interfaces[$iname]['bonding']"
           interface_table['$iname']["bondingmaster"] = "$system.interfaces[$iname]['bonding_master']"
           interface_table['$iname']["bondingopts"] = "$system.interfaces[$iname]['bonding_opts']"
           if ("$system.interfaces[$iname]['static']" != "False") {
               interface_table['$iname']["static"]     = true
           } else {
               interface_table['$iname']["static"]     = false
           }
           interface_table['$iname']["ipaddress"]  = "$system.interfaces[$iname]['ip_address']"
           interface_table['$iname']["subnet"]     = "$system.interfaces[$iname]['subnet']"
           interface_table['$iname']["dns_name"]   = "$system.interfaces[$iname]['dns_name']"
           #set joined = " ".join($system.interfaces[$iname]['static_routes'])
           interface_table['$iname']["static_routes"] = "$joined"
           interface_table['$iname']["dhcptag"]    = "$system.interfaces[$iname]['dhcp_tag']"
           interface_table['$iname']["virtbridge"] = "$system.interfaces[$iname]['virt_bridge']"
           interface_table['$iname']["present"]    = "1"
           interface_table['$iname']["original"]   = "1"
           last = "$iname"
       #end for
    #else
       interface_table["eth0"] = new Array()
       interface_table["eth0"]["macaddress"] = ""
       interface_table["eth0"]["bonding"] = ""
       interface_table["eth0"]["bondingmaster"] = ""
       interface_table["eth0"]["bondingopts"] = ""
       interface_table["eth0"]["static"] = ""
       interface_table["eth0"]["ipaddress"] = ""
       interface_table["eth0"]["subnet"] = ""
       interface_table["eth0"]["dns_name"] = ""
       interface_table["eth0"]["static_routes"] = ""
       interface_table["eth0"]["dhcptag"] = ""
       interface_table["eth0"]["virtbridge"] = ""
       interface_table["eth0"]["present"] = "1"
       interface_table["eth0"]["original"] = "0"
    #end if
    return interface_table
}

#raw
function on_form_submit()
{
    // form submission handler
    save_intf(get_selected_interface())
    var listing = ""
    for (var iname in interface_table) {
        if (listing == "") {
            listing = iname
        } else {
            listing = iname + "," + listing
        }
        for (var ikey in interface_table[iname]) {
            var field_name = ikey + "-" + iname
            var current_value = interface_table[iname][ikey]
            var new_input=document.createElement('input')
            new_input.name=field_name
            new_input.value=current_value
            new_input.style.display='none'
            document.forms.myform.appendChild(new_input)

        }
    }
    document.getElementById("interface_list").value = listing
    document.myform.submit()
}
#end raw

function page_onload() {
    interface_table = build_interface_table()
    last_interface = get_selected_interface()
    load_intf()
    no_delete = "eth0"
}
</script>



#if $editable != True
#set global $owners = $system.owners
#include "/usr/share/cobbler/webui_templates/enoaccess.tmpl"
#end if

<form name="myform" id="myform" method="post" action="$base_url?mode=system_save">
<fieldset id="cform">

    <input name="interface_list" type="hidden" value="" id="interface_list"/>
   
    #if $system
        <input type="hidden" name="new_or_edit" value="edit"/>
        <input type="hidden" name="oldname" value="$system.name"/>
    #else
        <input type="hidden" name="new_or_edit" value="new"/>
    #end if

    <legend>Edit a System</legend>

    <table border=0>

    <tr>
    <td>
    <label for="name">System Name</label>
    </td>
    <td>
    #if $system
    <input type="text" size="128" style="width: 150px;" name="name" id="name" disabled="true"
    #else
    <input type="text" size="128" style="width: 150px;" name="name" id="name"
    #end if
        #if $system
            value="$system.name"
        #end if
    />
    <p class="context-tip">Example: vanhalen</p>
    </td>
    </tr>

    #if $system
    <tr>
    <td>
    <label for="mode">Edit Mode</label>
    </td>
    <td>
    <input type="radio" name="editmode" value="edit" checked onclick="javascript:disablename(true)">Edit
    <input type="radio" name="editmode" value="rename" onclick="javascript:disablename(false)">Rename + Edit
    <input type="radio" name="editmode" value="copy" onclick="javascript:disablename(false)">Copy + Edit
    <p class="context-tip">How do you want to modify this object?</p>
    </td>
    </tr>
    #else
    <input type="hidden" name="editmode" value="new"/>
    #end if

    #if $system
    <tr>
    <td>
    <label>Created</label>
    </td>
    <td>
    $time.ctime($system.ctime)
    </td>
    </tr>

    <tr>
    <td>
    <label>Last Modified</label>
    </td>
    <td>
    $time.ctime($system.mtime)
    </td>
    </tr>
    #end if

    <tr>
    <td>
    <label for="comment">Comment</label>
    </td>
    <td>
    #if $system
       #set $comm = $system.comment
    #else
       #set $comm = ""
    #end if
    <textarea rows="5" cols="30" style="width: 400px;" name="comment" id="comment">$comm</textarea>
    <p class="context-tip">This is a free-form description field</p>
    </td>
    </tr>


    <tr>
    <td>
    <label for="netboot">Netboot Enabled</label>
    </td>
    <td>

    #if $system
       #if str($system.netboot_enabled) != "False"
           <input type="checkbox" name="netboot" id="netboot" checked=True>
       #else
           <input type="checkbox" name="netboot" id="netboot">
       #end if
    #else
       <input type="checkbox" name="netboot" id="netboot" checked="True">
    #end if

    <p class="context-tip">For PXE setups, select to boot the profile below for the system.<br/>De-select to boot the system from local disk.</p>
    </td>
    </tr>

    <tr>
    <td>
    <label for="profile">Profile</label>
    </td>
    <td>
    <select name="profile" id="profile">
        #for $profile in $profiles:
        <option name="$profile.name"
            #if $system and $system.profile == $profile.name
                    selected="1"
            #end if
        >$profile.name</option>
        #end for
    </select>
    <p class="context-tip">What profile should be installed on this system?</p>
    </td>
    </tr>

    <tr>
    <td>
    <label for="ksmeta">Kickstart Metadata</label>
    </td>
    <td>
    <input type="text" size="255" style="width: 400px;" name="ksmeta" id="ksmeta"
        #if $system
            value="$system.ks_meta"
        #end if
    />
    <p class="context-tip">Example: dog=fido gnome=yes</p>
    </td>
    </tr>

    <tr>
    <td>
    <label for="kopts">Kernel Options</label>
    </td>
    <td>
    <input type="text" size="255" style="width: 400px;" name="kopts" id="kopts"
        #if $system
            value="$system.kernel_options"
        #end if
    /> 
    <p class="context-tip">Example: noipv6 magic=foo</p>
    </td>
    </tr>

    <tr>
    <td>
    <label for="koptspost">Post Kernel Options</label>
    </td>
    <td>
    <input type="text" size="255" style="width: 400px;" name="koptspost" id="koptspost"
        #if $system
            value="$system.kernel_options_post"
        #end if
    /> 
    <p class="context-tip">Example: clocksource=pit nosmp noapic nolapic</p>
    </td>
    </tr>

    <tr>
    <td>
    <label for="server_override">Server Override</label>
    </td>
    <td>
    <input type="text" size="128" style="width: 150px;" name="server_override" id="server_override"
        #if $system
           value="$system.server" 
        #end if
    />
    <p class="context-tip">Use this server for kickstarts, not the value in settings.  Usually this should be left alone.</p>
    </td>
    </tr>

    <tr>
    <td>
    <label for="owners">Access Allowed For</label>
    </td>
    <td>
    #if $system
       #set ownerslist = ','.join($system.owners)
    #end if
    <input type="text" size="255" style="width: 400px;" name="owners" id="owners"
        #if $system
            value="$ownerslist"
        #else
            value="$user"
        #end if
    />
    <p class="context-tip">Applies only if using authz_ownership module, comma-delimited</p>
    </td>
    </tr>

    <tr id="hostname_row">
        <td class="netedit">
        <label for="hostname">Hostname</label>
        </td>
        <td class="netedit">
        #if $system
            <input type="text" size="64" style="width: 150px;" name="hostname" id="hostname" value="$system.hostname" />
        #else
            <input type="text" size="64" style="width: 150px;" name="hostname" id="hostname" />
        #end if
        <p class="context-tip">Ex: "vanhalen.example.org".  Used for /etc/sysconfig/network.</p>
        </td>
    </tr>

    <tr id="gateway_row">
        <td class="netedit">
        <label for="gateway">Gateway</label>
        </td>
        <td class="netedit">
        #if $system
            <input type="text" size="64" style="width: 150px;" name="gateway" id="gateway" />
        #else
            <input type="text" size="64" style="width: 150px;" name="gateway" id="gateway" value="$system.gateway" />
        #end if
        <p class="context-tip">Ex: "192.168.1.11".  For use with static IP configs.</p>
        </td>
    </tr>


    <tr>
    <td class="netedit">
    <label for="name_servers">Name Servers</label>
    </td>
    <td class="netedit">
    #if $system
       #set joined = " ".join($profile.name_servers)
       <input type="text" name="name_servers" id="name_servers" value="$joined">
    #else
       <input type="text" name="name_servers" id="name_servers" value="<<inherit>>">
    #end if
    <p class="context-tip">Name servers, space delimited, if not provided by DHCP</p>
    </td>
    </tr>

    <tr>
    <td class="virtedit">
    <label for="virtfilesize">Virt Disk (GB)</label>
    </td>
    <td class="virtedit">
    <input type="text" size="5" style="width: 150px;" name="virtfilesize" id="virtfilesize"
        #if $system
           value="$system.virt_file_size"
        #end if
    />
    <p class="context-tip">For virtual installs only, require this disk size in GB.</p>
    </td>
    </tr>

    <tr>
    <td class="virtedit">
    <label for="virtram">Virt RAM (MB)</label>
    </td>
    <td class="virtedit">
    <input type="text" size="5" style="width: 150px;" name="virtram" id="virtram"
        #if $system
           value="$system.virt_ram"
        #end if
    />
    <p class="context-tip">For virtual installs only, allocate this amount of RAM, in MB.</p>
    </td>
    </tr>

    <tr>
    <td class="virtedit">
    <label for="virttype">Virt Type</label>
    </td>
    <td class="virtedit">

    #if $system and $system.virt_type == "<<inherit>>"
        <input type="radio" name="virttype" id="virttype" value="<<inherit>>" checked>Inherit
    #else
        #if $system
            <input type="radio" name="virttype" id="virttype" value="<<inherit>>">Inherit
        #else
            <input type="radio" name="virttype" id="virttype" value="<<inherit>>" checked>Inherit
        #end if 
    #end if


    #if $system and $system.virt_type == "auto"
        <input type="radio" name="virttype" id="virttype" value="auto" checked>Any
    #else
        #if $system
            <input type="radio" name="virttype" id="virttype" value="auto">Any
        #else
            <input type="radio" name="virttype" id="virttype" value="auto">Any
        #end if 
    #end if

    #if $system and $system.virt_type == "xenpv"
        <input type="radio" name="virttype" id="virttype" value="xenpv" checked>Xen (pv)
    #else
        <input type="radio" name="virttype" id="virttype" value="xenpv">Xen (pv)
    #end if

    #if $system and $system.virt_type == "qemu"
        <input type="radio" name="virttype" id="virttype" value="qemu" checked>qemu/KVM
    #else
        <input type="radio" name="virttype" id="virttype" value="qemu">qemu/KVM
    #end if
    <p class="context-tip">What virtualization technology should koan use?</p>
    </td>
    </tr>

    <tr>
    <td class="virtedit">
    <label for="virtpath">Virt Path</label>
    </td>
    <td class="virtedit">
    <input type="text" size="255" style="width: 400px;" name="virtpath" id="virtpath"
        #if $system
           value="$system.virt_path"
        #end if
    />
    <p class="context-tip">Sets koan's storage preferences, read manpage or leave blank.</p>
    </td>
    </tr>

    <tr>
    <td class="virtedit">
    <label for="virtpath">Virt CPUs</label>
    </td>
    <td class="virtedit">
    <input type="text" size="255" style="width: 150px;" name="virtcpus" id="virtcpus"
        #if $system
           value="$system.virt_cpus"
        #end if
    />
    <p class="context-tip">How many virtual CPUs?  This is an integer.</p>
    </td>
    </tr>

    <tr>
    <td class="poweredit">
    <label for="power_type">Power Type</label>
    </td>
    <td class="poweredit">
    <select name="power_type" id="power_type">
        #set valid_power = [ "bullpap", "wti", "apc_snmp", "ether-wake", "ipmilan", "drac", "ipmitool", "ilo", "rsa", "lpar", "bladecenter" ]
        #set nothing = valid_power.sort()

        #for $value in $valid_power:
        <option name="$value"
            #if $system and (($system.power_type == $value) or ($system.power_type == "" and $value == "none"))
                    selected="1"
            #end if
        >$value</option>
        #end for
    </select>
    <p class="context-tip">Is a power management device attached?</p>
    </td>
    </tr>

    <tr>
    <td class="poweredit">
    <label for="power_address">Power Address</label>
    </td>
    <td class="poweredit">
    <input type="text" size="255" style="width: 150px;" name="power_address" id="power_address"
        #if $system
           value="$system.power_address"
        #end if
    />
    <p class="context-tip">Ex: hostname-mgmt.example.org</p>
    </td>
    </tr>

    <tr>
    <td class="poweredit">
    <label for="power_id">Power Id</label>
    </td>
    <td class="poweredit">
    <input type="text" size="255" style="width: 150px;" name="power_id" id="power_id"
        #if $system
           value="$system.power_id"
        #end if
    />
    <p class="context-tip">Plug number or blade name, if applicable.</p>
    </td>
    </tr>

    <tr>
    <td class="poweredit">
    <label for="power_user">Power User</label>
    </td>
    <td class="poweredit">
    <input type="text" size="255" style="width: 150px;" name="power_user" id="power_user"
        #if $system
           value="$system.power_user"
        #end if
    />
    <p class="context-tip">Power management username, if device requires one.</p>
    </td>
    </tr>

    <tr>
    <td class="poweredit">
    <label for="power_pass">Power Password</label>
    </td>
    <td class="poweredit">
    <input type="text" size="255" style="width: 150px;" name="power_pass" id="power_pass"
        #if $system
           value="$system.power_pass"
        #end if
    />
    <p class="context-tip">Power management password.</p>
    </td>
    </tr>

    ## FIXME: it might be a good idea to color code the power section in the same
    ## way we color code the interface section (see "nicedit" in CSS) as well as
    ## the virt section being a different color

    <tr>
    <td>
    <label for="new-interface">Add Interface</label>
    </td>
    <td>
    <input name="newinterfacename" id="newinterfacename"/>&nbsp;&nbsp;
    <a href="javascript: on_interface_add()" style="font-size: 0.8em;">Add interface name</a>
    <p class="context-tip">Add an interface to the system, ex: eth1</p>
    </td>
    </tr>

    <tr>
    <td>
    <label for="interfaces">Interface</label>
    </td>
    <td>
    <select name="interfaces" id="interfaces" onchange="on_interface_change();">
        #if $system
            #set inames = $system.interfaces.keys()
            #set nothing = $inames.sort()
            #for $iname in  $inames
                <option name="$iname"
                    #if $iname == "eth0"
                        selected="1"
                    #end if
                >$iname</option>
            #end for
        #else
            <option name="eth0" selected="1">eth0</option>
        #end if
    </select>
    <p class="context-tip">Select what interface to edit below</p>
    </td>
    </tr>

    ## ====================================== start of interface section

        ## ----------------------------------------
        ## now show all of the interface fields which may or may not
        ## be hidden but are always there
        ## ----------------------------------------

        <tr id="macaddress_row">
        <td class="nicedit">
        <label for="macaddress">MAC</label>
        </td>
        <td class="nicedit">
        <input type="text" size="64" style="width: 150px;" name="macaddress" id="macaddress" />

        ## FIXME: random MAC needs to pass the virt-type to get it in the selected range

        <a href="javascript: get_random_mac()" style="font-size: 0.8em;">Random MAC</a>   

        <p class="context-tip">Example: AA:BB:CC:DD:EE:FF</p>
        </td>
        </tr>

        <tr id="bonding_row">
        <td class="nicedit">
        <label for="bonding">Bonding</label>
        </td>
        <td class="nicedit">
        <input type="radio" id="bonding_is_na" name="bonding" value="na" checked onclick="javascript: intf_update_visibility();">No bonding
        <input type="radio" id="bonding_is_master" name="bonding" value="master" onclick="javascript: intf_update_visibility();">master
        <input type="radio" id="bonding_is_slave" name="bonding" value="slave"  onclick="javascript: intf_update_visibility();">slave
        <p class="context-tip">Use bonding? If enabled specify bonding mode to use</p>
        </td>
        </tr>

        <tr id="bondingmaster_row">
        <td class="nicedit">
        <label for="bondingmaster">Bonding master</label>
        </td>
        <td class="nicedit">
        <input type="text" size="64" style="width: 150px;" name="bondingmaster" id="bondingmaster" />
        <p class="context-tip">If bonding is "slave", specify the master interface here.</p>
        </td>
        </tr>

        <tr id="bondingopts_row">
        <td class="nicedit">
        <label for="bondingopts">Bonding options</label>
        </td>
        <td class="nicedit">
        <input type="text" size="64" style="width: 300px;" name="bondingopts" id="bondingopts" />
        <p class="context-tip">If bonding is "master", specify the bonding options here.</p>
        </td>
        </tr>

        <tr id="static_row">
        <td class="nicedit">
        <label for="static">IP assignment</label>
        </td>
        <td class="nicedit">
        <input type="radio" id="static_true" name="static" value="true" checked onclick="javascript: intf_update_visibility();">Static
        <input type="radio" id="static_false" name="static" value="false" onclick="javascript: intf_update_visibility();">DHCP
        <p class="context-tip">Is the IP address of the interface statically or by DHCP configured?</p>
        </td>
        </tr>

        <tr id="ipaddress_row">
        <td class="nicedit">
        <label for="ipaddress">IP</label>
        </td>
        <td class="nicedit">
        <input type="text" size="64" style="width: 150px;" name="ipaddress" id="ipaddress" />
        <p class="context-tip">Example: 192.168.10.15</p>
        </td>
        </tr>

        <tr id="subnet_row">
        <td class="nicedit">
        <label for="subnet">Subnet</label>
        </td>
        <td class="nicedit">
        <input type="text" size="64" style="width: 150px;" name="subnet" id="subnet" />
        <p class="context-tip">Ex: "255.255.255.0".  For use in kickstart templates for static IPs.</p>
        </td>
        </tr>

        <tr id="dns_name_row">
        <td class="nicedit">
        <label for="dns_name">DNS name</label>
        </td>
        <td class="nicedit">
        <input type="text" size="255" style="width: 300px;" name="dns_name" id="dns_name" />
        <p class="context-tip">Example: vanhalen.example.org, used by manage_dns feature</p>
        </td>
        </tr>

        <tr id="dhcptag_row">
        <td class="nicedit">
        <label for="dhcptag">DHCP Tag</label>
        </td>
        <td class="nicedit">
        <input type="text" size="128" style="width: 150px;" name="dhcptag" id="dhcptag" />
        <p class="context-tip">Selects alternative subnets, see manpage or leave blank</p>
        </td>
        </tr>

        <tr id="static_routes_row">
        <td class="nicedit">
        <label for="static_routes">Static Routes</label>
        </td>
        <td class="nicedit">
        <input type="text" size="128" style="width: 150px;" name="static_routes" id="static_routes" />
        <p class="context-tip">optional list of ipaddress:netmask:gateway, space delimited</p>
        </td>
        </tr>


        <tr id="virtbridge_row">
        <td class="nicedit">
        <label for="virtbridge">Virt Bridge</label>
        </td>
        <td class="nicedit">
        <input type="text" size="20" style="width: 150px;" name="virtbridge" id="virtbridge" />
        <p class="context-tip">Example: 'xenbr0' or 'virbr0'.  Can be blank if set in profile or settings.</p>
        </td>
        </tr>

        #if $editable == True
        <tr>
        <td class="nicedit">
            <label for="enabled">Remove</label>
        </td>
        <td class="nicedit">
            <input type="button" name="delete-interface" value="remove" onclick="on_interface_delete()">
            <p class="context-tip">Clicking this button removes the interface from the configuration.</p>
        </td>
        </tr>

        <input type="hidden" id="present" name="present" value="0">
        <input type="hidden" id="original" name="original" value="0">

        #end if


    ## ====================================== end of interface section

    <tr>
    <td>
    <hr width="95%"/>
    </td>
    <td>
    <hr width="95%"/>
    </td>
    </tr>

    #if $system and $editable == True
    <tr>
    <td>
    <label for="delete">Delete</label>
    </td>
    <td>
       <input type="checkbox" name="delete1" value="delete1">Yes
       <input type="checkbox" name="delete2" value="delete2">Really
    <p class="context-tip">Check both buttons and click save to delete this object</p>
    </td>
    </tr>
    #end if

    #if $editable == True
    <tr>
    <td>
    </td>
    <td>
    <input type="button" name="submitter" onClick="on_form_submit();" value="Save"/>
    <input type="reset" name="reset" value="Reset"/>
    </td>
    </tr>
    #end if

    </table>

</fieldset>
</form>

#end block body