4 Star 7 Fork 1

Gitee 极速下载/Cacti

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/Cacti/cacti
克隆/下载
automation_templates.php 46.39 KB
一键复制 编辑 原始数据 按行查看 历史
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553
<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2024 The Cacti Group |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDtool-based Graphing Solution |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
include('./include/auth.php');
include_once('./lib/poller.php');
include_once('./lib/utility.php');
$actions = array(
1 => __('Delete'),
2 => __('Export')
);
/* set default action */
set_default_action();
switch (get_request_var('action')) {
case 'save':
if (isset_request_var('save_component_import')) {
automation_import_process();
} else {
form_save();
}
break;
case 'import':
top_header();
automation_import();
bottom_footer();
break;
case 'export':
automation_export();
break;
case 'ajax_dnd':
automation_template_dnd();
break;
case 'graph_dnd':
automation_template_graph_item_dnd();
break;
case 'tree_dnd':
automation_template_tree_item_dnd();
break;
case 'exitonchange':
automation_template_tree_exit_on_change();
break;
case 'item_movedown':
automation_templates_item_movedown();
header('Location: automation_templates.php?action=edit&id=' . get_filter_request_var('template_id'));
break;
case 'item_moveup':
automation_templates_item_moveup();
header('Location: automation_templates.php?action=edit&id=' . get_filter_request_var('template_id'));
break;
case 'actions':
form_actions();
break;
case 'item_add_agr':
automation_add_graph_rule();
header('Location: automation_templates.php?action=edit&id=' . get_filter_request_var('template_id'));
break;
case 'item_remove_agr_confirm':
automation_remove_agr_confirm();
break;
case 'item_remove_agr':
automation_remove_agr();
header('Location: automation_templates.php?action=edit&id=' . get_filter_request_var('template_id'));
break;
case 'item_add_atr':
automation_add_tree_rule();
header('Location: automation_templates.php?action=edit&id=' . get_filter_request_var('template_id'));
break;
case 'item_remove_atr_confirm':
automation_remove_atr_confirm();
break;
case 'item_remove_atr':
automation_remove_atr();
header('Location: automation_templates.php?action=edit&id=' . get_filter_request_var('template_id'));
break;
case 'movedown':
automation_movedown();
header('Location: automation_templates.php');
break;
case 'moveup':
automation_moveup();
header('Location: automation_templates.php');
break;
case 'remove':
automation_remove();
header('Location: automation_templates.php');
break;
case 'edit':
top_header();
template_edit();
bottom_footer();
break;
default:
top_header();
template();
bottom_footer();
break;
}
function automation_export() {
/* if we are to save this form, instead of display it */
if (isset_request_var('selected_items')) {
$selected_items = sanitize_unserialize_selected_items(get_nfilter_request_var('selected_items'));
if ($selected_items != false) {
if(cacti_sizeof($selected_items) == 1) {
$export_data = automation_device_rule_export($selected_items[0]);
} else {
foreach($selected_items as $id) {
$snmp_option_ids[] = $id;
}
$export_data = automation_device_rule_export($snmp_option_ids);
}
if (cacti_sizeof($export_data)) {
$export_file_name = $export_data['export_name'];
header('Content-type: application/json');
header('Content-Disposition: attachment; filename=' . $export_file_name);
$output = json_encode($export_data, JSON_PRETTY_PRINT);
print $output;
}
}
}
}
function automation_import() {
$form_data = array(
'import_file' => array(
'friendly_name' => __('Import Device Rules from Local File',),
'description' => __('If the JSON file containing the Device Rules data is located on your local machine, select it here.'),
'method' => 'file',
'accept' => '.json'
),
'import_text' => array(
'method' => 'textarea',
'friendly_name' => __('Import Device Rules from Text'),
'description' => __('If you have the JSON file containing the Device Rules data as text, you can paste it into this box to import it.'),
'value' => '',
'default' => '',
'textarea_rows' => '10',
'textarea_cols' => '80',
'class' => 'textAreaNotes'
)
);
form_start('automation_templates.php', 'chk', true);
if ((isset($_SESSION['import_debug_info'])) && (is_array($_SESSION['import_debug_info']))) {
html_start_box(__('Import Results'), '80%', '', '3', 'center', '');
print '<tr class="tableHeader"><th>' . __('Cacti has Imported the following Device Rules'). '</th></tr>';
foreach ($_SESSION['import_debug_info'] as $line) {
print '<tr><td>' . $line . '</td></tr>';
}
html_end_box();
kill_session_var('import_debug_info');
}
html_start_box(__('Import Device Rules'), '80%', false, '3', 'center', '');
draw_edit_form(
array(
'config' => array('no_form_tag' => true),
'fields' => $form_data
)
);
form_hidden_box('save_component_import', '1', '');
print " <tr><td><hr/></td></tr><tr>
<td class='saveRow'>
<input type='hidden' name='action' value='save'>
<input type='submit' value='" . __esc('Import') . "' title='" . __esc('Import Network Discovery Rule') . "' class='ui-button ui-corner-all ui-widget ui-state-active'>
</td>
<script type='text/javascript'>
$(function() {
clearAllTimeouts();
});
</script>
</tr>";
html_end_box();
}
function automation_import_process() {
$json_data = json_decode(get_nfilter_request_var('import_text'), true);
// If we have text, then we were trying to import text, otherwise we are uploading a file for import
if (empty($json_data)) {
$json_data = automation_validate_upload();
}
if (is_array($json_data) && cacti_sizeof($json_data) && isset($json_data['device'])) {
foreach($json_data['device'] as $device) {
$return_data += automation_template_import($device);
}
}
if (sizeof($return_data) && isset($return_data['success'])) {
foreach ($return_data['success'] as $message) {
$debug_data[] = '<span class="deviceUp">' . __('NOTE:') . '</span> ' . $message;
cacti_log('NOTE: Automation Device Rules Import Succeeded!. Message: '. $message, false, 'AUTOM8');
}
}
if (isset($return_data['errors'])) {
foreach ($return_data['errors'] as $error) {
$debug_data[] = '<span class="deviceDown">' . __('ERROR:') . '</span> ' . $error;
cacti_log('NOTE: Automation Device Rules Import Error!. Message: '. $message, false, 'AUTOM8');
}
}
if (isset($return_data['failure'])) {
foreach ($return_data['failure'] as $message) {
$debug_data[] = '<span class="deviceDown">' . __('ERROR:') . '</span> ' . $message;
cacti_log('NOTE: Automation Device Rules Import Failed!. Message: '. $message, false, 'AUTOM8');
}
}
if (cacti_sizeof($debug_data)) {
$_SESSION['import_debug_info'] = $debug_data;
}
header('Location: automation_templates.php?action=import');
exit();
}
function automation_template_dnd() {
/* ================= Input validation ================= */
get_filter_request_var('id');
/* ================= Input validation ================= */
if (isset_request_var('template_ids') && is_array(get_nfilter_request_var('template_ids'))) {
$aids = get_nfilter_request_var('template_ids');
$sequence = 1;
foreach ($aids as $id) {
$id = str_replace('line', '', $id);
input_validate_input_number($id, 'id');
db_execute_prepared('UPDATE automation_templates
SET sequence = ?
WHERE id = ?',
array($sequence, $id));
$sequence++;
}
}
header('Location: automation_templates.php');
exit;
}
function automation_templates_item_movedown() {
/* ================= input validation ================= */
get_filter_request_var('id');
get_filter_request_var('template_id');
get_filter_request_var('rule_type');
/* ==================================================== */
$cur_sequence = db_fetch_cell_prepared('SELECT sequence
FROM automation_templates_rules
WHERE template_id = ?
AND rule_type = ?
AND id = ?',
array(get_request_var('template_id'), get_request_var('rule_type'), get_request_var('id')));
$other_id = db_fetch_cell_prepared('SELECT id
FROM automation_templates_rules
WHERE template_id = ?
AND rule_type = ?
AND sequence = ?',
array(get_request_var('template_id'), get_request_var('rule_type'), $cur_sequence + 1));
db_execute_prepared('UPDATE automation_templates_rules
SET sequence = ?
WHERE id = ?',
array($cur_sequence + 1, get_request_var('id')));
db_execute_prepared('UPDATE automation_templates_rules
SET sequence = ?
WHERE id = ?',
array($cur_sequence, $other_id));
automation_resequence_rules(get_request_var('template_id'));
}
function automation_templates_item_moveup() {
/* ================= input validation ================= */
get_filter_request_var('id');
get_filter_request_var('template_id');
get_filter_request_var('rule_type');
/* ==================================================== */
$cur_sequence = db_fetch_cell_prepared('SELECT sequence
FROM automation_templates_rules
WHERE template_id = ?
AND rule_type = ?
AND id = ?',
array(get_request_var('template_id'), get_request_var('rule_type'), get_request_var('id')));
$other_id = db_fetch_cell_prepared('SELECT id
FROM automation_templates_rules
WHERE template_id = ?
AND rule_type = ?
AND sequence = ?',
array(get_request_var('template_id'), get_request_var('rule_type'), $cur_sequence - 1));
db_execute_prepared('UPDATE automation_templates_rules
SET sequence = ?
WHERE id = ?',
array($cur_sequence - 1, get_request_var('id')));
db_execute_prepared('UPDATE automation_templates_rules
SET sequence = ?
WHERE id = ?',
array($cur_sequence, $other_id));
automation_resequence_rules(get_request_var('template_id'));
}
function automation_template_graph_item_dnd() {
/* ================= Input validation ================= */
get_filter_request_var('id');
/* ================= Input validation ================= */
if (isset_request_var('graph_rules') && is_array(get_nfilter_request_var('graph_rules'))) {
$aids = get_nfilter_request_var('graph_rules');
$sequence = 1;
$template_id = get_request_var('id');
foreach ($aids as $id) {
$id = str_replace('gr', '', $id);
input_validate_input_number($id, 'id');
db_execute_prepared('UPDATE automation_templates_rules
SET sequence = ?
WHERE template_id = ?
AND id = ?
AND rule_type = 1',
array($sequence, $template_id, $id));
$sequence++;
}
}
header('Location: automation_templates.php?action=edit&id=' . get_request_var('id'));
exit;
}
function automation_template_tree_item_dnd() {
/* ================= Input validation ================= */
get_filter_request_var('id');
/* ================= Input validation ================= */
if (isset_request_var('template_ids') && is_array(get_nfilter_request_var('template_ids'))) {
$aids = get_nfilter_request_var('template_ids');
$sequence = 1;
$template_id = get_request_var('id');
foreach ($aids as $id) {
$id = str_replace('tr', '', $id);
input_validate_input_number($id, 'id');
db_execute_prepared('UPDATE automation_templates_rules
SET sequence = ?
WHERE template_id = ?
AND id = ?
AND rule_type = 2',
array($sequence, $template_id, $id));
$sequence++;
}
}
header('Location: automation_templates.php?action=edit&id=' . get_request_var('id'));
exit;
}
function automation_template_tree_exit_on_change() {
$id = get_filter_request_var('id');
$newvalue = get_filter_request_var('current') == 0 ? 1:0;
$template_id = get_filter_request_var('template_id');
db_execute_prepared('UPDATE automation_templates_rules
SET exit_rules = ?
WHERE id = ?',
array($newvalue, $id));
header('Location: automation_templates.php?action=edit&id=' . $template_id);
}
function automation_movedown() {
move_item_down('automation_templates', get_filter_request_var('id'));
}
function automation_moveup() {
move_item_up('automation_templates', get_filter_request_var('id'));
}
function automation_remove() {
db_execute_prepared('DELETE FROM automation_templates WHERE id = ?', array(get_filter_request_var('id')));
}
function automation_add_graph_rule() {
/* ================= input validation ================= */
get_filter_request_var('template_id');
get_filter_request_var('rule_id');
/* ==================================================== */
$save = array();
$save['id'] = 0;
$save['hash'] = get_hash_automation(0, 'automation_templates_rules');
$save['template_id'] = get_request_var('template_id');
$save['rule_type'] = 1;
$save['rule_id'] = get_request_var('rule_id');
$save['sequence'] = db_fetch_cell('SELECT MAX(sequence)+1 FROM automation_templates_rules WHERE rule_type = 1');
$save['exit_rules'] = 0;
sql_save($save, 'automation_templates_rules');
automation_resequence_rules(get_request_var('template_id'));
raise_message('rule_save', __('The Graph Rule has been added to the Device Rule'), MESSAGE_LEVEL_INFO);
}
function automation_add_tree_rule() {
/* ================= input validation ================= */
get_filter_request_var('template_id');
get_filter_request_var('rule_id');
/* ==================================================== */
$save = array();
$save['id'] = 0;
$save['hash'] = get_hash_automation(0, 'automation_templates_rules');
$save['template_id'] = get_request_var('template_id');
$save['rule_type'] = 2;
$save['rule_id'] = get_request_var('rule_id');
$save['sequence'] = db_fetch_cell('SELECT MAX(sequence)+1 FROM automation_templates_rules WHERE rule_type = 2');
$save['exit_rules'] = 0;
sql_save($save, 'automation_templates_rules');
automation_resequence_rules(get_request_var('template_id'));
raise_message('rule_save', __('The Tree Rule has been added to the Device Rule'), MESSAGE_LEVEL_INFO);
}
function form_actions() {
global $actions;
/* ================= input validation ================= */
get_filter_request_var('drp_action', FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '/^([a-zA-Z0-9_]+)$/')));
/* ==================================================== */
/* if we are to save this form, instead of display it */
if (isset_request_var('selected_items')) {
$selected_items = sanitize_unserialize_selected_items(get_nfilter_request_var('selected_items'));
if ($selected_items != false) {
if (get_nfilter_request_var('drp_action') == '1') { /* delete */
db_execute('DELETE FROM automation_templates WHERE ' . array_to_sql_or($selected_items, 'id'));
} elseif (get_nfilter_request_var('drp_action') == '2') { /* export */
top_header();
print '<script text="text/javascript">
function DownloadStart(url) {
document.getElementById("download_iframe").src = url;
setTimeout(function() {
document.location = "automation_templates.php";
Pace.stop();
}, 500);
}
$(function() {
//debugger;
DownloadStart(\'automation_templates.php?action=export&selected_items=' . get_nfilter_request_var('selected_items') . '\');
});
</script>
<iframe id="download_iframe" style="display:none;"></iframe>';
bottom_footer();
exit;
}
}
header('Location: automation_templates.php');
exit;
} else {
$ilist = '';
$iarray = array();
foreach ($_POST as $var => $val) {
if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1], 'chk[1]');
/* ==================================================== */
$ilist .= '<li>' . html_escape(db_fetch_cell_prepared('SELECT ht.name FROM automation_templates AS at INNER JOIN host_template AS ht ON ht.id=at.host_template WHERE at.id = ?', array($matches[1]))) . '</li>';
$iarray[] = $matches[1];
}
}
$form_data = array(
'general' => array(
'page' => 'automation_templates.php',
'actions' => $actions,
'optvar' => 'drp_action',
'item_array' => $iarray,
'item_list' => $ilist
),
'options' => array(
1 => array(
'smessage' => __('Click \'Continue\' to Delete the following Device Rule.'),
'pmessage' => __('Click \'Continue\' to Delete following Device Rules.'),
'scont' => __('Delete Device Rule'),
'pcont' => __('Delete Device Rules')
),
2 => array(
'smessage' => __('Click \'Continue\' to Export the following Device Rule.'),
'pmessage' => __('Click \'Continue\' to Export following Device Rules.'),
'scont' => __('Export Device Rule'),
'pcont' => __('Export Device Rules'),
)
)
);
form_continue_confirmation($form_data);
}
}
function form_save() {
if (isset_request_var('save_component_template')) {
$redirect_back = false;
$save['id'] = get_nfilter_request_var('id');
$save['hash'] = get_hash_automation(get_request_var('id'), 'automation_templates');
$save['host_template'] = form_input_validate(get_nfilter_request_var('host_template'), 'host_template', '', false, 3);
$save['availability_method'] = form_input_validate(get_nfilter_request_var('availability_method'), 'availability_method', '', false, 3);
$save['sysDescr'] = get_nfilter_request_var('sysDescr');
$save['sysName'] = get_nfilter_request_var('sysName');
$save['sysOid'] = get_nfilter_request_var('sysOid');
$save['description_pattern'] = get_nfilter_request_var('description_pattern');
$save['populate_location'] = isset_request_var('populate_location') ? 'on':'';
if (function_exists('filter_var')) {
$save['sysDescr'] = filter_var($save['sysDescr'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
} else {
$save['sysDescr'] = strip_tags($save['sysDescr']);
}
if (!is_error_message()) {
$template_id = sql_save($save, 'automation_templates');
if ($template_id) {
raise_message(1);
} else {
raise_message(2);
}
}
if (is_error_message() || isempty_request_var('id')) {
header('Location: automation_templates.php?id=' . (empty($template_id) ? get_nfilter_request_var('id') : $template_id));
} else {
header('Location: automation_templates.php');
}
}
}
function automation_remove_agr_confirm() {
/* ================= input validation ================= */
get_filter_request_var('rule_id');
get_filter_request_var('template_id');
/* ==================================================== */
form_start('automation_templates.php?action=edit&id=' . get_request_var('template_id'));
html_start_box('', '100%', '', '3', 'center', '');
$rule = db_fetch_row_prepared('SELECT *
FROM automation_templates_rules
WHERE id = ?',
array(get_request_var('rule_id')));
if (cacti_sizeof($rule)) {
$name = db_fetch_cell_prepared('SELECT name
FROM automation_graph_rules
WHERE id = ?',
array($rule['rule_id']));
} else {
$name = __('Unknown');
}
?>
<tr>
<td class='topBoxAlt'>
<p><?php print __('Click \'Continue\' to Delete the following Graph Rule will be disassociated from the Device Rule.');?></p>
<p><?php print __("Graph Rule Name: '%s'", html_escape($name));?>
<br>
</td>
</tr>
<tr>
<td class='right'>
<input type='button' class='ui-button ui-corner-all ui-widget' id='cancel' value='<?php print __esc('Cancel');?>' onClick='$("#cdialog").dialog("close")' name='cancel'>
<input type='button' class='ui-button ui-corner-all ui-widget' id='continue' value='<?php print __esc('Continue');?>' name='continue' title='<?php print __esc('Remove Graph Rule');?>'>
</td>
</tr>
<?php
html_end_box();
form_end();
?>
<script type='text/javascript'>
$('#continue').click(function(data) {
var options = {
url: 'automation_templates.php?action=item_remove_agr'
}
var data = {
__csrf_magic: csrfMagicToken,
template_id: <?php print get_request_var('template_id');?>,
rule_id: <?php print get_request_var('rule_id');?>
}
postUrl(options, data);
});
</script>
<?php
}
function automation_remove_agr() {
/* ================= input validation ================= */
get_filter_request_var('rule_id');
get_filter_request_var('template_id');
/* ==================================================== */
db_execute_prepared('DELETE FROM automation_templates_rules
WHERE id = ?
AND rule_type = 1
AND template_id = ?',
array(get_request_var('rule_id'), get_request_var('template_id')));
automation_resequence_rules(get_request_var('template_id'));
raise_message('rule_remove', __('The Graph Rule has been removed from the Device Rule'), MESSAGE_LEVEL_INFO);
}
function automation_resequence_rules($template_id) {
$gr_seq = db_fetch_assoc_prepared('SELECT *
FROM automation_templates_rules
WHERE template_id = ?
AND rule_type = 1
ORDER BY sequence',
array($template_id));
if (cacti_sizeof($gr_seq)) {
$sequence = 1;
foreach($gr_seq as $s) {
db_execute_prepared('UPDATE automation_templates_rules
SET `sequence` = ?
WHERE id = ?',
array($sequence, $s['id']));
$sequence++;
}
}
$tr_seq = db_fetch_assoc_prepared('SELECT *
FROM automation_templates_rules
WHERE template_id = ?
AND rule_type = 2
ORDER BY sequence',
array($template_id));
if (cacti_sizeof($tr_seq)) {
$sequence = 1;
foreach($tr_seq as $s) {
db_execute_prepared('UPDATE automation_templates_rules
SET `sequence` = ?
WHERE id = ?',
array($sequence, $s['id']));
$sequence++;
}
}
}
function automation_remove_atr_confirm() {
/* ================= input validation ================= */
get_filter_request_var('rule_id');
get_filter_request_var('template_id');
/* ==================================================== */
form_start('automation_templates.php?action=edit&id=' . get_request_var('template_id'));
html_start_box('', '100%', '', '3', 'center', '');
$rule = db_fetch_row_prepared('SELECT *
FROM automation_templates_rules
WHERE id = ?',
array(get_request_var('rule_id')));
if (cacti_sizeof($rule)) {
$name = db_fetch_cell_prepared('SELECT name
FROM automation_tree_rules
WHERE id = ?',
array($rule['rule_id']));
} else {
$name = __('Unknown');
}
?>
<tr>
<td class='topBoxAlt'>
<p><?php print __('Click \'Continue\' to Delete the following Tree Rule(s) will be disassociated from the Device Rule.');?></p>
<p><?php print __("Tree Rule Name: '%s'", html_escape($name));?>
<br>
</td>
</tr>
<tr>
<td class='right'>
<input type='button' class='ui-button ui-corner-all ui-widget' id='cancel' value='<?php print __esc('Cancel');?>' onClick='$("#cdialog").dialog("close")' name='cancel'>
<input type='button' class='ui-button ui-corner-all ui-widget' id='continue' value='<?php print __esc('Continue');?>' name='continue' title='<?php print __esc('Remove Tree Rule');?>'>
</td>
</tr>
<?php
html_end_box();
form_end();
?>
<script type='text/javascript'>
$('#continue').click(function(data) {
var options = {
url: 'automation_templates.php?action=item_remove_atr'
}
var data = {
__csrf_magic: csrfMagicToken,
template_id: <?php print get_request_var('template_id');?>,
rule_id: <?php print get_request_var('rule_id');?>
}
postUrl(options, data);
});
</script>
<?php
}
function automation_remove_atr() {
/* ================= input validation ================= */
get_filter_request_var('rule_id');
get_filter_request_var('template_id');
/* ==================================================== */
db_execute_prepared('DELETE FROM automation_templates_rules
WHERE id = ?
AND rule_type = 2
AND template_id = ?',
array(get_request_var('rule_id'), get_request_var('template_id')));
automation_resequence_rules(get_request_var('template_id'));
raise_message('rule_remove', __('The Tree Rule has been removed from the Device Automation Rule'), MESSAGE_LEVEL_INFO);
}
function automation_get_child_branches($tree_id, $id, $spaces, $headers) {
$items = db_fetch_assoc_prepared('SELECT id, title
FROM graph_tree_items
WHERE graph_tree_id = ?
AND host_id = 0
AND local_graph_id = 0
AND parent = ?
ORDER BY position', array($tree_id, $id));
$spaces .= '--';
if (cacti_sizeof($items)) {
foreach ($items as $i) {
$headers['tr_' . $tree_id . '_bi_' . $i['id']] = $spaces . ' ' . $i['title'];
$headers = automation_get_child_branches($tree_id, $i['id'], $spaces, $headers);
}
}
return $headers;
}
function automation_get_tree_headers() {
$headers = array();
$trees = db_fetch_assoc('SELECT id, name FROM graph_tree ORDER BY name');
foreach ($trees as $tree) {
$headers['tr_' . $tree['id'] . '_br_0'] = $tree['name'];
$spaces = '';
$headers = automation_get_child_branches($tree['id'], 0, $spaces, $headers);
}
return $headers;
}
function template_edit() {
global $availability_options, $config;
$host_template_names = db_fetch_assoc('SELECT id, name FROM host_template');
$template_names = array();
if (cacti_sizeof($host_template_names)) {
foreach ($host_template_names as $ht) {
$template_names[$ht['id']] = $ht['name'];
}
}
$fields = array(
'spacer0' => array(
'method' => 'spacer',
'friendly_name' => __('Matching Settings'),
),
'host_template' => array(
'method' => 'drop_array',
'friendly_name' => __('Device Template'),
'description' => __('Select a Device Template that Devices will be matched to.'),
'value' => '|arg1:host_template|',
'array' => $template_names,
),
'availability_method' => array(
'method' => 'drop_array',
'friendly_name' => __('Availability Method'),
'description' => __('Choose the Availability Method to use for Discovered Devices.'),
'value' => '|arg1:availability_method|',
'default' => read_config_option('availability_method'),
'array' => $availability_options,
),
'sysDescr' => array(
'method' => 'textbox',
'friendly_name' => __('System Description Match'),
'description' => __('This is a unique string that will be matched to a devices sysDescr string to pair it to this Device Rule. Any Perl regular expression can be used in addition to any SQL Where expression.'),
'value' => '|arg1:sysDescr|',
'max_length' => '255',
),
'sysName' => array(
'method' => 'textbox',
'friendly_name' => __('System Name Match'),
'description' => __('This is a unique string that will be matched to a devices sysName string to pair it to this Device Rule. Any Perl regular expression can be used in addition to any SQL Where expression.'),
'value' => '|arg1:sysName|',
'max_length' => '128',
),
'sysOid' => array(
'method' => 'textbox',
'friendly_name' => __('System OID Match'),
'description' => __('This is a unique string that will be matched to a devices sysOid string to pair it to this Device Rule. Any Perl regular expression can be used in addition to any SQL Where expression.'),
'value' => '|arg1:sysOid|',
'max_length' => '128',
),
'spacer1' => array(
'method' => 'spacer',
'friendly_name' => __('Device Creation Defaults'),
),
'description_pattern' => array(
'method' => 'textbox',
'friendly_name' => __('Device Description Pattern'),
'description' => __('Represents the final desired Device description to be used in Cacti. The following replacement values can be used: |sysName|, |ipAddress|, |dnsName|, |dnsShortName|, |sysLocation|. The following functions can also be used: CONCAT(), SUBSTRING(), SUBSTRING_INDEX(). See the MySQL/MariaDB documentation for examples on how to use these functions. An example would be: CONCAT(\'|sysName|\', SUBSTRING(\'|sysLocation|\',1,3)). Take care to include quoting around the variables names when used in the supported MySQL/MariaDB function examples.'),
'value' => '|arg1:description_pattern|',
'default' => '|sysName|',
'max_length' => '128',
'size' => '80'
),
'populate_location' => array(
'method' => 'checkbox',
'friendly_name' => __('Populate Location with sysLocation'),
'description' => __('If checked, when the Automation Network is scanned if a Device is found that will be added to Cacti, its Location will be updated to match the Devices sysLocation.'),
'value' => '|arg1:populate_location|',
'default' => ''
),
'id' => array(
'method' => 'hidden_zero',
'value' => '|arg1:id|'
),
'save_component_template' => array(
'method' => 'hidden',
'value' => '1'
)
);
/* ================= input validation ================= */
get_filter_request_var('id');
/* ==================================================== */
if (!isempty_request_var('id')) {
$template = db_fetch_row_prepared('SELECT *
FROM automation_templates
WHERE id = ?',
array(get_request_var('id')));
if (isset($template_names[$template['host_template']])) {
$header_label = __esc('Device Rules [edit: %s]', $template_names[$template['host_template']]);
} else {
$header_label = __('Device Rules for [Deleted Template]');
}
} else {
$header_label = __('Device Rules [new]');
set_request_var('id', 0);
}
form_start('automation_templates.php', 'form_network');
html_start_box($header_label, '100%', '', '3', 'center', '');
draw_edit_form(
array(
'config' => array('no_form_tag' => 'true'),
'fields' => inject_form_variables($fields, (isset($template) ? $template : array()))
)
);
html_end_box();
if (!isempty_request_var('id')) {
html_start_box(__('Associated Graph Rules'), '100%', '', '3', 'center', '');
$graph_rules = db_fetch_assoc_prepared('SELECT atr.*, gr.name
FROM automation_templates_rules AS atr
INNER JOIN automation_graph_rules AS gr
ON atr.rule_id = gr.id
AND atr.rule_type = 1
WHERE template_id = ?
ORDER BY sequence',
array(get_request_var('id')));
$i = 1;
$display_text = array(
array(
'display' => __('Graph Rule Name'),
'align' => 'left',
),
array(
'display' => __('Sequence'),
'align' => 'right',
),
array(
'display' => __('Actions'),
'align' => 'right',
)
);
html_header($display_text, false);
$dnd = read_config_option('drag_and_drop') == 'on' ? true:false;
if (cacti_sizeof($graph_rules)) {
$i = 0;
foreach($graph_rules as $rule) {
$id = "gr{$rule['id']}";
form_alternate_row($id, true);
form_selectable_cell($rule['name'], $id);
form_selectable_cell($rule['sequence'], $id, '', 'right');
$action = '';
if (!$dnd) {
if ($i != cacti_sizeof($graph_rules) - 1) {
$action .= '<a class="pic fa fa-caret-down moveArrow" href="' . html_escape('automation_templates.php?action=item_movedown&template_id=' . get_request_var('id') . '&id=' . $rule['id'] . '&rule_type=1') . '" title="' . __esc('Move Down') . '"></a>';
} else {
$action .= '<a href="#" class="moveArrowNone"></a>';
}
if ($i > 0) {
$action .= '<a class="pic fa fa-caret-up moveArrow" href="' . html_escape('automation_templates.php?action=item_moveup&template_id=' . get_request_var('id') . '&id=' . $rule['id'] . '&rule_type=1') . '" title="' . __esc('Move Up') . '"></a>';
} else {
$action .= '<a href="#" class="moveArrowNone"></a>';
}
}
form_selectable_cell("$action<a class='delete deleteMarker fa fa-times' title='" . __esc('Delete') . "' href='" . html_escape('automation_templates.php?action=item_remove_agr_confirm&template_id=' . get_request_var('id') . '&rule_id=' . $rule['id']) . "'></a>", $id, '40', 'right');
form_end_row();
$i++;
}
} else {
print '<tr><td><em>' . __('No Associated Graph Rules') . '</em></td></tr>';
}
html_end_box();
html_start_box('', '100%', '', '3', 'center', '');
?>
<tr class='odd'>
<td colspan='2'>
<table>
<tr style='line-height:10px'>
<td class='nowrap templateAdd'>
<?php print __('Add Graph Rule');?>
</td>
<td class='noHide'>
<?php form_dropdown('graph_rule', db_fetch_assoc_prepared('SELECT DISTINCT ar.id, ar.name
FROM automation_graph_rules AS ar
LEFT JOIN automation_templates_rules AS art
ON ar.id = art.rule_id
AND art.rule_type = 1
WHERE ar.id NOT IN (SELECT rule_id FROM automation_templates_rules WHERE rule_type = 1 AND template_id = ?)
ORDER BY ar.name',
array(get_request_var('id'))), 'name', 'id', '', '', '');?>
</td>
<td class='noHide'>
<input type='button' class='ui-button ui-corner-all ui-widget' value='<?php print __esc('Add');?>' id='add_agr' title='<?php print __esc('Add Graph Rule to Device Rule');?>'>
</td>
</tr>
</table>
</td>
</tr>
<?php
html_end_box();
html_start_box(__('Associated Tree Rules'), '100%', '', '3', 'center', '');
$tree_rules = db_fetch_assoc_prepared('SELECT atr.*, tr.name
FROM automation_templates_rules AS atr
INNER JOIN automation_tree_rules AS tr
ON atr.rule_id = tr.id
AND atr.rule_type = 2
WHERE template_id = ?
ORDER BY sequence',
array(get_request_var('id')));
$i = 1;
$display_text = array(
array(
'display' => __('Tree Rule Name'),
'align' => 'left',
),
array(
'display' => __('Exit On Match'),
'align' => 'left',
),
array(
'display' => __('Sequence'),
'align' => 'right',
),
array(
'display' => __('Actions'),
'align' => 'right',
)
);
html_header($display_text, false);
$dnd = read_config_option('drag_and_drop') == 'on' ? true:false;
if (cacti_sizeof($tree_rules)) {
$i = 0;
foreach($tree_rules as $rule) {
$id = "tr{$rule['id']}";
$exit_on_url = html_escape(CACTI_PATH_URL . 'automation_templates.php' .
'?action=exitonchange' .
'&template_id='. get_request_var('id') .
'&id=' . $rule['id'] .
'&current=' . $rule['exit_rules']);
$exit_text = $rule['exit_rules'] == 0 ? __('No'):__('Yes');
form_alternate_row($id, true);
form_selectable_cell($rule['name'], $id);
form_selectable_cell(filter_value($exit_text, '', $exit_on_url), $id);
form_selectable_cell($rule['sequence'], $id, '', 'right');
$action = '';
if (!$dnd) {
if ($i != cacti_sizeof($tree_rules) - 1) {
$action .= '<a class="pic fa fa-caret-down moveArrow" href="' . html_escape('automation_templates.php?action=item_movedown&template_id=' . get_request_var('id') . '&id=' . $rule['id'] . '&rule_type=2') . '" title="' . __esc('Move Down') . '"></a>';
} else {
$action .= '<a href="#" class="moveArrowNone"></a>';
}
if ($i > 0) {
$action .= '<a class="pic fa fa-caret-up moveArrow" href="' . html_escape('automation_templates.php?action=item_moveup&template_id=' . get_request_var('id') . '&id=' . $rule['id'] . '&rule_type=2') . '" title="' . __esc('Move Up') . '"></a>';
} else {
$action .= '<a href="#" class="moveArrowNone"></a>';
}
}
form_selectable_cell("$action<a class='delete deleteMarker fa fa-times' title='" . __esc('Delete') . "' href='" . html_escape('automation_templates.php?action=item_remove_atr_confirm&template_id=' . get_request_var('id') . '&rule_id=' . $rule['id']) . "'></a>", $id, '40', 'right');
form_end_row();
$i++;
}
} else {
print '<tr><td><em>' . __('No Associated Tree Rules') . '</em></td></tr>';
}
?>
<tr class='odd'>
<td colspan='2'>
<table>
<tr style='line-height:10px'>
<td class='nowrap templateAdd'>
<?php print __('Add Tree Rule');?>
</td>
<td class='noHide'>
<?php form_dropdown('tree_rule', db_fetch_assoc_prepared('SELECT DISTINCT ar.id, ar.name
FROM automation_tree_rules AS ar
LEFT JOIN automation_templates_rules AS art
ON ar.id = art.rule_id
AND art.rule_type = 2
WHERE ar.id NOT IN (SELECT rule_id FROM automation_templates_rules WHERE rule_type = 2 AND template_id = ?)
ORDER BY ar.name',
array(get_request_var('id'))), 'name', 'id', '', '', '');?>
</td>
<td class='noHide'>
<input type='button' class='ui-button ui-corner-all ui-widget' value='<?php print __esc('Add');?>' id='add_atr' title='<?php print __esc('Add Tree Rule to Device Rule');?>'>
</td>
</tr>
</table>
</td>
</tr>
<?php
html_end_box();
}
form_save_button('automation_templates.php');
?>
<script type='text/javascript'>
var dnd = <?php print read_config_option('drag_and_drop') == 'on' ? 'true':'false';?>;
$(function() {
$('#cdialog').remove();
$('#main').append("<div id='cdialog' class='cdialog'></div>");
$('.delete').click(function (event) {
event.preventDefault();
request = $(this).attr('href');
$.get(request)
.done(function(data) {
$('#cdialog').html(data);
applySkin();
$('#cdialog').dialog({
title: '<?php print __('Delete Item from Device Rule');?>',
close: function () { $('.delete').blur(); $('.selectable').removeClass('selected'); },
minHeight: 80,
minWidth: 500
})
})
.fail(function(data) {
getPresentHTTPError(data);
});
}).css('cursor', 'pointer');
$('#add_agr').click(function() {
var options = {
url: 'automation_templates.php?action=item_add_agr'
}
var data = {
template_id: $('#id').val(),
rule_id: $('#graph_rule').val(),
__csrf_magic: csrfMagicToken
}
postUrl(options, data);
});
$('#add_atr').click(function() {
var options = {
url: 'automation_templates.php?action=item_add_atr'
}
var data = {
template_id: $('#id').val(),
rule_id: $('#tree_rule').val(),
__csrf_magic: csrfMagicToken
}
postUrl(options, data);
});
$('#automation_templates_edit2_child').attr('id', 'graph_rules');
$('#automation_templates_edit4_child').attr('id', 'tree_rules');
if (dnd) {
$('#graph_rules').find('tr:first').addClass('nodrag').addClass('nodrop');
$('#tree_rules').find('tr:first').addClass('nodrag').addClass('nodrop');
$('#graph_rules').tableDnD({
onDrop: function(table, row) {
loadUrl({url:'automation_templates.php?action=graph_dnd&id='+$('#id').val()+'&'+$.tableDnD.serialize()});
}
});
$('#tree_rules').tableDnD({
onDrop: function(table, row) {
loadUrl({url:'automation_templates.php?action=tree_dnd&id='+$('#id').val()+'&'+$.tableDnD.serialize()});
}
});
}
});
</script>
<?php
}
function template() {
global $actions, $item_rows, $availability_options;
automation_update_hashes();
/* ================= input validation and session storage ================= */
$filters = array(
'rows' => array(
'filter' => FILTER_VALIDATE_INT,
'pageset' => true,
'default' => '-1'
),
'page' => array(
'filter' => FILTER_VALIDATE_INT,
'default' => '1'
),
'filter' => array(
'filter' => FILTER_DEFAULT,
'pageset' => true,
'default' => ''
)
);
validate_store_request_vars($filters, 'sess_autot');
/* ================= input validation ================= */
if (get_request_var('rows') == '-1') {
$rows = read_config_option('num_rows_table');
} else {
$rows = get_request_var('rows');
}
html_start_box(__('Device Rules'), '100%', '', '3', 'center', 'automation_templates.php?action=edit');
?>
<tr class='even'>
<td>
<form id='form_at' action='automation_templates.php'>
<table class='filterTable'>
<tr>
<td>
<?php print __('Search');?>
</td>
<td>
<input type='text' class='ui-state-default ui-corner-all' id='filter' size='25' value='<?php print html_escape_request_var('filter');?>'>
</td>
<td>
<?php print __('Templates');?>
</td>
<td>
<select id='rows' onChange='applyFilter()'>
<option value='-1'<?php print(get_request_var('rows') == '-1' ? ' selected>':'>') . __('Default');?></option>
<?php
if (cacti_sizeof($item_rows) > 0) {
foreach ($item_rows as $key => $value) {
print "<option value='" . $key . "'";
if (get_request_var('rows') == $key) {
print ' selected';
} print '>' . html_escape($value) . '</option>';
}
}
?>
</select>
</td>
<td>
<span>
<input type='button' class='ui-button ui-corner-all ui-widget' id='refresh' value='<?php print __esc('Go');?>' title='<?php print __esc('Set/Refresh Filters');?>'>
<input type='button' class='ui-button ui-corner-all ui-widget' id='clear' value='<?php print __esc('Clear');?>' title='<?php print __esc('Clear Filters');?>'>
<input type='button' class='ui-button ui-corner-all ui-widget' id='import' value='<?php print __esc('Import');?>' title='<?php print __esc('Import Device Rules');?>'>
</span>
</td>
</tr>
</table>
</form>
<script type='text/javascript'>
function applyFilter() {
strURL = 'automation_templates.php' +
'?filter=' + $('#filter').val() +
'&rows=' + $('#rows').val() +
'&has_graphs=' + $('#has_graphs').is(':checked');
loadUrl({url:strURL})
}
function clearFilter() {
strURL = 'automation_templates.php?clear=1';
loadUrl({url:strURL})
}
function importTemplate() {
strURL = 'automation_templates.php?action=import';
loadUrl({url:strURL})
}
$(function() {
$('#refresh').click(function() {
applyFilter();
});
$('#clear').click(function() {
clearFilter();
});
$('#import').click(function() {
importTemplate();
});
$('#form_at').submit(function(event) {
event.preventDefault();
applyFilter();
});
});
</script>
</td>
</tr>
<?php
html_end_box();
/* form the 'where' clause for our main sql query */
if (get_request_var('filter') != '') {
$sql_where = 'WHERE (name LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR ' .
'sysName LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR ' .
'sysDescr LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR ' .
'sysOID LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ')';
} else {
$sql_where = '';
}
$total_rows = db_fetch_cell("SELECT COUNT(*)
FROM automation_templates AS at
LEFT JOIN host_template AS ht
ON ht.id=at.host_template
$sql_where");
$dts = db_fetch_assoc("SELECT at.*, ht.name
FROM automation_templates AS at
LEFT JOIN host_template AS ht
ON ht.id=at.host_template
$sql_where
ORDER BY sequence " .
' LIMIT ' . ($rows * (get_request_var('page') - 1)) . ',' . $rows);
$nav = html_nav_bar('automation_templates.php', MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 7, __('Templates'), 'page', 'main');
form_start('automation_templates.php', 'chk');
print $nav;
html_start_box('', '100%', '', '3', 'center', '');
$display_text = array(
array(
'display' => __('Template Name'),
'align' => 'left'
),
array(
'display' => __('Availability Method'),
'align' => 'left'
),
array(
'display' => __('System Description Match'),
'align' => 'left'
),
array(
'display' => __('System Name Match'),
'align' => 'left'
),
array(
'display' => __('System ObjectId Match'),
'align' => 'left'
)
);
if (read_config_option('drag_and_drop') == '') {
$display_text[] = array('display' => __('Order'), 'align' => 'center');
}
html_header_checkbox($display_text, false);
$i = 1;
$total_items = cacti_sizeof($dts);
if (cacti_sizeof($dts)) {
foreach ($dts as $dt) {
if ($dt['name'] == '') {
$name = __('Unknown Template');
} else {
$name = $dt['name'];
}
form_alternate_row('line' . $dt['id'], true);
form_selectable_cell(filter_value($name, get_request_var('filter'), 'automation_templates.php?action=edit&id=' . $dt['id']), $dt['id']);
form_selectable_cell($availability_options[$dt['availability_method']], $dt['id']);
form_selectable_cell(filter_value($dt['sysDescr'], get_request_var('filter')), $dt['id']);
form_selectable_cell(filter_value($dt['sysName'], get_request_var('filter')), $dt['id']);
form_selectable_cell(filter_value($dt['sysOid'], get_request_var('filter')), $dt['id']);
if (read_config_option('drag_and_drop') == '') {
$add_text = '';
if ($i < $total_items && $total_items > 1) {
$add_text .= '<a class="pic fa fa-caret-down moveArrow" href="' . html_escape('automation_templates.php?action=movedown&id=' . $dt['id']) . '" title="' . __esc('Move Down') . '"></a>';
} else {
$add_text .= '<span class="moveArrowNone"></span>';
}
if ($i > 1 && $i <= $total_items) {
$add_text .= '<a class="pic fa fa-caret-up moveArrow" href="' . html_escape('automation_templates.php?action=moveup&id=' . $dt['id']) . '" title="' . __esc('Move Up') . '"></a>';
} else {
$add_text .= '<span class="moveArrowNone"></span>';
}
form_selectable_cell($add_text, $dt['id'], '', 'center');
}
form_checkbox_cell($name, $dt['id']);
form_end_row();
$i++;
}
} else {
print "<tr class='tableRow'><td colspan='" . (cacti_sizeof($display_text) + 1) . "'><em>" . __('No Automation Device Templates Found') . "</em></td></tr>";
}
html_end_box(false);
if (cacti_sizeof($dts)) {
print $nav;
}
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($actions);
form_end();
?>
<script type='text/javascript'>
$(function() {
$('#automation_templates2_child').attr('id', 'template_ids');
$('img.action').click(function() {
strURL = $(this).attr('href');
loadUrl({url:strURL})
});
<?php if (read_config_option('drag_and_drop') == 'on') { ?>
$('#template_ids').find('tr:first').addClass('nodrag').addClass('nodrop');
$('#template_ids').tableDnD({
onDrop: function(table, row) {
loadUrl({url:'automation_templates.php?action=ajax_dnd&'+$.tableDnD.serialize()})
}
});
<?php } ?>
});
</script>
<?php
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/Cacti.git
git@gitee.com:mirrors/Cacti.git
mirrors
Cacti
Cacti
develop

搜索帮助