Add project calendars (merge/refactoring of #490)

This commit is contained in:
Frederic Guillot 2015-01-17 17:11:51 -05:00
parent 4b45b2aa35
commit 84b0f0df90
50 changed files with 1438 additions and 173 deletions

View File

@ -196,4 +196,14 @@ class App extends Base
);
}
}
/**
* Colors stylesheet
*
* @access public
*/
public function colors()
{
$this->response->css($this->color->getCss());
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace Controller;
/**
* Project Calendar controller
*
* @package controller
* @author Frederic Guillot
* @author Timo Litzbarski
*/
class Calendar extends Base
{
/**
* Show calendar view
*
* @access public
*/
public function show()
{
$project = $this->getProject();
$this->response->html($this->template->layout('calendar/show', array(
'check_interval' => $this->config->get('board_private_refresh_interval'),
'users_list' => $this->projectPermission->getMemberList($project['id'], true, true),
'categories_list' => $this->category->getList($project['id'], true, true),
'columns_list' => $this->board->getColumnsList($project['id'], true),
'swimlanes_list' => $this->swimlane->getList($project['id'], true),
'colors_list' => $this->color->getList(true),
'status_list' => $this->taskStatus->getList(true),
'project' => $project,
'title' => t('Calendar for "%s"', $project['name']),
'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()),
)));
}
/**
* Get tasks to display on the calendar
*
* @access public
*/
public function events()
{
$this->response->json(
$this->taskFilter
->create()
->filterByProject($this->request->getIntegerParam('project_id'))
->filterByCategory($this->request->getIntegerParam('category_id', -1))
->filterByOwner($this->request->getIntegerParam('owner_id', -1))
->filterByColumn($this->request->getIntegerParam('column_id', -1))
->filterBySwimlane($this->request->getIntegerParam('swimlane_id', -1))
->filterByColor($this->request->getStringParam('color_id'))
->filterByStatus($this->request->getIntegerParam('is_active', -1))
->filterByDueDateRange(
$this->request->getStringParam('start'),
$this->request->getStringParam('end')
)
->toCalendarEvents()
);
}
/**
* Update task due date
*
* @access public
*/
public function save()
{
if ($this->request->isAjax() && $this->request->isPost()) {
$values = $this->request->getJson();
$this->taskModification->update(array(
'id' => $values['task_id'],
'date_due' => $values['date_due'],
));
}
}
}

View File

@ -104,9 +104,9 @@ class Helper
* @param string $filename Filename
* @return string
*/
public function css($filename)
public function css($filename, $is_file = true)
{
return '<link rel="stylesheet" href="'.$filename.'?'.filemtime($filename).'" media="screen">';
return '<link rel="stylesheet" href="'.$filename.($is_file ? '?'.filemtime($filename) : '').'" media="screen">';
}
/**
@ -417,7 +417,7 @@ class Helper
}
/**
* URL query string
* Generate controller/action url for templates
*
* u('task', 'show', array('task_id' => $task_id))
*
@ -429,17 +429,40 @@ class Helper
*/
public function u($controller, $action, array $params = array(), $csrf = false)
{
$html = '?controller='.$controller.'&amp;action='.$action;
$values = array(
'controller' => $controller,
'action' => $action,
);
if ($csrf) {
$params['csrf_token'] = Security::getCSRFToken();
}
foreach ($params as $key => $value) {
$html .= '&amp;'.$key.'='.$value;
}
$values += $params;
return $html;
return '?'.http_build_query($values, '', '&amp;');
}
/**
* Generate controller/action url
*
* l('task', 'show', array('task_id' => $task_id))
*
* @param string $controller Controller name
* @param string $action Action name
* @param array $params Url parameters
* @return string
*/
public function url($controller, $action, array $params = array())
{
$values = array(
'controller' => $controller,
'action' => $action,
);
$values += $params;
return '?'.http_build_query($values, '');
}
/**
@ -656,4 +679,55 @@ class Helper
return $default_value;
}
/**
* Get calendar translations
*
* @access public
* @return string
*/
public function getCalendarTranslations()
{
return json_encode(array(
'Today' => t('Today'),
'Jan' => t('Jan'),
'Feb' => t('Feb'),
'Mar' => t('Mar'),
'Apr' => t('Apr'),
'May' => t('May'),
'Jun' => t('Jun'),
'Jul' => t('Jul'),
'Aug' => t('Aug'),
'Sep' => t('Sep'),
'Oct' => t('Oct'),
'Nov' => t('Nov'),
'Dec' => t('Dec'),
'January' => t('January'),
'February' => t('February'),
'March' => t('March'),
'April' => t('April'),
'May' => t('May'),
'June' => t('June'),
'July' => t('July'),
'August' => t('August'),
'September' => t('September'),
'October' => t('October'),
'November' => t('November'),
'December' => t('December'),
'Sunday' => t('Sunday'),
'Monday' => t('Monday'),
'Tuesday' => t('Tuesday'),
'Wednesday' => t('Wednesday'),
'Thursday' => t('Thursday'),
'Friday' => t('Friday'),
'Saturday' => t('Saturday'),
'Sun' => t('Sun'),
'Mon' => t('Mon'),
'Tue' => t('Tue'),
'Wed' => t('Wed'),
'Thu' => t('Thu'),
'Fri' => t('Fri'),
'Sat' => t('Sat'),
));
}
}

View File

