summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'scire/job.php')
-rw-r--r--scire/job.php118
1 files changed, 55 insertions, 63 deletions
diff --git a/scire/job.php b/scire/job.php
index 81a10a1..8adc957 100644
--- a/scire/job.php
+++ b/scire/job.php
@@ -10,68 +10,7 @@ add_leftbar($leftbar_menu, "««Cancel", "jobs.php");
$jobid = "";
-# Minutes array
-$minutes = array(
-# "*" => "Every minute",
-# "*/2" => "Every other minute",
- "*/5" => "Every five minutes",
- "*/10" => "Every ten minutes",
- "*/15" => "Every fifteen minutes",
- );
-foreach (range(0,59) as $val) {
- $minutes[(string)$val] = $val;
-}
-$minutes["other"] = "other";
-
-# Hours array
-$hours = array(
- "*" => "Every hour",
- "*/2" => "Every other hour");
-foreach (range(0,11) as $val) {
- $hours[(string)$val] = (string)$val . " A.M.";
-}
-$hours["12"] = "12 Noon";
-foreach (range(13,23) as $val) {
- $hours[(string)$val] = (string)($val-12) . " P.M.";
-}
-$hours["other"] = "other";
-
-# Days
-$days = array(
- "*" => "Every day",
- "*/2" => "Every other day");
-foreach (range(1,31) as $val) {
- $days[(string)$val] = (string)($val);
-}
-$days["other"] = "other";
-
-# Weekdays
-$weekdays = array(
- "*" => "Every weekday",
- "0" => "Sunday",
- "1" => "Monday",
- "2" => "Tuesday",
- "3" => "Wednesday",
- "4" => "Thursday",
- "5" => "Friday",
- "6" => "Saturday");
-$weekdays["other"] = "other";
-
-# Months
-$months = array("*" => "Every month",
- "1" => "January",
- "2" => "February",
- "3" => "March",
- "4" => "April",
- "5" => "May",
- "6" => "June",
- "7" => "July",
- "8" => "August",
- "9" => "October",
- "10" => "September",
- "11" => "November",
- "12" => "December");
-$months["other"] = "other";
+list($minutes,$hours,$days,$weekdays,$months) = get_cron_times();
function scheduleUIHelper($cronString) {
@@ -206,10 +145,63 @@ if ($_POST['delete_cancel']) {
header('Location: ' . $baseurl . 'jobs.php');
}
+########################################################
+################## MAIN SWITCH #########################
switch($_GET['Action']) {
case "create":
check_action_access("Add Job"); #Access check
add_leftbar($leftbar_menu, "««Cancel", "jobs.php");
+
+ 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);
+ $smarty->assign('dyn_tags', $matches[1]);
+ foreach ($matches[1] as $tag) {
+ $tag_values[$tag] = get_dyn_tag_value($_GET['scriptid'],$tag);
+ }
+ $smarty->assign('tag_values', $tag_values);
+
+ pre_var_dump($tag_values);
+ }
+
+ 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<br>Permname: $permname<br>";
+ 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('minutes', $minutes);
+ $smarty->assign('hours', $hours);
+ $smarty->assign('days', $days);
+ $smarty->assign('months', $months);
+ $smarty->assign('weekdays', $weekdays);
break;
case "edit":
@@ -273,7 +265,7 @@ switch($_GET['Action']) {
break;
}
-
+$smarty->assign('get', $_GET);
$smarty->assign('leftbar_menu', $leftbar_menu);
$smarty->assign('Action', $_GET['Action']);
$smarty->assign('status', $status);