summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPreston Cody <codeman@gentoo.org>2008-01-06 21:59:21 +0000
committerPreston Cody <codeman@gentoo.org>2008-01-06 21:59:21 +0000
commit2726871de34bf4ca3b31699935eac179c30f45f3 (patch)
treecd4d76e8f3b0f7bb77f972c17756fc20a73111a5
parentstatusid needs to be a part of the key to avoid (diff)
downloadscire-2726871de34bf4ca3b31699935eac179c30f45f3.tar.gz
scire-2726871de34bf4ca3b31699935eac179c30f45f3.tar.bz2
scire-2726871de34bf4ca3b31699935eac179c30f45f3.zip
adding recurring_jobs_clients to hold the information for recurring jobs.
svn path=/trunk/; revision=338
-rw-r--r--docs/scire.sql12
-rwxr-xr-xscire/.lib/DB_functions.php12
-rwxr-xr-xscire/.smarty/templates/add_job.tpl20
-rw-r--r--scire/add_job.php10
4 files changed, 45 insertions, 9 deletions
diff --git a/docs/scire.sql b/docs/scire.sql
index 047e9e9..6bd41ba 100644
--- a/docs/scire.sql
+++ b/docs/scire.sql
@@ -104,6 +104,18 @@ CREATE TABLE jobs_clients (
) ENGINE = MyISAM;
# Either clienid or groupid is required, if 1 is provided the other MUST be NULL
+DROP TABLE IF EXISTS recurring_jobs_clients;
+CREATE TABLE recurring_jobs_clients (
+ jobid INT NOT NULL,
+ clientid INT,
+ groupid INT,
+ PRIMARY KEY (jobid, clientid, groupid),
+ FOREIGN KEY (jobid) REFERENCES jobs.jobid,
+ FOREIGN KEY (groupid) REFERENCES groups.gropuid,
+ FOREIGN KEY (clientid) REFERENCES clients.clientid
+) ENGINE = MyISAM;
+# Either clienid or groupid is required, if 1 is provided the other MUST be NULL
+
DROP TABLE IF EXISTS job_conditions;
CREATE TABLE job_conditions (
jobid INT NOT NULL,
diff --git a/scire/.lib/DB_functions.php b/scire/.lib/DB_functions.php
index 7750708..b6b63ab 100755
--- a/scire/.lib/DB_functions.php
+++ b/scire/.lib/DB_functions.php
@@ -389,6 +389,12 @@ function scire_add_job($script, $priority, $creator, $permission, $description,
if (!$result) {
return $db->error;
}
+ if ($run_schedule != "") {
+ $result = $db->insert('recurring_jobs_clients', array('jobid' => $jobid, 'clientid' => $client));
+ if (!$result) {
+ return $db->error;
+ }
+ }
}
}
@@ -398,6 +404,12 @@ function scire_add_job($script, $priority, $creator, $permission, $description,
if (!$result) {
return $db->error;
}
+ if ($run_schedule != "") {
+ $result = $db->insert('recurring_jobs_clients', array('jobid' => $jobid, 'groupid' => $cgroup));
+ if (!$result) {
+ return $db->error;
+ }
+ }
}
}
return 0; #Success
diff --git a/scire/.smarty/templates/add_job.tpl b/scire/.smarty/templates/add_job.tpl
index 987bc3e..e652a40 100755
--- a/scire/.smarty/templates/add_job.tpl
+++ b/scire/.smarty/templates/add_job.tpl
@@ -132,12 +132,13 @@
</table>
<hr>
Job Description: <br><textarea name="description" rows="3" cols="40"></textarea><br>
-Recurring stuff here.<br>
+<hr>
+Recurring stuff here. <b>You need to select all of them to get it to save the schedule!</b><br>
<table>
<tr><td>Minute(s):<br>
<select multiple name=minute1 size=10>
-<option value=*> Every Minute
-<option value=*/2> Every Other Minute
+<!-- <option value=*> Every Minute
+<option value=*/2> Every Other Minute -->
<option value=*/5> Every Five Minutes
<option value=*/10> Every Ten Minutes
<option value=*/15> Every Fifteen Minutes
@@ -315,11 +316,20 @@ Recurring stuff here.<br>
</select>
</td></tr>
<tr><td>
-<label for="validity_period">Validity Period: </label><input type="text" name="validity_period" />
+<hr>
+<label for="validity_period">Validity Period (in seconds?): </label><input type="text" name="validity_period" />
</td></tr>
+
+<tr><td>
+<label for="deploy_time">Start time: <B>CODE ME</B</label>
+</td>
+<td>
+<label for="expiration_time">End time: <B>CODE ME</B</label>
+</td>
+</tr>
</table>
<hr>
-Job dependency stuff here.<br>
+Job dependency stuff here.<B>CODE ME</B><br>
Set notification email address: <input type="radio" name="notify_addr" value="{$useremail}">{$useremail}</input><input type="radio" name="notify_addr" value="new"><input type="text" name="notify_new"></input>
<input type="submit" name="ADD" value="ADD JOB!!!">
</form>
diff --git a/scire/add_job.php b/scire/add_job.php
index d352401..a5266e0 100644
--- a/scire/add_job.php
+++ b/scire/add_job.php
@@ -33,9 +33,10 @@ if ($_POST['ADD']) {
} else {
$description = "No description provided.";
}
- $pending = sizeof($_POST['clients']);
+ $pending = sizeof($_POST['clients']) + sizeof($_POST['clientgroups']);
+
if (!$status and ($pending or $_POST['clientgroups'])) { #We have a script and clients;
- # Get the schedule!
+ # Get the schedule! All fields are required or else you're SOL
$scheduleComplete = $_POST["minute1"] and $_POST["hour1"] and
$_POST["day1"] and $_POST["month1"] and $_POST["weekday1"];
if ($scheduleComplete) {
@@ -44,8 +45,9 @@ if ($_POST['ADD']) {
} else {
$str = "";
}
-
- #$dependency = 1;
+# pre_var_dump($_POST);
+# pre_var_dump($scheduleComplete);
+ pre_var_dump($str);
try {
$result = scire_add_job($_POST['script'], $priority, $_SESSION['userid'], $permission, $description, $pending, $_POST['clients'], $_POST['clientgroups'], $dependency, $str, $_POST['validity_period']);