assign('leftbar', "on"); $leftbar_menu = array(); add_leftbar($leftbar_menu, "««Cancel", "jobs.php"); $status = ""; ##################################################### #Deal with submitted forms. if ($_POST['ADD']) { if ($_POST['script']) { $script = get_scire_script($_POST['script']); if ($_POST['permission']) { $permission = $_POST['permission']; $permission = get_scire_permission_by_name($permission); $permission = $permission['permid']; # print "Permission is: $permission"; } else { $permission = $script['permission']; } if ($_POST['priority']) { $priority = $_POST['priority']; } else { $priority = $script['priority']; } } else { $status .= "ERROR: No script selected!"; } if ($_POST['description']) { $description = $_POST['description']; } else { $description = "No description provided."; } $pending = sizeof($_POST['clients']); if (!$status and ($pending or $_POST['clientgroups'])) { #We have a script and clients; $result = scire_add_job($_POST['script'], $priority, $_SESSION['userid'], $permission, $description, $pending, $_POST['clients'], $_POST['clientgroups']); if (!$result) { $status .= "Job successfully added."; } else { $status .= "Error occurred during job addition. $result"; } } } ######################################################## if ($_GET['scriptid']) { $_GET['scriptid'] = (int) $_GET['scriptid']; $script = get_scire_script($_GET['scriptid']); $smarty->assign('script', $script); print $script['script_data']; preg_match_all('/%%(.*?)%%/', $script['script_data'], $matches); # pre_var_dump($dyn_tag); # pre_var_dump($matches); } if ($_GET['clientid']) { $_GET['clientid'] = (int) $_GET['clientid']; $client = get_scire_client($_GET['clientid']); #$id = $acl->get_object_id("clients",$client['hostname'],'AXO' $smarty->assign('client', $client); } ######################################################## $permissions = array(); $all_permissions = $acl->get_objects(NULL, 1, 'ACO'); foreach ($all_permissions as $categoryname => $cat) { #print "Perm: $perm
Permname: $permname
"; if ($categoryname != $scire_ui_section) { foreach ($cat as $perm) { array_push($permissions, $perm); } } } $smarty->assign('perms', $permissions); #pre_var_dump($permissions); $smarty->assign('priorities', get_priorities()); $scripts = get_scire_scripts(); $smarty->assign('scripts', $scripts); $smarty->assign('cgroups', $acl->format_groups($acl->sort_groups('AXO'), TEXT)); $clients = get_scire_clients('hostname', 'asc'); $smarty->assign('clients', $clients); $smarty->assign('get', $_GET); $smarty->assign('leftbar_menu', $leftbar_menu); $smarty->assign('Action', $_GET['Action']); $smarty->assign('status', $status); $smarty->display('add_job.tpl'); #pre_var_dump($_POST); ?>