Commit b74ef5e5 authored by tbrehm's avatar tbrehm

First commit for: FS#952 - Module for virtual machine management

parent f66e40ca
--
-- Table structure for table `openvz_ip`
--
CREATE TABLE IF NOT EXISTS `openvz_ip` (
`ip_address_id` bigint(20) NOT NULL AUTO_INCREMENT,
`sys_userid` int(11) NOT NULL DEFAULT '0',
`sys_groupid` int(11) NOT NULL DEFAULT '0',
`sys_perm_user` varchar(5) DEFAULT NULL,
`sys_perm_group` varchar(5) DEFAULT NULL,
`sys_perm_other` varchar(5) DEFAULT NULL,
`server_id` int(11) NOT NULL DEFAULT '0',
`ip_address` varchar(15) DEFAULT NULL,
`vm_id` int(11) NOT NULL DEFAULT '0',
`reserved` varchar(255) NOT NULL DEFAULT 'n',
PRIMARY KEY (`ip_address_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
--
-- Dumping data for table `openvz_ip`
--
-- --------------------------------------------------------
--
-- Table structure for table `openvz_ostemplate`
--
CREATE TABLE IF NOT EXISTS `openvz_ostemplate` (
`ostemplate_id` bigint(20) NOT NULL AUTO_INCREMENT,
`sys_userid` int(11) NOT NULL DEFAULT '0',
`sys_groupid` int(11) NOT NULL DEFAULT '0',
`sys_perm_user` varchar(5) DEFAULT NULL,
`sys_perm_group` varchar(5) DEFAULT NULL,
`sys_perm_other` varchar(5) DEFAULT NULL,
`template_name` varchar(255) DEFAULT NULL,
`template_file` varchar(255) NOT NULL,
`server_id` int(11) NOT NULL DEFAULT '0',
`allservers` varchar(255) NOT NULL DEFAULT 'y',
`active` varchar(255) NOT NULL DEFAULT 'y',
`description` text,
PRIMARY KEY (`ostemplate_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
--
-- Dumping data for table `openvz_ostemplate`
--
INSERT INTO `openvz_ostemplate` (`ostemplate_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `template_file`, `server_id`, `allservers`, `active`, `description`) VALUES(1, 1, 1, 'riud', 'riud', '', 'Debian minimal', 'debian-minimal-x86', 1, 'y', 'y', 'Debain minmal image.');
-- --------------------------------------------------------
--
-- Table structure for table `openvz_template`
--
CREATE TABLE IF NOT EXISTS `openvz_template` (
`template_id` bigint(20) NOT NULL AUTO_INCREMENT,
`sys_userid` int(11) NOT NULL DEFAULT '0',
`sys_groupid` int(11) NOT NULL DEFAULT '0',
`sys_perm_user` varchar(5) DEFAULT NULL,
`sys_perm_group` varchar(5) DEFAULT NULL,
`sys_perm_other` varchar(5) DEFAULT NULL,
`template_name` varchar(255) DEFAULT NULL,
`diskspace` int(11) NOT NULL DEFAULT '0',
`traffic` int(11) NOT NULL DEFAULT '-1',
`bandwidth` int(11) NOT NULL DEFAULT '-1',
`ram` int(11) NOT NULL DEFAULT '0',
`ram_burst` int(11) NOT NULL DEFAULT '0',
`cpu_units` int(11) NOT NULL DEFAULT '1000',
`cpu_num` int(11) NOT NULL DEFAULT '4',
`cpu_limit` int(11) NOT NULL DEFAULT '400',
`io_priority` int(11) NOT NULL DEFAULT '4',
`active` varchar(255) NOT NULL DEFAULT 'y',
`description` text,
`numproc` varchar(255) DEFAULT NULL,
`numtcpsock` varchar(255) DEFAULT NULL,
`numothersock` varchar(255) DEFAULT NULL,
`vmguarpages` varchar(255) DEFAULT NULL,
`kmemsize` varchar(255) DEFAULT NULL,
`tcpsndbuf` varchar(255) DEFAULT NULL,
`tcprcvbuf` varchar(255) DEFAULT NULL,
`othersockbuf` varchar(255) DEFAULT NULL,
`dgramrcvbuf` varchar(255) DEFAULT NULL,
`oomguarpages` varchar(255) DEFAULT NULL,
`privvmpages` varchar(255) DEFAULT NULL,
`lockedpages` varchar(255) DEFAULT NULL,
`shmpages` varchar(255) DEFAULT NULL,
`physpages` varchar(255) DEFAULT NULL,
`numfile` varchar(255) DEFAULT NULL,
`avnumproc` varchar(255) DEFAULT NULL,
`numflock` varchar(255) DEFAULT NULL,
`numpty` varchar(255) DEFAULT NULL,
`numsiginfo` varchar(255) DEFAULT NULL,
`dcachesize` varchar(255) DEFAULT NULL,
`numiptent` varchar(255) DEFAULT NULL,
`swappages` varchar(255) DEFAULT NULL,
`hostname` varchar(255) DEFAULT NULL,
`nameserver` varchar(255) DEFAULT NULL,
`create_dns` varchar(1) NOT NULL DEFAULT 'n',
`capability` varchar(255) DEFAULT NULL,
PRIMARY KEY (`template_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
--
-- Dumping data for table `openvz_template`
--
INSERT INTO `openvz_template` (`template_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `diskspace`, `traffic`, `bandwidth`, `ram`, `ram_burst`, `cpu_units`, `cpu_num`, `cpu_limit`, `io_priority`, `active`, `description`, `numproc`, `numtcpsock`, `numothersock`, `vmguarpages`, `kmemsize`, `tcpsndbuf`, `tcprcvbuf`, `othersockbuf`, `dgramrcvbuf`, `oomguarpages`, `privvmpages`, `lockedpages`, `shmpages`, `physpages`, `numfile`, `avnumproc`, `numflock`, `numpty`, `numsiginfo`, `dcachesize`, `numiptent`, `swappages`, `hostname`, `nameserver`, `create_dns`, `capability`) VALUES(1, 1, 1, 'riud', 'riud', '', 'small', 10, -1, -1, 256, 512, 1000, 4, 400, 4, 'y', '', '999999:999999', '7999992:7999992', '7999992:7999992', '65536:65536', '2147483646:2147483646', '214748160:396774400', '214748160:396774400', '214748160:396774400', '214748160:396774400', '65536:65536', '131072:131072', '999999:999999', '65536:65536', '0:2147483647', '23999976:23999976', '180:180', '999999:999999', '500000:500000', '999999:999999', '2147483646:2147483646', '999999:999999', '256000:256000', 'v{VEID}.test.tld', '8.8.8.8 8.8.4.4', 'n', '');
-- --------------------------------------------------------
--
-- Table structure for table `openvz_traffic`
--
CREATE TABLE IF NOT EXISTS `openvz_traffic` (
`veid` int(11) NOT NULL,
`traffic_date` date NOT NULL,
`traffic_bytes` bigint(32) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`veid`,`traffic_date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Dumping data for table `openvz_traffic`
--
-- --------------------------------------------------------
--
-- Table structure for table `openvz_vm`
--
CREATE TABLE IF NOT EXISTS `openvz_vm` (
`vm_id` bigint(20) NOT NULL AUTO_INCREMENT,
`sys_userid` int(11) NOT NULL DEFAULT '0',
`sys_groupid` int(11) NOT NULL DEFAULT '0',
`sys_perm_user` varchar(5) DEFAULT NULL,
`sys_perm_group` varchar(5) DEFAULT NULL,
`sys_perm_other` varchar(5) DEFAULT NULL,
`server_id` int(11) NOT NULL DEFAULT '0',
`veid` int(10) unsigned NOT NULL,
`ostemplate_id` int(11) NOT NULL DEFAULT '0',
`template_id` int(11) NOT NULL DEFAULT '0',
`ip_address` varchar(255) NOT NULL,
`hostname` varchar(255) DEFAULT NULL,
`vm_password` varchar(255) DEFAULT NULL,
`start_boot` varchar(255) NOT NULL DEFAULT 'y',
`active` varchar(255) NOT NULL DEFAULT 'y',
`active_until_date` date NOT NULL,
`description` text,
`diskspace` int(11) NOT NULL DEFAULT '0',
`traffic` int(11) NOT NULL DEFAULT '-1',
`bandwidth` int(11) NOT NULL DEFAULT '-1',
`ram` int(11) NOT NULL DEFAULT '0',
`ram_burst` int(11) NOT NULL DEFAULT '0',
`cpu_units` int(11) NOT NULL DEFAULT '1000',
`cpu_num` int(11) NOT NULL DEFAULT '4',
`cpu_limit` int(11) NOT NULL DEFAULT '400',
`io_priority` int(11) NOT NULL DEFAULT '4',
`nameserver` varchar(255) NOT NULL DEFAULT '8.8.8.8 8.8.4.4',
`create_dns` varchar(1) NOT NULL DEFAULT 'n',
`capability` text NOT NULL,
`config` mediumtext NOT NULL,
PRIMARY KEY (`vm_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
--
-- Dumping data for table `openvz_vm`
--
-- --------------------------------------------------------
......@@ -792,6 +792,180 @@ CREATE TABLE `monitor_data` (
-- --------------------------------------------------------
--
-- Table structure for table `openvz_ip`
--
CREATE TABLE IF NOT EXISTS `openvz_ip` (
`ip_address_id` bigint(20) NOT NULL AUTO_INCREMENT,
`sys_userid` int(11) NOT NULL DEFAULT '0',
`sys_groupid` int(11) NOT NULL DEFAULT '0',
`sys_perm_user` varchar(5) DEFAULT NULL,
`sys_perm_group` varchar(5) DEFAULT NULL,
`sys_perm_other` varchar(5) DEFAULT NULL,
`server_id` int(11) NOT NULL DEFAULT '0',
`ip_address` varchar(15) DEFAULT NULL,
`vm_id` int(11) NOT NULL DEFAULT '0',
`reserved` varchar(255) NOT NULL DEFAULT 'n',
PRIMARY KEY (`ip_address_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
--
-- Dumping data for table `openvz_ip`
--
-- --------------------------------------------------------
--
-- Table structure for table `openvz_ostemplate`
--
CREATE TABLE IF NOT EXISTS `openvz_ostemplate` (
`ostemplate_id` bigint(20) NOT NULL AUTO_INCREMENT,
`sys_userid` int(11) NOT NULL DEFAULT '0',
`sys_groupid` int(11) NOT NULL DEFAULT '0',
`sys_perm_user` varchar(5) DEFAULT NULL,
`sys_perm_group` varchar(5) DEFAULT NULL,
`sys_perm_other` varchar(5) DEFAULT NULL,
`template_name` varchar(255) DEFAULT NULL,
`template_file` varchar(255) NOT NULL,
`server_id` int(11) NOT NULL DEFAULT '0',
`allservers` varchar(255) NOT NULL DEFAULT 'y',
`active` varchar(255) NOT NULL DEFAULT 'y',
`description` text,
PRIMARY KEY (`ostemplate_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
--
-- Dumping data for table `openvz_ostemplate`
--
INSERT INTO `openvz_ostemplate` (`ostemplate_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `template_file`, `server_id`, `allservers`, `active`, `description`) VALUES(1, 1, 1, 'riud', 'riud', '', 'Debian minimal', 'debian-minimal-x86', 1, 'y', 'y', 'Debain minmal image.');
-- --------------------------------------------------------
--
-- Table structure for table `openvz_template`
--
CREATE TABLE IF NOT EXISTS `openvz_template` (
`template_id` bigint(20) NOT NULL AUTO_INCREMENT,
`sys_userid` int(11) NOT NULL DEFAULT '0',
`sys_groupid` int(11) NOT NULL DEFAULT '0',
`sys_perm_user` varchar(5) DEFAULT NULL,
`sys_perm_group` varchar(5) DEFAULT NULL,
`sys_perm_other` varchar(5) DEFAULT NULL,
`template_name` varchar(255) DEFAULT NULL,
`diskspace` int(11) NOT NULL DEFAULT '0',
`traffic` int(11) NOT NULL DEFAULT '-1',
`bandwidth` int(11) NOT NULL DEFAULT '-1',
`ram` int(11) NOT NULL DEFAULT '0',
`ram_burst` int(11) NOT NULL DEFAULT '0',
`cpu_units` int(11) NOT NULL DEFAULT '1000',
`cpu_num` int(11) NOT NULL DEFAULT '4',
`cpu_limit` int(11) NOT NULL DEFAULT '400',
`io_priority` int(11) NOT NULL DEFAULT '4',
`active` varchar(255) NOT NULL DEFAULT 'y',
`description` text,
`numproc` varchar(255) DEFAULT NULL,
`numtcpsock` varchar(255) DEFAULT NULL,
`numothersock` varchar(255) DEFAULT NULL,
`vmguarpages` varchar(255) DEFAULT NULL,
`kmemsize` varchar(255) DEFAULT NULL,
`tcpsndbuf` varchar(255) DEFAULT NULL,
`tcprcvbuf` varchar(255) DEFAULT NULL,
`othersockbuf` varchar(255) DEFAULT NULL,
`dgramrcvbuf` varchar(255) DEFAULT NULL,
`oomguarpages` varchar(255) DEFAULT NULL,
`privvmpages` varchar(255) DEFAULT NULL,
`lockedpages` varchar(255) DEFAULT NULL,
`shmpages` varchar(255) DEFAULT NULL,
`physpages` varchar(255) DEFAULT NULL,
`numfile` varchar(255) DEFAULT NULL,
`avnumproc` varchar(255) DEFAULT NULL,
`numflock` varchar(255) DEFAULT NULL,
`numpty` varchar(255) DEFAULT NULL,
`numsiginfo` varchar(255) DEFAULT NULL,
`dcachesize` varchar(255) DEFAULT NULL,
`numiptent` varchar(255) DEFAULT NULL,
`swappages` varchar(255) DEFAULT NULL,
`hostname` varchar(255) DEFAULT NULL,
`nameserver` varchar(255) DEFAULT NULL,
`create_dns` varchar(1) NOT NULL DEFAULT 'n',
`capability` varchar(255) DEFAULT NULL,
PRIMARY KEY (`template_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
--
-- Dumping data for table `openvz_template`
--
INSERT INTO `openvz_template` (`template_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `diskspace`, `traffic`, `bandwidth`, `ram`, `ram_burst`, `cpu_units`, `cpu_num`, `cpu_limit`, `io_priority`, `active`, `description`, `numproc`, `numtcpsock`, `numothersock`, `vmguarpages`, `kmemsize`, `tcpsndbuf`, `tcprcvbuf`, `othersockbuf`, `dgramrcvbuf`, `oomguarpages`, `privvmpages`, `lockedpages`, `shmpages`, `physpages`, `numfile`, `avnumproc`, `numflock`, `numpty`, `numsiginfo`, `dcachesize`, `numiptent`, `swappages`, `hostname`, `nameserver`, `create_dns`, `capability`) VALUES(1, 1, 1, 'riud', 'riud', '', 'small', 10, -1, -1, 256, 512, 1000, 4, 400, 4, 'y', '', '999999:999999', '7999992:7999992', '7999992:7999992', '65536:65536', '2147483646:2147483646', '214748160:396774400', '214748160:396774400', '214748160:396774400', '214748160:396774400', '65536:65536', '131072:131072', '999999:999999', '65536:65536', '0:2147483647', '23999976:23999976', '180:180', '999999:999999', '500000:500000', '999999:999999', '2147483646:2147483646', '999999:999999', '256000:256000', 'v{VEID}.test.tld', '8.8.8.8 8.8.4.4', 'n', '');
-- --------------------------------------------------------
--
-- Table structure for table `openvz_traffic`
--
CREATE TABLE IF NOT EXISTS `openvz_traffic` (
`veid` int(11) NOT NULL,
`traffic_date` date NOT NULL,
`traffic_bytes` bigint(32) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`veid`,`traffic_date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Dumping data for table `openvz_traffic`
--
-- --------------------------------------------------------
--
-- Table structure for table `openvz_vm`
--
CREATE TABLE IF NOT EXISTS `openvz_vm` (
`vm_id` bigint(20) NOT NULL AUTO_INCREMENT,
`sys_userid` int(11) NOT NULL DEFAULT '0',
`sys_groupid` int(11) NOT NULL DEFAULT '0',
`sys_perm_user` varchar(5) DEFAULT NULL,
`sys_perm_group` varchar(5) DEFAULT NULL,
`sys_perm_other` varchar(5) DEFAULT NULL,
`server_id` int(11) NOT NULL DEFAULT '0',
`veid` int(10) unsigned NOT NULL,
`ostemplate_id` int(11) NOT NULL DEFAULT '0',
`template_id` int(11) NOT NULL DEFAULT '0',
`ip_address` varchar(255) NOT NULL,
`hostname` varchar(255) DEFAULT NULL,
`vm_password` varchar(255) DEFAULT NULL,
`start_boot` varchar(255) NOT NULL DEFAULT 'y',
`active` varchar(255) NOT NULL DEFAULT 'y',
`active_until_date` date NOT NULL,
`description` text,
`diskspace` int(11) NOT NULL DEFAULT '0',
`traffic` int(11) NOT NULL DEFAULT '-1',
`bandwidth` int(11) NOT NULL DEFAULT '-1',
`ram` int(11) NOT NULL DEFAULT '0',
`ram_burst` int(11) NOT NULL DEFAULT '0',
`cpu_units` int(11) NOT NULL DEFAULT '1000',
`cpu_num` int(11) NOT NULL DEFAULT '4',
`cpu_limit` int(11) NOT NULL DEFAULT '400',
`io_priority` int(11) NOT NULL DEFAULT '4',
`nameserver` varchar(255) NOT NULL DEFAULT '8.8.8.8 8.8.4.4',
`create_dns` varchar(1) NOT NULL DEFAULT 'n',
`capability` text NOT NULL,
`config` mediumtext NOT NULL,
PRIMARY KEY (`vm_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
--
-- Dumping data for table `openvz_vm`
--
-- --------------------------------------------------------
--
-- Table structure for table `proxy_reverse`
--
......
......@@ -36,7 +36,7 @@ $wb['top_menu_help'] = 'Help';
$wb['top_menu_billing'] = 'Billing';
$wb['top_menu_domain'] = 'Domains';
$wb['top_menu_dashboard'] = 'Home';
$wb['top_menu_vm'] = 'VM';
$wb['top_menu_vm'] = 'VServer';
$wb['toolsarea_head_txt'] = 'Tools';
$wb['latest_news_txt'] = 'Latest news';
?>
......@@ -161,7 +161,7 @@ class page_action extends tform_actions {
// Create the controlpaneluser for the client
//Generate ssh-rsa-keys
exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""');
$app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".file_get_contents('/tmp/id_rsa')."', ssh_rsa = '".file_get_contents('/tmp/id_rsa.pub')."' WHERE client_id = ".$this->id);
$app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa'))."', ssh_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa.pub'))."' WHERE client_id = ".$this->id);
exec('rm -f /tmp/id_rsa /tmp/id_rsa.pub');
// Create the controlpaneluser for the client
......
<?php
/*
Form Definition
Tabledefinition
Datatypes:
- INTEGER (Forces the input to Int)
- DOUBLE
- CURRENCY (Formats the values to currency notation)
- VARCHAR (no format check, maxlength: 255)
- TEXT (no format check)
- DATE (Dateformat, automatic conversion to timestamps)
Formtype:
- TEXT (Textfield)
- TEXTAREA (Textarea)
- PASSWORD (Password textfield, input is not shown when edited)
- SELECT (Select option field)
- RADIO
- CHECKBOX
- CHECKBOXARRAY
- FILE
VALUE:
- Wert oder Array
Hint:
The ID field of the database table is not part of the datafield definition.
The ID field must be always auto incement (int or bigint).
*/
$form["title"] = "Openvz IP address";
$form["description"] = "";
$form["name"] = "openvz_ip";
$form["action"] = "openvz_ip_edit.php";
$form["db_table"] = "openvz_ip";
$form["db_table_idx"] = "ip_address_id";
$form["db_history"] = "yes";
$form["tab_default"] = "main";
$form["list_default"] = "openvz_ip_list.php";
$form["auth"] = 'yes'; // yes / no
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
$form["tabs"]['main'] = array (
'title' => "IP address",
'width' => 100,
'template' => "templates/openvz_ip_edit.htm",
'fields' => array (
##################################
# Begin Datatable fields
##################################
'server_id' => array (
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '',
'datasource' => array ( 'type' => 'SQL',
'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
'keyfield'=> 'server_id',
'valuefield'=> 'server_name'
),
'value' => ''
),
'ip_address' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'ISIPV4',
'errmsg'=> 'ip_error_wrong'),
1 => array ( 'type' => 'UNIQUE',
'errmsg'=> 'ip_error_unique'),
),
'default' => '',
'value' => '',
'separator' => '',
'width' => '15',
'maxlength' => '15',
'rows' => '',
'cols' => ''
),
'vm_id' => array (
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '',
'datasource' => array ( 'type' => 'SQL',
'querystring' => 'SELECT vm_id,hostname FROM openvz_vm WHERE {AUTHSQL} ORDER BY hostname',
'keyfield'=> 'vm_id',
'valuefield'=> 'hostname'
),
'value' => array(0 => '- Not assigned -')
),
'reserved' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'n',
'value' => array(0 => 'n',1 => 'y')
),
##################################
# ENDE Datatable fields
##################################
)
);
?>
\ No newline at end of file
<?php
/*
Form Definition
Tabledefinition
Datatypes:
- INTEGER (Forces the input to Int)
- DOUBLE
- CURRENCY (Formats the values to currency notation)
- VARCHAR (no format check, maxlength: 255)
- TEXT (no format check)
- DATE (Dateformat, automatic conversion to timestamps)
Formtype:
- TEXT (Textfield)
- TEXTAREA (Textarea)
- PASSWORD (Password textfield, input is not shown when edited)
- SELECT (Select option field)
- RADIO
- CHECKBOX
- CHECKBOXARRAY
- FILE
VALUE:
- Wert oder Array
Hint:
The ID field of the database table is not part of the datafield definition.
The ID field must be always auto incement (int or bigint).
*/
$form["title"] = "Openvz OS-Template";
$form["description"] = "";
$form["name"] = "openvz_ostemplate";
$form["action"] = "openvz_ostemplate_edit.php";
$form["db_table"] = "openvz_ostemplate";
$form["db_table_idx"] = "ostemplate_id";
$form["db_history"] = "yes";
$form["tab_default"] = "main";
$form["list_default"] = "openvz_ostemplate_list.php";
$form["auth"] = 'yes'; // yes / no
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
$form["tabs"]['main'] = array (
'title' => "Template",
'width' => 100,
'template' => "templates/openvz_ostemplate_edit.htm",
'fields' => array (
##################################
# Begin Datatable fields
##################################
'template_name' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
'errmsg'=> 'template_name_error_empty'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'template_file' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
'errmsg'=> 'template_file_error_empty'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'server_id' => array (
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '',
'datasource' => array ( 'type' => 'SQL',
'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
'keyfield'=> 'server_id',
'valuefield'=> 'server_name'
),
'value' => ''
),
'allservers' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'y',
'value' => array(0 => 'n',1 => 'y')
),
'active' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'y',
'value' => array(0 => 'n',1 => 'y')
),
'description' => array (
'datatype' => 'TEXT',
'formtype' => 'TEXTAREA',
'default' => '',
'value' => '',
'separator' => '',
'width' => '',
'maxlength' => '',
'rows' => '10',
'cols' => '30'
),
##################################
# ENDE Datatable fields
##################################
)
);
?>
\ No newline at end of file
This diff is collapsed.
<?php
/*
Form Definition
Tabledefinition
Datatypes:
- INTEGER (Forces the input to Int)
- DOUBLE
- CURRENCY (Formats the values to currency notation)
- VARCHAR (no format check, maxlength: 255)
- TEXT (no format check)
- DATE (Dateformat, automatic conversion to timestamps)
Formtype:
- TEXT (Textfield)
- TEXTAREA (Textarea)
- PASSWORD (Password textfield, input is not shown when edited)
- SELECT (Select option field)
- RADIO