function get_response() { $response = $this->response; $form = $response->get_form($this->actions_name, 'step3'); $resource = new resource(); $resource->get_instance_by_id($this->appliance->resources); // if not openQRM resource if ($resource->id != 0) { $virtualization = new virtualization(); $virtualization->get_instance_by_id($resource->vtype); } $submit = $form->get_elements('submit'); $submit->handler = 'onclick="wait();"'; $form->add($submit, 'submit'); $submit = $form->get_elements('cancel'); $submit->handler = 'onclick="cancel();"'; $form->add($submit, 'cancel'); // prepare image list according to the resource capabilities + vtype $image = new image(); $list = $image->get_list(); unset($list[0]); unset($list[1]); $images = array(); // openQRM if ($resource->id == 0) { $images[] = array(0, 'Local openQRM Installation'); // local-server integrated resource } else { if (strstr($resource->capabilities, "TYPE=local-server")) { $local_image = new image(); $local_image->get_instance_by_id($resource->imageid); $images[] = array($local_image->id, 'Local OS Installation'); // local-deployment VMs } else { if (strstr($virtualization->type, "-vm-local")) { $virtualization_plugin_name = $virtualization->get_plugin_name(); $deployment = new deployment(); $deployment_id_arr = $deployment->get_deployment_ids(); $possible_deployment_types_arr = ''; foreach ($deployment_id_arr as $deployment_id_db) { $deployment_id = $deployment_id_db['deployment_id']; $deployment->get_instance_by_id($deployment_id); if ($deployment->storagetype === $virtualization_plugin_name) { $possible_deployment_types_arr[] = $deployment->type; } } // filter image list with only the images from the VM deployment type foreach ($list as $value) { $image_id = $value['value']; $image->get_instance_by_id($image_id); // is image active ? then do not show it here if ($image->isactive == 1) { continue; } if (!in_array($image->type, $possible_deployment_types_arr)) { continue; } // filter local-server images $images[] = array($image_id, $image->id . ' / ' . $image->name . ' (' . $image->type . ')'); } // network-deployment - show only network-boot images } else { if (strstr($virtualization->type, "-vm-net")) { foreach ($list as $value) { $image_id = $value['value']; $image->get_instance_by_id($image_id); // is image active ? then do not show it here if ($image->isactive == 1) { continue; } // filter local-server images if (strstr($image->capabilities, "TYPE=local-server")) { continue; } $is_network_deployment = false; if ($image->is_network_deployment() === true) { $is_network_deployment = true; } if ($is_network_deployment) { $images[] = array($image_id, $image->id . ' / ' . $image->name . ' (' . $image->type . ')'); } } // network deployment - physical systems - show only network-boot images } else { foreach ($list as $value) { $image_id = $value['value']; $image->get_instance_by_id($image_id); // is image active ? then do not show it here if ($image->isactive == 1) { continue; } // filter local-server images if (strstr($image->capabilities, "TYPE=local-server")) { continue; } $is_network_deployment = false; if ($image->is_network_deployment() === true) { $is_network_deployment = true; } if ($is_network_deployment) { $images[] = array($image_id, $image->id . ' / ' . $image->name . ' (' . $image->type . ')'); } } } } } } // handle appliance is new or edited $selected = $this->response->html->request()->get('image_id'); if ($selected === '' && isset($this->appliance->imageid)) { $selected = $this->appliance->imageid; } $d['image']['label'] = $this->lang['form_image']; $d['image']['required'] = true; $d['image']['object']['type'] = 'htmlobject_select'; $d['image']['object']['attrib']['index'] = array(0, 1); $d['image']['object']['attrib']['id'] = 'image'; $d['image']['object']['attrib']['name'] = 'image'; $d['image']['object']['attrib']['options'] = $images; $d['image']['object']['attrib']['selected'] = array($selected); $d['image_edit'] = ''; if ($this->appliance->resources != 0) { $d['image_edit']['label'] = $this->lang['form_image_edit']; $d['image_edit']['object']['type'] = 'htmlobject_input'; $d['image_edit']['object']['attrib']['type'] = 'checkbox'; $d['image_edit']['object']['attrib']['id'] = 'image_edit'; $d['image_edit']['object']['attrib']['name'] = 'image_edit'; $d['image_edit']['object']['attrib']['checked'] = true; } $form->add($d); $response->form = $form; return $response; }
function get_response() { $OPENQRM_SERVER_BASE_DIR = $this->openqrm->get('basedir'); $response = $this->response; $form = $response->get_form($this->actions_name, 'add'); $cpus[] = array("1", "1 CPU"); $cpus[] = array("2", "2 CPUs"); $cpus[] = array("4", "4 CPUs"); $cpus[] = array("8", "8 CPUs"); $cpus[] = array("16", "16 CPUs"); $ram[] = array("256", "256 MB"); $ram[] = array("512", "512 MB"); $ram[] = array("1024", "1 GB"); $ram[] = array("2048", "2 GB"); $ram[] = array("4096", "4 GB"); $ram[] = array("8192", "8 GB"); $ram[] = array("16384", "16 GB"); $ram[] = array("32768", "32 GB"); $ram[] = array("65536", "64 GB"); $nics[] = array("virtio", $this->lang['form_net_virtio']); $nics[] = array("e1000", $this->lang['form_net_e1000']); $nics[] = array("rtl8139", $this->lang['form_net_rtl8139']); $keymaps[] = array("de", "de"); $keymaps[] = array("en-us", "en-us"); $keymaps[] = array("es", "es"); $keymaps[] = array("fr", "fr"); $keymaps[] = array("it", "it"); $keymaps[] = array("ja", "ja"); $keymaps[] = array("nl", "nl"); $keymaps[] = array("ru", "ru"); $keymaps[] = array("none", "none"); $disk_interfaces[] = array("virtio", "Virtio"); $disk_interfaces[] = array("ide", "IDE"); $swap_select_arr[] = array('1024', '1 GB'); $swap_select_arr[] = array('2048', '2 GB'); $swap_select_arr[] = array('4096', '4 GB'); // if we come from the wizard suggest the server name $vm_name_suggestion = ''; if (isset($this->user->wizard_name) && $this->user->wizard_name === 'appliance' && $this->user->wizard_step == 2) { $appliance = new appliance(); $appliance->get_instance_by_id($this->user->wizard_id); $vm_name_suggestion = $appliance->name; } // get a list of existing kvm localboot images to select $existing_image_arr = array(); $image = new image(); $image_image_id_ar = $image->get_ids_by_type('kvm-lvm-deployment'); foreach ($image_image_id_ar as $iid_ar) { $image_id = $iid_ar['image_id']; $image->get_instance_by_id($image_id); $existing_image_arr[] = array($image->id, $image->name); } $image_image_id_ar = $image->get_ids_by_type('kvm-bf-deployment'); foreach ($image_image_id_ar as $iid_ar) { $image_id = $iid_ar['image_id']; $image->get_instance_by_id($image_id); $existing_image_arr[] = array($image->id, $image->name); } $image_image_id_ar = $image->get_ids_by_type('kvm-gluster-deployment'); foreach ($image_image_id_ar as $iid_ar) { $image_id = $iid_ar['image_id']; $image->get_instance_by_id($image_id); $existing_image_arr[] = array($image->id, $image->name); } $existing_image_arr[] = array('', ''); // get a list of network-deployment images for netboot vms $existing_netboot_image_arr = array(); $existing_netboot_image_id_ar = $image->get_ids(); foreach ($existing_netboot_image_id_ar as $iid_ar) { $image_id = $iid_ar['image_id']; $image->get_instance_by_id($image_id); if ($image->is_network_deployment()) { $existing_netboot_image_arr[] = array($image->id, $image->name); } } $existing_netboot_image_arr[] = array('', ''); $file = $OPENQRM_SERVER_BASE_DIR . '/plugins/kvm/web/kvm-stat/' . $this->resource->id . '.bridge_config'; $data = openqrm_parse_conf($file); $bridges = array(); $bridge_list = $data['OPENQRM_KVM_BRIDGES']; $bridge_list = rtrim($bridge_list, ":"); $bridge_array = explode(':', $bridge_list); // handle no bridge error if (isset($bridge_array[0]) && $bridge_array[0] !== '') { foreach ($bridge_array as $b) { $bridges[] = array($b, $b); } $submit = $form->get_elements('submit'); $submit->handler = 'onclick="wait();"'; $form->add($submit, 'submit'); $submit = $form->get_elements('cancel'); $submit->handler = 'onclick="cancel();"'; $form->add($submit, 'cancel'); $d['name']['label'] = $this->lang['form_name']; $d['name']['required'] = true; $d['name']['validate']['regex'] = '/^[a-z0-9._]+$/i'; $d['name']['validate']['errormsg'] = sprintf($this->lang['error_name'], 'a-z0-9._'); $d['name']['object']['type'] = 'htmlobject_input'; $d['name']['object']['attrib']['name'] = 'name'; $d['name']['object']['attrib']['id'] = 'name'; $d['name']['object']['attrib']['type'] = 'text'; $d['name']['object']['attrib']['css'] = 'namegen'; $d['name']['object']['attrib']['customattribs'] = 'data-prefix="kvm" data-length="6"'; $d['name']['object']['attrib']['value'] = $vm_name_suggestion; $d['name']['object']['attrib']['maxlength'] = 50; $d['cpus']['label'] = $this->lang['form_cpus']; $d['cpus']['required'] = true; $d['cpus']['object']['type'] = 'htmlobject_select'; $d['cpus']['object']['attrib']['name'] = 'cpus'; $d['cpus']['object']['attrib']['index'] = array(0, 1); $d['cpus']['object']['attrib']['options'] = $cpus; $d['memory']['label'] = $this->lang['form_memory']; $d['memory']['required'] = true; $d['memory']['object']['type'] = 'htmlobject_select'; $d['memory']['object']['attrib']['name'] = 'memory'; $d['memory']['object']['attrib']['index'] = array(0, 1); $d['memory']['object']['attrib']['options'] = $ram; $d['memory']['object']['attrib']['selected'] = array(512); $vmtype = $this->response->html->request()->get('vmtype'); if ($vmtype === 'kvm-vm-net') { $d['netboot_image']['label'] = $this->lang['form_existing_disk']; $d['netboot_image']['object']['type'] = 'htmlobject_select'; $d['netboot_image']['object']['attrib']['index'] = array(0, 1); $d['netboot_image']['object']['attrib']['id'] = 'netboot_image'; $d['netboot_image']['object']['attrib']['name'] = 'netboot_image'; $d['netboot_image']['object']['attrib']['options'] = $existing_netboot_image_arr; $d['netboot_image']['object']['attrib']['selected'] = array(''); $d['disk_interface'] = ""; $d['localboot_image'] = ""; $d['cdrom_iso_path'] = ""; $d['cdrom_button'] = ""; } else { $d['localboot_image']['label'] = $this->lang['form_existing_disk']; $d['localboot_image']['object']['type'] = 'htmlobject_select'; $d['localboot_image']['object']['attrib']['index'] = array(0, 1); $d['localboot_image']['object']['attrib']['id'] = 'localboot_image'; $d['localboot_image']['object']['attrib']['name'] = 'localboot_image'; $d['localboot_image']['object']['attrib']['options'] = $existing_image_arr; $d['localboot_image']['object']['attrib']['selected'] = array(''); $d['disk_interface']['label'] = $this->lang['form_disk_interface']; $d['disk_interface']['required'] = true; $d['disk_interface']['object']['type'] = 'htmlobject_select'; $d['disk_interface']['object']['attrib']['name'] = 'disk_interface'; $d['disk_interface']['object']['attrib']['id'] = 'disk_interface'; $d['disk_interface']['object']['attrib']['index'] = array(0, 1); $d['disk_interface']['object']['attrib']['options'] = $disk_interfaces; $d['cdrom_iso_path']['label'] = $this->lang['form_cdrom']; $d['cdrom_iso_path']['object']['type'] = 'htmlobject_input'; $d['cdrom_iso_path']['object']['attrib']['type'] = 'text'; $d['cdrom_iso_path']['object']['attrib']['id'] = 'cdrom'; $d['cdrom_iso_path']['object']['attrib']['name'] = 'cdrom'; $d['cdrom_button']['static'] = true; $d['cdrom_button']['object']['type'] = 'htmlobject_input'; $d['cdrom_button']['object']['attrib']['type'] = 'button'; $d['cdrom_button']['object']['attrib']['name'] = 'cdrom_button'; $d['cdrom_button']['object']['attrib']['id'] = 'cdrom_button'; $d['cdrom_button']['object']['attrib']['css'] = 'browse-button'; $d['cdrom_button']['object']['attrib']['handler'] = 'onclick="filepicker.init(\'cdrom\'); return false;"'; $d['cdrom_button']['object']['attrib']['style'] = "display:none;"; $d['cdrom_button']['object']['attrib']['value'] = $this->lang['lang_browse']; $d['netboot_image'] = ""; } $mac = ''; if (isset($this->resource)) { $this->resource->generate_mac(); $mac = $this->resource->mac; } $d['net0']['label'] = $this->lang['lang_net_0']; $d['net0']['object']['type'] = 'htmlobject_input'; $d['net0']['object']['attrib']['type'] = 'checkbox'; $d['net0']['object']['attrib']['id'] = 'net0'; $d['net0']['object']['attrib']['name'] = 'net0'; $d['net0']['object']['attrib']['value'] = 'enabled'; $d['net0']['object']['attrib']['checked'] = true; $d['net0']['object']['attrib']['disabled'] = true; $d['mac']['label'] = $this->lang['form_mac']; $d['mac']['required'] = true; $d['mac']['object']['type'] = 'htmlobject_input'; $d['mac']['object']['attrib']['name'] = 'mac'; $d['mac']['object']['attrib']['type'] = 'text'; $d['mac']['object']['attrib']['value'] = $mac; $d['mac']['object']['attrib']['maxlength'] = 50; $d['bridge']['label'] = $this->lang['form_bridge']; $d['bridge']['required'] = true; $d['bridge']['object']['type'] = 'htmlobject_select'; $d['bridge']['object']['attrib']['name'] = 'bridge'; $d['bridge']['object']['attrib']['index'] = array(0, 1); $d['bridge']['object']['attrib']['options'] = $bridges; $d['nic']['label'] = $this->lang['form_netdevice']; $d['nic']['required'] = true; $d['nic']['object']['type'] = 'htmlobject_select'; $d['nic']['object']['attrib']['name'] = 'nic'; $d['nic']['object']['attrib']['index'] = array(0, 1); $d['nic']['object']['attrib']['options'] = $nics; // net 1 if (isset($this->resource)) { $this->resource->generate_mac(); $mac = $this->resource->mac; } $d['net1']['label'] = $this->lang['lang_net_1']; $d['net1']['object']['type'] = 'htmlobject_input'; $d['net1']['object']['attrib']['type'] = 'checkbox'; $d['net1']['object']['attrib']['id'] = 'net1'; $d['net1']['object']['attrib']['name'] = 'net1'; $d['net1']['object']['attrib']['value'] = 'enabled'; $d['net1']['object']['attrib']['handler'] = 'onchange="nettoggle(this);"'; $d['mac1']['label'] = $this->lang['form_mac']; $d['mac1']['object']['type'] = 'htmlobject_input'; $d['mac1']['object']['attrib']['name'] = 'mac1'; $d['mac1']['object']['attrib']['type'] = 'text'; $d['mac1']['object']['attrib']['value'] = $mac; $d['mac1']['object']['attrib']['maxlength'] = 50; $d['bridge1']['label'] = $this->lang['form_bridge']; $d['bridge1']['object']['type'] = 'htmlobject_select'; $d['bridge1']['object']['attrib']['name'] = 'bridge1'; $d['bridge1']['object']['attrib']['index'] = array(0, 1); $d['bridge1']['object']['attrib']['options'] = $bridges; $d['nic1']['label'] = $this->lang['form_netdevice']; $d['nic1']['object']['type'] = 'htmlobject_select'; $d['nic1']['object']['attrib']['name'] = 'nic1'; $d['nic1']['object']['attrib']['index'] = array(0, 1); $d['nic1']['object']['attrib']['options'] = $nics; // net 2 if (isset($this->resource)) { $this->resource->generate_mac(); $mac = $this->resource->mac; } $d['net2']['label'] = $this->lang['lang_net_2']; $d['net2']['object']['type'] = 'htmlobject_input'; $d['net2']['object']['attrib']['type'] = 'checkbox'; $d['net2']['object']['attrib']['id'] = 'net2'; $d['net2']['object']['attrib']['name'] = 'net2'; $d['net2']['object']['attrib']['value'] = 'enabled'; $d['net2']['object']['attrib']['handler'] = 'onchange="nettoggle(this);"'; $d['mac2']['label'] = $this->lang['form_mac']; $d['mac2']['object']['type'] = 'htmlobject_input'; $d['mac2']['object']['attrib']['name'] = 'mac2'; $d['mac2']['object']['attrib']['type'] = 'text'; $d['mac2']['object']['attrib']['value'] = $mac; $d['mac2']['object']['attrib']['maxlength'] = 50; $d['bridge2']['label'] = $this->lang['form_bridge']; $d['bridge2']['object']['type'] = 'htmlobject_select'; $d['bridge2']['object']['attrib']['name'] = 'bridge2'; $d['bridge2']['object']['attrib']['index'] = array(0, 1); $d['bridge2']['object']['attrib']['options'] = $bridges; $d['nic2']['label'] = $this->lang['form_netdevice']; $d['nic2']['object']['type'] = 'htmlobject_select'; $d['nic2']['object']['attrib']['name'] = 'nic2'; $d['nic2']['object']['attrib']['index'] = array(0, 1); $d['nic2']['object']['attrib']['options'] = $nics; // net 3 if (isset($this->resource)) { $this->resource->generate_mac(); $mac = $this->resource->mac; } $d['net3']['label'] = $this->lang['lang_net_3']; $d['net3']['object']['type'] = 'htmlobject_input'; $d['net3']['object']['attrib']['type'] = 'checkbox'; $d['net3']['object']['attrib']['id'] = 'net3'; $d['net3']['object']['attrib']['name'] = 'net3'; $d['net3']['object']['attrib']['value'] = 'enabled'; $d['net3']['object']['attrib']['handler'] = 'onchange="nettoggle(this);"'; $d['mac3']['label'] = $this->lang['form_mac']; $d['mac3']['object']['type'] = 'htmlobject_input'; $d['mac3']['object']['attrib']['name'] = 'mac3'; $d['mac3']['object']['attrib']['type'] = 'text'; $d['mac3']['object']['attrib']['value'] = $mac; $d['mac3']['object']['attrib']['maxlength'] = 50; $d['bridge3']['label'] = $this->lang['form_bridge']; $d['bridge3']['object']['type'] = 'htmlobject_select'; $d['bridge3']['object']['attrib']['name'] = 'bridge3'; $d['bridge3']['object']['attrib']['index'] = array(0, 1); $d['bridge3']['object']['attrib']['options'] = $bridges; $d['nic3']['label'] = $this->lang['form_netdevice']; $d['nic3']['object']['type'] = 'htmlobject_select'; $d['nic3']['object']['attrib']['name'] = 'nic3'; $d['nic3']['object']['attrib']['index'] = array(0, 1); $d['nic3']['object']['attrib']['options'] = $nics; // net 4 if (isset($this->resource)) { $this->resource->generate_mac(); $mac = $this->resource->mac; } $d['net4']['label'] = $this->lang['lang_net_4']; $d['net4']['object']['type'] = 'htmlobject_input'; $d['net4']['object']['attrib']['type'] = 'checkbox'; $d['net4']['object']['attrib']['name'] = 'net4'; $d['net4']['object']['attrib']['id'] = 'net4'; $d['net4']['object']['attrib']['value'] = 'enabled'; $d['net4']['object']['attrib']['handler'] = 'onchange="nettoggle(this);"'; $d['mac4']['label'] = $this->lang['form_mac']; $d['mac4']['object']['type'] = 'htmlobject_input'; $d['mac4']['object']['attrib']['name'] = 'mac4'; $d['mac4']['object']['attrib']['type'] = 'text'; $d['mac4']['object']['attrib']['value'] = $mac; $d['mac4']['object']['attrib']['maxlength'] = 50; $d['bridge4']['label'] = $this->lang['form_bridge']; $d['bridge4']['object']['type'] = 'htmlobject_select'; $d['bridge4']['object']['attrib']['name'] = 'bridge4'; $d['bridge4']['object']['attrib']['index'] = array(0, 1); $d['bridge4']['object']['attrib']['options'] = $bridges; $d['nic4']['label'] = $this->lang['form_netdevice']; $d['nic4']['object']['type'] = 'htmlobject_select'; $d['nic4']['object']['attrib']['name'] = 'nic4'; $d['nic4']['object']['attrib']['index'] = array(0, 1); $d['nic4']['object']['attrib']['options'] = $nics; // boot from $d['boot_cd'] = ''; $d['boot_iso'] = ''; $d['boot_iso_path'] = ''; $d['boot_local'] = ''; $d['browse_button'] = ''; if ($vmtype !== 'kvm-vm-net') { $d['boot_cd']['label'] = $this->lang['form_boot_cd']; $d['boot_cd']['object']['type'] = 'htmlobject_input'; $d['boot_cd']['object']['attrib']['type'] = 'radio'; $d['boot_cd']['object']['attrib']['name'] = 'boot'; $d['boot_cd']['object']['attrib']['value'] = 'cdrom'; $d['boot_iso']['label'] = $this->lang['form_boot_iso']; $d['boot_iso']['object']['type'] = 'htmlobject_input'; $d['boot_iso']['object']['attrib']['type'] = 'radio'; $d['boot_iso']['object']['attrib']['id'] = 'boot_iso'; $d['boot_iso']['object']['attrib']['name'] = 'boot'; $d['boot_iso']['object']['attrib']['value'] = 'iso'; $d['boot_iso_path']['label'] = $this->lang['form_iso_path']; $d['boot_iso_path']['object']['type'] = 'htmlobject_input'; $d['boot_iso_path']['object']['attrib']['type'] = 'text'; $d['boot_iso_path']['object']['attrib']['id'] = 'iso_path'; $d['boot_iso_path']['object']['attrib']['name'] = 'iso_path'; $d['boot_local']['label'] = $this->lang['form_boot_local']; $d['boot_local']['object']['type'] = 'htmlobject_input'; $d['boot_local']['object']['attrib']['type'] = 'radio'; $d['boot_local']['object']['attrib']['name'] = 'boot'; $d['boot_local']['object']['attrib']['value'] = 'local'; $d['boot_local']['object']['attrib']['checked'] = true; $d['browse_button']['static'] = true; $d['browse_button']['object']['type'] = 'htmlobject_input'; $d['browse_button']['object']['attrib']['type'] = 'button'; $d['browse_button']['object']['attrib']['name'] = 'browse_button'; $d['browse_button']['object']['attrib']['id'] = 'browsebutton'; $d['browse_button']['object']['attrib']['css'] = 'browse-button'; $d['browse_button']['object']['attrib']['handler'] = 'onclick="filepicker.init(\'iso_path\'); return false;"'; $d['browse_button']['object']['attrib']['style'] = "display:none;"; $d['browse_button']['object']['attrib']['value'] = $this->lang['lang_browse']; } $d['boot_net']['label'] = $this->lang['form_boot_net']; $d['boot_net']['object']['type'] = 'htmlobject_input'; $d['boot_net']['object']['attrib']['type'] = 'radio'; $d['boot_net']['object']['attrib']['name'] = 'boot'; $d['boot_net']['object']['attrib']['value'] = 'network'; if ($vmtype === 'kvm-vm-net') { $d['boot_net']['object']['attrib']['checked'] = true; } $d['vnc']['label'] = $this->lang['form_vnc']; $d['vnc']['required'] = true; $d['vnc']['object']['type'] = 'htmlobject_input'; $d['vnc']['object']['attrib']['name'] = 'vnc'; $d['vnc']['object']['attrib']['id'] = 'vnc'; $d['vnc']['object']['attrib']['type'] = 'password'; $d['vnc']['object']['attrib']['value'] = ''; $d['vnc']['object']['attrib']['maxlength'] = 50; $d['vnc_1']['label'] = $this->lang['form_vnc_repeat']; $d['vnc_1']['required'] = true; $d['vnc_1']['object']['type'] = 'htmlobject_input'; $d['vnc_1']['object']['attrib']['name'] = 'vnc_1'; $d['vnc_1']['object']['attrib']['id'] = 'vnc_1'; $d['vnc_1']['object']['attrib']['value'] = ''; $d['vnc_1']['object']['attrib']['type'] = 'password'; $d['vnc_1']['object']['attrib']['maxlength'] = 50; $d['vnc_keymap']['label'] = $this->lang['form_vnc_keymap']; $d['vnc_keymap']['object']['type'] = 'htmlobject_select'; $d['vnc_keymap']['object']['attrib']['name'] = 'vnc_keymap'; $d['vnc_keymap']['object']['attrib']['index'] = array(0, 1); $d['vnc_keymap']['object']['attrib']['options'] = $keymaps; $form->add($d); $response->form = $form; } else { $response->msg = $this->lang['error_no_bridge']; $response->form = $form; } return $response; }