Browse Source

fixes for bugs 1 and 2 - notification templates not accessed correctly

sirjeff 1 month ago
parent
commit
ac788ab523

+ 6 - 0
.gitignore

@@ -0,0 +1,6 @@
+
+.git/
+
+inf.db
+
+Template/notification/

+ 75 - 51
Controller/TemplateController.php

@@ -14,11 +14,11 @@ class TemplateController extends BaseController {
   * Show all the available templates.
   * Show all the available templates.
   */
   */
   public function show() {
   public function show() {
-        $templates = $this->getEditableTemplates();
-        $missingTemplates = array_diff($this->getCoreTemplates(), $this->getPluginTemplates());
-        $extraTemplates = array_diff($this->getPluginTemplates(), $this->getCoreTemplates());
-        $modifiedStatus = $this->getModifiedStatus();
-
+    $templates = $this->getEditableTemplates();
+    $missingTemplates = array_diff($this->getCoreTemplates(), $this->getPluginTemplates());
+    $extraTemplates = array_diff($this->getPluginTemplates(), $this->getCoreTemplates());
+    $modifiedStatus = $this->getModifiedStatus();
+    
     $this->response->html($this->helper->layout->config("OMITemplateModder:config/index", [
     $this->response->html($this->helper->layout->config("OMITemplateModder:config/index", [
       "title" => t("OMI - Notification Template Modder"),
       "title" => t("OMI - Notification Template Modder"),
       "templates" => $templates,
       "templates" => $templates,
@@ -35,7 +35,7 @@ class TemplateController extends BaseController {
   */
   */
   private function getEditableTemplates() {
   private function getEditableTemplates() {
     $templates = [];
     $templates = [];
-    $templateDir = ETM_PLUGIN_ROOT_DIR . "/Template/notification";
+    $templateDir = \ETM_PLUGIN_ROOT_DIR . "/Template/notification";
     
     
     foreach (glob($templateDir . "/*.php") as $filename) {
     foreach (glob($templateDir . "/*.php") as $filename) {
       $templateName = basename($filename, ".php");
       $templateName = basename($filename, ".php");
@@ -45,6 +45,7 @@ class TemplateController extends BaseController {
     return $templates;
     return $templates;
   }
   }
   
   
+  
   /**
   /**
   * Get a list of core notification templates.
   * Get a list of core notification templates.
   *
   *
@@ -52,8 +53,7 @@ class TemplateController extends BaseController {
   */
   */
   private function getCoreTemplates() {
   private function getCoreTemplates() {
     $templates = [];
     $templates = [];
-    // Use the new custom constant defined in Plugin.php
-    $templateDir = KB_APP_DIR . "/Template/notification";
+    $templateDir = \KB_APP_DIR . "/Template/notification";
     
     
     foreach (glob($templateDir . "/*.php") as $filename) {
     foreach (glob($templateDir . "/*.php") as $filename) {
       $templates[] = basename($filename, ".php");
       $templates[] = basename($filename, ".php");
@@ -69,7 +69,7 @@ class TemplateController extends BaseController {
   */
   */
   private function getPluginTemplates() {
   private function getPluginTemplates() {
     $templates = [];
     $templates = [];
-    $templateDir = ETM_PLUGIN_ROOT_DIR . "/Template/notification";
+    $templateDir = \ETM_PLUGIN_ROOT_DIR . "/Template/notification";
     
     
     foreach (glob($templateDir . "/*.php") as $filename) {
     foreach (glob($templateDir . "/*.php") as $filename) {
       $templates[] = basename($filename, ".php");
       $templates[] = basename($filename, ".php");
@@ -78,45 +78,69 @@ class TemplateController extends BaseController {
     return $templates;
     return $templates;
   }
   }
   
   
-    /**
-     * Compares core and plugin templates by file content to check for modifications.
-     *
-     * @return array
-     */
-    private function getModifiedStatus()
-    {
-        $modified = [];
-        $pluginTemplateDir = ETM_PLUGIN_ROOT_DIR . '/Template/notification';
-        $coreTemplateDir = KB_APP_DIR . '/Template/notification';
-
-        foreach (glob($pluginTemplateDir . '/*.php') as $filename) {
-            $templateName = basename($filename);
-            $pluginFile = $pluginTemplateDir . '/' . $templateName;
-            $coreFile = $coreTemplateDir . '/' . $templateName;
-
-            // Only compare if the core file exists
-            if (file_exists($coreFile)) {
-                $pluginContent = file_get_contents($pluginFile);
-                $coreContent = file_get_contents($coreFile);
-                
-                // Compare the file contents
-                if ($pluginContent !== $coreContent) {
-                    $modified[$templateName] = true;
-                }
-            }
+  /**
+  * Compares core and plugin templates by file content to check for modifications.
+  *
+  * @return array
+  */
+  private function getModifiedStatus() {
+    $modified = [];
+    $pluginTemplateDir = \ETM_PLUGIN_ROOT_DIR . "/Template/notification";
+    $coreTemplateDir = \KB_APP_DIR . "/Template/notification";
+    
+    foreach (glob($pluginTemplateDir . "/*.php") as $filename) {
+      $templateName = basename($filename);
+      $pluginFile = $pluginTemplateDir . "/" . $templateName;
+      $coreFile = $coreTemplateDir . "/" . $templateName;
+      
+      // Only compare if the core file exists
+      if (file_exists($coreFile)) {
+        $pluginContent = file_get_contents($pluginFile);
+        $coreContent = file_get_contents($coreFile);
+        
+        // Compare the file contents
+        if ($pluginContent !== $coreContent) {
+          $modified[$templateName] = true;
         }
         }
-        return $modified;
+      }
+    }
+    return $modified;
+  }
+  
+  /**
+  * Create a missing template from the core version.
+  */
+  public function create() {
+    $templateName = $this->request->getStringParam("template_name");
+    
+    $coreTemplateFile = \KB_APP_DIR . "/Template/notification/" . $templateName . ".php";
+    $pluginTemplateFile = \ETM_PLUGIN_ROOT_DIR . "/Template/notification/" . $templateName . ".php";
+    
+    if (file_exists($coreTemplateFile)) {
+      if (!file_exists(dirname($pluginTemplateFile))) {
+        mkdir(dirname($pluginTemplateFile), 0755, true);
+      }
+      if (copy($coreTemplateFile, $pluginTemplateFile)) {
+        $this->flash->success(t("Template created successfully!"));
+      } else {
+        $this->flash->failure(t("Unable to create template. Check folder permissions."));
+      }
+    } else {
+      $this->flash->failure(t("Core template not found."));
     }
     }
+    
+    return $this->response->redirect($this->helper->url->to("TemplateController", "show", ["plugin" => "OMITemplateModder"]));
+  }
   
   
   /**
   /**
-   * Show the form to edit a template
-   */
+  * Show the form to edit a template
+  */
   public function edit() {
   public function edit() {
     $templateIndex = $this->request->getIntegerParam("template_index");
     $templateIndex = $this->request->getIntegerParam("template_index");
     $templates = $this->getEditableTemplates();
     $templates = $this->getEditableTemplates();
     
     
     if (!isset($templates[$templateIndex])) {
     if (!isset($templates[$templateIndex])) {
-      $this->flash->failure(t("Template not found!"));
+      $this->flash->failure(t("Template not found."));
       return $this->response->redirect($this->helper->url->to("TemplateController", "show", ["plugin" => "OMITemplateModder"]));
       return $this->response->redirect($this->helper->url->to("TemplateController", "show", ["plugin" => "OMITemplateModder"]));
     }
     }
     
     
@@ -124,7 +148,7 @@ class TemplateController extends BaseController {
     $templatePath = $this->getTemplatePath($templateName);
     $templatePath = $this->getTemplatePath($templateName);
     
     
     if (!file_exists($templatePath)) {
     if (!file_exists($templatePath)) {
-      $this->flash->failure(t("Template file not found!"));
+      $this->flash->failure(t("Template file not found."));
       return $this->response->redirect($this->helper->url->to("TemplateController", "show", ["plugin" => "OMITemplateModder"]));
       return $this->response->redirect($this->helper->url->to("TemplateController", "show", ["plugin" => "OMITemplateModder"]));
     }
     }
     
     
@@ -134,22 +158,22 @@ class TemplateController extends BaseController {
     $this->response->html($this->helper->layout->config("OMITemplateModder:config/edit", [
     $this->response->html($this->helper->layout->config("OMITemplateModder:config/edit", [
       "title" => t("OMI - Notification Template Modder"),
       "title" => t("OMI - Notification Template Modder"),
       "subtitle" => t("Edit Template: %s", $templateName),
       "subtitle" => t("Edit Template: %s", $templateName),
-      "templateName" => $templateName,
-      "templateContent" => htmlspecialchars($templateContent),
-      "templateIndex" => $templateIndex // Pass the index for the form action
+      "template_name" => $templateName,
+      "template_content" => htmlspecialchars($templateContent),
+      "template_index" => $templateIndex // Pass the index for the form action
     ]));
     ]));
   }
   }
   
   
   /**
   /**
-   * Save the edited template
-   */
+  * Save the edited template
+  */
   public function save() {
   public function save() {
     
     
     $templateIndex = $this->request->getIntegerParam("template_index");
     $templateIndex = $this->request->getIntegerParam("template_index");
     $templates = $this->getEditableTemplates();
     $templates = $this->getEditableTemplates();
     
     
     if (!isset($templates[$templateIndex])) {
     if (!isset($templates[$templateIndex])) {
-      $this->flash->failure(t("Template not found! Check your Kanboard version is compatible with this plugin."));
+      $this->flash->failure(t("Template not found. Check your Kanboard version is compatible with this plugin."));
       return $this->response->redirect($this->helper->url->to("TemplateController", "show", ["plugin" => "OMITemplateModder"]));
       return $this->response->redirect($this->helper->url->to("TemplateController", "show", ["plugin" => "OMITemplateModder"]));
     }
     }
     
     
@@ -177,11 +201,11 @@ class TemplateController extends BaseController {
   }
   }
   
   
   /**
   /**
-   * Get the full path to a template file
-   *
-   * @param string $templateName
-   * @return string
-   */
+  * Get the full path to a template file
+  *
+  * @param string $templateName
+  * @return string
+  */
   private function getTemplatePath($templateName) {
   private function getTemplatePath($templateName) {
     return \ETM_PLUGIN_ROOT_DIR . "/Template/" . $templateName . ".php";
     return \ETM_PLUGIN_ROOT_DIR . "/Template/" . $templateName . ".php";
   }
   }

+ 8 - 7
Plugin.php

@@ -31,12 +31,12 @@ class Plugin extends Base {
     $this->route->addRoute("/settings/template_modder/edit/:template_index", "TemplateController", "edit", "OMITemplateModder");
     $this->route->addRoute("/settings/template_modder/edit/:template_index", "TemplateController", "edit", "OMITemplateModder");
     $this->route->addRoute("/settings/template_modder/save/:template_index", "TemplateController", "save", "OMITemplateModder");
     $this->route->addRoute("/settings/template_modder/save/:template_index", "TemplateController", "save", "OMITemplateModder");
     
     
-     // loop through all notification templates and registers them (that exist in this plugin dir!)
-     $templateDir = ETM_PLUGIN_ROOT_DIR . "/Template/notification";
-     foreach (glob($templateDir . "/*.php") as $filename) {
-       $templateName = basename($filename, ".php");
-       $this->template->setTemplateOverride("notification/" . $templateName, "EmailTemplateModder:notification/" . $templateName);
-     }
+    // Loop through all notification templates and register them (that exist in this plugin dir!)
+    $templateDir = ETM_PLUGIN_ROOT_DIR . "/Template/notification";
+    foreach (glob($templateDir . "/*.php") as $filename) {
+      $templateName = basename($filename, ".php");
+      $this->template->setTemplateOverride("notification/" . $templateName, "OMITemplateModder:notification/" . $templateName);
+    }
   }
   }
   
   
   public function getPluginName() {
   public function getPluginName() {
@@ -52,7 +52,7 @@ class Plugin extends Base {
   }
   }
   
   
   public function getPluginVersion() {
   public function getPluginVersion() {
-    return "1.0.3";
+    return "1.0.4";
   }
   }
   
   
   public function getPluginHomepage() {
   public function getPluginHomepage() {
@@ -63,5 +63,6 @@ class Plugin extends Base {
     return ">=1.2";
     return ">=1.2";
   }
   }
 }
 }
+
 #-
 #-
 #plugins/OMITemplateModder/Plugin.php
 #plugins/OMITemplateModder/Plugin.php

+ 14 - 3
README.md

@@ -21,7 +21,7 @@ All Kanboard plugins are found in the `plugins` directory. In general you just p
 
 
 In a terminal window ( or command for Windoze ) browse/cd to your Kanboard `plugins` directory and issue this command  
 In a terminal window ( or command for Windoze ) browse/cd to your Kanboard `plugins` directory and issue this command  
 
 
-#### git clone
+#### git clone ( best method )
 
 
 `git clone https://vcs.nz/ominz/OMITemplateModder.git`  
 `git clone https://vcs.nz/ominz/OMITemplateModder.git`  
 
 
@@ -51,13 +51,24 @@ Download either zip file :
 
 
 and uncompress/unzip/untar into your Kanboard `plugins` directory  
 and uncompress/unzip/untar into your Kanboard `plugins` directory  
 
 
+### Updating
+
+The only trick to updating is to make sure you don't overwrite your modified templates, under `Templates/notification`  
+Best way is to copy or move the directory away, and then move or copy it back again after updating.  
+
+If you installed the plugin via `git clone` then you can just do `git pull` which will only get the updated code, and your templates will not be touched.  
+
 ## How to use
 ## How to use
 
 
 You will see a new link appear under /settings : "Notification Templates"  
 You will see a new link appear under /settings : "Notification Templates"  
 
 
-Follow this link and you should see a list of available templates that you can modify.  
+To begin with there should be no templates to modify. 
+Instead you should see a list of templates that you can add, from your core app. Each with a "Create from Core" link. 
+Click this link to add the template to the plugin so it can be modified.  
+
+You can always copy files manually from the core app directory `app/Template/notification` into the plugins corresponding directory `Template/notification`.
+
 This plugin will alert you to any templates missing or any extras. This may occur if the Kanboard version was different to the one this plugin was built on (1.2).  
 This plugin will alert you to any templates missing or any extras. This may occur if the Kanboard version was different to the one this plugin was built on (1.2).  
-Easy to fix, just make sure the files in your Kanboard `app/Template/notification` directory match the ones in the plugin `Template/notification` directory.  
 
 
 This plugin will also show a red asterisk on the template files that are different ( have been modified ) to the ones in the app.  
 This plugin will also show a red asterisk on the template files that are different ( have been modified ) to the ones in the app.  
 
 

+ 6 - 12
Template/config/edit.php

@@ -1,26 +1,20 @@
+
 <div class="page-header">
 <div class="page-header">
   <h2><?= $title ?></h2>
   <h2><?= $title ?></h2>
   <h3><?= $subtitle ?></h3>
   <h3><?= $subtitle ?></h3>
 </div>
 </div>
 
 
-<form method="post" action="<?= $this->url->href('TemplateController', 'save', ['plugin' => 'OMITemplateModder', 'template_index' => $templateIndex]) ?>">
+<form method="post" action="<?= $this->url->href('TemplateController', 'save', ['plugin' => 'OMITemplateModder', 'template_index' => $template_index]) ?>">
   <?= $this->form->csrf() ?>
   <?= $this->form->csrf() ?>
   
   
   <div class="form-group">
   <div class="form-group">
-    <label for="form-content">
-      <?= t('Template Content') ?>
-      
-    </label>
-    <textarea name="content" id="form-content" class="form-textarea" rows="20" style="width:100%; font-family: monospace;"><?= $templateContent ?></textarea>
+    <label for="form-content">Template Content</label>
+    <textarea name="content" id="form-content" class="form-textarea" rows="20" style="width:100%;font-family:monospace;"><?= $template_content ?></textarea>
   </div>
   </div>
   
   
   <div class="form-actions">
   <div class="form-actions">
-    <button type="submit" class="btn btn-blue">
-      <?= t("Save") ?>
-      
-    </button>
+    <button type="submit" class="btn btn-blue">Save</button>
     <?= $this->url->link(t("Cancel"), "TemplateController", "show", ["plugin" => "OMITemplateModder"], false, "btn") ?>
     <?= $this->url->link(t("Cancel"), "TemplateController", "show", ["plugin" => "OMITemplateModder"], false, "btn") ?>
-    
+  
   </div>
   </div>
 </form>
 </form>
-

+ 31 - 18
Template/config/index.php

@@ -1,44 +1,57 @@
+
+<style>
+  a.smr {font-size:0.8em;}
+</style>
+
 <div class="page-header">
 <div class="page-header">
   <h2><?= $title ?></h2>
   <h2><?= $title ?></h2>
 </div>
 </div>
 
 
 <p style="margin-bottom:1em;">
 <p style="margin-bottom:1em;">
-  <span style="color:red;font-weight:bold;">*</span><i>Indicates a template that has been modified from the core version.</i>
+ <i><span style="color:red;font-weight:bold;">*</span> <?= t('Indicates a template that has been modified from the core version.') ?></i>
 </p>
 </p>
 
 
 <?php /* Display notices about missing/extra templates */ ?>
 <?php /* Display notices about missing/extra templates */ ?>
 <?php if (!empty($missing_templates)): ?>
 <?php if (!empty($missing_templates)): ?>
 <div class="alert alert-info">
 <div class="alert alert-info">
-  <h4 style="margin-top: 0;"><?= t("Missing Templates") ?></h4>
-  <p><?= t('The following core notification templates are not available in your plugin. To use them, copy the files from "%s" to "%s".', 'app/Template/notification/', 'plugins/OMITemplateModder/Template/notification/') ?></p>
-  <ul style="list-style-type: disc; margin-left: 20px;">
-    <?php foreach ($missing_templates as $template): ?><li><?= $template ?>.php</li><?php endforeach ?>
+  <h4 style="margin-top:0;">Missing Templates</h4>
+  <p>The following core notification templates are not available in your plugin. You can create them from the core version using the link below.</p>
+  <ul style="list-style-type:disc;margin-left:20px;">
+
+    <?php foreach ($missing_templates as $template): ?><li style="margin-bottom:5px;"><?= $template ?>.php <?= $this->url->link(t('Create from Core'), 'TemplateController', 'create', ['plugin' => 'OMITemplateModder', 'template_name' => $template], false, 'btn btn-blue btn-xs smr') ?></li>
+    <?php endforeach ?>  
   </ul>
   </ul>
 </div>
 </div>
 <?php endif ?>
 <?php endif ?>
 
 
 <?php if (!empty($extra_templates)): ?>
 <?php if (!empty($extra_templates)): ?>
 <div class="alert alert-warning">
 <div class="alert alert-warning">
-  <h4 style="margin-top: 0;"><?= t("Extra Templates") ?></h4>
-  <p><?= t('The following templates exist in your plugin but not in the core application. They will be ignored during the override process.') ?></p>
-  <ul style="list-style-type: disc; margin-left: 20px;">
-    <?php foreach ($extra_templates as $template): ?><li><?= $template ?>.php</li><?php endforeach ?>
+  <h4 style="margin-top:0;">Extra Templates</h4>
+  <p>The following templates exist in your plugin but not in the core application. They will be ignored during the override process.</p>
+  <ul style="list-style-type:disc;margin-left:20px;">
+    
+    <?php foreach ($extra_templates as $template): ?><li><?= $template ?>.php</li>
+    <?php endforeach ?>
+    
   </ul>
   </ul>
 </div>
 </div>
 <?php endif ?>
 <?php endif ?>
 
 
-<ul class="listing"><?php foreach ($templates as $index => $template): ?>
-  
+  <ul class="listing">
+  <?php foreach ($templates as $index => $template): ?>
   <li>
   <li>
     <?php
     <?php
-      $templateName = basename($template);
-      $isModified = isset($modified_status[$templateName . ".php"]);
-    ?><?= $this->url->link($template, 'TemplateController', 'edit', ['plugin' => 'OMITemplateModder', 'template_index' => $index]) ?>
-    <?php if ($isModified): ?><span style="color:red;font-weight:bold;">*</span><?php endif ?>
+        $templateName = basename($template);
+        $isModified = isset($modified_status[$templateName . '.php']);
+    ?>
+    <?= $this->url->link($template, 'TemplateController', 'edit', ['plugin' => 'OMITemplateModder', 'template_index' => $index]) ?><?php if ($isModified): ?><span style="color:red;font-weight:bold;">*</span><?php endif ?>
   
   
-  </li>
-<?php endforeach ?></ul>
+    </li>
+  <?php endforeach ?>
+</ul>
 
 
 <p style="margin-top:2em;">
 <p style="margin-top:2em;">
-  <i>To add or remove templates, simply copy or delete the corresponding files from this plugin's Templates/notification directory. They will automatically be registered for use.</i>
+  <i>To add or remove templates, simply copy or delete the corresponding files from this plugin's Templates/notification directory.
+  <br>They will automatically be registered for use.
+  <br>Alternatively this plugin will show which templates are not listed and give you the option to add them [create from core].</i>
 </p>
 </p>

+ 0 - 15
Template/notification/comment_create.php

@@ -1,15 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<?php if (! empty($comment['username'])): ?>
-    <h3><?= t('New comment posted by %s', $comment['name'] ?: $comment['username']) ?></h3>
-<?php else: ?>
-    <h3><?= t('New comment') ?></h3>
-<?php endif ?>
-
-<?= $this->text->markdown($comment['comment'], true) ?>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 11
Template/notification/comment_delete.php

@@ -1,11 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<h3><?= t('Comment removed') ?></h3>
-
-<?= $this->text->markdown($comment['comment'], true) ?>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 11
Template/notification/comment_update.php

@@ -1,11 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<h3><?= t('Comment updated') ?></h3>
-
-<?= $this->text->markdown($comment['comment'], true) ?>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 11
Template/notification/comment_user_mention.php

@@ -1,11 +0,0 @@
-<html>
-<body>
-<h2><?= t('You were mentioned in a comment on the task #%d', $task['id']) ?></h2>
-
-<p><?= $this->text->e($task['title']) ?></p>
-
-<?= $this->text->markdown($comment['comment'], true) ?>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 9
Template/notification/footer.php

@@ -1,9 +0,0 @@
-<hr/>
-Kanboard
-
-<?php if ($this->app->config('application_url') != ''): ?>
-    <?php if (isset($task['id'])): ?>
-        - <?= $this->url->absoluteLink(t('view the task on Kanboard'), 'TaskViewController', 'show', array('task_id' => $task['id'])) ?>
-    <?php endif ?>
-    - <?= $this->url->absoluteLink(t('view the board on Kanboard'), 'BoardViewController', 'show', array('project_id' => $task['project_id'])) ?>
-<?php endif ?>

+ 0 - 21
Template/notification/subtask_create.php

@@ -1,21 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<h3><?= t('New sub-task') ?></h3>
-
-<ul>
-    <li><?= t('Title:') ?> <?= $this->text->e($subtask['title']) ?></li>
-    <li><?= t('Status:') ?> <?= t($subtask['status_name']) ?></li>
-    <li><?= t('Assignee:') ?> <?= $this->text->e($subtask['name'] ?: $subtask['username'] ?: '?') ?></li>
-    <?php if (! empty($subtask['time_estimated'])): ?>
-        <li>
-            <?= t('Time tracking:') ?>
-            <?= t('%sh estimated', n($subtask['time_estimated'])) ?>
-        </li>
-    <?php endif ?>
-</ul>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 15
Template/notification/subtask_delete.php

@@ -1,15 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<h3><?= t('Subtask removed') ?></h3>
-
-<ul>
-    <li><?= t('Title:') ?> <?= $this->text->e($subtask['title']) ?></li>
-    <li><?= t('Status:') ?> <?= t($subtask['status_name']) ?></li>
-    <li><?= t('Assignee:') ?> <?= $this->text->e($subtask['name'] ?: $subtask['username'] ?: '?') ?></li>
-</ul>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 27
Template/notification/subtask_update.php

@@ -1,27 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<h3><?= t('Sub-task updated') ?></h3>
-
-<ul>
-    <li><?= t('Title:') ?> <?= $this->text->e($subtask['title']) ?></li>
-    <li><?= t('Status:') ?> <?= t($subtask['status_name']) ?></li>
-    <li><?= t('Assignee:') ?> <?= $this->text->e($subtask['name'] ?: $subtask['username'] ?: '?') ?></li>
-    <?php if (! empty($subtask['time_spent']) || ! empty($subtask['time_estimated'])): ?>
-    <li>
-        <?= t('Time tracking:') ?>
-        <?php if (! empty($subtask['time_spent'])): ?>
-            <?= t('%sh spent', n($subtask['time_spent'])) ?>
-        <?php endif ?>
-        <?php if (! empty($subtask['time_spent']) && ! empty($subtask['time_estimated'])): ?>/<?php endif ?>
-        <?php if (! empty($subtask['time_estimated'])): ?>
-            <?= t('%sh estimated', n($subtask['time_estimated'])) ?>
-        <?php endif ?>
-    </li>
-    <?php endif ?>
-</ul>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 24
Template/notification/task_assignee_change.php

@@ -1,24 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<ul>
-    <li>
-        <strong>
-        <?php if ($task['assignee_username']): ?>
-            <?= t('Assigned to %s', $task['assignee_name'] ?: $task['assignee_username']) ?>
-        <?php else: ?>
-            <?= t('There is nobody assigned') ?>
-        <?php endif ?>
-        </strong>
-    </li>
-</ul>
-
-<?php if (! empty($task['description'])): ?>
-    <h2><?= t('Description') ?></h2>
-    <?= $this->text->markdown($task['description'], true) ?: t('There is no description.') ?>
-<?php endif ?>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 9
Template/notification/task_close.php

@@ -1,9 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<p><?= t('The task #%d has been closed.', $task['id']) ?></p>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 47
Template/notification/task_create.php

@@ -1,47 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<ul>
-    <li>
-        <?= t('Created:').' '.$this->dt->datetime($task['date_creation']) ?>
-    </li>
-    <?php if ($task['date_due']): ?>
-    <li>
-        <strong><?= t('Due date:').' '.$this->dt->datetime($task['date_due']) ?></strong>
-    </li>
-    <?php endif ?>
-    <?php if (! empty($task['creator_username'])): ?>
-    <li>
-        <?= t('Created by %s', $task['creator_name'] ?: $task['creator_username']) ?>
-    </li>
-    <?php endif ?>
-    <li>
-        <strong>
-        <?php if (! empty($task['assignee_username'])): ?>
-            <?= t('Assigned to %s', $task['assignee_name'] ?: $task['assignee_username']) ?>
-        <?php else: ?>
-            <?= t('There is nobody assigned') ?>
-        <?php endif ?>
-        </strong>
-    </li>
-    <li>
-        <?= t('Column on the board:') ?>
-        <strong><?= $this->text->e($task['column_title']) ?></strong>
-    </li>
-    <li><?= t('Task position:').' '.$this->text->e($task['position']) ?></li>
-    <?php if (! empty($task['category_name'])): ?>
-    <li>
-        <?= t('Category:') ?> <strong><?= $this->text->e($task['category_name']) ?></strong>
-    </li>
-    <?php endif ?>
-</ul>
-
-<?php if (! empty($task['description'])): ?>
-    <h2><?= t('Description') ?></h2>
-    <?= $this->text->markdown($task['description'], true) ?>
-<?php endif ?>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 9
Template/notification/task_file_create.php

@@ -1,9 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<p><?= t('New attachment added "%s"', $file['name']) ?></p>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 9
Template/notification/task_file_destroy.php

@@ -1,9 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<p><?= t('Attachment removed "%s"', $file['name']) ?></p>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 13
Template/notification/task_internal_link_create_update.php

@@ -1,13 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<p>
-    <?= e('This task is now linked to the task %s with the relation "%s"',
-          $this->url->absoluteLink(t('#%d', $task_link['opposite_task_id']), 'TaskViewController', 'show', array('task_id' => $task_link['opposite_task_id'])),
-          e($task_link['label'])) ?>
-</p>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 13
Template/notification/task_internal_link_delete.php

@@ -1,13 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<p>
-    <?= e('The link with the relation "%s" to the task %s has been removed',
-          e($task_link['label']),
-          $this->url->absoluteLink(t('#%d', $task_link['opposite_task_id']), 'TaskViewController', 'show', array('task_id' => $task_link['opposite_task_id']))) ?>
-</p>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 15
Template/notification/task_move_column.php

@@ -1,15 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<ul>
-    <li>
-        <?= t('Column on the board:') ?>
-        <strong><?= $this->text->e($task['column_title']) ?></strong>
-    </li>
-    <li><?= t('Task position:').' '.$this->text->e($task['position']) ?></li>
-</ul>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 15
Template/notification/task_move_position.php

@@ -1,15 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<ul>
-    <li>
-        <?= t('Column on the board:') ?>
-        <strong><?= $this->text->e($task['column_title']) ?></strong>
-    </li>
-    <li><?= t('Task position:').' '.$this->text->e($task['position']) ?></li>
-</ul>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 9
Template/notification/task_move_project.php

@@ -1,9 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<p><?= t('Task #%d "%s" has been moved to the project "%s"', $task['id'], $task['title'], $task['project_name']) ?></p>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 23
Template/notification/task_move_swimlane.php

@@ -1,23 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<ul>
-    <li>
-        <?php if ($task['swimlane_id'] == 0): ?>
-            <?= t('The task has been moved to the first swimlane') ?>
-        <?php else: ?>
-            <?= t('The task has been moved to another swimlane:') ?>
-            <strong><?= $this->text->e($task['swimlane_name']) ?></strong>
-        <?php endif ?>
-    </li>
-    <li>
-        <?= t('Column on the board:') ?>
-        <strong><?= $this->text->e($task['column_title']) ?></strong>
-    </li>
-    <li><?= t('Task position:').' '.$this->text->e($task['position']) ?></li>
-</ul>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 9
Template/notification/task_open.php

@@ -1,9 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<p><?= t('The task #%d has been opened.', $task['id']) ?></p>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 41
Template/notification/task_overdue.php

@@ -1,41 +0,0 @@
-<html>
-<body>
-<h2><?= t('Overdue tasks for the project(s) "%s"', $project_name) ?></h2>
-
-<table style="font-size: .8em; table-layout: fixed; width: 100%; border-collapse: collapse; border-spacing: 0; margin-bottom: 20px;" cellpadding=5 cellspacing=1>
-    <tr style="background: #fbfbfb; text-align: left; padding-top: .5em; padding-bottom: .5em; padding-left: 3px; padding-right: 3px;">
-        <th style="border: 1px solid #eee;"><?= t('Id') ?></th>
-        <th style="border: 1px solid #eee;"><?= t('Title') ?></th>
-        <th style="border: 1px solid #eee;"><?= t('Due date') ?></th>
-        <th style="border: 1px solid #eee;"><?= t('Project') ?></th>
-        <th style="border: 1px solid #eee;"><?= t('Assignee') ?></th>
-    </tr>
-
-    <?php foreach ($tasks as $task): ?>
-        <tr style="overflow: hidden; background: #fff; text-align: left; padding-top: .5em; padding-bottom: .5em; padding-left: 3px; padding-right: 3px;">
-            <td style="border: 1px solid #eee;">#<?= $task['id'] ?></td>
-            <td style="border: 1px solid #eee;">
-                <?php if ($this->app->config('application_url') !== ''): ?>
-                    <?= $this->url->absoluteLink($this->text->e($task['title']), 'TaskViewController', 'show', array('task_id' => $task['id'])) ?>
-                <?php else: ?>
-                    <?= $this->text->e($task['title']) ?>
-                <?php endif ?>
-            </td>
-            <td style="border: 1px solid #eee;"><?= $this->dt->datetime($task['date_due']) ?></td>
-            <td style="border: 1px solid #eee;">
-                <?php if ($this->app->config('application_url') !== ''): ?>
-                    <?= $this->url->absoluteLink($this->text->e($task['project_name']), 'BoardViewController', 'show', array('project_id' => $task['project_id'])) ?>
-                <?php else: ?>
-                    <?= $this->text->e($task['project_name']) ?>
-                <?php endif ?>
-            </td>
-            <td style="border: 1px solid #eee;">
-                <?php if (! empty($task['assignee_username'])): ?>
-                    <?= $this->text->e($task['assignee_name'] ?: $task['assignee_username']) ?>
-                <?php endif ?>
-            </td>
-        </tr>
-    <?php endforeach ?>
-</table>
-</body>
-</html>

+ 0 - 8
Template/notification/task_update.php

@@ -1,8 +0,0 @@
-<html>
-<body>
-<h2><?= $this->text->e($task['title']) ?> (#<?= $task['id'] ?>)</h2>
-
-<?= $this->render('task/changes', array('changes' => $changes, 'task' => $task, 'public' => true)) ?>
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 0 - 11
Template/notification/task_user_mention.php

@@ -1,11 +0,0 @@
-<html>
-<body>
-<h2><?= t('You were mentioned in the task #%d', $task['id']) ?></h2>
-<p><?= $this->text->e($task['title']) ?></p>
-
-<h2><?= t('Description') ?></h2>
-<?= $this->text->markdown($task['description'], true) ?>
-
-<?= $this->render('notification/footer', array('task' => $task)) ?>
-</body>
-</html>

+ 1 - 1
ver

@@ -1 +1 @@
-1.0.3
+1.0.4