From: Nik Okuntseff <support@anuko.com>
Date: Fri, 15 Mar 2019 21:56:01 +0000 (+0000)
Subject: A bit more work in progress on project attachments.
X-Git-Tag: timetracker_1.19-1~167
X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=26dd5629ee5f2c3de36ff44e65529e4ca491cab1;p=timetracker.git

A bit more work in progress on project attachments.
---

diff --git a/WEB-INF/resources/ca.lang.php b/WEB-INF/resources/ca.lang.php
index e524613a..59ea97ef 100644
--- a/WEB-INF/resources/ca.lang.php
+++ b/WEB-INF/resources/ca.lang.php
@@ -274,6 +274,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // TODO: Improve titles for consistency, so that each title explains correctly what each
diff --git a/WEB-INF/resources/cs.lang.php b/WEB-INF/resources/cs.lang.php
index 2d7b36ff..96f17769 100644
--- a/WEB-INF/resources/cs.lang.php
+++ b/WEB-INF/resources/cs.lang.php
@@ -284,6 +284,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // TODO: Improve titles for consistency, so that each title explains correctly what each
diff --git a/WEB-INF/resources/da.lang.php b/WEB-INF/resources/da.lang.php
index 662b21bd..7a6ef813 100644
--- a/WEB-INF/resources/da.lang.php
+++ b/WEB-INF/resources/da.lang.php
@@ -262,6 +262,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 'title.error' => 'Fejl',
diff --git a/WEB-INF/resources/de.lang.php b/WEB-INF/resources/de.lang.php
index 7d0dda04..bc7ba0c3 100644
--- a/WEB-INF/resources/de.lang.php
+++ b/WEB-INF/resources/de.lang.php
@@ -250,6 +250,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 'title.error' => 'Fehler',
diff --git a/WEB-INF/resources/en.lang.php b/WEB-INF/resources/en.lang.php
index 3e855d05..8dc20118 100644
--- a/WEB-INF/resources/en.lang.php
+++ b/WEB-INF/resources/en.lang.php
@@ -240,6 +240,7 @@ $i18n_key_words = array(
 'label.template' => 'Template',
 'label.attachments' => 'Attachments',
 'label.files' => 'Files',
+'label.image' => 'Image',
 
 // Form titles.
 'title.error' => 'Error',
diff --git a/WEB-INF/resources/es.lang.php b/WEB-INF/resources/es.lang.php
index b314181e..7978ff55 100644
--- a/WEB-INF/resources/es.lang.php
+++ b/WEB-INF/resources/es.lang.php
@@ -277,6 +277,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // TODO: Translate the following.
diff --git a/WEB-INF/resources/et.lang.php b/WEB-INF/resources/et.lang.php
index 7ffb1656..94fb496e 100644
--- a/WEB-INF/resources/et.lang.php
+++ b/WEB-INF/resources/et.lang.php
@@ -265,6 +265,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // TODO: Improve titles for consistency, so that each title explains correctly what each
diff --git a/WEB-INF/resources/fa.lang.php b/WEB-INF/resources/fa.lang.php
index e404d79c..17a76172 100644
--- a/WEB-INF/resources/fa.lang.php
+++ b/WEB-INF/resources/fa.lang.php
@@ -272,6 +272,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 'title.error' => 'خطا',
diff --git a/WEB-INF/resources/fi.lang.php b/WEB-INF/resources/fi.lang.php
index ac6e438f..661edd86 100644
--- a/WEB-INF/resources/fi.lang.php
+++ b/WEB-INF/resources/fi.lang.php
@@ -266,6 +266,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 'title.error' => 'Virhe',
diff --git a/WEB-INF/resources/fr.lang.php b/WEB-INF/resources/fr.lang.php
index 5a38ee3f..b797b6ff 100644
--- a/WEB-INF/resources/fr.lang.php
+++ b/WEB-INF/resources/fr.lang.php
@@ -260,6 +260,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 'title.error' => 'Erreur',
diff --git a/WEB-INF/resources/gr.lang.php b/WEB-INF/resources/gr.lang.php
index 608b3878..a69e6aa8 100644
--- a/WEB-INF/resources/gr.lang.php
+++ b/WEB-INF/resources/gr.lang.php
@@ -253,6 +253,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 'title.error' => 'Σφάλμα',
diff --git a/WEB-INF/resources/he.lang.php b/WEB-INF/resources/he.lang.php
index f0a31aa2..8cc4d022 100644
--- a/WEB-INF/resources/he.lang.php
+++ b/WEB-INF/resources/he.lang.php
@@ -283,6 +283,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 'title.error' => 'שגיאה',
diff --git a/WEB-INF/resources/hu.lang.php b/WEB-INF/resources/hu.lang.php
index 0bc245f6..8c2e730c 100644
--- a/WEB-INF/resources/hu.lang.php
+++ b/WEB-INF/resources/hu.lang.php
@@ -279,6 +279,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // TODO: Translate the following.
diff --git a/WEB-INF/resources/it.lang.php b/WEB-INF/resources/it.lang.php
index 54cf7e73..c1a87b73 100644
--- a/WEB-INF/resources/it.lang.php
+++ b/WEB-INF/resources/it.lang.php
@@ -257,6 +257,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // TODO: Improve titles for consistency, so that each title explains correctly what each
diff --git a/WEB-INF/resources/ja.lang.php b/WEB-INF/resources/ja.lang.php
index 0a443f95..3b48408c 100644
--- a/WEB-INF/resources/ja.lang.php
+++ b/WEB-INF/resources/ja.lang.php
@@ -284,6 +284,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // TODO: Translate the following.
diff --git a/WEB-INF/resources/ko.lang.php b/WEB-INF/resources/ko.lang.php
index c4988fa3..1a77cde7 100644
--- a/WEB-INF/resources/ko.lang.php
+++ b/WEB-INF/resources/ko.lang.php
@@ -284,6 +284,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // TODO: Translate the following.
diff --git a/WEB-INF/resources/nl.lang.php b/WEB-INF/resources/nl.lang.php
index c5a3b509..426a1428 100644
--- a/WEB-INF/resources/nl.lang.php
+++ b/WEB-INF/resources/nl.lang.php
@@ -242,6 +242,7 @@ $i18n_key_words = array(
 // TODO: translate the following.
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 'title.error' => 'Fout',
diff --git a/WEB-INF/resources/no.lang.php b/WEB-INF/resources/no.lang.php
index 55cb9d86..a37e8881 100644
--- a/WEB-INF/resources/no.lang.php
+++ b/WEB-INF/resources/no.lang.php
@@ -281,6 +281,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // TODO: Translate the following.
diff --git a/WEB-INF/resources/pl.lang.php b/WEB-INF/resources/pl.lang.php
index 5a6ea8a9..9258b851 100644
--- a/WEB-INF/resources/pl.lang.php
+++ b/WEB-INF/resources/pl.lang.php
@@ -267,6 +267,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 'title.error' => 'Błąd',
diff --git a/WEB-INF/resources/pt-br.lang.php b/WEB-INF/resources/pt-br.lang.php
index 843258fb..99d4d1c7 100644
--- a/WEB-INF/resources/pt-br.lang.php
+++ b/WEB-INF/resources/pt-br.lang.php
@@ -264,6 +264,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 'title.error' => 'Erro',
diff --git a/WEB-INF/resources/pt.lang.php b/WEB-INF/resources/pt.lang.php
index 538ec988..8969cdcd 100644
--- a/WEB-INF/resources/pt.lang.php
+++ b/WEB-INF/resources/pt.lang.php
@@ -269,6 +269,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // TODO: Translate the following.
diff --git a/WEB-INF/resources/ro.lang.php b/WEB-INF/resources/ro.lang.php
index 10803e21..74b843e9 100644
--- a/WEB-INF/resources/ro.lang.php
+++ b/WEB-INF/resources/ro.lang.php
@@ -281,6 +281,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // TODO: Improve titles for consistency, so that each title explains correctly what each
diff --git a/WEB-INF/resources/ru.lang.php b/WEB-INF/resources/ru.lang.php
index 751d3a75..c8dee6fc 100644
--- a/WEB-INF/resources/ru.lang.php
+++ b/WEB-INF/resources/ru.lang.php
@@ -239,6 +239,7 @@ $i18n_key_words = array(
 'label.template' => 'Шаблон',
 'label.attachments' => 'Приложения',
 'label.files' => 'Файлы',
+'label.image' => 'Изображение',
 
 // Form titles.
 'title.error' => 'Ошибка',
diff --git a/WEB-INF/resources/sk.lang.php b/WEB-INF/resources/sk.lang.php
index 81409771..34d92dd5 100644
--- a/WEB-INF/resources/sk.lang.php
+++ b/WEB-INF/resources/sk.lang.php
@@ -272,6 +272,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 'title.error' => 'Chyba',
diff --git a/WEB-INF/resources/sl.lang.php b/WEB-INF/resources/sl.lang.php
index 712b3ee5..a4cc8fef 100644
--- a/WEB-INF/resources/sl.lang.php
+++ b/WEB-INF/resources/sl.lang.php
@@ -264,6 +264,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // TODO: Translate the following.
diff --git a/WEB-INF/resources/sr.lang.php b/WEB-INF/resources/sr.lang.php
index a4541454..7178d548 100644
--- a/WEB-INF/resources/sr.lang.php
+++ b/WEB-INF/resources/sr.lang.php
@@ -265,6 +265,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 'title.error' => 'Greška',
diff --git a/WEB-INF/resources/sv.lang.php b/WEB-INF/resources/sv.lang.php
index 105b25f0..818a7db5 100644
--- a/WEB-INF/resources/sv.lang.php
+++ b/WEB-INF/resources/sv.lang.php
@@ -261,6 +261,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Rubriker för formulär
 'title.error' => 'Fel',
diff --git a/WEB-INF/resources/tr.lang.php b/WEB-INF/resources/tr.lang.php
index a02ed68a..7608d155 100644
--- a/WEB-INF/resources/tr.lang.php
+++ b/WEB-INF/resources/tr.lang.php
@@ -288,6 +288,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // Form titles.
diff --git a/WEB-INF/resources/zh-cn.lang.php b/WEB-INF/resources/zh-cn.lang.php
index 33cd0898..ef133c96 100644
--- a/WEB-INF/resources/zh-cn.lang.php
+++ b/WEB-INF/resources/zh-cn.lang.php
@@ -272,6 +272,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // TODO: Translate the following.
diff --git a/WEB-INF/resources/zh-tw.lang.php b/WEB-INF/resources/zh-tw.lang.php
index 12a328e2..9aa12451 100644
--- a/WEB-INF/resources/zh-tw.lang.php
+++ b/WEB-INF/resources/zh-tw.lang.php
@@ -279,6 +279,7 @@ $i18n_key_words = array(
 // 'label.template' => 'Template',
 // 'label.attachments' => 'Attachments',
 // 'label.files' => 'Files',
+// 'label.image' => 'Image',
 
 // Form titles.
 // TODO: Translate the following.
diff --git a/WEB-INF/templates/project_files.tpl b/WEB-INF/templates/project_files.tpl
new file mode 100644
index 00000000..0313e030
--- /dev/null
+++ b/WEB-INF/templates/project_files.tpl
@@ -0,0 +1,102 @@
+<script>
+  function chLocation(newLocation) { document.location = newLocation; }
+</script>
+
+<table cellspacing="0" cellpadding="7" border="0" width="720">
+  <tr>
+    <td valign="top">
+{if $user->can('manage_projects')}
+      <table cellspacing="1" cellpadding="3" border="0" width="100%">
+  {if $inactive_projects}
+        <tr><td class="sectionHeaderNoBorder">{$i18n.form.projects.active_projects}</td></tr>
+  {/if}
+        <tr>
+          <td width="35%" class="tableHeader">{$i18n.label.image}</td>
+          <td width="35%" class="tableHeader">{$i18n.label.description}</td>
+  {if $show_files}
+          <td class="tableHeader">{$i18n.label.files}</td>
+  {/if}
+          <td class="tableHeader">{$i18n.label.edit}</td>
+          <td class="tableHeader">{$i18n.label.delete}</td>
+        </tr>
+  {if $active_projects}
+    {foreach $active_projects as $project}
+        <tr bgcolor="{cycle values="#f5f5f5,#ffffff"}">
+          <td>{$project.name|escape}</td>
+          <td>{$project.description|escape}</td>
+      {if $show_files}
+          <td><a href="project_files.php?id={$project.id}">{$i18n.label.view}</a></td>
+      {/if}
+          <td><a href="project_edit.php?id={$project.id}">{$i18n.label.edit}</a></td>
+          <td><a href="project_delete.php?id={$project.id}">{$i18n.label.delete}</a></td>
+        </tr>
+    {/foreach}
+  {/if}
+      </table>
+
+      <table width="100%">
+        <tr>
+          <td align="center"><br>
+            <form><input type="button" onclick="chLocation('project_add.php');" value="{$i18n.button.add}"></form>
+          </td>
+        </tr>
+      </table>
+
+  {if $inactive_projects}
+      <table cellspacing="1" cellpadding="3" border="0" width="100%">
+        <tr><td class="sectionHeaderNoBorder">{$i18n.form.projects.inactive_projects}</td></tr>
+        <tr>
+          <td width="35%" class="tableHeader">{$i18n.label.thing_name}</td>
+          <td width="35%" class="tableHeader">{$i18n.label.description}</td>
+    {if $show_files}
+          <td class="tableHeader">{$i18n.label.files}</td>
+    {/if}
+          <td class="tableHeader">{$i18n.label.edit}</td>
+          <td class="tableHeader">{$i18n.label.delete}</td>
+        </tr>
+    {foreach $inactive_projects as $project}
+        <tr bgcolor="{cycle values="#f5f5f5,#ffffff"}">
+          <td>{$project.name|escape}</td>
+          <td>{$project.description|escape}</td>
+      {if $show_files}
+          <td><a href="project_files.php?id={$project.id}">{$i18n.label.view}</a></td>
+      {/if}
+          <td><a href="project_edit.php?id={$project.id}">{$i18n.label.edit}</a></td>
+          <td><a href="project_delete.php?id={$project.id}">{$i18n.label.delete}</a></td>
+        </tr>
+    {/foreach}
+      </table>
+
+      <table width="100%">
+        <tr>
+          <td align="center"><br>
+            <form><input type="button" onclick="chLocation('project_add.php');" value="{$i18n.button.add}"></form>
+          </td>
+        </tr>
+      </table>
+  {/if}
+{else}
+      <table cellspacing="1" cellpadding="3" border="0" width="100%">
+        <tr>
+          <td class="tableHeader">{$i18n.label.thing_name}</td>
+          <td class="tableHeader">{$i18n.label.description}</td>
+    {if $show_files}
+          <td class="tableHeader">{$i18n.label.files}</td>
+    {/if}
+        </tr>
+  {if $active_projects}
+    {foreach $active_projects as $project}
+        <tr bgcolor="{cycle values="#f5f5f5,#ffffff"}">
+          <td>{$project.name|escape}</td>
+          <td>{$project.description|escape}</td>
+      {if $show_files}
+          <td><a href="project_files.php?id={$project.id}">{$i18n.label.view}</a></td>
+      {/if}
+        </tr>
+    {/foreach}
+  {/if}
+      </table>
+{/if}
+    </td>
+  </tr>
+</table>
diff --git a/project_files.php b/project_files.php
index baec9aa2..b069acb7 100644
--- a/project_files.php
+++ b/project_files.php
@@ -27,8 +27,7 @@
 // +----------------------------------------------------------------------+
 
 require_once('initialize.php');
-import('form.Form');
-import('ttGroupHelper');
+import('ttProjectHelper');
 
 // Access checks.
 if (!(ttAccessAllowed('view_own_projects') || ttAccessAllowed('manage_projects'))) {
@@ -39,17 +38,18 @@ if (MODE_PROJECTS != $user->getTrackingMode() && MODE_PROJECTS_AND_TASKS != $use
   header('Location: feature_disabled.php');
   exit();
 }
+$cl_project_id = (int)$request->getParameter('id');
+$project = ttProjectHelper::get($cl_project_id);
+if (!$project) {
+  header('Location: access_denied.php');
+  exit();
+}
 // End of access checks.
 
-if($user->can('manage_projects')) {
-  $active_projects = ttGroupHelper::getActiveProjects();
-  $inactive_projects = ttGroupHelper::getInactiveProjects();
-} else
-  $active_projects = $user->getAssignedProjects();
+$files = null;
+// $files = ttAttachmentHelper::getProjectFiles();
 
-$smarty->assign('active_projects', $active_projects);
-$smarty->assign('inactive_projects', $inactive_projects);
-$smarty->assign('show_files', $user->isPluginEnabled('at'));
+$smarty->assign('files', $files);
 $smarty->assign('title', $i18n->get('title.project_files'));
-$smarty->assign('content_page_name', 'projects.tpl');
+$smarty->assign('content_page_name', 'project_files.tpl');
 $smarty->display('index.tpl');
diff --git a/projects.php b/projects.php
index 97a86ba6..236291cd 100644
--- a/projects.php
+++ b/projects.php
@@ -27,7 +27,6 @@
 // +----------------------------------------------------------------------+
 
 require_once('initialize.php');
-import('form.Form');
 import('ttGroupHelper');
 
 // Access checks.