From 7383e18dff19e7e6a1e56d55cdfbfa109e91bfb3 Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Thu, 7 Aug 2008 15:35:03 +0200 Subject: [PATCH] Fixed issue 4, with fine control over the tabs access. For each tab, at the exception of the project home and the administration area, it possible to control the access rights if the user is anonymous, signed in, member or owner. --- src/IDF/Form/TabsConf.php | 57 ++++++++++ src/IDF/Middleware.php | 12 ++ src/IDF/Precondition.php | 49 +++++++++ src/IDF/Template/IssueComment.php | 18 ++- src/IDF/Views/Download.php | 7 +- src/IDF/Views/Issue.php | 10 +- src/IDF/Views/Project.php | 54 ++++++++- src/IDF/Views/Source.php | 5 + src/IDF/conf/idf.php-dist | 2 +- src/IDF/conf/views.php | 6 + src/IDF/locale/fr/idf.po | 113 ++++++++++++++++++- src/IDF/locale/idf.pot | 140 +++++++++++++++++------- src/IDF/templates/admin/base.html | 3 +- src/IDF/templates/admin/tabs.html | 45 ++++++++ src/IDF/templates/base.html | 6 +- src/IDF/templates/issues/view.html | 2 +- src/IDF/templates/js-hotkeys.html | 10 +- src/IDF/templates/project-home.html | 2 +- src/IDF/templates/source/changelog.html | 2 +- src/IDF/templates/source/commit.html | 2 +- 20 files changed, 475 insertions(+), 70 deletions(-) create mode 100644 src/IDF/Form/TabsConf.php create mode 100644 src/IDF/templates/admin/tabs.html diff --git a/src/IDF/Form/TabsConf.php b/src/IDF/Form/TabsConf.php new file mode 100644 index 0000000..fd961c7 --- /dev/null +++ b/src/IDF/Form/TabsConf.php @@ -0,0 +1,57 @@ +conf = $extra['conf']; + $ak = array('downloads_access_rights' => __('Downloads'), + 'source_access_rights' => __('Source'), + 'issues_access_rights' => __('Issues'),); + foreach ($ak as $key=>$label) { + $this->fields[$key] = new Pluf_Form_Field_Varchar( + array('required' => true, + 'label' => $label, + 'initial' => $this->conf->getVal($key, 'all'), + 'widget_attrs' => array('choices' => + array( + __('Open to all') => 'all', + __('Signed in users') => 'login', + __('Project members') => 'members', + __('Project owners') => 'owners', + __('Closed') => 'none', + ) + ), + 'widget' => 'Pluf_Form_Widget_SelectInput', + )); + } + } +} + + diff --git a/src/IDF/Middleware.php b/src/IDF/Middleware.php index 3fb7e6a..e52cf92 100644 --- a/src/IDF/Middleware.php +++ b/src/IDF/Middleware.php @@ -24,6 +24,7 @@ /** * Project middleware. * + * It must be after the session middleware. */ class IDF_Middleware { @@ -49,6 +50,15 @@ class IDF_Middleware } catch (Pluf_HTTP_Error404 $e) { return new Pluf_HTTP_Response_NotFound(sprintf(__('The page %s was not found on the server.'), htmlspecialchars($request->query))); } + $request->conf = new IDF_Conf(); + $request->conf->setProject($request->project); + $ak = array('downloads_access_rights' => 'hasDownloadsAccess', + 'source_access_rights' => 'hasSourceAccess', + 'issues_access_rights' => 'hasIssuesAccess'); + $request->rights = array(); + foreach ($ak as $key=>$val) { + $request->rights[$val] = (true === IDF_Precondition::accessTabGeneric($request, $key)); + } } return false; } @@ -58,12 +68,14 @@ class IDF_Middleware function IDF_Middleware_ContextPreProcessor($request) { $c = array(); + $c['request'] = $request; if (isset($request->project)) { $c['project'] = $request->project; $c['isOwner'] = $request->user->hasPerm('IDF.project-owner', $request->project); $c['isMember'] = $request->user->hasPerm('IDF.project-member', $request->project); + $c = array_merge($c, $request->rights); } return $c; } diff --git a/src/IDF/Precondition.php b/src/IDF/Precondition.php index fb07330..5944100 100644 --- a/src/IDF/Precondition.php +++ b/src/IDF/Precondition.php @@ -61,4 +61,53 @@ class IDF_Precondition } return new Pluf_HTTP_Response_Forbidden($request); } + + /** + * Check if the user can access a given element. + * + * The rights are: + * - 'all' (default) + * - 'none' + * - 'login' + * - 'members' + * - 'owners' + * + * The order of the rights is such that a 'owner' is also a + * 'member' and of course a logged in person. + * + * @param Pluf_HTTP_Request + * @param string Control key + * @return mixed + */ + static public function accessTabGeneric($request, $key) + { + switch ($request->conf->getVal($key, 'all')) { + case 'none': + return new Pluf_HTTP_Response_Forbidden($request); + case 'login': + return Pluf_Precondition::loginRequired($request); + case 'members': + return self::projectMemberOrOwner($request); + case 'owners': + return self::projectOwner($request); + case 'all': + default: + return true; + } + } + + static public function accessSource($request) + { + return self::accessTabGeneric($request, 'source_access_rights'); + } + + static public function accessIssues($request) + { + return self::accessTabGeneric($request, 'issues_access_rights'); + } + + static public function accessDownloads($request) + { + return self::accessTabGeneric($request, 'downloads_access_rights'); + } } \ No newline at end of file diff --git a/src/IDF/Template/IssueComment.php b/src/IDF/Template/IssueComment.php index 8647b39..9023801 100644 --- a/src/IDF/Template/IssueComment.php +++ b/src/IDF/Template/IssueComment.php @@ -29,21 +29,27 @@ Pluf::loadFunction('Pluf_HTTP_URL_urlForView'); class IDF_Template_IssueComment extends Pluf_Template_Tag { private $project = null; + private $request = null; private $git = null; - function start($text, $project) + function start($text, $request) { - $this->project = $project; + $this->project = $request->project; + $this->request = $request; $this->git = new IDF_Git($this->project->getGitRepository()); $text = wordwrap($text, 69, "\n", true); $text = Pluf_esc($text); $text = ereg_replace('[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]', '\\0', $text); - $text = preg_replace_callback('#(issues?|bugs?|tickets?)\s+(\d+)((\s+and|\s+or|,)\s+(\d+)){0,}#im', - array($this, 'callbackIssues'), $text); - $text = preg_replace_callback('#(commit\s+)([0-9a-f]{5,40})#im', - array($this, 'callbackCommit'), $text); + if ($request->rights['hasIssuesAccess']) { + $text = preg_replace_callback('#(issues?|bugs?|tickets?)\s+(\d+)((\s+and|\s+or|,)\s+(\d+)){0,}#im', + array($this, 'callbackIssues'), $text); + } + if ($request->rights['hasSourceAccess']) { + $text = preg_replace_callback('#(commit\s+)([0-9a-f]{5,40})#im', + array($this, 'callbackCommit'), $text); + } echo $text; } diff --git a/src/IDF/Views/Download.php b/src/IDF/Views/Download.php index ed5d800..3fdc3b6 100644 --- a/src/IDF/Views/Download.php +++ b/src/IDF/Views/Download.php @@ -38,6 +38,7 @@ class IDF_Views_Download /** * List the files available for download. */ + public $index_precond = array('IDF_Precondition::accessDownloads'); public function index($request, $match) { $prj = $request->project; @@ -75,6 +76,7 @@ class IDF_Views_Download /** * View details of a file. */ + public $view_precond = array('IDF_Precondition::accessDownloads'); public function view($request, $match) { $prj = $request->project; @@ -123,6 +125,7 @@ class IDF_Views_Download /** * Download a file. */ + public $download_precond = array('IDF_Precondition::accessDownloads'); public function download($request, $match) { $prj = $request->project; @@ -136,7 +139,8 @@ class IDF_Views_Download /** * Submit a new file for download. */ - public $submit_precond = array('IDF_Precondition::projectMemberOrOwner'); + public $submit_precond = array('IDF_Precondition::accessDownloads', + 'IDF_Precondition::projectMemberOrOwner'); public function submit($request, $match) { $prj = $request->project; @@ -197,6 +201,7 @@ class IDF_Views_Download /** * View list of downloads with a given label. */ + public $listLabel_precond = array('IDF_Precondition::accessDownloads'); public function listLabel($request, $match) { $prj = $request->project; diff --git a/src/IDF/Views/Issue.php b/src/IDF/Views/Issue.php index 9b4153a..7e4a361 100644 --- a/src/IDF/Views/Issue.php +++ b/src/IDF/Views/Issue.php @@ -34,6 +34,7 @@ class IDF_Views_Issue /** * View list of issues for a given project. */ + public $index_precond = array('IDF_Precondition::accessIssues'); public function index($request, $match) { $prj = $request->project; @@ -77,7 +78,8 @@ class IDF_Views_Issue * * Only open issues are shown. */ - public $myIssues_precond = array('Pluf_Precondition::loginRequired'); + public $myIssues_precond = array('IDF_Precondition::accessIssues', + 'Pluf_Precondition::loginRequired'); public function myIssues($request, $match) { $prj = $request->project; @@ -124,7 +126,8 @@ class IDF_Views_Issue $request); } - public $create_precond = array('Pluf_Precondition::loginRequired'); + public $create_precond = array('IDF_Precondition::accessIssues', + 'Pluf_Precondition::loginRequired'); public function create($request, $match) { $prj = $request->project; @@ -157,6 +160,7 @@ class IDF_Views_Issue $request); } + public $view_precond = array('IDF_Precondition::accessIssues'); public function view($request, $match) { $prj = $request->project; @@ -204,6 +208,7 @@ class IDF_Views_Issue /** * View list of issues for a given project with a given status. */ + public $listStatus_precond = array('IDF_Precondition::accessIssues'); public function listStatus($request, $match) { $prj = $request->project; @@ -246,6 +251,7 @@ class IDF_Views_Issue /** * View list of issues for a given project with a given label. */ + public $listLabel_precond = array('IDF_Precondition::accessIssues'); public function listLabel($request, $match) { $prj = $request->project; diff --git a/src/IDF/Views/Project.php b/src/IDF/Views/Project.php index 3b0edf3..018ea7a 100644 --- a/src/IDF/Views/Project.php +++ b/src/IDF/Views/Project.php @@ -39,9 +39,12 @@ class IDF_Views_Project $prj = $request->project; $team = $prj->getMembershipData(); $title = (string) $prj; - $tags = IDF_Views_Download::getDownloadTags($prj); - // the first tag is the featured, the last is the deprecated. - $downloads = $tags[0]->get_idf_upload_list(); + $downloads = array(); + if ($request->rights['hasDownloadsAccess']) { + $tags = IDF_Views_Download::getDownloadTags($prj); + // the first tag is the featured, the last is the deprecated. + $downloads = $tags[0]->get_idf_upload_list(); + } return Pluf_Shortcuts_RenderToResponse('project-home.html', array( 'page_title' => $title, @@ -201,4 +204,49 @@ class IDF_Views_Project ), $request); } + + /** + * Administrate the access rights to the tabs. + */ + public $adminTabs_precond = array('IDF_Precondition::projectOwner'); + public function adminTabs($request, $match) + { + $prj = $request->project; + $title = sprintf(__('%s Tabs Access Rights'), (string) $prj); + $extra = array( + 'conf' => $request->conf, + ); + if ($request->method == 'POST') { + $form = new IDF_Form_TabsConf($request->POST, $extra); + if ($form->isValid()) { + foreach ($form->cleaned_data as $key=>$val) { + $request->conf->setVal($key, $val); + } + $request->user->setMessage(__('The project tabs access rights have been saved.')); + $url = Pluf_HTTP_URL_urlForView('IDF_Views_Project::adminTabs', + array($prj->shortname)); + return new Pluf_HTTP_Response_Redirect($url); + } + } else { + $params = array(); + $keys = array('downloads_access_rights', 'source_access_rights', + 'issues_access_rights'); + foreach ($keys as $key) { + $_val = $request->conf->getVal($key, false); + if ($_val !== false) { + $params[$key] = $_val; + } + } + if (count($params) == 0) { + $params = null; //Nothing in the db, so new form. + } + $form = new IDF_Form_TabsConf($params, $extra); + } + return Pluf_Shortcuts_RenderToResponse('admin/tabs.html', + array( + 'page_title' => $title, + 'form' => $form, + ), + $request); + } } \ No newline at end of file diff --git a/src/IDF/Views/Source.php b/src/IDF/Views/Source.php index 70a716f..4180dca 100644 --- a/src/IDF/Views/Source.php +++ b/src/IDF/Views/Source.php @@ -31,6 +31,7 @@ Pluf::loadFunction('Pluf_Shortcuts_GetFormForModel'); */ class IDF_Views_Source { + public $changeLog_precond = array('IDF_Precondition::accessSource'); public function changeLog($request, $match) { $title = sprintf(__('%s Git Change Log'), (string) $request->project); @@ -49,6 +50,7 @@ class IDF_Views_Source $request); } + public $treeBase_precond = array('IDF_Precondition::accessSource'); public function treeBase($request, $match) { $title = sprintf(__('%s Git Source Tree'), (string) $request->project); @@ -78,6 +80,7 @@ class IDF_Views_Source $request); } + public $tree_precond = array('IDF_Precondition::accessSource'); public function tree($request, $match) { $title = sprintf(__('%s Git Source Tree'), (string) $request->project); @@ -149,6 +152,7 @@ class IDF_Views_Source return ''.implode(''.$sep.'', $out).''; } + public $commit_precond = array('IDF_Precondition::accessSource'); public function commit($request, $match) { $git = new IDF_Git($request->project->getGitRepository()); @@ -182,6 +186,7 @@ class IDF_Views_Source * Get a zip archive of the current commit. * */ + public $download_precond = array('IDF_Precondition::accessSource'); public function download($request, $match) { $commit = trim($match[2]); diff --git a/src/IDF/conf/idf.php-dist b/src/IDF/conf/idf.php-dist index 11a1a29..35ae1fa 100644 --- a/src/IDF/conf/idf.php-dist +++ b/src/IDF/conf/idf.php-dist @@ -103,8 +103,8 @@ $cfg['db_database'] = 'website'; $cfg['installed_apps'] = array('Pluf', 'IDF'); $cfg['pluf_use_rowpermission'] = true; $cfg['middleware_classes'] = array( - 'IDF_Middleware', 'Pluf_Middleware_Session', + 'IDF_Middleware', 'Pluf_Middleware_Translation', ); $cfg['template_context_processors'] = array('IDF_Middleware_ContextPreProcessor'); diff --git a/src/IDF/conf/views.php b/src/IDF/conf/views.php index 82bde44..268d429 100644 --- a/src/IDF/conf/views.php +++ b/src/IDF/conf/views.php @@ -206,4 +206,10 @@ $ctl[] = array('regex' => '#^/p/(\w+)/admin/members/$#', 'model' => 'IDF_Views_Project', 'method' => 'adminMembers'); +$ctl[] = array('regex' => '#^/p/(\w+)/admin/tabs/$#', + 'base' => $base, + 'priority' => 4, + 'model' => 'IDF_Views_Project', + 'method' => 'adminTabs'); + return $ctl; diff --git a/src/IDF/locale/fr/idf.po b/src/IDF/locale/fr/idf.po index eb8d3c7..b9ad3ad 100644 --- a/src/IDF/locale/fr/idf.po +++ b/src/IDF/locale/fr/idf.po @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: InDefero\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-08-06 22:28+0200\n" -"PO-Revision-Date: 2008-08-06 22:30+0100\n" +"POT-Creation-Date: 2008-08-07 15:31+0200\n" +"PO-Revision-Date: 2008-08-07 15:34+0100\n" "Last-Translator: Loïc d'Anterroches \n" "Language-Team: Translation team \n" "MIME-Version: 1.0\n" @@ -101,6 +101,7 @@ msgid "modification date" msgstr "date de modification" #: IDF/Middleware.php:50 +#: IDF/Middleware.php:51 #, php-format msgid "The page %s was not found on the server." msgstr "Cette page %s n'a pas été trouvée sur le serveur." @@ -186,48 +187,58 @@ msgid "Here to Help You!" msgstr "Ici pour vous aider !" #: IDF/Views/Project.php:62 +#: IDF/Views/Project.php:65 #, php-format msgid "%s Project Summary" msgstr "Résumé du projet %s" #: IDF/Views/Project.php:69 +#: IDF/Views/Project.php:72 msgid "The project has been updated." msgstr "Le projet a été mis à jour." #: IDF/Views/Project.php:93 +#: IDF/Views/Project.php:96 #, php-format msgid "%s Issue Tracking Configuration" msgstr "Configuration du gestionnaire de tickets de %s" #: IDF/Views/Project.php:102 +#: IDF/Views/Project.php:105 msgid "The issue tracking configuration has been saved." msgstr "La configuration du gestionnaire de tickets a été sauvegardée." #: IDF/Views/Project.php:137 +#: IDF/Views/Project.php:140 #, php-format msgid "%s Downloads Configuration" msgstr "Configuration des Téléchargements de %s" #: IDF/Views/Project.php:146 +#: IDF/Views/Project.php:149 msgid "The downloads configuration has been saved." msgstr "La configuration des téléchargements a été sauvegardée." #: IDF/Views/Project.php:180 +#: IDF/Views/Project.php:183 #, php-format msgid "%s Project Members" msgstr "Membres du projet %s" #: IDF/Views/Project.php:189 +#: IDF/Views/Project.php:192 msgid "The project membership has been saved." msgstr "Les membres du projet ont été sauvegardés." #: IDF/Views/Download.php:44 +#: IDF/Views/Download.php:45 #, php-format msgid "%s Downloads" msgstr "Téléchargements de %s" #: IDF/Views/Download.php:50 #: IDF/Views/Download.php:52 +#: IDF/Views/Download.php:51 msgid "This table shows the files to download." msgstr "Ce tableau présente la liste des fichiers en téléchargement." @@ -237,6 +248,8 @@ msgstr "Ce tableau présente la liste des fichiers en téléchargement." #: IDF/Views/Download.php:56 #: IDF/Views/Download.php:212 #: IDF/Views/Download.php:218 +#: IDF/Views/Download.php:55 +#: IDF/Views/Download.php:223 msgid "File" msgstr "Fichier" @@ -252,6 +265,12 @@ msgstr "Fichier" #: IDF/Views/Download.php:57 #: IDF/Views/Download.php:213 #: IDF/Views/Download.php:219 +#: IDF/Views/Download.php:56 +#: IDF/Views/Download.php:224 +#: IDF/Views/Issue.php:58 +#: IDF/Views/Issue.php:111 +#: IDF/Views/Issue.php:233 +#: IDF/Views/Issue.php:287 msgid "Summary" msgstr "Résumé" @@ -260,6 +279,8 @@ msgstr "Résumé" #: IDF/Views/Download.php:58 #: IDF/Views/Download.php:214 #: IDF/Views/Download.php:220 +#: IDF/Views/Download.php:57 +#: IDF/Views/Download.php:225 msgid "Size" msgstr "Taille" @@ -267,6 +288,8 @@ msgstr "Taille" #: IDF/Views/Download.php:59 #: IDF/Views/Download.php:215 #: IDF/Views/Download.php:221 +#: IDF/Views/Download.php:58 +#: IDF/Views/Download.php:226 msgid "Uploaded" msgstr "Mis en ligne" @@ -274,11 +297,14 @@ msgstr "Mis en ligne" #: IDF/Views/Download.php:63 #: IDF/Views/Download.php:219 #: IDF/Views/Download.php:225 +#: IDF/Views/Download.php:62 +#: IDF/Views/Download.php:230 msgid "No downloads were found." msgstr "Aucun fichier n'a été trouvé." #: IDF/Views/Download.php:81 #: IDF/Views/Download.php:83 +#: IDF/Views/Download.php:85 #, php-format msgid "Download %s" msgstr "Télécharger %s" @@ -286,6 +312,7 @@ msgstr "Télécharger %s" #: IDF/Views/Download.php:94 #: IDF/Views/Download.php:96 #: IDF/Views/Download.php:100 +#: IDF/Views/Download.php:102 #, php-format msgid "The file %2$s has been updated." msgstr "Le fichier %2$s a été mis à jour." @@ -295,23 +322,28 @@ msgstr "Le fichier %2$s a été mis à jour." #: IDF/gettexttemplates/downloads/index.html.php:3 #: IDF/Views/Download.php:137 #: IDF/Views/Download.php:143 +#: IDF/Views/Download.php:147 msgid "New Download" msgstr "Nouveau téléchargement" #: IDF/Views/Download.php:144 #: IDF/Views/Download.php:146 #: IDF/Views/Download.php:152 +#: IDF/Views/Download.php:156 #, php-format msgid "The file has been uploaded." msgstr "Le fichier a été mis en ligne." #: IDF/Views/Issue.php:40 +#: IDF/Views/Issue.php:41 #, php-format msgid "%s Recent Issues" msgstr "Tickets récents de %s" #: IDF/Views/Issue.php:49 #: IDF/Views/Issue.php:103 +#: IDF/Views/Issue.php:50 +#: IDF/Views/Issue.php:105 msgid "This table shows the open recent issues." msgstr "Ce tableau montre les tickets récents." @@ -319,6 +351,10 @@ msgstr "Ce tableau montre les tickets récents." #: IDF/Views/Issue.php:108 #: IDF/Views/Issue.php:227 #: IDF/Views/Issue.php:280 +#: IDF/Views/Issue.php:57 +#: IDF/Views/Issue.php:110 +#: IDF/Views/Issue.php:232 +#: IDF/Views/Issue.php:286 msgid "Id" msgstr "Id" @@ -328,6 +364,10 @@ msgstr "Id" #: IDF/Views/Issue.php:282 #: IDF/Form/IssueCreate.php:70 #: IDF/Form/IssueUpdate.php:66 +#: IDF/Views/Issue.php:59 +#: IDF/Views/Issue.php:112 +#: IDF/Views/Issue.php:234 +#: IDF/Views/Issue.php:288 msgid "Status" msgstr "Statut" @@ -335,6 +375,10 @@ msgstr "Statut" #: IDF/Views/Issue.php:111 #: IDF/Views/Issue.php:230 #: IDF/Views/Issue.php:283 +#: IDF/Views/Issue.php:60 +#: IDF/Views/Issue.php:113 +#: IDF/Views/Issue.php:235 +#: IDF/Views/Issue.php:289 msgid "Last Updated" msgstr "Dernière mise à jour" @@ -342,58 +386,73 @@ msgstr "Dernière mise à jour" #: IDF/Views/Issue.php:115 #: IDF/Views/Issue.php:234 #: IDF/Views/Issue.php:287 +#: IDF/Views/Issue.php:64 +#: IDF/Views/Issue.php:117 +#: IDF/Views/Issue.php:239 +#: IDF/Views/Issue.php:293 msgid "No issues were found." msgstr "Aucun ticket n'a été trouvé." #: IDF/Views/Issue.php:87 +#: IDF/Views/Issue.php:89 #, php-format msgid "My Submitted %s Issues" msgstr "Mes tickets soumis pour %s" #: IDF/Views/Issue.php:90 +#: IDF/Views/Issue.php:92 #, php-format msgid "My Working %s Issues" msgstr "Mes tickets en cours pour %s" #: IDF/Views/Issue.php:131 +#: IDF/Views/Issue.php:134 msgid "Submit a new issue" msgstr "Soumettre un nouveau ticket" #: IDF/Views/Issue.php:143 +#: IDF/Views/Issue.php:146 #, php-format msgid "Issue %d has been created." msgstr "Le ticket %d a été créé." #: IDF/Views/Issue.php:168 +#: IDF/Views/Issue.php:172 #, php-format msgid "Issue %d: %s" msgstr "Ticket %d : %s" #: IDF/Views/Issue.php:184 +#: IDF/Views/Issue.php:188 #, php-format msgid "Issue %d has been updated." msgstr "Le ticket %d a été mise à jour." #: IDF/Views/Issue.php:211 +#: IDF/Views/Issue.php:216 #, php-format msgid "%s Closed Issues" msgstr "Tickets fermés de %s" #: IDF/Views/Issue.php:220 +#: IDF/Views/Issue.php:225 msgid "This table shows the closed issues." msgstr "Ce tableau montre les tickets fermés." #: IDF/Views/Issue.php:258 +#: IDF/Views/Issue.php:264 #, php-format msgid "%1$s Issues with Label %2$s" msgstr "%1$s tickets avec l'étiquette %2$s" #: IDF/Views/Issue.php:261 +#: IDF/Views/Issue.php:267 #, php-format msgid "%1$s Closed Issues with Label %2$s" msgstr "Tickets fermés de %1$s avec l'étiquette %2$s" #: IDF/Views/Issue.php:273 +#: IDF/Views/Issue.php:279 #, php-format msgid "This table shows the issues with label %s." msgstr "Ce tableau montre les tickets avec l'étiquette %s." @@ -429,16 +488,19 @@ msgid "Project Home" msgstr "Page d'Accueil" #: IDF/gettexttemplates/base.html.php:9 +#: IDF/Form/TabsConf.php:36 msgid "Issues" msgstr "Tickets" #: IDF/gettexttemplates/base.html.php:10 #: IDF/gettexttemplates/downloads/base.html.php:3 #: IDF/gettexttemplates/admin/base.html.php:6 +#: IDF/Form/TabsConf.php:34 msgid "Downloads" msgstr "Téléchargements" #: IDF/gettexttemplates/base.html.php:11 +#: IDF/Form/TabsConf.php:35 msgid "Source" msgstr "Source" @@ -636,6 +698,7 @@ msgstr "" #: IDF/gettexttemplates/admin/issue-tracking.html.php:8 #: IDF/gettexttemplates/admin/members.html.php:13 #: IDF/gettexttemplates/admin/summary.html.php:8 +#: IDF/gettexttemplates/admin/tabs.html.php:5 msgid "Save Changes" msgstr "Enregistrer les changements" @@ -1214,42 +1277,51 @@ msgid "No changes were entered." msgstr "Aucun changement n'a été entré." #: IDF/Form/MembersConf.php:46 +#: IDF/Form/TabsConf.php:47 msgid "Project owners" msgstr "Propriétaires du projet" #: IDF/Form/MembersConf.php:54 +#: IDF/Form/TabsConf.php:46 msgid "Project members" msgstr "Membres du projet" #: IDF/Views/Source.php:36 +#: IDF/Views/Source.php:37 #, php-format msgid "%s Git Change Log" msgstr "Changements Git de %s" #: IDF/Views/Source.php:54 #: IDF/Views/Source.php:83 +#: IDF/Views/Source.php:56 +#: IDF/Views/Source.php:86 #, php-format msgid "%s Git Source Tree" msgstr "Arbre des sources Git de %s" #: IDF/Views/Source.php:164 +#: IDF/Views/Source.php:168 #, php-format msgid "%s Commit Details" msgstr "Détails d'un commit de %s" #: IDF/Views/Source.php:165 +#: IDF/Views/Source.php:169 #, php-format msgid "%s Commit Details - %s" msgstr "Détails d'un commit de %s - %s" #: IDF/Views/Download.php:199 #: IDF/Views/Download.php:205 +#: IDF/Views/Download.php:210 #, php-format msgid "%1$s Downloads with Label %2$s" msgstr "Téléchargements avec l'étiquette %2$s de %1$s" #: IDF/Views/Download.php:207 #: IDF/Views/Download.php:213 +#: IDF/Views/Download.php:218 #, php-format msgid "This table shows the downloads with label %s." msgstr "Ce tableau montre les téléchargements avec l'étiquette %s." @@ -1258,3 +1330,40 @@ msgstr "Ce tableau montre les téléchargements avec l'étiquette %s." msgid "Attention! This file is marked as deprecated, download it only if you are sure you need this specific version." msgstr "Attention ! Ce fichier est marqué comme obsolète, téléchargez ce fichier uniquement si vous avez besoin de cette version." +#: IDF/Views/Project.php:215 +#, php-format +msgid "%s Tabs Access Rights" +msgstr "Accès aux onglets de %s" + +#: IDF/Views/Project.php:225 +msgid "The project tabs access rights have been saved." +msgstr "Les droits d'accès aux onglets du projet ont été sauvegardés." + +#: IDF/gettexttemplates/admin/base.html.php:7 +msgid "Tabs Access" +msgstr "Accès aux onglets" + +#: IDF/gettexttemplates/admin/tabs.html.php:3 +msgid "You can configure here the project tabs access rights." +msgstr "Vous pouvez configurer ici les droits d'accès aux onglets." + +#: IDF/gettexttemplates/admin/tabs.html.php:4 +msgid "The form contains some errors. Please correct them to update the access rights." +msgstr "Le formulaire contient des erreurs. Merci de les corriger pour mettre à jour les droits d'accès." + +#: IDF/gettexttemplates/admin/tabs.html.php:6 +msgid "Instructions:" +msgstr "Instructions :" + +#: IDF/Form/TabsConf.php:44 +msgid "Open to all" +msgstr "Ouvert à tous" + +#: IDF/Form/TabsConf.php:45 +msgid "Signed in users" +msgstr "Utilisateurs authentifiés" + +#: IDF/Form/TabsConf.php:48 +msgid "Closed" +msgstr "Fermé" + diff --git a/src/IDF/locale/idf.pot b/src/IDF/locale/idf.pot index f7bd87f..862c262 100644 --- a/src/IDF/locale/idf.pot +++ b/src/IDF/locale/idf.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-08-06 22:28+0200\n" +"POT-Creation-Date: 2008-08-07 15:31+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -92,7 +92,7 @@ msgstr "" msgid "modification date" msgstr "" -#: IDF/Middleware.php:50 +#: IDF/Middleware.php:50 IDF/Middleware.php:51 #, php-format msgid "The page %s was not found on the server." msgstr "" @@ -176,54 +176,56 @@ msgstr "" msgid "Here to Help You!" msgstr "" -#: IDF/Views/Project.php:62 +#: IDF/Views/Project.php:62 IDF/Views/Project.php:65 #, php-format msgid "%s Project Summary" msgstr "" -#: IDF/Views/Project.php:69 +#: IDF/Views/Project.php:69 IDF/Views/Project.php:72 msgid "The project has been updated." msgstr "" -#: IDF/Views/Project.php:93 +#: IDF/Views/Project.php:93 IDF/Views/Project.php:96 #, php-format msgid "%s Issue Tracking Configuration" msgstr "" -#: IDF/Views/Project.php:102 +#: IDF/Views/Project.php:102 IDF/Views/Project.php:105 msgid "The issue tracking configuration has been saved." msgstr "" -#: IDF/Views/Project.php:137 +#: IDF/Views/Project.php:137 IDF/Views/Project.php:140 #, php-format msgid "%s Downloads Configuration" msgstr "" -#: IDF/Views/Project.php:146 +#: IDF/Views/Project.php:146 IDF/Views/Project.php:149 msgid "The downloads configuration has been saved." msgstr "" -#: IDF/Views/Project.php:180 +#: IDF/Views/Project.php:180 IDF/Views/Project.php:183 #, php-format msgid "%s Project Members" msgstr "" -#: IDF/Views/Project.php:189 +#: IDF/Views/Project.php:189 IDF/Views/Project.php:192 msgid "The project membership has been saved." msgstr "" -#: IDF/Views/Download.php:44 +#: IDF/Views/Download.php:44 IDF/Views/Download.php:45 #, php-format msgid "%s Downloads" msgstr "" #: IDF/Views/Download.php:50 IDF/Views/Download.php:52 +#: IDF/Views/Download.php:51 msgid "This table shows the files to download." msgstr "" #: IDF/Views/Download.php:54 IDF/gettexttemplates/source/tree.html.php:6 #: IDF/Form/Upload.php:49 IDF/Views/Download.php:56 IDF/Views/Download.php:212 -#: IDF/Views/Download.php:218 +#: IDF/Views/Download.php:218 IDF/Views/Download.php:55 +#: IDF/Views/Download.php:223 msgid "File" msgstr "" @@ -232,127 +234,138 @@ msgstr "" #: IDF/Form/IssueCreate.php:50 IDF/Form/UpdateUpload.php:42 #: IDF/Form/IssueUpdate.php:45 IDF/Views/Download.php:57 #: IDF/Views/Download.php:213 IDF/Views/Download.php:219 +#: IDF/Views/Download.php:56 IDF/Views/Download.php:224 IDF/Views/Issue.php:58 +#: IDF/Views/Issue.php:111 IDF/Views/Issue.php:233 IDF/Views/Issue.php:287 msgid "Summary" msgstr "" #: IDF/Views/Download.php:56 IDF/gettexttemplates/source/tree.html.php:9 #: IDF/Views/Download.php:58 IDF/Views/Download.php:214 -#: IDF/Views/Download.php:220 +#: IDF/Views/Download.php:220 IDF/Views/Download.php:57 +#: IDF/Views/Download.php:225 msgid "Size" msgstr "" #: IDF/Views/Download.php:57 IDF/Views/Download.php:59 #: IDF/Views/Download.php:215 IDF/Views/Download.php:221 +#: IDF/Views/Download.php:58 IDF/Views/Download.php:226 msgid "Uploaded" msgstr "" #: IDF/Views/Download.php:61 IDF/Views/Download.php:63 #: IDF/Views/Download.php:219 IDF/Views/Download.php:225 +#: IDF/Views/Download.php:62 IDF/Views/Download.php:230 msgid "No downloads were found." msgstr "" #: IDF/Views/Download.php:81 IDF/Views/Download.php:83 +#: IDF/Views/Download.php:85 #, php-format msgid "Download %s" msgstr "" #: IDF/Views/Download.php:94 IDF/Views/Download.php:96 -#: IDF/Views/Download.php:100 +#: IDF/Views/Download.php:100 IDF/Views/Download.php:102 #, php-format msgid "The file %2$s has been updated." msgstr "" #: IDF/Views/Download.php:135 IDF/gettexttemplates/downloads/base.html.php:4 #: IDF/gettexttemplates/downloads/index.html.php:3 IDF/Views/Download.php:137 -#: IDF/Views/Download.php:143 +#: IDF/Views/Download.php:143 IDF/Views/Download.php:147 msgid "New Download" msgstr "" #: IDF/Views/Download.php:144 IDF/Views/Download.php:146 -#: IDF/Views/Download.php:152 +#: IDF/Views/Download.php:152 IDF/Views/Download.php:156 #, php-format msgid "The file has been uploaded." msgstr "" -#: IDF/Views/Issue.php:40 +#: IDF/Views/Issue.php:40 IDF/Views/Issue.php:41 #, php-format msgid "%s Recent Issues" msgstr "" -#: IDF/Views/Issue.php:49 IDF/Views/Issue.php:103 +#: IDF/Views/Issue.php:49 IDF/Views/Issue.php:103 IDF/Views/Issue.php:50 +#: IDF/Views/Issue.php:105 msgid "This table shows the open recent issues." msgstr "" #: IDF/Views/Issue.php:56 IDF/Views/Issue.php:108 IDF/Views/Issue.php:227 -#: IDF/Views/Issue.php:280 +#: IDF/Views/Issue.php:280 IDF/Views/Issue.php:57 IDF/Views/Issue.php:110 +#: IDF/Views/Issue.php:232 IDF/Views/Issue.php:286 msgid "Id" msgstr "" #: IDF/Views/Issue.php:58 IDF/Views/Issue.php:110 IDF/Views/Issue.php:229 #: IDF/Views/Issue.php:282 IDF/Form/IssueCreate.php:70 -#: IDF/Form/IssueUpdate.php:66 +#: IDF/Form/IssueUpdate.php:66 IDF/Views/Issue.php:59 IDF/Views/Issue.php:112 +#: IDF/Views/Issue.php:234 IDF/Views/Issue.php:288 msgid "Status" msgstr "" #: IDF/Views/Issue.php:59 IDF/Views/Issue.php:111 IDF/Views/Issue.php:230 -#: IDF/Views/Issue.php:283 +#: IDF/Views/Issue.php:283 IDF/Views/Issue.php:60 IDF/Views/Issue.php:113 +#: IDF/Views/Issue.php:235 IDF/Views/Issue.php:289 msgid "Last Updated" msgstr "" #: IDF/Views/Issue.php:63 IDF/Views/Issue.php:115 IDF/Views/Issue.php:234 -#: IDF/Views/Issue.php:287 +#: IDF/Views/Issue.php:287 IDF/Views/Issue.php:64 IDF/Views/Issue.php:117 +#: IDF/Views/Issue.php:239 IDF/Views/Issue.php:293 msgid "No issues were found." msgstr "" -#: IDF/Views/Issue.php:87 +#: IDF/Views/Issue.php:87 IDF/Views/Issue.php:89 #, php-format msgid "My Submitted %s Issues" msgstr "" -#: IDF/Views/Issue.php:90 +#: IDF/Views/Issue.php:90 IDF/Views/Issue.php:92 #, php-format msgid "My Working %s Issues" msgstr "" -#: IDF/Views/Issue.php:131 +#: IDF/Views/Issue.php:131 IDF/Views/Issue.php:134 msgid "Submit a new issue" msgstr "" -#: IDF/Views/Issue.php:143 +#: IDF/Views/Issue.php:143 IDF/Views/Issue.php:146 #, php-format msgid "Issue %d has been created." msgstr "" -#: IDF/Views/Issue.php:168 +#: IDF/Views/Issue.php:168 IDF/Views/Issue.php:172 #, php-format msgid "Issue %d: %s" msgstr "" -#: IDF/Views/Issue.php:184 +#: IDF/Views/Issue.php:184 IDF/Views/Issue.php:188 #, php-format msgid "Issue %d has been updated." msgstr "" -#: IDF/Views/Issue.php:211 +#: IDF/Views/Issue.php:211 IDF/Views/Issue.php:216 #, php-format msgid "%s Closed Issues" msgstr "" -#: IDF/Views/Issue.php:220 +#: IDF/Views/Issue.php:220 IDF/Views/Issue.php:225 msgid "This table shows the closed issues." msgstr "" -#: IDF/Views/Issue.php:258 +#: IDF/Views/Issue.php:258 IDF/Views/Issue.php:264 #, php-format msgid "%1$s Issues with Label %2$s" msgstr "" -#: IDF/Views/Issue.php:261 +#: IDF/Views/Issue.php:261 IDF/Views/Issue.php:267 #, php-format msgid "%1$s Closed Issues with Label %2$s" msgstr "" -#: IDF/Views/Issue.php:273 +#: IDF/Views/Issue.php:273 IDF/Views/Issue.php:279 #, php-format msgid "This table shows the issues with label %s." msgstr "" @@ -389,17 +402,17 @@ msgstr "" msgid "Project Home" msgstr "" -#: IDF/gettexttemplates/base.html.php:9 +#: IDF/gettexttemplates/base.html.php:9 IDF/Form/TabsConf.php:36 msgid "Issues" msgstr "" #: IDF/gettexttemplates/base.html.php:10 #: IDF/gettexttemplates/downloads/base.html.php:3 -#: IDF/gettexttemplates/admin/base.html.php:6 +#: IDF/gettexttemplates/admin/base.html.php:6 IDF/Form/TabsConf.php:34 msgid "Downloads" msgstr "" -#: IDF/gettexttemplates/base.html.php:11 +#: IDF/gettexttemplates/base.html.php:11 IDF/Form/TabsConf.php:35 msgid "Source" msgstr "" @@ -587,6 +600,7 @@ msgstr "" #: IDF/gettexttemplates/admin/issue-tracking.html.php:8 #: IDF/gettexttemplates/admin/members.html.php:13 #: IDF/gettexttemplates/admin/summary.html.php:8 +#: IDF/gettexttemplates/admin/tabs.html.php:5 msgid "Save Changes" msgstr "" @@ -1143,40 +1157,43 @@ msgstr "" msgid "No changes were entered." msgstr "" -#: IDF/Form/MembersConf.php:46 +#: IDF/Form/MembersConf.php:46 IDF/Form/TabsConf.php:47 msgid "Project owners" msgstr "" -#: IDF/Form/MembersConf.php:54 +#: IDF/Form/MembersConf.php:54 IDF/Form/TabsConf.php:46 msgid "Project members" msgstr "" -#: IDF/Views/Source.php:36 +#: IDF/Views/Source.php:36 IDF/Views/Source.php:37 #, php-format msgid "%s Git Change Log" msgstr "" -#: IDF/Views/Source.php:54 IDF/Views/Source.php:83 +#: IDF/Views/Source.php:54 IDF/Views/Source.php:83 IDF/Views/Source.php:56 +#: IDF/Views/Source.php:86 #, php-format msgid "%s Git Source Tree" msgstr "" -#: IDF/Views/Source.php:164 +#: IDF/Views/Source.php:164 IDF/Views/Source.php:168 #, php-format msgid "%s Commit Details" msgstr "" -#: IDF/Views/Source.php:165 +#: IDF/Views/Source.php:165 IDF/Views/Source.php:169 #, php-format msgid "%s Commit Details - %s" msgstr "" #: IDF/Views/Download.php:199 IDF/Views/Download.php:205 +#: IDF/Views/Download.php:210 #, php-format msgid "%1$s Downloads with Label %2$s" msgstr "" #: IDF/Views/Download.php:207 IDF/Views/Download.php:213 +#: IDF/Views/Download.php:218 #, php-format msgid "This table shows the downloads with label %s." msgstr "" @@ -1186,3 +1203,42 @@ msgid "" "Attention! This file is marked as deprecated, download it " "only if you are sure you need this specific version." msgstr "" + +#: IDF/Views/Project.php:215 +#, php-format +msgid "%s Tabs Access Rights" +msgstr "" + +#: IDF/Views/Project.php:225 +msgid "The project tabs access rights have been saved." +msgstr "" + +#: IDF/gettexttemplates/admin/base.html.php:7 +msgid "Tabs Access" +msgstr "" + +#: IDF/gettexttemplates/admin/tabs.html.php:3 +msgid "You can configure here the project tabs access rights." +msgstr "" + +#: IDF/gettexttemplates/admin/tabs.html.php:4 +msgid "" +"The form contains some errors. Please correct them to update the access " +"rights." +msgstr "" + +#: IDF/gettexttemplates/admin/tabs.html.php:6 +msgid "Instructions:" +msgstr "" + +#: IDF/Form/TabsConf.php:44 +msgid "Open to all" +msgstr "" + +#: IDF/Form/TabsConf.php:45 +msgid "Signed in users" +msgstr "" + +#: IDF/Form/TabsConf.php:48 +msgid "Closed" +msgstr "" diff --git a/src/IDF/templates/admin/base.html b/src/IDF/templates/admin/base.html index 0cae4d8..501c2cf 100644 --- a/src/IDF/templates/admin/base.html +++ b/src/IDF/templates/admin/base.html @@ -5,6 +5,7 @@ {trans 'Project Summary'} | {trans 'Project Members'} | {trans 'Issue Tracking'} | -{trans 'Downloads'} +{trans 'Downloads'} | +{trans 'Tabs Access'} {/block} diff --git a/src/IDF/templates/admin/tabs.html b/src/IDF/templates/admin/tabs.html new file mode 100644 index 0000000..fce8782 --- /dev/null +++ b/src/IDF/templates/admin/tabs.html @@ -0,0 +1,45 @@ +{extends "admin/base.html"} +{block docclass}yui-t1{assign $inTabs = true}{/block} +{block body} +{if $form.errors} +
+

{trans 'The form contains some errors. Please correct them to update the access rights.'}

+{if $form.get_top_errors} +{$form.render_top_errors|unsafe} +{/if} +
+{/if} +
+ + + + + + + + + + + + + + + + +
{$form.f.downloads_access_rights.labelTag}:{if $form.f.downloads_access_rights.errors}{$form.f.downloads_access_rights.fieldErrors}{/if} +{$form.f.downloads_access_rights|unsafe} +
{$form.f.issues_access_rights.labelTag}:{if $form.f.issues_access_rights.errors}{$form.f.issues_access_rights.fieldErrors}{/if} +{$form.f.issues_access_rights|unsafe} +
{$form.f.source_access_rights.labelTag}:{if $form.f.source_access_rights.errors}{$form.f.source_access_rights.fieldErrors}{/if} +{$form.f.source_access_rights|unsafe} +
+ +
+
+{/block} +{block context} +
+

{trans 'Instructions:'}

+

{blocktrans}You can configure here the project tabs access rights.{/blocktrans}

+
+{/block} diff --git a/src/IDF/templates/base.html b/src/IDF/templates/base.html index 3aaebd6..34fd3bd 100644 --- a/src/IDF/templates/base.html +++ b/src/IDF/templates/base.html @@ -42,9 +42,9 @@
{if $project} {trans 'Project Home'} - {trans 'Issues'} - {trans 'Downloads'} - {trans 'Source'} +{if $hasIssuesAccess} {trans 'Issues'}{/if} +{if $hasDownloadsAccess} {trans 'Downloads'}{/if} +{if $hasSourceAccess} {trans 'Source'}{/if} {if $isOwner} {trans 'Administer'}{/if}{/if}
diff --git a/src/IDF/templates/issues/view.html b/src/IDF/templates/issues/view.html index 4e57081..1a225b4 100644 --- a/src/IDF/templates/issues/view.html +++ b/src/IDF/templates/issues/view.html @@ -13,7 +13,7 @@

{blocktrans}Comment {$i} by {$who}, {$c.creation_dtime|date}{/blocktrans}

{/if} -
{if strlen($c.content) > 0}{issuetext $c.content, $project}{else}{trans '(No comments were given for this change.)'}{/if}
+
{if strlen($c.content) > 0}{issuetext $c.content, $request}{else}{trans '(No comments were given for this change.)'}{/if}
{if $i> 0 and $c.changedIssue()}
diff --git a/src/IDF/templates/js-hotkeys.html b/src/IDF/templates/js-hotkeys.html index a625eb8..89f7c68 100644 --- a/src/IDF/templates/js-hotkeys.html +++ b/src/IDF/templates/js-hotkeys.html @@ -3,11 +3,11 @@