@ -167,6 +167,23 @@ class Response
exit;
}
/**
* Send a css response
*
* @access public
* @param string $data Raw data
* @param integer $status_code HTTP status code
*/
public function css($data, $status_code = 200)
{
$this->status($status_code);
header('Content-Type: text/css; charset=utf-8');
echo $data;
exit;
}
/**
* Send a binary response
*

View File

@ -647,5 +647,54 @@ return array(
// 'Application default' => '',
// 'Language:' => '',
// 'Timezone:' => '',
// 'All columns' => '',
// 'Calendar for "%s"' => '',
// 'Filter by column' => '',
// 'Filter by status' => '',
// 'Calendar' => '',
// 'Today' => '',
// 'Jan ' => '',
// 'Feb' => '',
// 'Mar' => '',
// 'Apr' => '',
// 'May' => '',
// 'Jun' => '',
// 'Jul' => '',
// 'Aug' => '',
// 'Sep' => '',
// 'Oct' => '',
// 'Nov' => '',
// 'Dec' => '',
// 'January' => '',
// 'February' => '',
// 'March' => '',
// 'April' => '',
// 'June' => '',
// 'July' => '',
// 'August' => '',
// 'September' => '',
// 'October' => '',
// 'November' => '',
// 'December' => '',
// 'Sunday' => '',
// 'Monday' => '',
// 'Tuesday' => '',
// 'Wednesday' => '',
// 'Thursday' => '',
// 'Friday' => '',
// 'Saturday' => '',
// 'Sun' => '',
// 'Mon' => '',
// 'Tue' => '',
// 'Wed' => '',
// 'Thu' => '',
// 'Fri' => '',
// 'Sat' => '',
// 'Next' => '',
// '#%d' => '',
// 'Filter by color' => '',
// 'Filter by swimlane' => '',
// 'All swimlanes' => '',
// 'All colors' => '',
// 'All status' => '',
);

View File

@ -647,5 +647,54 @@ return array(
'Application default' => 'Anwendungsstandard',
'Language:' => 'Sprache:',
'Timezone:' => 'Zeitzone:',
// 'Next' => '',
'All columns' => 'Alle Spalten',
'Calendar for "%s"' => 'Kalender für "%s"',
'Filter by column' => 'Spalte filtern',
'Filter by status' => 'Status filtern',
'Calendar' => 'Kalender',
'Today' => 'Heute',
'Jan ' => 'Jan',
'Feb' => 'Feb',
'Mar' => 'Mar',
'Apr' => 'Apr',
'May' => 'Mai',
'Jun' => 'Jun',
'Jul' => 'Jul',
'Aug' => 'Aug',
'Sep' => 'Sep',
'Oct' => 'Okt',
'Nov' => 'Nov',
'Dec' => 'Dez',
'January' => 'Januar',
'February' => 'Februar',
'March' => 'März',
'April' => 'April',
'June' => 'Juni',
'July' => 'Juli',
'August' => 'August',
'September' => 'September',
'October' => 'Oktober',
'November' => 'November',
'December' => 'Dezember',
'Sunday' => 'Sonntag',
'Monday' => 'Montag',
'Tuesday' => 'Dienstag',
'Wednesday' => 'Mittwoch',
'Thursday' => 'Donnerstag',
'Friday' => 'Freitag',
'Saturday' => 'Samstag',
'Sun' => 'So',
'Mon' => 'Mo',
'Tue' => 'Di',
'Wed' => 'Mi',
'Thu' => 'Do',
'Fri' => 'Fr',
'Sat' => 'Sa',
'Next' => 'Nächste',
// '#%d' => '',
'Filter by color' => 'Farbe filtern',
'Filter by swimlane' => 'Swimlane filtern',
'All swimlanes' => 'Alle Swimlanes',
'All colors' => 'Alle Farben',
// 'All status' => '',
);

View File

@ -647,5 +647,54 @@ return array(
// 'Application default' => '',
// 'Language:' => '',
// 'Timezone:' => '',
// 'All columns' => '',
// 'Calendar for "%s"' => '',
// 'Filter by column' => '',
// 'Filter by status' => '',
// 'Calendar' => '',
// 'Today' => '',
// 'Jan ' => '',
// 'Feb' => '',
// 'Mar' => '',
// 'Apr' => '',
// 'May' => '',
// 'Jun' => '',
// 'Jul' => '',
// 'Aug' => '',
// 'Sep' => '',
// 'Oct' => '',
// 'Nov' => '',
// 'Dec' => '',
// 'January' => '',
// 'February' => '',
// 'March' => '',
// 'April' => '',
// 'June' => '',
// 'July' => '',
// 'August' => '',
// 'September' => '',
// 'October' => '',
// 'November' => '',
// 'December' => '',
// 'Sunday' => '',
// 'Monday' => '',
// 'Tuesday' => '',
// 'Wednesday' => '',
// 'Thursday' => '',
// 'Friday' => '',
// 'Saturday' => '',
// 'Sun' => '',
// 'Mon' => '',
// 'Tue' => '',
// 'Wed' => '',
// 'Thu' => '',
// 'Fri' => '',
// 'Sat' => '',
// 'Next' => '',
// '#%d' => '',
// 'Filter by color' => '',
// 'Filter by swimlane' => '',
// 'All swimlanes' => '',
// 'All colors' => '',
// 'All status' => '',
);

View File

@ -647,5 +647,54 @@ return array(
// 'Application default' => '',
// 'Language:' => '',
// 'Timezone:' => '',
// 'All columns' => '',
// 'Calendar for "%s"' => '',
// 'Filter by column' => '',
// 'Filter by status' => '',
// 'Calendar' => '',
// 'Today' => '',
// 'Jan ' => '',
// 'Feb' => '',
// 'Mar' => '',
// 'Apr' => '',
// 'May' => '',
// 'Jun' => '',
// 'Jul' => '',
// 'Aug' => '',
// 'Sep' => '',
// 'Oct' => '',
// 'Nov' => '',
// 'Dec' => '',
// 'January' => '',
// 'February' => '',
// 'March' => '',
// 'April' => '',
// 'June' => '',
// 'July' => '',
// 'August' => '',
// 'September' => '',
// 'October' => '',
// 'November' => '',
// 'December' => '',
// 'Sunday' => '',
// 'Monday' => '',
// 'Tuesday' => '',
// 'Wednesday' => '',
// 'Thursday' => '',
// 'Friday' => '',
// 'Saturday' => '',
// 'Sun' => '',
// 'Mon' => '',
// 'Tue' => '',
// 'Wed' => '',
// 'Thu' => '',
// 'Fri' => '',
// 'Sat' => '',
// 'Next' => '',
// '#%d' => '',
// 'Filter by color' => '',
// 'Filter by swimlane' => '',
// 'All swimlanes' => '',
// 'All colors' => '',
// 'All status' => '',
);

View File

@ -647,6 +647,55 @@ return array(
'Application default' => 'Valeur par défaut de l\'application',
'Language:' => 'Langue :',
'Timezone:' => 'Fuseau horaire :',
'All columns' => 'Toutes les colonnes',
'Calendar for "%s"' => 'Agenda pour le projet « %s »',
'Filter by column' => 'Filtrer par colonne',
'Filter by status' => 'Filtrer par status',
'Calendar' => 'Agenda',
'Today' => 'Aujourd\'hui',
'Jan ' => 'Janv',
'Feb' => 'Fév',
'Mar' => 'Mars',
'Apr' => 'Avr',
'May' => 'Mai',
'Jun' => 'Juin',
'Jul' => 'Juil',
'Aug' => 'Août',
'Sep' => 'Sept',
'Oct' => 'Oct',
'Nov' => 'Nov',
'Dec' => 'Déc',
'January' => 'Janvier',
'February' => 'Février',
'March' => 'Mars',
'April' => 'Avril',
'May' => 'Mai',
'June' => 'Juin',
'July' => 'Juillet',
'August' => 'Août',
'September' => 'Septembre',
'October' => 'Octobre',
'November' => 'Novembre',
'December' => 'Décembre',
'Sunday' => 'Dimanche',
'Monday' => 'Lundi',
'Tuesday' => 'Mardi',
'Wednesday' => 'Mercredi',
'Thursday' => 'Jeudi',
'Friday' => 'Vendredi',
'Saturday' => 'Samedi',
'Sun' => 'Dim',
'Mon' => 'Lun',
'Tue' => 'Mar',
'Wed' => 'Mer',
'Thu' => 'Jeu',
'Fri' => 'Ven',
'Sat' => 'Sam',
'Next' => 'Suivant',
'#%d' => 'n˚%d',
'Filter by color' => 'Filtrer par couleur',
'Filter by swimlane' => 'Filtrer par swimlanes',
'All swimlanes' => 'Toutes les swimlanes',
'All colors' => 'Toutes les couleurs',
'All status' => 'Tous les états',
);

View File

@ -647,5 +647,54 @@ return array(
// 'Application default' => '',
// 'Language:' => '',
// 'Timezone:' => '',
// 'All columns' => '',
// 'Calendar for "%s"' => '',
// 'Filter by column' => '',
// 'Filter by status' => '',
// 'Calendar' => '',
// 'Today' => '',
// 'Jan ' => '',
// 'Feb' => '',
// 'Mar' => '',
// 'Apr' => '',
// 'May' => '',
// 'Jun' => '',
// 'Jul' => '',
// 'Aug' => '',
// 'Sep' => '',
// 'Oct' => '',
// 'Nov' => '',
// 'Dec' => '',
// 'January' => '',
// 'February' => '',
// 'March' => '',
// 'April' => '',
// 'June' => '',
// 'July' => '',
// 'August' => '',
// 'September' => '',
// 'October' => '',
// 'November' => '',
// 'December' => '',
// 'Sunday' => '',
// 'Monday' => '',
// 'Tuesday' => '',
// 'Wednesday' => '',
// 'Thursday' => '',
// 'Friday' => '',
// 'Saturday' => '',
// 'Sun' => '',
// 'Mon' => '',
// 'Tue' => '',
// 'Wed' => '',
// 'Thu' => '',
// 'Fri' => '',
// 'Sat' => '',
// 'Next' => '',
// '#%d' => '',
// 'Filter by color' => '',
// 'Filter by swimlane' => '',
// 'All swimlanes' => '',
// 'All colors' => '',
// 'All status' => '',
);

View File

@ -647,5 +647,54 @@ return array(
// 'Application default' => '',
// 'Language:' => '',
// 'Timezone:' => '',
// 'All columns' => '',
// 'Calendar for "%s"' => '',
// 'Filter by column' => '',
// 'Filter by status' => '',
// 'Calendar' => '',
// 'Today' => '',
// 'Jan ' => '',
// 'Feb' => '',
// 'Mar' => '',
// 'Apr' => '',
// 'May' => '',
// 'Jun' => '',
// 'Jul' => '',
// 'Aug' => '',
// 'Sep' => '',
// 'Oct' => '',
// 'Nov' => '',
// 'Dec' => '',
// 'January' => '',
// 'February' => '',
// 'March' => '',
// 'April' => '',
// 'June' => '',
// 'July' => '',
// 'August' => '',
// 'September' => '',
// 'October' => '',
// 'November' => '',
// 'December' => '',
// 'Sunday' => '',
// 'Monday' => '',
// 'Tuesday' => '',
// 'Wednesday' => '',
// 'Thursday' => '',
// 'Friday' => '',
// 'Saturday' => '',
// 'Sun' => '',
// 'Mon' => '',
// 'Tue' => '',
// 'Wed' => '',
// 'Thu' => '',
// 'Fri' => '',
// 'Sat' => '',
// 'Next' => '',
// '#%d' => '',
// 'Filter by color' => '',
// 'Filter by swimlane' => '',
// 'All swimlanes' => '',
// 'All colors' => '',
// 'All status' => '',
);

View File

@ -647,5 +647,54 @@ return array(
// 'Application default' => '',
// 'Language:' => '',
// 'Timezone:' => '',
// 'All columns' => '',
// 'Calendar for "%s"' => '',
// 'Filter by column' => '',
// 'Filter by status' => '',
// 'Calendar' => '',
// 'Today' => '',
// 'Jan ' => '',
// 'Feb' => '',
// 'Mar' => '',
// 'Apr' => '',
// 'May' => '',
// 'Jun' => '',
// 'Jul' => '',
// 'Aug' => '',
// 'Sep' => '',
// 'Oct' => '',
// 'Nov' => '',
// 'Dec' => '',
// 'January' => '',
// 'February' => '',
// 'March' => '',
// 'April' => '',
// 'June' => '',
// 'July' => '',
// 'August' => '',
// 'September' => '',
// 'October' => '',
// 'November' => '',
// 'December' => '',
// 'Sunday' => '',
// 'Monday' => '',
// 'Tuesday' => '',
// 'Wednesday' => '',
// 'Thursday' => '',
// 'Friday' => '',
// 'Saturday' => '',
// 'Sun' => '',
// 'Mon' => '',
// 'Tue' => '',
// 'Wed' => '',
// 'Thu' => '',
// 'Fri' => '',
// 'Sat' => '',
// 'Next' => '',
// '#%d' => '',
// 'Filter by color' => '',
// 'Filter by swimlane' => '',
// 'All swimlanes' => '',
// 'All colors' => '',
// 'All status' => '',
);

View File

@ -647,5 +647,54 @@ return array(
// 'Application default' => '',
// 'Language:' => '',
// 'Timezone:' => '',
// 'All columns' => '',
// 'Calendar for "%s"' => '',
// 'Filter by column' => '',
// 'Filter by status' => '',
// 'Calendar' => '',
// 'Today' => '',
// 'Jan ' => '',
// 'Feb' => '',
// 'Mar' => '',
// 'Apr' => '',
// 'May' => '',
// 'Jun' => '',
// 'Jul' => '',
// 'Aug' => '',
// 'Sep' => '',
// 'Oct' => '',
// 'Nov' => '',
// 'Dec' => '',
// 'January' => '',
// 'February' => '',
// 'March' => '',
// 'April' => '',
// 'June' => '',
// 'July' => '',
// 'August' => '',
// 'September' => '',
// 'October' => '',
// 'November' => '',
// 'December' => '',
// 'Sunday' => '',
// 'Monday' => '',
// 'Tuesday' => '',
// 'Wednesday' => '',
// 'Thursday' => '',
// 'Friday' => '',
// 'Saturday' => '',
// 'Sun' => '',
// 'Mon' => '',
// 'Tue' => '',
// 'Wed' => '',
// 'Thu' => '',
// 'Fri' => '',
// 'Sat' => '',
// 'Next' => '',
// '#%d' => '',
// 'Filter by color' => '',
// 'Filter by swimlane' => '',
// 'All swimlanes' => '',
// 'All colors' => '',
// 'All status' => '',
);

View File

@ -647,5 +647,54 @@ return array(
'Application default' => 'Aplicação padrão',
'Language:' => 'Idioma',
'Timezone:' => 'Fuso horário',
// 'All columns' => '',
// 'Calendar for "%s"' => '',
// 'Filter by column' => '',
// 'Filter by status' => '',
// 'Calendar' => '',
// 'Today' => '',
// 'Jan ' => '',
// 'Feb' => '',
// 'Mar' => '',
// 'Apr' => '',
// 'May' => '',
// 'Jun' => '',
// 'Jul' => '',
// 'Aug' => '',
// 'Sep' => '',
// 'Oct' => '',
// 'Nov' => '',
// 'Dec' => '',
// 'January' => '',
// 'February' => '',
// 'March' => '',
// 'April' => '',
// 'June' => '',
// 'July' => '',
// 'August' => '',
// 'September' => '',
// 'October' => '',
// 'November' => '',
// 'December' => '',
// 'Sunday' => '',
// 'Monday' => '',
// 'Tuesday' => '',
// 'Wednesday' => '',
// 'Thursday' => '',
// 'Friday' => '',
// 'Saturday' => '',
// 'Sun' => '',
// 'Mon' => '',
// 'Tue' => '',
// 'Wed' => '',
// 'Thu' => '',
// 'Fri' => '',
// 'Sat' => '',
'Next' => 'Próximo',
// '#%d' => '',
// 'Filter by color' => '',
// 'Filter by swimlane' => '',
// 'All swimlanes' => '',
// 'All colors' => '',
// 'All status' => '',
);

View File

@ -647,5 +647,54 @@ return array(
// 'Application default' => '',
// 'Language:' => '',
// 'Timezone:' => '',
// 'All columns' => '',
// 'Calendar for "%s"' => '',
// 'Filter by column' => '',
// 'Filter by status' => '',
// 'Calendar' => '',
// 'Today' => '',
// 'Jan ' => '',
// 'Feb' => '',
// 'Mar' => '',
// 'Apr' => '',
// 'May' => '',
// 'Jun' => '',
// 'Jul' => '',
// 'Aug' => '',
// 'Sep' => '',
// 'Oct' => '',
// 'Nov' => '',
// 'Dec' => '',
// 'January' => '',
// 'February' => '',
// 'March' => '',
// 'April' => '',
// 'June' => '',
// 'July' => '',
// 'August' => '',
// 'September' => '',
// 'October' => '',
// 'November' => '',
// 'December' => '',
// 'Sunday' => '',
// 'Monday' => '',
// 'Tuesday' => '',
// 'Wednesday' => '',
// 'Thursday' => '',
// 'Friday' => '',
// 'Saturday' => '',
// 'Sun' => '',
// 'Mon' => '',
// 'Tue' => '',
// 'Wed' => '',
// 'Thu' => '',
// 'Fri' => '',
// 'Sat' => '',
// 'Next' => '',
// '#%d' => '',
// 'Filter by color' => '',
// 'Filter by swimlane' => '',
// 'All swimlanes' => '',
// 'All colors' => '',
// 'All status' => '',
);

View File

@ -647,5 +647,54 @@ return array(
'Application default' => 'Applikationsstandard',
'Language:' => 'Språk',
'Timezone:' => 'Tidszon',
// 'All columns' => '',
// 'Calendar for "%s"' => '',
// 'Filter by column' => '',
// 'Filter by status' => '',
// 'Calendar' => '',
// 'Today' => '',
// 'Jan ' => '',
// 'Feb' => '',
// 'Mar' => '',
// 'Apr' => '',
// 'May' => '',
// 'Jun' => '',
// 'Jul' => '',
// 'Aug' => '',
// 'Sep' => '',
// 'Oct' => '',
// 'Nov' => '',
// 'Dec' => '',
// 'January' => '',
// 'February' => '',
// 'March' => '',
// 'April' => '',
// 'June' => '',
// 'July' => '',
// 'August' => '',
// 'September' => '',
// 'October' => '',
// 'November' => '',
// 'December' => '',
// 'Sunday' => '',
// 'Monday' => '',
// 'Tuesday' => '',
// 'Wednesday' => '',
// 'Thursday' => '',
// 'Friday' => '',
// 'Saturday' => '',
// 'Sun' => '',
// 'Mon' => '',
// 'Tue' => '',
// 'Wed' => '',
// 'Thu' => '',
// 'Fri' => '',
// 'Sat' => '',
'Next' => 'Nästa',
// '#%d' => '',
// 'Filter by color' => '',
// 'Filter by swimlane' => '',
// 'All swimlanes' => '',
// 'All colors' => '',
// 'All status' => '',
);

View File

@ -647,5 +647,54 @@ return array(
// 'Application default' => '',
// 'Language:' => '',
// 'Timezone:' => '',
// 'All columns' => '',
// 'Calendar for "%s"' => '',
// 'Filter by column' => '',
// 'Filter by status' => '',
// 'Calendar' => '',
// 'Today' => '',
// 'Jan ' => '',
// 'Feb' => '',
// 'Mar' => '',
// 'Apr' => '',
// 'May' => '',
// 'Jun' => '',
// 'Jul' => '',
// 'Aug' => '',
// 'Sep' => '',
// 'Oct' => '',
// 'Nov' => '',
// 'Dec' => '',
// 'January' => '',
// 'February' => '',
// 'March' => '',
// 'April' => '',
// 'June' => '',
// 'July' => '',
// 'August' => '',
// 'September' => '',
// 'October' => '',
// 'November' => '',
// 'December' => '',
// 'Sunday' => '',
// 'Monday' => '',
// 'Tuesday' => '',
// 'Wednesday' => '',
// 'Thursday' => '',
// 'Friday' => '',
// 'Saturday' => '',
// 'Sun' => '',
// 'Mon' => '',
// 'Tue' => '',
// 'Wed' => '',
// 'Thu' => '',
// 'Fri' => '',
// 'Sat' => '',
// 'Next' => '',
// '#%d' => '',
// 'Filter by color' => '',
// 'Filter by swimlane' => '',
// 'All swimlanes' => '',
// 'All colors' => '',
// 'All status' => '',
);

View File

@ -647,5 +647,54 @@ return array(
// 'Application default' => '',
// 'Language:' => '',
// 'Timezone:' => '',
// 'All columns' => '',
// 'Calendar for "%s"' => '',
// 'Filter by column' => '',
// 'Filter by status' => '',
// 'Calendar' => '',
// 'Today' => '',
// 'Jan ' => '',
// 'Feb' => '',
// 'Mar' => '',
// 'Apr' => '',
// 'May' => '',
// 'Jun' => '',
// 'Jul' => '',
// 'Aug' => '',
// 'Sep' => '',
// 'Oct' => '',
// 'Nov' => '',
// 'Dec' => '',
// 'January' => '',
// 'February' => '',
// 'March' => '',
// 'April' => '',
// 'June' => '',
// 'July' => '',
// 'August' => '',
// 'September' => '',
// 'October' => '',
// 'November' => '',
// 'December' => '',
// 'Sunday' => '',
// 'Monday' => '',
// 'Tuesday' => '',
// 'Wednesday' => '',
// 'Thursday' => '',
// 'Friday' => '',
// 'Saturday' => '',
// 'Sun' => '',
// 'Mon' => '',
// 'Tue' => '',
// 'Wed' => '',
// 'Thu' => '',
// 'Fri' => '',
// 'Sat' => '',
// 'Next' => '',
// '#%d' => '',
// 'Filter by color' => '',
// 'Filter by swimlane' => '',
// 'All swimlanes' => '',
// 'All colors' => '',
// 'All status' => '',
);

View File

@ -37,6 +37,7 @@ class Acl extends Base
'project' => array('show', 'tasks', 'search', 'activity'),
'subtask' => '*',
'task' => '*',
'calendar' => '*',
);
/**

View File

@ -258,16 +258,19 @@ class Board extends Base
*
* @access public
* @param integer $project_id
* @param boolean $prepend Prepend default value
* @return array
*/
public function getColumnStats($project_id)
public function getColumnStats($project_id, $prepend = false)
{
return $this->db
->table(Task::TABLE)
->eq('project_id', $project_id)
->eq('is_active', 1)
->groupBy('column_id')
->listing('column_id', 'COUNT(*) AS total');
$listing = $this->db
->table(Task::TABLE)
->eq('project_id', $project_id)
->eq('is_active', 1)
->groupBy('column_id')
->listing('column_id', 'COUNT(*) AS total');
return $prepend ? array(-1 => t('All columns')) + $listing : $listing;
}
/**
@ -287,11 +290,13 @@ class Board extends Base
*
* @access public
* @param integer $project_id Project id
* @param boolean $prepend Prepend a default value
* @return array
*/
public function getColumnsList($project_id)
public function getColumnsList($project_id, $prepend = false)
{
return $this->db->table(self::TABLE)->eq('project_id', $project_id)->asc('position')->listing('id', 'title');
$listing = $this->db->table(self::TABLE)->eq('project_id', $project_id)->asc('position')->listing('id', 'title');
return $prepend ? array(-1 => t('All columns')) + $listing : $listing;
}
/**

View File

@ -3,22 +3,68 @@
namespace Model;
/**
* Color model (TODO: model for the future color picker)
* Color model
*
* @package model
* @author Frederic Guillot
*/
class Color extends Base
{
/**
* Default colors
*
* @access private
* @var array
*/
private $default_colors = array(
'yellow' => array(
'name' => 'Yellow',
'background' => 'rgb(245, 247, 196)',
'border' => 'rgb(223, 227, 45)',
),
'blue' => array(
'name' => 'Blue',
'background' => 'rgb(219, 235, 255)',
'border' => 'rgb(168, 207, 255)',
),
'green' => array(
'name' => 'Green',
'background' => 'rgb(189, 244, 203)',
'border' => 'rgb(74, 227, 113)',
),
'purple' => array(
'name' => 'Purple',
'background' => 'rgb(223, 176, 255)',
'border' => 'rgb(205, 133, 254)',
),
'red' => array(
'name' => 'Red',
'background' => 'rgb(255, 187, 187)',
'border' => 'rgb(255, 151, 151)',
),
'orange' => array(
'name' => 'Orange',
'background' => 'rgb(255, 215, 179)',
'border' => 'rgb(255, 172, 98)',
),
'grey' => array(
'name' => 'Grey',
'background' => 'rgb(238, 238, 238)',
'border' => 'rgb(204, 204, 204)',
),
);
/**
* Get available colors
*
* @access public
* @return array
*/
public function getList()
public function getList($prepend = false)
{
return array(
$listing = $prepend ? array('' => t('All colors')) : array();
return $listing + array(
'yellow' => t('Yellow'),
'blue' => t('Blue'),
'green' => t('Green'),
@ -39,4 +85,57 @@ class Color extends Base
{
return 'yellow'; // TODO: make this parameter configurable
}
/**
* Get Bordercolor from string
*
* @access public
* @param string $color_id Color id
* @return string
*/
public function getBorderColor($color_id)
{
if (isset($this->default_colors[$color_id])) {
return $this->default_colors[$color_id]['border'];
}
return $this->default_colors[$this->getDefaultColor()]['border'];
}
/**
* Get background color from the color_id
*
* @access public
* @param string $color_id Color id
* @return string
*/
public function getBackgroundColor($color_id)
{
if (isset($this->default_colors[$color_id])) {
return $this->default_colors[$color_id]['background'];
}
return $this->default_colors[$this->getDefaultColor()]['background'];
}
/**
* Get CSS stylesheet of all colors
*
* @access public
* @return string
*/
public function getCss()
{
$buffer = '';
foreach ($this->default_colors as $color => $values) {
$buffer .= 'td.color-'.$color.',';
$buffer .= 'div.color-'.$color.' {';
$buffer .= 'background-color: '.$values['background'].';';
$buffer .= 'border-color: '.$values['border'];
$buffer .= '}';
}
return $buffer;
}
}

View File

@ -98,6 +98,18 @@ class DateParser extends Base
return mktime(0, 0, 0, date('m', $timestamp), date('d', $timestamp), date('Y', $timestamp));
}
/**
* Get a timetstamp from an ISO date format
*
* @access public
* @param string $date Date format
* @return integer
*/
public function getTimestampFromIsoFormat($date)
{
return $this->resetDateToMidnight(strtotime($date));
}
/**
* Format date (form display)
*

View File

@ -161,20 +161,20 @@ class Swimlane extends Base
*
* @access public
* @param integer $project_id Project id
* @param boolean $prepend Prepend default value
* @return array
*/
public function getSwimlanesList($project_id)
public function getList($project_id, $prepend = false)
{
$swimlanes = $this->db->table(self::TABLE)
->eq('project_id', $project_id)
->orderBy('position', 'asc')
->listing('id', 'name');
$swimlanes = array();
$swimlanes[] = $this->db->table(Project::TABLE)->eq('id', $project_id)->findOneColumn('default_swimlane');
$swimlanes[0] = $this->db->table(Project::TABLE)
->eq('id', $project_id)
->findOneColumn('default_swimlane');
$swimlanes = array_merge(
$swimlanes,
$this->db->table(self::TABLE)->eq('project_id', $project_id)->orderBy('name', 'asc')->listing('id', 'name')
);
return $swimlanes;
return $prepend ? array(-1 => t('All swimlanes')) + $swimlanes : $swimlanes;
}
/**

View File

@ -24,7 +24,7 @@ class TaskExport extends Base
public function export($project_id, $from, $to)
{
$tasks = $this->getTasks($project_id, $from, $to);
$swimlanes = $this->swimlane->getSwimlanesList($project_id);
$swimlanes = $this->swimlane->getList($project_id);
$results = array($this->getColumns());
foreach ($tasks as &$task) {

117
app/Model/TaskFilter.php Normal file
View File

@ -0,0 +1,117 @@
<?php
namespace Model;
/**
* Task Filter
*
* @package model
* @author Frederic Guillot
*/
class TaskFilter extends Base
{
private $query;
public function create()
{
$this->query = $this->db->table(Task::TABLE);
return $this;
}
public function filterByProject($project_id)
{
if ($project_id > 0) {
$this->query->eq('project_id', $project_id);
}
return $this;
}
public function filterByCategory($category_id)
{
if ($category_id >= 0) {
$this->query->eq('category_id', $category_id);
}
return $this;
}
public function filterByOwner($owner_id)
{
if ($owner_id >= 0) {
$this->query->eq('owner_id', $owner_id);
}
return $this;
}
public function filterByColor($color_id)
{
if ($color_id !== '') {
$this->query->eq('color_id', $color_id);
}
return $this;
}
public function filterByColumn($column_id)
{
if ($column_id >= 0) {
$this->query->eq('column_id', $column_id);
}
return $this;
}
public function filterBySwimlane($swimlane_id)
{
if ($swimlane_id >= 0) {
$this->query->eq('swimlane_id', $swimlane_id);
}
return $this;
}
public function filterByStatus($is_active)
{
if ($is_active >= 0) {
$this->query->eq('is_active', $is_active);
}
return $this;
}
public function filterByDueDateRange($start, $end)
{
$this->query->gte('date_due', $this->dateParser->getTimestampFromIsoFormat($start));
$this->query->lte('date_due', $this->dateParser->getTimestampFromIsoFormat($end));
return $this;
}
public function findAll()
{
return $this->query->findAll();
}
public function toCalendarEvents()
{
$events = array();
foreach ($this->query->findAll() as $task) {
$events[] = array(
'id' => $task['id'],
'title' => t('#%d', $task['id']).' '.$task['title'],
'start' => date('Y-m-d', $task['date_due']),
'end' => date('Y-m-d', $task['date_due']),
'allday' => true,
'backgroundColor' => $this->color->getBackgroundColor($task['color_id']),
'borderColor' => $this->color->getBorderColor($task['color_id']),
'textColor' => 'black',
'url' => $this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])),
);
}
return $events;
}
}

