summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Controller/App.php3
-rw-r--r--app/Controller/Calendar.php30
-rw-r--r--app/Controller/User.php14
-rw-r--r--app/Core/Helper.php1
-rw-r--r--app/Locale/da_DK/translations.php2
-rw-r--r--app/Locale/de_DE/translations.php2
-rw-r--r--app/Locale/es_ES/translations.php2
-rw-r--r--app/Locale/fi_FI/translations.php2
-rw-r--r--app/Locale/fr_FR/translations.php2
-rw-r--r--app/Locale/hu_HU/translations.php2
-rw-r--r--app/Locale/it_IT/translations.php2
-rw-r--r--app/Locale/ja_JP/translations.php2
-rw-r--r--app/Locale/pl_PL/translations.php2
-rw-r--r--app/Locale/pt_BR/translations.php2
-rw-r--r--app/Locale/ru_RU/translations.php2
-rw-r--r--app/Locale/sv_SE/translations.php2
-rw-r--r--app/Locale/th_TH/translations.php2
-rw-r--r--app/Locale/zh_CN/translations.php2
-rw-r--r--app/Model/Acl.php2
-rw-r--r--app/Template/app/dashboard.php10
-rw-r--r--app/Template/user/calendar.php5
-rw-r--r--app/Template/user/sidebar.php3
-rw-r--r--assets/css/app.css5
-rw-r--r--assets/css/src/dashboard.css4
-rw-r--r--assets/js/app.js19
-rw-r--r--assets/js/src/calendar.js99
26 files changed, 181 insertions, 42 deletions
diff --git a/app/Controller/App.php b/app/Controller/App.php
index c4ed0fb8..ef0a08a9 100644
--- a/app/Controller/App.php
+++ b/app/Controller/App.php
@@ -68,10 +68,11 @@ class App extends Base
$this->response->html($this->template->layout('app/dashboard', array(
'title' => t('Dashboard'),
'board_selector' => $this->projectPermission->getAllowedProjects($user_id),
- 'events' => $this->projectActivity->getProjects($project_ids, 10),
+ 'events' => $this->projectActivity->getProjects($project_ids, 5),
'task_paginator' => $task_paginator,
'subtask_paginator' => $subtask_paginator,
'project_paginator' => $project_paginator,
+ 'user_id' => $user_id,
)));
}
diff --git a/app/Controller/Calendar.php b/app/Controller/Calendar.php
index 6b0c8619..abbcab7f 100644
--- a/app/Controller/Calendar.php
+++ b/app/Controller/Calendar.php
@@ -2,6 +2,8 @@
namespace Controller;
+use Model\Task;
+
/**
* Project Calendar controller
*
@@ -35,7 +37,7 @@ class Calendar extends Base
}
/**
- * Get tasks to display on the calendar
+ * Get tasks to display on the calendar (project view)
*
* @access public
*/
@@ -52,8 +54,30 @@ class Calendar extends Base
->filterByColor($this->request->getStringParam('color_id'))
->filterByStatus($this->request->getIntegerParam('is_active', -1))
->filterByDueDateRange(
- $this->request->getStringParam('start'),
- $this->request->getStringParam('end')
+ $this->request->getStringParam('start'),
+ $this->request->getStringParam('end')
+ )
+ ->toCalendarEvents()
+ );
+ }
+
+ /**
+ * Get tasks to display on the calendar (user view)
+ *
+ * @access public
+ */
+ public function user()
+ {
+ $user_id = $this->request->getIntegerParam('user_id');
+
+ $this->response->json(
+ $this->taskFilter
+ ->create()
+ ->filterByOwner($user_id)
+ ->filterByStatus(Task::STATUS_OPEN)
+ ->filterByDueDateRange(
+ $this->request->getStringParam('start'),
+ $this->request->getStringParam('end')
)
->toCalendarEvents()
);
diff --git a/app/Controller/User.php b/app/Controller/User.php
index 91141241..3736f20e 100644
--- a/app/Controller/User.php
+++ b/app/Controller/User.php
@@ -190,6 +190,20 @@ class User extends Base
}
/**
+ * Display user calendar
+ *
+ * @access public
+ */
+ public function calendar()
+ {
+ $user = $this->getUser();
+
+ $this->response->html($this->layout('user/calendar', array(
+ 'user' => $user,
+ )));
+ }
+
+ /**
* Display timesheet
*
* @access public
diff --git a/app/Core/Helper.php b/app/Core/Helper.php
index 25d580e9..c3ffe95a 100644
--- a/app/Core/Helper.php
+++ b/app/Core/Helper.php
@@ -12,6 +12,7 @@ use Pimple\Container;
*
* @property \Core\Session $session
* @property \Model\Acl $acl
+ * @property \Model\Config $config
* @property \Model\User $user
* @property \Model\UserSession $userSession
*/
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index b312e29d..07c05b89 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -676,4 +676,6 @@ return array(
// 'Show/hide subtasks' => '',
// 'Show/hide tasks' => '',
// 'Disable login form' => '',
+ // 'Show/hide calendar' => '',
+ // 'User calendar' => '',
);
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index bd388342..af15c6b2 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -676,4 +676,6 @@ return array(
// 'Show/hide subtasks' => '',
// 'Show/hide tasks' => '',
// 'Disable login form' => '',
+ // 'Show/hide calendar' => '',
+ // 'User calendar' => '',
);
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index ec42cc9c..b39e9793 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -676,4 +676,6 @@ return array(
// 'Show/hide subtasks' => '',
// 'Show/hide tasks' => '',
// 'Disable login form' => '',
+ // 'Show/hide calendar' => '',
+ // 'User calendar' => '',
);
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index c5f45e2d..9adc19e4 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -676,4 +676,6 @@ return array(
// 'Show/hide subtasks' => '',
// 'Show/hide tasks' => '',
// 'Disable login form' => '',
+ // 'Show/hide calendar' => '',
+ // 'User calendar' => '',
);
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index 8148361c..2542a6fe 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -678,4 +678,6 @@ return array(
'Show/hide subtasks' => 'Afficher/cacher les sous-tâches',
'Show/hide tasks' => 'Afficher/cacher les tâches',
'Disable login form' => 'Désactiver le formulaire d\'authentification',
+ 'Show/hide calendar' => 'Afficher/cacher le calendrier',
+ 'User calendar' => 'Calendrier de l\'utilisateur',
);
diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php
index 25e330a2..8cbe6d8d 100644
--- a/app/Locale/hu_HU/translations.php
+++ b/app/Locale/hu_HU/translations.php
@@ -676,4 +676,6 @@ return array(
// 'Show/hide subtasks' => '',
// 'Show/hide tasks' => '',
// 'Disable login form' => '',
+ // 'Show/hide calendar' => '',
+ // 'User calendar' => '',
);
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index ff8ac1cb..98ed4a91 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -676,4 +676,6 @@ return array(
// 'Show/hide subtasks' => '',
// 'Show/hide tasks' => '',
// 'Disable login form' => '',
+ // 'Show/hide calendar' => '',
+ // 'User calendar' => '',
);
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index 12dfb953..229622c5 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -676,4 +676,6 @@ return array(
// 'Show/hide subtasks' => '',
// 'Show/hide tasks' => '',
// 'Disable login form' => '',
+ // 'Show/hide calendar' => '',
+ // 'User calendar' => '',
);
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index 53e9e550..e2cc3ab8 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -676,4 +676,6 @@ return array(
// 'Show/hide subtasks' => '',
// 'Show/hide tasks' => '',
// 'Disable login form' => '',
+ // 'Show/hide calendar' => '',
+ // 'User calendar' => '',
);
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index 368ce0e6..db640901 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -676,4 +676,6 @@ return array(
// 'Show/hide subtasks' => '',
// 'Show/hide tasks' => '',
// 'Disable login form' => '',
+ // 'Show/hide calendar' => '',
+ // 'User calendar' => '',
);
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index 134133ca..513436af 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -676,4 +676,6 @@ return array(
// 'Show/hide subtasks' => '',
// 'Show/hide tasks' => '',
// 'Disable login form' => '',
+ // 'Show/hide calendar' => '',
+ // 'User calendar' => '',
);
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index c0babf5a..4958189f 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -676,4 +676,6 @@ return array(
// 'Show/hide subtasks' => '',
// 'Show/hide tasks' => '',
// 'Disable login form' => '',
+ // 'Show/hide calendar' => '',
+ // 'User calendar' => '',
);
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index 3455739c..962971f4 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -676,4 +676,6 @@ return array(
// 'Show/hide subtasks' => '',
// 'Show/hide tasks' => '',
// 'Disable login form' => '',
+ // 'Show/hide calendar' => '',
+ // 'User calendar' => '',
);
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index ed9ab82b..4c76d7ab 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -676,4 +676,6 @@ return array(
// 'Show/hide subtasks' => '',
// 'Show/hide tasks' => '',
// 'Disable login form' => '',
+ // 'Show/hide calendar' => '',
+ // 'User calendar' => '',
);
diff --git a/app/Model/Acl.php b/app/Model/Acl.php
index 56f2980b..b6c0e6b8 100644
--- a/app/Model/Acl.php
+++ b/app/Model/Acl.php
@@ -38,7 +38,7 @@ class Acl extends Base
'project' => array('show', 'tasks', 'search', 'activity'),
'subtask' => '*',
'task' => '*',
- 'calendar' => '*',
+ 'calendar' => array('show', 'events', 'save'),
);
/**
diff --git a/app/Template/app/dashboard.php b/app/Template/app/dashboard.php
index c29ae02e..80f32fee 100644
--- a/app/Template/app/dashboard.php
+++ b/app/Template/app/dashboard.php
@@ -25,6 +25,9 @@
<a href="#" class="dashboard-toggle" data-toggle="subtasks"><?= t('Show/hide subtasks') ?></a>
</li>
<li>
+ <a href="#" class="dashboard-toggle" data-toggle="calendar"><?= t('Show/hide calendar') ?></a>
+ </li>
+ <li>
<a href="#" class="dashboard-toggle" data-toggle="activities"><?= t('Show/hide activities') ?></a>
</li>
</ul>
@@ -40,6 +43,13 @@
<div id="dashboard-subtasks"><?= $this->render('app/subtasks', array('paginator' => $subtask_paginator)) ?></div>
</div>
<div class="dashboard-right-column">
+ <div id="dashboard-calendar">
+ <div id="user-calendar"
+ data-check-url="<?= $this->u('calendar', 'user') ?>"
+ data-user-id="<?= $user_id ?>"
+ >
+ </div>
+ </div>
<div id="dashboard-activities">
<h2><?= t('Activity stream') ?></h2>
<?= $this->render('project/events', array('events' => $events)) ?>
diff --git a/app/Template/user/calendar.php b/app/Template/user/calendar.php
new file mode 100644
index 00000000..ab7d05a2
--- /dev/null
+++ b/app/Template/user/calendar.php
@@ -0,0 +1,5 @@
+<div id="user-calendar"
+ data-check-url="<?= $this->u('calendar', 'user') ?>"
+ data-user-id="<?= $user['id'] ?>"
+>
+</div> \ No newline at end of file
diff --git a/app/Template/user/sidebar.php b/app/Template/user/sidebar.php
index 05be2e84..e41851a9 100644
--- a/app/Template/user/sidebar.php
+++ b/app/Template/user/sidebar.php
@@ -37,6 +37,9 @@
<li>
<?= $this->a(t('User dashboard'), 'app', 'dashboard', array('user_id' => $user['id'])) ?>
</li>
+ <li>
+ <?= $this->a(t('User calendar'), 'user', 'calendar', array('user_id' => $user['id'])) ?>
+ </li>
<?php endif ?>
<?php if ($this->userSession->isAdmin() && ! $this->userSession->isCurrentUser($user['id'])): ?>
diff --git a/assets/css/app.css b/assets/css/app.css
index 679d3fbc..f9720b3c 100644
--- a/assets/css/app.css
+++ b/assets/css/app.css
@@ -1866,7 +1866,10 @@ a.task-board-nobody {
.dashboard-table-link:hover {
color: #999;
}
-/* datepicker */
+
+#dashboard-calendar {
+ font-size: 0.85em;
+}/* datepicker */
#ui-datepicker-div {
font-size: 0.8em;
}
diff --git a/assets/css/src/dashboard.css b/assets/css/src/dashboard.css
index 9044aa43..dd997c62 100644
--- a/assets/css/src/dashboard.css
+++ b/assets/css/src/dashboard.css
@@ -44,3 +44,7 @@
.dashboard-table-link:hover {
color: #999;
}
+
+#dashboard-calendar {
+ font-size: 0.85em;
+} \ No newline at end of file
diff --git a/assets/js/app.js b/assets/js/app.js
index ef6221f0..ce22131f 100644
--- a/assets/js/app.js
+++ b/assets/js/app.js
@@ -139,15 +139,16 @@ $("body").data("login-url")}}})},Init:function(){$("#board-selector").chosen({wi
InitAfterAjax:function(){$(".form-date").datepicker({showOtherMonths:!0,selectOtherMonths:!0,dateFormat:"yy-mm-dd",constrainInput:!1});$("#markdown-preview").click(Kanboard.MarkdownPreview);$("#markdown-write").click(Kanboard.MarkdownWriter);$(".auto-select").focus(function(){$(this).select()});$(".dropit-submenu").hide();$(".dropdown").not(".dropit").dropit()}}}();
Kanboard.Board=function(){function a(a){Kanboard.Popover(a,Kanboard.InitAfterAjax)}function c(){Mousetrap.bind("n",function(){Kanboard.OpenPopover($(".task-creation-popover").attr("href"),Kanboard.InitAfterAjax)})}function b(){$(".column").sortable({delay:300,distance:5,connectWith:".column",placeholder:"draggable-placeholder",stop:function(a,b){e(b.item.attr("data-task-id"),b.item.parent().attr("data-column-id"),b.item.index()+1,b.item.parent().attr("data-swimlane-id"))}});$(".assignee-popover").click(a);
$(".category-popover").click(a);$(".task-edit-popover").click(a);$(".task-creation-popover").click(a);$(".task-description-popover").click(a);$(".column-tooltip").tooltip({content:function(a){return $(this).attr("title")}});$(".task-board-tooltip").tooltip({track:!1,position:{my:"left-20 top",at:"center bottom+9",using:function(a,b){$(this).css(a);var c=b.target.left+b.target.width/2-b.element.left-20;$("<div>").addClass("tooltip-arrow").addClass(b.vertical).addClass(0==c?"align-left":"align-right").appendTo(this)}},
-content:function(a){if(a=$(this).attr("data-href")){var b=this;$.get(a,function k(a){$(".ui-tooltip-content:visible").html(a);a=$(".ui-tooltip:visible");a.css({top:"",left:""});a.children(".tooltip-arrow").remove();var c=$(b).tooltip("option","position");c.of=$(b);a.position(c);$("#tooltip-subtasks a").click(function(a){a.preventDefault();a.stopPropagation();$(this).hasClass("popover-subtask-restriction")?(Kanboard.OpenPopover($(this).attr("href")),$(b).tooltip("close")):$.get($(this).attr("href"),
-k)})});return'<i class="fa fa-refresh fa-spin fa-2x"></i>'}}}).on("mouseenter",function(){var a=this;$(this).tooltip("open");$(".ui-tooltip").on("mouseleave",function(){$(a).tooltip("close")})}).on("mouseleave focusout",function(a){a.stopImmediatePropagation();var b=this;setTimeout(function(){$(".ui-tooltip:hover").length||$(b).tooltip("close")},100)});$("[data-task-url]").each(function(){$(this).click(function(){window.location=$(this).attr("data-task-url")})});var b=parseInt($("#board").attr("data-check-interval"));
-0<b&&(h=window.setInterval(f,1E3*b))}function d(){$("[data-task-url]").off();clearInterval(h)}function e(a,c,f,e){d();$.ajax({cache:!1,url:$("#board").attr("data-save-url"),contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({task_id:a,column_id:c,swimlane_id:e,position:f}),success:function(a){$("#board").remove();$("#main").append(a);Kanboard.InitAfterAjax();b();g()}})}function f(){Kanboard.IsVisible()&&$.ajax({cache:!1,url:$("#board").attr("data-check-url"),statusCode:{200:function(a){$("#board").remove();
-$("#main").append(a);Kanboard.InitAfterAjax();d();b();g()}}})}function g(){var a=$("#form-user_id").val(),b=$("#form-category_id").val(),c=$("#filter-due-date").hasClass("filter-on"),d=$("#board").data("project-id");$("[data-task-id]").each(function(d,f){var e=f.getAttribute("data-owner-id"),g=f.getAttribute("data-due-date"),h=f.getAttribute("data-category-id");f.style.opacity=e!=a&&-1!=a?"0.2":"1.0";!c||""!=g&&"0"!=g||(f.style.opacity="0.2");h!=b&&-1!=b&&(f.style.opacity="0.2")});Kanboard.SetStorageItem("board_filter_"+
-d+"_form-user_id",a);Kanboard.SetStorageItem("board_filter_"+d+"_form-category_id",b);Kanboard.SetStorageItem("board_filter_"+d+"_filter-due-date",~~c)}function l(){var a=$("#board").data("project-id");$("#form-user_id").change(g);$("#form-category_id").change(g);$("#filter-due-date").click(function(a){$(this).toggleClass("filter-on");g();a.preventDefault()});$("#form-user_id").val(Kanboard.GetStorageItem("board_filter_"+a+"_form-user_id")||-1);$("#form-category_id").val(Kanboard.GetStorageItem("board_filter_"+
-a+"_form-category_id")||-1);+Kanboard.GetStorageItem("board_filter_"+a+"_filter-due-date")?$("#filter-due-date").addClass("filter-on"):$("#filter-due-date").removeClass("filter-on");g()}var h=null;jQuery(document).ready(function(){Kanboard.Exists("board")&&(b(),l(),c())})}();
-Kanboard.Calendar=function(){function a(a){$.ajax({cache:!1,url:$("#calendar").data("save-url"),contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({task_id:a.id,date_due:a.start.format()})})}function c(a){var b=$("#calendar"),c=b.data("check-url"),d={start:b.fullCalendar("getView").start.format(),end:b.fullCalendar("getView").end.format()};jQuery.extend(d,a);for(var e in d)c+="&"+e+"="+d[e];$.getJSON(c,function(a){b.fullCalendar("removeEvents");b.fullCalendar("addEventSource",
-a);b.fullCalendar("rerenderEvents")})}function b(){var a=Kanboard.GetStorageItem(e);if(""!==a){var a=JSON.parse(a),b;for(b in a)$("select[name="+b+"]").val(a[b])}c(a||{});$(".calendar-filter").change(d)}function d(){var a={};$(".calendar-filter").each(function(b,c){a[$(this).attr("name")]=$(this).val()});Kanboard.SetStorageItem(e,JSON.stringify(a));c(a)}var e="";jQuery(document).ready(function(){if(Kanboard.Exists("calendar")){e="calendar_filters_"+$("#calendar").data("project-id");var c=$("#calendar");
-c.data("translations");c.fullCalendar({lang:$("body").data("js-lang"),editable:!0,eventLimit:!0,header:{left:"prev,next today",center:"title",right:"month,agendaWeek,agendaDay"},viewRender:b,eventDrop:a});b()}})}();
+content:function(a){if(a=$(this).attr("data-href")){var b=this;$.get(a,function l(a){$(".ui-tooltip-content:visible").html(a);a=$(".ui-tooltip:visible");a.css({top:"",left:""});a.children(".tooltip-arrow").remove();var c=$(b).tooltip("option","position");c.of=$(b);a.position(c);$("#tooltip-subtasks a").click(function(a){a.preventDefault();a.stopPropagation();$(this).hasClass("popover-subtask-restriction")?(Kanboard.OpenPopover($(this).attr("href")),$(b).tooltip("close")):$.get($(this).attr("href"),
+l)})});return'<i class="fa fa-refresh fa-spin fa-2x"></i>'}}}).on("mouseenter",function(){var a=this;$(this).tooltip("open");$(".ui-tooltip").on("mouseleave",function(){$(a).tooltip("close")})}).on("mouseleave focusout",function(a){a.stopImmediatePropagation();var b=this;setTimeout(function(){$(".ui-tooltip:hover").length||$(b).tooltip("close")},100)});$("[data-task-url]").each(function(){$(this).click(function(){window.location=$(this).attr("data-task-url")})});var b=parseInt($("#board").attr("data-check-interval"));
+0<b&&(k=window.setInterval(f,1E3*b))}function d(){$("[data-task-url]").off();clearInterval(k)}function e(a,c,e,h){d();$.ajax({cache:!1,url:$("#board").attr("data-save-url"),contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({task_id:a,column_id:c,swimlane_id:h,position:e}),success:function(a){$("#board").remove();$("#main").append(a);Kanboard.InitAfterAjax();b();g()}})}function f(){Kanboard.IsVisible()&&$.ajax({cache:!1,url:$("#board").attr("data-check-url"),statusCode:{200:function(a){$("#board").remove();
+$("#main").append(a);Kanboard.InitAfterAjax();d();b();g()}}})}function g(){var a=$("#form-user_id").val(),b=$("#form-category_id").val(),c=$("#filter-due-date").hasClass("filter-on"),d=$("#board").data("project-id");$("[data-task-id]").each(function(d,g){var e=g.getAttribute("data-owner-id"),h=g.getAttribute("data-due-date"),f=g.getAttribute("data-category-id");g.style.opacity=e!=a&&-1!=a?"0.2":"1.0";!c||""!=h&&"0"!=h||(g.style.opacity="0.2");f!=b&&-1!=b&&(g.style.opacity="0.2")});Kanboard.SetStorageItem("board_filter_"+
+d+"_form-user_id",a);Kanboard.SetStorageItem("board_filter_"+d+"_form-category_id",b);Kanboard.SetStorageItem("board_filter_"+d+"_filter-due-date",~~c)}function h(){var a=$("#board").data("project-id");$("#form-user_id").change(g);$("#form-category_id").change(g);$("#filter-due-date").click(function(a){$(this).toggleClass("filter-on");g();a.preventDefault()});$("#form-user_id").val(Kanboard.GetStorageItem("board_filter_"+a+"_form-user_id")||-1);$("#form-category_id").val(Kanboard.GetStorageItem("board_filter_"+
+a+"_form-category_id")||-1);+Kanboard.GetStorageItem("board_filter_"+a+"_filter-due-date")?$("#filter-due-date").addClass("filter-on"):$("#filter-due-date").removeClass("filter-on");g()}var k=null;jQuery(document).ready(function(){Kanboard.Exists("board")&&(b(),h(),c())})}();
+Kanboard.Calendar=function(){function a(a){$.ajax({cache:!1,url:$("#calendar").data("save-url"),contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({task_id:a.id,date_due:a.start.format()})})}function c(a){var b=$("#user-calendar");a=b.data("check-url");var c={start:b.fullCalendar("getView").start.format(),end:b.fullCalendar("getView").end.format(),user_id:b.data("user-id")},d;for(d in c)a+="&"+d+"="+c[d];$.getJSON(a,function(a){b.fullCalendar("removeEvents");b.fullCalendar("addEventSource",
+a);b.fullCalendar("rerenderEvents")})}function b(a){var b=$("#calendar"),c=b.data("check-url"),d={start:b.fullCalendar("getView").start.format(),end:b.fullCalendar("getView").end.format()};jQuery.extend(d,a);for(var e in d)c+="&"+e+"="+d[e];$.getJSON(c,function(a){b.fullCalendar("removeEvents");b.fullCalendar("addEventSource",a);b.fullCalendar("rerenderEvents")})}function d(){var a=Kanboard.GetStorageItem(f);if(""!==a){var a=JSON.parse(a),c;for(c in a)$("select[name="+c+"]").val(a[c])}b(a||{});$(".calendar-filter").change(e)}
+function e(){var a={};$(".calendar-filter").each(function(b,c){a[$(this).attr("name")]=$(this).val()});Kanboard.SetStorageItem(f,JSON.stringify(a));b(a)}var f="";jQuery(document).ready(function(){if(Kanboard.Exists("calendar")){f="calendar_filters_"+$("#calendar").data("project-id");var b=$("#calendar");b.data("translations");b.fullCalendar({lang:$("body").data("js-lang"),editable:!0,eventLimit:!0,header:{left:"prev,next today",center:"title",right:"month,agendaWeek,agendaDay"},viewRender:d,eventDrop:a});
+d()}else Kanboard.Exists("user-calendar")&&(b=$("#user-calendar"),b.data("translations"),b.fullCalendar({lang:$("body").data("js-lang"),editable:!1,eventLimit:!0,defaultView:"agendaWeek",header:{left:"prev,next today",center:"title",right:"month,agendaWeek,agendaDay"},viewRender:c}))})}();
Kanboard.Analytic=function(){jQuery(document).ready(function(){Kanboard.Exists("analytic-task-repartition")?Kanboard.Analytic.TaskRepartition.Init():Kanboard.Exists("analytic-user-repartition")?Kanboard.Analytic.UserRepartition.Init():Kanboard.Exists("analytic-cfd")&&Kanboard.Analytic.CFD.Init()});return{}}();
Kanboard.Analytic.CFD=function(){return{Init:function(){jQuery.getJSON($("#chart").attr("data-url"),function(a){var c=a.labels,b=a.columns,d=a.metrics;a=[];for(var e=0;e<d.length;e++){var f={};f[c.column]=d[e].column_title;f[c.day]=d[e].day;f[c.total]=d[e].total;a.push(f)}d=dimple.newSvg("#chart","100%",380);a=new dimple.chart(d,a);a.addCategoryAxis("x",c.day).addOrderRule("Date");a.addMeasureAxis("y",c.total);a.addSeries(c.column,dimple.plot.area).addOrderRule(b.reverse());a.addLegend(10,10,500,
30,"left");a.draw()})}}}();Kanboard.Analytic.TaskRepartition=function(){return{Init:function(){jQuery.getJSON($("#chart").attr("data-url"),function(a){var c=a.labels,b=a.metrics;a=[];for(var d=0;d<b.length;d++){var e={};e[c.nb_tasks]=b[d].nb_tasks;e[c.column_title]=b[d].column_title;a.push(e)}b=dimple.newSvg("#chart","100%",350);a=new dimple.chart(b,a);a.addMeasureAxis("p",c.nb_tasks);a.addSeries(c.column_title,dimple.plot.pie).innerRadius="50%";a.addLegend(0,0,100,"100%","left");a.draw()})}}}();
diff --git a/assets/js/src/calendar.js b/assets/js/src/calendar.js
index bdd43db0..1d712545 100644
--- a/assets/js/src/calendar.js
+++ b/assets/js/src/calendar.js
@@ -2,44 +2,86 @@ Kanboard.Calendar = (function() {
var filter_storage_key = "";
- // Show the empty calendar
- function show_calendar()
+ // Save the new due date for a moved task
+ function move_calendar_event(calendar_event)
+ {
+ $.ajax({
+ cache: false,
+ url: $("#calendar").data("save-url"),
+ contentType: "application/json",
+ type: "POST",
+ processData: false,
+ data: JSON.stringify({
+ "task_id": calendar_event.id,
+ "date_due": calendar_event.start.format()
+ })
+ });
+ }
+
+ // Show the user calendar
+ function show_user_calendar()
{
- var calendar = $("#calendar");
+ var calendar = $("#user-calendar");
var translations = calendar.data("translations");
calendar.fullCalendar({
lang: $("body").data("js-lang"),
- editable: true,
+ editable: false,
eventLimit: true,
+ defaultView: "agendaWeek",
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
- viewRender: load_filters,
- eventDrop: move_calendar_event
+ viewRender: refresh_user_calendar
});
}
- // Save the new due date for a moved task
- function move_calendar_event(calendar_event)
- {
- $.ajax({
- cache: false,
- url: $("#calendar").data("save-url"),
- contentType: "application/json",
- type: "POST",
- processData: false,
- data: JSON.stringify({
- "task_id": calendar_event.id,
- "date_due": calendar_event.start.format()
- })
+ // Refresh the calendar events
+ function refresh_user_calendar(filters)
+ {
+ var calendar = $("#user-calendar");
+ var url = calendar.data("check-url");
+ var params = {
+ "start": calendar.fullCalendar('getView').start.format(),
+ "end": calendar.fullCalendar('getView').end.format(),
+ "user_id": calendar.data("user-id")
+ }
+
+ for (var key in params) {
+ url += "&" + key + "=" + params[key];
+ }
+
+ $.getJSON(url, function(events) {
+ calendar.fullCalendar('removeEvents');
+ calendar.fullCalendar('addEventSource', events);
+ calendar.fullCalendar('rerenderEvents');
+ });
+ }
+
+ // Show the project calendar
+ function show_project_calendar()
+ {
+ var calendar = $("#calendar");
+ var translations = calendar.data("translations");
+
+ calendar.fullCalendar({
+ lang: $("body").data("js-lang"),
+ editable: true,
+ eventLimit: true,
+ header: {
+ left: 'prev,next today',
+ center: 'title',
+ right: 'month,agendaWeek,agendaDay'
+ },
+ viewRender: load_project_filters,
+ eventDrop: move_calendar_event
});
}
// Refresh the calendar events
- function refresh_calendar(filters)
+ function refresh_project_calendar(filters)
{
var calendar = $("#calendar");
var url = calendar.data("check-url");
@@ -62,7 +104,7 @@ Kanboard.Calendar = (function() {
}
// Restore saved filters
- function load_filters()
+ function load_project_filters()
{
var filters = Kanboard.GetStorageItem(filter_storage_key);
@@ -74,13 +116,13 @@ Kanboard.Calendar = (function() {
}
}
- refresh_calendar(filters || {});
+ refresh_project_calendar(filters || {});
- $('.calendar-filter').change(apply_filters);
+ $('.calendar-filter').change(apply_project_filters);
}
// Apply filters on change
- function apply_filters()
+ function apply_project_filters()
{
var filters = {};
@@ -89,15 +131,18 @@ Kanboard.Calendar = (function() {
});
Kanboard.SetStorageItem(filter_storage_key, JSON.stringify(filters));
- refresh_calendar(filters);
+ refresh_project_calendar(filters);
}
jQuery(document).ready(function() {
if (Kanboard.Exists("calendar")) {
filter_storage_key = "calendar_filters_" + $("#calendar").data("project-id");
- show_calendar();
- load_filters();
+ show_project_calendar();
+ load_project_filters();
+ }
+ else if (Kanboard.Exists("user-calendar")) {
+ show_user_calendar();
}
});