/* ua_select.c */
STORE *select_storage_resource(UAContext *ua);
JOB *select_job_resource(UAContext *ua);
+JOB *select_enable_disable_job_resource(UAContext *ua, bool enable);
JOB *select_restore_job_resource(UAContext *ua);
CLIENT *select_client_resource(UAContext *ua);
FILESET *select_fileset_resource(UAContext *ua);
i = find_arg_with_value(ua, NT_("job"));
if (i < 0) {
- job = select_job_resource(ua);
+ job = select_enable_disable_job_resource(ua, setting);
if (!job) {
return;
}
return 1;
}
-
+/*
+ * Enter with Resources locked
+ */
+static void show_disabled_jobs(UAContext *ua)
+{
+ JOB *job;
+ bool first = true;
+ foreach_res(job, R_JOB) {
+ if (!acl_access_ok(ua, Job_ACL, job->name())) {
+ continue;
+ }
+ if (!job->enabled) {
+ if (first) {
+ first = false;
+ ua->send_msg(_("Disabled Jobs:\n"));
+ }
+ ua->send_msg(" %s\n", job->name());
+ }
+ }
+ if (first) {
+ ua->send_msg(_("No disabled Jobs.\n"));
+ }
+}
struct showstruct {const char *res_name; int type;};
static struct showstruct reses[] = {
* show all
* show <resource-keyword-name> e.g. show directors
* show <resource-keyword-name>=<name> e.g. show director=HeadMan
+ * show disabled shows disabled jobs
*
*/
int show_cmd(UAContext *ua, const char *cmd)
LockRes();
for (i=1; i<ua->argc; i++) {
+ if (strcasecmp(ua->argk[i], _("disabled")) == 0) {
+ show_disabled_jobs(ua);
+ goto bail_out;
+ }
type = 0;
res_name = ua->argk[i];
if (!ua->argv[i]) { /* was a name given? */
}
+/*
+ * Select a job to enable or disable
+ */
+JOB *select_enable_disable_job_resource(UAContext *ua, bool enable)
+{
+ char name[MAX_NAME_LENGTH];
+ JOB *job;
+
+ LockRes();
+ start_prompt(ua, _("The defined Job resources are:\n"));
+ foreach_res(job, R_JOB) {
+ if (!acl_access_ok(ua, Job_ACL, job->name())) {
+ continue;
+ }
+ if (job->enabled == enable) { /* Already enabled/disabled? */
+ continue; /* yes, skip */
+ }
+ add_prompt(ua, job->name());
+ }
+ UnlockRes();
+ if (do_prompt(ua, _("Job"), _("Select Job resource"), name, sizeof(name)) < 0) {
+ return NULL;
+ }
+ job = (JOB *)GetResWithName(R_JOB, name);
+ return job;
+}
+
/*
* Select a Job resource from prompt list
*/
General:
+30Jul09
+kes Add 'show disabled' command that lists the disabled jobs.
+kes Modify enable/disable commands to show only appropriate Jobs.
29Jul09
kes Add ACL check for client in estimate commande
ebl Change time_t by utime_t in accurate function