View File

@ -12,6 +12,23 @@ use Event\TaskEvent;
*/
class TaskStatus extends Base
{
/**
* Return the list of statuses
*
* @access public
* @param boolean $prepend Prepend default value
* @return array
*/
public function getList($prepend = false)
{
$listing = $prepend ? array(-1 => t('All status')) : array();
return $listing + array(
Task::STATUS_OPEN => t('Open'),
Task::STATUS_CLOSED => t('Closed'),
);
}
/**
* Return true if the task is closed
*

View File

@ -39,6 +39,7 @@ class ClassProvider implements ServiceProviderInterface
'TaskDuplication',
'TaskExport',
'TaskFinder',
'TaskFilter',
'TaskModification',
'TaskPaginator',
'TaskPermission',
@ -51,6 +52,7 @@ class ClassProvider implements ServiceProviderInterface
'Webhook',
),
'Core' => array(
'Helper',
'Template',
'Session',
'MemoryCache',

View File

@ -17,6 +17,7 @@
<?php if ($this->isManager($project['id'])): ?>
<?= $this->a('<i class="fa fa-cog"></i>', 'project', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Settings')) ?>&nbsp;
<?php endif ?>
<?= $this->a('<i class="fa fa-calendar"></i>', 'calendar', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Calendar')) ?>&nbsp;
<?= $this->a($this->e($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?>
</td>
<td class="dashboard-project-stats">

View File

@ -11,7 +11,7 @@
</tr>
<?php foreach ($subtasks as $subtask): ?>
<tr>
<td class="task-table task-<?= $subtask['color_id'] ?>">
<td class="task-table color-<?= $subtask['color_id'] ?>">
<?= $this->a('#'.$subtask['task_id'], 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?>
</td>
<td>

View File

@ -11,7 +11,7 @@
</tr>
<?php foreach ($tasks as $task): ?>
<tr>
<td class="task-table task-<?= $task['color_id'] ?>">
<td class="task-table color-<?= $task['color_id'] ?>">
<?= $this->a('#'.$task['id'], 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</td>
<td>

View File

@ -23,13 +23,19 @@
<i class="fa fa-dashboard fa-fw"></i>
<?= $this->a(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?>
</li>
<li>
<i class="fa fa-calendar fa-fw"></i>
<?= $this->a(t('Calendar'), 'calendar', 'show', array('project_id' => $project['id'])) ?>
</li>
<?php if ($this->acl->isManagerActionAllowed($project['id'])): ?>
<li>
<i class="fa fa-line-chart fa-fw"></i>
<?= $this->a(t('Analytics'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?>
</li>
<li><i class="fa fa-cog fa-fw"></i>
<li>
<i class="fa fa-cog fa-fw"></i>
<?= $this->a(t('Configure'), 'project', 'show', array('project_id' => $project['id'])) ?>
</li>
<?php endif ?>
</ul>
</div>

View File

@ -1,6 +1,6 @@
<?php if ($not_editable): ?>
<div class="task-board task-<?= $task['color_id'] ?> <?= $task['date_modification'] > time() - $board_highlight_period ? 'task-board-recent' : '' ?>">
<div class="task-board color-<?= $task['color_id'] ?> <?= $task['date_modification'] > time() - $board_highlight_period ? 'task-board-recent' : '' ?>">
<?= $this->a('#'.$task['id'], 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?>
@ -30,7 +30,7 @@
<?php else: ?>
<div class="task-board draggable-item task-<?= $task['color_id'] ?> <?= $task['date_modification'] > time() - $board_highlight_period ? 'task-board-recent' : '' ?>"
<div class="task-board draggable-item color-<?= $task['color_id'] ?> <?= $task['date_modification'] > time() - $board_highlight_period ? 'task-board-recent' : '' ?>"
data-task-id="<?= $task['id'] ?>"
data-owner-id="<?= $task['owner_id'] ?>"
data-category-id="<?= $task['category_id'] ?>"

View File

@ -0,0 +1,29 @@
<section id="main">
<div class="page-header">
<ul>
<li><i class="fa fa-table fa-fw"></i><?= $this->a(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?></li>
</ul>
</div>
<section class="sidebar-container">
<?= $this->render('calendar/sidebar', array(
'project' => $project,
'users_list' => $users_list,
'categories_list' => $categories_list,
'columns_list' => $columns_list,
'swimlanes_list' => $swimlanes_list,
'colors_list' => $colors_list,
'status_list' => $status_list
)) ?>
<div class="sidebar-content">
<div id="calendar"
data-save-url="<?= $this->u('calendar', 'save', array('project_id' => $project['id'])) ?>"
data-check-url="<?= $this->u('calendar', 'events', array('project_id' => $project['id'])) ?>"
data-check-interval="<?= $check_interval ?>"
data-translations='<?= $this->getCalendarTranslations() ?>'
>
</div>
</div>
</section>
</section>

View File

@ -0,0 +1,40 @@
<div class="sidebar">
<ul class="no-bullet">
<li>
<?= t('Filter by user') ?>
</li>
<li>
<?= $this->formSelect('owner_id', $users_list, array(), array(), 'calendar-filter') ?>
</li>
<li>
<?= t('Filter by category') ?>
</li>
<li>
<?= $this->formSelect('category_id', $categories_list, array(), array(), 'calendar-filter') ?>
</li>
<li>
<?= t('Filter by column') ?>
</li>
<li>
<?= $this->formSelect('column_id', $columns_list, array(), array(), 'calendar-filter') ?>
</li>
<li>
<?= t('Filter by swimlane') ?>
</li>
<li>
<?= $this->formSelect('swimlane_id', $swimlanes_list, array(), array(), 'calendar-filter') ?>
</li>
<li>
<?= t('Filter by color') ?>
</li>
<li>
<?= $this->formSelect('color_id', $colors_list, array(), array(), 'calendar-filter') ?>
</li>
<li>
<?= t('Filter by status') ?>
</li>
<li>
<?= $this->formSelect('is_active', $status_list, array(), array(), 'calendar-filter') ?>
</li>
</ul>
</div>

View File

@ -14,6 +14,7 @@
<?= $this->js('assets/js/app.js') ?>
<?php endif ?>
<?= $this->css($this->u('app', 'colors'), false) ?>
<?= $this->css('assets/css/app.css') ?>
<link rel="icon" type="image/png" href="assets/img/favicon.png">

View File

@ -1,4 +1,4 @@
<div class="task-<?= $task['color_id'] ?> task-show-details">
<div class="color-<?= $task['color_id'] ?> task-show-details">
<h2><?= $this->e('#'.$task['id'].' '.$task['title']) ?></h2>
<?php if ($task['score']): ?>
<span class="task-score"><?= $this->e($task['score']) ?></span>

View File

@ -12,7 +12,7 @@
</tr>
<?php foreach ($tasks as $task): ?>
<tr>
<td class="task-table task-<?= $task['color_id'] ?>">
<td class="task-table color-<?= $task['color_id'] ?>">
<?= $this->a('#'.$this->e($task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?>
</td>
<td>

File diff suppressed because one or more lines are too long

5
assets/css/fullcalendar.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -13,6 +13,7 @@
left: 0px;
top: 0;
max-width: 250px;
min-width: 200px;
padding: 10px;
padding-top: 0;
border: 1px solid #ddd;

View File

@ -205,46 +205,3 @@ a.task-board-nobody {
margin-bottom: 25px;
padding: 3px;
}
/* task colors */
tr td.task-blue,
.task-blue {
background-color: rgb(219, 235, 255);
border-color: rgb(168, 207, 255);
}
tr td.task-purple,
.task-purple {
background-color: rgb(223, 176, 255);
border-color: rgb(205, 133, 254);
}
tr td.task-grey,
.task-grey {
background-color: rgb(238, 238, 238);
border-color: rgb(204, 204, 204);
}
tr td.task-red,
.task-red {
background-color: rgb(255, 187, 187);
border-color: rgb(255, 151, 151);
}
tr td.task-green,
.task-green {
background-color: rgb(189, 244, 203);
border-color: rgb(74, 227, 113);
}
tr td.task-yellow,
.task-yellow {
background-color: rgb(245, 247, 196);
border-color: rgb(223, 227, 45);
}
tr td.task-orange,
.task-orange {
background-color: rgb(255, 215, 179);
border-color: rgb(255, 172, 98);
}

File diff suppressed because one or more lines are too long

View File

@ -65,6 +65,22 @@ var Kanboard = (function() {
return true;
},
// Save preferences in local storage
SetStorageItem: function(key, value) {
if (typeof(Storage) !== "undefined") {
localStorage.setItem(key, value);
}
},
GetStorageItem: function(key) {
if (typeof(Storage) !== "undefined") {
return localStorage.getItem(key);
}
return '';
},
// Generate Markdown preview
MarkdownPreview: function(e) {

View File

@ -1,4 +1,3 @@
// Board related functions
Kanboard.Board = (function() {
var checkInterval = null;
@ -191,6 +190,7 @@ Kanboard.Board = (function() {
var selectedUserId = $("#form-user_id").val();
var selectedCategoryId = $("#form-category_id").val();
var filterDueDate = $("#filter-due-date").hasClass("filter-on");
var projectId = $('#board').data('project-id');
$("[data-task-id]").each(function(index, item) {
@ -214,43 +214,36 @@ Kanboard.Board = (function() {
}
});
// Save filter settings for active project to localStorage
if (typeof(Storage) !== "undefined") {
var projectId = $('#board').data('project-id');
localStorage.setItem("filters_" + projectId + "_form-user_id", selectedUserId);
localStorage.setItem("filters_" + projectId + "_form-category_id", selectedCategoryId);
localStorage.setItem("filters_" + projectId + "_filter-due-date", ~~(filterDueDate));
}
// Save filter settings
Kanboard.SetStorageItem("board_filter_" + projectId + "_form-user_id", selectedUserId);
Kanboard.SetStorageItem("board_filter_" + projectId + "_form-category_id", selectedCategoryId);
Kanboard.SetStorageItem("board_filter_" + projectId + "_filter-due-date", ~~(filterDueDate));
}
// Load filter events
function filter_load_events()
{
var projectId = $('#board').data('project-id');
$("#form-user_id").change(filter_apply);
$("#form-category_id").change(filter_apply);
$("#filter-due-date").click(function(e) {
$(this).toggleClass("filter-on");
filter_apply();
e.preventDefault();
});
// Get and set filters from localStorage for active project
if (typeof(Storage) !== "undefined") {
var projectId = $('#board').data('project-id');
$("#form-user_id").val(localStorage.getItem("filters_" + projectId + "_form-user_id") || -1);
$("#form-category_id").val(localStorage.getItem("filters_" + projectId + "_form-category_id") || -1);
if (+localStorage.getItem("filters_" + projectId + "_filter-due-date")) {
$("#filter-due-date").addClass("filter-on");
} else {
$("#filter-due-date").removeClass("filter-on");
}
filter_apply();
// Get and set filters from localStorage
$("#form-user_id").val(Kanboard.GetStorageItem("board_filter_" + projectId + "_form-user_id") || -1);
$("#form-category_id").val(Kanboard.GetStorageItem("board_filter_" + projectId + "_form-category_id") || -1);
if (+Kanboard.GetStorageItem("board_filter_" + projectId + "_filter-due-date")) {
$("#filter-due-date").addClass("filter-on");
} else {
$("#filter-due-date").removeClass("filter-on");
}
filter_apply();
}
return {

103
assets/js/calendar.js Normal file
View File

@ -0,0 +1,103 @@
Kanboard.Calendar = (function() {
// Show the empty calendar
function show_calendar()
{
var calendar = $("#calendar");
var translations = calendar.data("translations");
calendar.fullCalendar({
editable: true,
eventLimit: true,
header: {
left: 'prev,next today',
center: 'title',
right: ''
},
eventDrop: move_calendar_event,
monthNames: [translations.January, translations.February, translations.March, translations.April, translations.May, translations.June, translations.July, translations.August, translations.September, translations.October, translations.November, translations.December],
monthNamesShort: [translations.Jan, translations.Feb, translations.Mar, translations.Apr, translations.May, translations.Jun, translations.Jul, translations.Aug, translations.Sep, translations.Oct, translations.Nov, translations.Dec],
buttonText: {today: translations.Today},
dayNames: [translations.Sunday, translations.Monday, translations.Tuesday, translations.Wednesday, translations.Thursday, translations.Friday, translations.Saturday],
dayNamesShort: [translations.Sun, translations.Mon, translations.Tue, translations.Wed, translations.Thu, translations.Fri, translations.Sat]
});
}
// 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_calendar(filters)
{
var calendar = $("#calendar");
var url = calendar.data("check-url");
var params = {
"start": calendar.fullCalendar('getView').start.format(),
"end": calendar.fullCalendar('getView').end.format()
}
jQuery.extend(params, filters);
for (var key in params) {
url += "&" + key + "=" + params[key];
}
$.getJSON(url, function(events) {
calendar.fullCalendar('removeEvents');
calendar.fullCalendar('addEventSource', events);
calendar.fullCalendar('rerenderEvents');
});
}
// Restore saved filters
function load_filters()
{
var filters = Kanboard.GetStorageItem('calendar_filters');
if (filters !== "undefined" && filters !== "") {
filters = JSON.parse(filters);
for (var filter in filters) {
$("select[name=" + filter + "]").val(filters[filter]);
}
}
refresh_calendar(filters || {});
$('.calendar-filter').change(apply_filters);
}
// Apply filters on change
function apply_filters()
{
var filters = {};
$('.calendar-filter').each(function(index, element) {
filters[$(this).attr("name")] = $(this).val();
});
Kanboard.SetStorageItem("calendar_filters", JSON.stringify(filters));
refresh_calendar(filters);
}
return {
Init: function() {
show_calendar();
load_filters();
}
};
})();

8
assets/js/fullcalendar.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,9 @@ $(function() {
if (Kanboard.Exists("board")) {
Kanboard.Board.Init();
}
else if (Kanboard.Exists("calendar")) {
Kanboard.Calendar.Init();
}
else if (Kanboard.Exists("task-section")) {
Kanboard.Task.Init();
}

6
assets/js/moment.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,8 @@
#!/bin/bash
css="base links title table form button alert tooltip header board project task comment subtask markdown listing activity dashboard pagination popover confirm sidebar responsive font-awesome.min jquery-ui-1.10.4.custom chosen.min"
js="jquery-1.11.1.min jquery-ui-1.10.4.custom.min jquery.ui.touch-punch.min chosen.jquery.min minify.min"
minify="base board task analytic init"
css="base links title table form button alert tooltip header board project task comment subtask markdown listing activity dashboard pagination popover confirm sidebar responsive jquery-ui-1.10.4.custom chosen.min fullcalendar.min font-awesome.min"
js="jquery-1.11.1.min jquery-ui-1.10.4.custom.min jquery.ui.touch-punch.min chosen.jquery.min moment.min fullcalendar.min minify.min"
minify="base board calendar task analytic init"
rm -f assets/js/minify* 2>/dev/null
rm -f assets/js/app.js 2>/dev/null

View File

@ -40,7 +40,7 @@ class SwimlaneTest extends Base
$this->assertEquals(1, $s->create(1, 'Swimlane #1'));
$this->assertEquals(2, $s->create(1, 'Swimlane #2'));
$swimlanes = $s->getSwimlanesList(1);
$swimlanes = $s->getList(1);
$expected = array('Default swimlane', 'Swimlane #1', 'Swimlane #2');
$this->assertEquals($expected, $swimlanes);