Merge branch 'develop' of projects.ceondo.com:indefero into develop

This commit is contained in:
Thomas Keller 2011-04-01 11:18:01 +02:00
commit ecef510f78
7 changed files with 89 additions and 18 deletions

View File

@ -31,6 +31,7 @@ Much appreciated contributors (in alphabetical order):
Raphaël Emourgeon <raphael> Raphaël Emourgeon <raphael>
Samuel Suther <info@suther.de> - German translation Samuel Suther <info@suther.de> - German translation
Sindre R. Myren <sindrero@stud.ntnu.no> Sindre R. Myren <sindrero@stud.ntnu.no>
Stewart Platt <stew@futurete.ch>
Thomas Keller <me@thomaskeller.biz> - Monotone support Thomas Keller <me@thomaskeller.biz> - Monotone support
Vladimir Solomatin <slash> Vladimir Solomatin <slash>
William Martin <william.martin@lcpc.fr> William Martin <william.martin@lcpc.fr>

View File

@ -5,6 +5,7 @@
## Bugfixes ## Bugfixes
- monotone zip archive entries now all carry the revision date as mtime (issue 645) - monotone zip archive entries now all carry the revision date as mtime (issue 645)
- Timeline only displays filter options for items a user has actually access to (issue 655)
## Documentation ## Documentation

View File

@ -62,20 +62,26 @@ class IDF_Views_Project
} }
/** /**
* Returns an associative array with available model filters * Returns an associative array with all accessible model filters
* *
* @return array * @return array
*/ */
private static function getAvailableModelFilters() private static function getAccessibleModelFilters($request)
{ {
return array( $filters = array('all' => __('All Updates'));
'all' => __('All Updates'),
'commits' => __('Commits'), if (true === IDF_Precondition::accessSource($request))
'issues' => __('Issues and Comments'), $filters['commits'] = __('Commits');
'downloads' => __('Downloads'), if (true === IDF_Precondition::accessIssues($request))
'documents' => __('Documents'), $filters['issues'] = __('Issues and Comments');
'reviews' => __('Reviews and Patches'), if (true === IDF_Precondition::accessDownloads($request))
); $filters['downloads'] = __('Downloads');
if (true === IDF_Precondition::accessWiki($request))
$filters['documents'] = __('Documents');
if (true === IDF_Precondition::accessReview($request))
$filters['reviews'] = __('Reviews and Patches');
return $filters;
} }
/** /**
@ -141,11 +147,11 @@ class IDF_Views_Project
$prj = $request->project; $prj = $request->project;
$model_filter = @$match[2]; $model_filter = @$match[2];
$all_model_filters = self::getAvailableModelFilters(); $accessible_model_filters = self::getAccessibleModelFilters($request);
if (!array_key_exists($model_filter, $all_model_filters)) { if (!array_key_exists($model_filter, $accessible_model_filters)) {
$model_filter = 'all'; $model_filter = 'all';
} }
$title = (string)$prj . ' ' . $all_model_filters[$model_filter]; $title = (string)$prj . ' ' . $accessible_model_filters[$model_filter];
$pag = new IDF_Timeline_Paginator(new IDF_Timeline()); $pag = new IDF_Timeline_Paginator(new IDF_Timeline());
$pag->class = 'recent-issues'; $pag->class = 'recent-issues';
@ -183,7 +189,7 @@ class IDF_Views_Project
'feedurl' => $feedurl, 'feedurl' => $feedurl,
'timeline' => $pag, 'timeline' => $pag,
'model_filter' => $model_filter, 'model_filter' => $model_filter,
'all_model_filters' => $all_model_filters, 'accessible_model_filters' => $accessible_model_filters,
), ),
$request); $request);
@ -214,11 +220,11 @@ class IDF_Views_Project
$prj = $request->project; $prj = $request->project;
$model_filter = @$match[2]; $model_filter = @$match[2];
$all_model_filters = self::getAvailableModelFilters(); $accessible_model_filters = self::getAccessibleModelFilters($request);
if (!array_key_exists($model_filter, $all_model_filters)) { if (!array_key_exists($model_filter, $accessible_model_filters)) {
$model_filter = 'all'; $model_filter = 'all';
} }
$title = $all_model_filters[$model_filter]; $title = $accessible_model_filters[$model_filter];
$classes = self::determineModelClasses($request, $model_filter); $classes = self::determineModelClasses($request, $model_filter);
$sqls = sprintf('model_class IN (%s)', implode(', ', $classes)); $sqls = sprintf('model_class IN (%s)', implode(', ', $classes));

View File

@ -15,7 +15,7 @@
{block context} {block context}
<p><span class="label{if 'all' == $model_filter} active{/if}"><a href="{url 'IDF_Views_Project::timeline', array($project.shortname, 'all')}">{trans 'All Updates'}</a></span></p> <p><span class="label{if 'all' == $model_filter} active{/if}"><a href="{url 'IDF_Views_Project::timeline', array($project.shortname, 'all')}">{trans 'All Updates'}</a></span></p>
<p><strong>{trans 'Filter by type'}</strong><br /> <p><strong>{trans 'Filter by type'}</strong><br />
{foreach $all_model_filters as $filter_key => $filter_name} {foreach $accessible_model_filters as $filter_key => $filter_name}
{if $filter_key != 'all'} {if $filter_key != 'all'}
<span class="label{if $filter_key == $model_filter} active{/if}"><a href="{url 'IDF_Views_Project::timeline', array($project.shortname, $filter_key)}">{$filter_name}</a></span><br /> <span class="label{if $filter_key == $model_filter} active{/if}"><a href="{url 'IDF_Views_Project::timeline', array($project.shortname, $filter_key)}">{$filter_name}</a></span><br />
{/if} {/if}

View File

@ -1,4 +1,25 @@
<?php <?php
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
# ***** BEGIN LICENSE BLOCK *****
# This file is part of InDefero, an open source project management application.
# Copyright (C) 2011 Céondo Ltd and contributors.
#
# InDefero is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# InDefero is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# ***** END LICENSE BLOCK ***** */
include 'IDF/Diff.php'; include 'IDF/Diff.php';

View File

@ -1,4 +1,25 @@
<?php <?php
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
# ***** BEGIN LICENSE BLOCK *****
# This file is part of InDefero, an open source project management application.
# Copyright (C) 2011 Céondo Ltd and contributors.
#
# InDefero is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# InDefero is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# ***** END LICENSE BLOCK ***** */
include 'IDF/Scm/Monotone/BasicIO.php'; include 'IDF/Scm/Monotone/BasicIO.php';

View File

@ -1,4 +1,25 @@
<?php <?php
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
# ***** BEGIN LICENSE BLOCK *****
# This file is part of InDefero, an open source project management application.
# Copyright (C) 2011 Céondo Ltd and contributors.
#
# InDefero is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# InDefero is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# ***** END LICENSE BLOCK ***** */
require_once 'IDF/Scm/Monotone/ZipRender.php'; require_once 'IDF/Scm/Monotone/ZipRender.php';
require_once 'IDF/Scm/Monotone/IStdio.php'; require_once 'IDF/Scm/Monotone/IStdio.php';