', $debug), MESSAGE_LEVEL_ERROR); header('Location: package.php'); exit; } if ($package_file != '') { header('Content-Type: application/gzip'); header('Content-Disposition: attachment; filename="' . basename($package_file) . '"'); header('Content-Length: ' . filesize($package_file)); header('Content-Control: no-cache'); header('Pragma: public'); header('Expires: 0'); readfile($package_file); unlink($package_file); exit; } } function export() : void { global $export_types, $device_classes, $graph_template_classes, $copyrights; // 'graph_template' should be the default if (!isrv('export_type')) { srv('export_type', 'host_template'); $id = db_fetch_cell('SELECT id FROM host_template ORDER BY name LIMIT 1'); srv('export_item_id', $id); } unset($export_types['data_template']); unset($export_types['data_query']); switch (gnrv('export_type')) { case 'host_template': case 'graph_template': case 'data_query': break; default: srv('export_type', 'host_template'); } html_start_box(__('Package Templates'), '100%', false, 3, 'center', ''); ?>
 
[ 'method' => 'spacer', 'friendly_name' => __('Available Templates'), ], 'export_item_id' => [ 'method' => 'drop_sql', 'friendly_name' => __('%s to Export', $export_types[gnrv('export_type')]['name']), 'description' => __('Choose the exact items to export in the Package.'), 'value' => (isrv('export_item_id') ? gfrv('export_item_id') : '|arg1:export_item_id|'), 'sql' => $export_types[gnrv('export_type')]['dropdown_sql'] ], 'include_deps' => [ 'method' => 'checkbox', 'friendly_name' => __('Include Dependencies'), 'description' => __('Some templates rely on other items in Cacti to function properly. It is highly recommended that you select this box or the resulting import may fail.'), 'value' => 'on', 'sql' => $export_types[gnrv('export_type')]['dropdown_sql'] ], 'spacer1' => [ 'method' => 'spacer', 'friendly_name' => __('Package Information'), ], 'description' => [ 'method' => 'textbox', 'friendly_name' => __('Description'), 'description' => __('The Package Description.'), 'value' => (isset($info['description']) ? $info['description'] : read_config_option('package_description', true)), 'max_length' => '255', 'size' => '80' ], 'copyright' => [ 'method' => 'drop_array', 'friendly_name' => __('Copyright'), 'description' => __('The license type for this package.'), 'value' => (isset($info['copyright']) ? $info['copyright'] : 'GNU General Public License'), 'array' => [ 'Apache License 2.0' => __('Apache License 2.0'), 'Creative Commons' => __('Creative Commons'), 'GNU General Public License' => __('GNU General Public License'), 'MIT License' => __('MIT License'), 'Eclipse Public License version 2.0' => __('Eclipse Public License version 2.0'), ], 'default' => 'GNU General Public License' ], 'version' => [ 'method' => 'textbox', 'friendly_name' => __('Version'), 'description' => __('The version number to publish for this Package.'), 'value' => (isset($info['version']) ? $info['version'] : read_config_option('package_version', true)), 'max_length' => '10', 'size' => '10' ], 'class' => [ 'method' => 'drop_array', 'friendly_name' => __('Class'), 'description' => __('The Classification of the Package.'), 'value' => (isset($info['class']) ? $info['class'] : read_config_option('package_class', true)), 'array' => $classes, 'default' => 'unassigned' ], 'tags' => [ 'method' => 'textarea', 'friendly_name' => __('Tags'), 'description' => __('Assign various searchable attributes to the Package.'), 'value' => (isset($info['tags']) ? $info['tags'] : read_config_option('package_tags', true)), 'textarea_rows' => '2', 'textarea_cols' => '80' ], 'installation' => [ 'method' => 'textarea', 'friendly_name' => __('Installation Instructions'), 'description' => __('Some Packages require additional changes outside of Cacti\'s scope such as setting up an SNMP Agent Extension on the Devices to be monitored. You should add those instructions here..'), 'value' => (isset($info['installation']) ? $info['installation'] : read_config_option('package_installation', true)), 'textarea_rows' => '5', 'textarea_cols' => '80' ], 'spacer2' => [ 'method' => 'spacer', 'friendly_name' => __('Author Information'), ], 'author' => [ 'method' => 'other', 'friendly_name' => __('Author Name'), 'description' => __('The Registered Authors Name.'), 'value' => $info['author'], 'max_length' => '40', 'size' => '40' ], 'homepage' => [ 'method' => 'other', 'friendly_name' => __('Homepage'), 'description' => __('The Registered Authors Home Page.'), 'value' => $info['homepage'], 'max_length' => '60', 'size' => '60' ], 'email' => [ 'method' => 'other', 'friendly_name' => __('Email Address'), 'description' => __('The Registered Authors Email Address.'), 'value' => $info['email'], 'max_length' => '60', 'size' => '60' ], 'export_type' => [ 'method' => 'hidden', 'value' => gnrv('export_type') ] ]; draw_edit_form( [ 'config' => ['no_form_tag' => true], 'fields' => $package_form ] ); html_end_box(); ?>
'>
'; print ''; } html_end_box(); }