Merge pull request #835 from laf/issue-711

Web UI for scheduling maintenance windows
This commit is contained in:
Daniel Preussker
2015-04-21 10:03:00 +00:00
32 changed files with 4210 additions and 1669 deletions
+18
View File
@@ -1154,3 +1154,21 @@ function set_curl_proxy($post)
curl_setopt($post, CURLOPT_PROXY, $config['callback_proxy']);
}
}
function target_to_id($target) {
if( $target[0].$target[1] == "g:" ) {
$target = "g".dbFetchCell('SELECT id FROM device_groups WHERE name = ?',array(substr($target,2)));
} else {
$target = dbFetchCell('SELECT device_id FROM devices WHERE hostname = ?',array($target));
}
return $target;
}
function id_to_target($id) {
if( $id[0] == "g" ) {
$id = 'g:'.dbFetchCell("SELECT name FROM device_groups WHERE id = ?",array(substr($id,1)));
} else {
$id = dbFetchCell("SELECT hostname FROM devices WHERE device_id = ?",array($id));
}
return $id;
}