Skip to content
Snippets Groups Projects
Commit 0470d8f7 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

dev #59187 add attachment view

parent 49a5ff77
Branches
Tags
2 merge requests!2365Dev#59187 explo redmine pouvoir uploader des fichiers dans les tickets back office,!2357Dev#59187 explo redmine pouvoir uploader des fichiers dans les tickets back office
Pipeline #2585 passed with stage
in 20 minutes and 40 seconds
......@@ -25,9 +25,7 @@ class Class_WebService_Redmine_Issue extends Class_Entity {
public static function newWith($data) {
$instance = new static();
$instance->updateAttributes($data);
return $instance;
return $instance->updateAttributes($data);
}
......@@ -136,6 +134,18 @@ class Class_WebService_Redmine_Issue extends Class_Entity {
}
public function renderAttachment($view, $key, $filename) {
if(!$filename)
return $view->tag('span', $this->_('Suppression de pièce jointe'));
$url = sprintf('%s/attachments/download/%s/%s',
Class_AdminVar::get('REDMINE_SERVER_URL'),
$key,
$filename);
return $view->tagAnchor($url, $this->_('Pièce jointe : %s', $filename), ['target' => '_blank']);
}
protected function withServiceDo($closure) {
return ($service = $this->getService()) ? $closure($service) : null;
}
......
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_View_Helper_Redmine_IssueAttachments extends ZendAfi_View_Helper_BaseHelper {
protected $_issue;
public function Redmine_IssueAttachments($issue) {
if (!$issue || (!$attachements = $issue->getAttachments()))
return $this->_('Aucune pièce jointe');
return '';
}
}
\ No newline at end of file
......@@ -95,6 +95,10 @@ class ZendAfi_View_Helper_Redmine_IssueJournal extends ZendAfi_View_Helper_BaseH
protected function renderDetail($detail) {
if('attachment' == $detail['property'])
return $this->_tag('li', $this->_issue->renderAttachment($this->view,
$detail['name'],
$detail['new_value']));
if ('relation' == $detail['property'])
return $this->_tag('li', $this->labelFromCode($detail['name'],
isset($detail['old_value']) ? $detail['old_value'] : null,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment