Edit Manage Job: remove double-title, top buttons, help only on the main job page
authorMathieu Lutfy <mathieu@symbiotic.coop>
Fri, 7 Jul 2023 14:55:03 +0000 (10:55 -0400)
committerMathieu Lutfy <mathieu@bidon.ca>
Fri, 7 Jul 2023 15:26:50 +0000 (11:26 -0400)
CRM/Admin/Form/Job.php
CRM/Admin/Page/Job.php
templates/CRM/Admin/Form/Job.tpl
templates/CRM/Admin/Page/Job.tpl

index d5d099417b46aa41ffbf1e9c08cb6d80236b3c68..1a95bf7d6144c425e6083c457ee2d87970a97017 100644 (file)
@@ -27,11 +27,32 @@ class CRM_Admin_Form_Job extends CRM_Admin_Form {
   public $submitOnce = TRUE;
 
   public function preProcess() {
-
     parent::preProcess();
     $this->setContext();
 
-    $this->setTitle(ts('Manage - Scheduled Jobs'));
+    if ($this->_action == CRM_Core_Action::DELETE) {
+      $this->setTitle(ts('Delete Scheduled Job'));
+    }
+    elseif ($this->_action == CRM_Core_Action::ADD) {
+      $this->setTitle(ts('New Scheduled Job'));
+    }
+    elseif ($this->_action == CRM_Core_Action::UPDATE) {
+      $this->setTitle(ts('Edit Scheduled Job'));
+    }
+    elseif ($this->_action == CRM_Core_Action::VIEW) {
+      $this->setTitle(ts('Execute Scheduled Job'));
+    }
+
+    CRM_Utils_System::appendBreadCrumb([
+      [
+        'title' => ts('Administer CiviCRM'),
+        'url' => CRM_Utils_System::url('civicrm/admin', 'reset=1'),
+      ],
+      [
+        'title' => ts('Scheduled Jobs'),
+        'url' => CRM_Utils_System::url('civicrm/admin/job', 'reset=1'),
+      ],
+    ]);
 
     if ($this->_id) {
       $refreshURL = CRM_Utils_System::url('civicrm/admin/job/edit',
index 72d9d3eed8acac51d1edf90e3912390282353158..abfa14bfbcba8796e9ae780d11de8dc080c69b33 100644 (file)
@@ -99,17 +99,13 @@ class CRM_Admin_Page_Job extends CRM_Core_Page_Basic {
    * Finally it calls the parent's run method.
    */
   public function run() {
-    // set title and breadcrumb
     CRM_Utils_System::setTitle(ts('Settings - Scheduled Jobs'));
-    $breadCrumb = [
+    CRM_Utils_System::appendBreadCrumb([
       [
-        'title' => ts('Scheduled Jobs'),
-        'url' => CRM_Utils_System::url('civicrm/admin',
-          'reset=1'
-        ),
+        'title' => ts('Administer CiviCRM'),
+        'url' => CRM_Utils_System::url('civicrm/admin', 'reset=1'),
       ],
-    ];
-    CRM_Utils_System::appendBreadCrumb($breadCrumb);
+    ]);
 
     $this->_id = CRM_Utils_Request::retrieve('id', 'String',
       $this, FALSE, 0
index 8cd1dd1d5dfcb5139c8917547ddc35f6afe7167f..f3e14eed7073d265d71181c55111595fe8d5ec19 100644 (file)
@@ -7,10 +7,8 @@
  | and copyright information, see https://civicrm.org/licensing       |
  +--------------------------------------------------------------------+
 *}
-{* This template is used for adding/configuring Scheduled Jobs.  *}
-<h3>{if $action eq 1}{ts}New Scheduled Job{/ts}{elseif $action eq 2}{ts}Edit Scheduled Job{/ts}{elseif $action eq 4}{ts}Execute Scheduled Job{/ts}{else}{ts}Delete Scheduled Job{/ts}{/if}</h3>
+{* Edit/Run Scheduled Jobs *}
 <div class="crm-block crm-form-block crm-job-form-block">
- <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
 
 {if $action eq 8}
   <div class="messages status no-popup">
         {ts 1=$jobName}Are you sure you would like to execute %1 job?{/ts}
   </div>
 {else}
+  <div class="help">
+    {capture assign=docUrlText}{ts}Job parameters and command line syntax documentation{/ts}{/capture}
+    {docURL page="user/initial-set-up/scheduled-jobs" text=$docUrlText}
+  </div>
   <table class="form-layout-compressed">
     <tr class="crm-job-form-block-name">
         <td class="label">{$form.name.label}</td><td>{$form.name.html}</td>
index 0030cffa10c0ab2b9cebc515d1fe2539aa5c5b09..902ce448e291ba8cb37884e5ce14ada04f9e4c34 100644 (file)
@@ -7,19 +7,18 @@
  | and copyright information, see https://civicrm.org/licensing       |
  +--------------------------------------------------------------------+
 *}
-{capture assign=docUrlText}{ts}(Job parameters and command line syntax documentation...){/ts}{/capture}
-{capture assign=runAllURL}{crmURL p='civicrm/admin/runjobs' q="reset=1"}{/capture}
-<div class="help">
-    {ts 1=$runAllURL}You can configure scheduled jobs (cron tasks) for your CiviCRM installation. For most sites, your system administrator should set up one or more 'cron' tasks to run the enabled jobs. However, you can also <a href="%1">run all scheduled jobs manually</a>, or run specific jobs from this screen (click 'more' and then 'Execute Now').{/ts} {docURL page="sysadmin/setup/jobs" text=$docUrlText}
-</div>
 
 {if $action eq 1 or $action eq 2 or $action eq 8 or $action eq 4}
    {include file="CRM/Admin/Form/Job.tpl"}
 {else}
-
-<div class="crm-content-block crm-block">
-{if $rows}
-
+  {capture assign=docUrlText}{ts}(How to setup cron on the command line...){/ts}{/capture}
+  {capture assign=runAllURL}{crmURL p='civicrm/admin/runjobs' q="reset=1"}{/capture}
+  <div class="help">
+    {ts}CiviCRM relies on a number of scheduled jobs that run automatically on a regular basis. These jobs keep data up-to-date and perform other important tasks.{/ts}
+    {ts 1=$runAllURL}For most sites, your system administrator should set up one or more 'cron' tasks to run the enabled jobs. You can also <a href="%1">run all scheduled jobs manually</a>, or run specific jobs from this screen.{/ts} {docURL page="sysadmin/setup/jobs" text=$docUrlText}
+  </div>
+  <div class="crm-content-block crm-block">
+  {if $rows}
       {if $action ne 1 and $action ne 2}
         <div class="action-link">
           {crmButton p='civicrm/admin/job/add' q="action=add&reset=1" id="newJob"  icon="plus-circle"}{ts}Add New Scheduled Job{/ts}{/crmButton}