Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskonsite-архив-перенесен
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Korolev
taskonsite-архив-перенесен
Commits
271b6012
Commit
271b6012
authored
Mar 14, 2016
by
Олег Гиммельшпах
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add comments for client in redmine module
parent
3b91dbde
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
239 additions
and
213 deletions
+239
-213
common/modules/support/controllers/SupportController.php
common/modules/support/controllers/SupportController.php
+39
-23
common/modules/support/models/redmine/Issue.php
common/modules/support/models/redmine/Issue.php
+14
-8
common/modules/support/models/redmine/RedmineHelper.php
common/modules/support/models/redmine/RedmineHelper.php
+77
-0
common/modules/support/views/support/create.php
common/modules/support/views/support/create.php
+2
-114
common/modules/support/views/support/view.php
common/modules/support/views/support/view.php
+71
-68
frontend/web/css/custom.css
frontend/web/css/custom.css
+36
-0
No files found.
common/modules/support/controllers/SupportController.php
View file @
271b6012
...
...
@@ -72,6 +72,7 @@ class SupportController extends Controller
$this
->
view
->
registerJsFile
(
'/js/support.js'
,
[
'position'
=>
yii\web\View
::
POS_END
]);
$model
=
new
Issue
();
$model
->
setScenario
(
Issue
::
SCENARIO_CREATE
);
$client
=
$this
->
getClient
();
...
...
@@ -118,6 +119,44 @@ class SupportController extends Controller
]);
}
public
function
actionView
(
$id
)
{
$client
=
$this
->
getClient
();
$user
=
$client
->
user
->
getCurrentUser
();
$model
=
$client
->
issue
->
show
(
$id
,
[
'include'
=>
[
'attachments'
,
'journals'
]
]);
if
(
empty
(
$model
[
'issue'
])
||
$model
[
'issue'
][
'author'
][
'id'
]
!=
$user
[
'user'
][
'id'
])
{
throw
new
NotFoundHttpException
(
'Доступ запрещен!'
);
}
$issue
=
new
Issue
();
$issue
->
setScenario
(
Issue
::
SCENARIO_UPDATE
);
if
(
$issue
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$issue
->
validate
())
{
$params
=
[
'notes'
=>
$issue
->
notes
,
];
$client
->
issue
->
update
(
$id
,
$params
);
return
$this
->
refresh
();
}
return
$this
->
render
(
'view'
,
[
'model'
=>
$model
[
'issue'
],
'issue'
=>
$issue
]);
}
public
function
actionFile
()
{
if
(
Yii
::
$app
->
request
->
isAjax
)
...
...
@@ -169,29 +208,6 @@ class SupportController extends Controller
}
}
public
function
actionView
(
$id
)
{
$client
=
$this
->
getClient
();
$user
=
$client
->
user
->
getCurrentUser
();
$model
=
$client
->
issue
->
show
(
$id
,
[
'include'
=>
[
'attachments'
,
'journals'
]
]);
if
(
empty
(
$model
[
'issue'
])
||
$model
[
'issue'
][
'author'
][
'id'
]
!=
$user
[
'user'
][
'id'
])
{
throw
new
NotFoundHttpException
(
'Доступ запрещен!'
);
}
return
$this
->
render
(
'view'
,
[
'model'
=>
$model
[
'issue'
],
]);
}
protected
function
getClient
()
{
return
$client
=
new
\Redmine\Client
(
Settings
::
getValue
(
'redmine-url'
),
Yii
::
$app
->
support
->
identity
->
redmine_key
);
...
...
common/modules/support/models/redmine/Issue.php
View file @
271b6012
...
...
@@ -13,6 +13,7 @@ class Issue extends yii\base\Model
public
$author_id
;
public
$tracker_id
=
self
::
TRACKER_NONE
;
public
$status_id
=
self
::
STATUS_NEW
;
public
$notes
;
public
$files
=
null
;
...
...
@@ -23,22 +24,26 @@ class Issue extends yii\base\Model
const
STATUS_NEW
=
7
;
const
SCENARIO_CREATE
=
'create'
;
const
SCENARIO_UPDATE
=
'update'
;
/**
* @inheritdoc
*/
public
function
rules
()
{
return
[
[[
'
tracker_id'
,
'status_id'
,
'priority_id'
],
'required'
],
[[
'
notes'
],
'required'
,
'on'
=>
self
::
SCENARIO_UPDATE
],
[[
'project_id'
],
'required'
,
'message'
=>
'Выберите проект, к которому относится новая задача'
],
[[
'subject'
],
'required'
,
'message'
=>
'Введите наименование задачи'
],
[[
'description'
],
'required'
,
'message'
=>
'Укажите описание задачи'
],
[[
'tracker_id'
,
'status_id'
,
'priority_id'
],
'required'
,
'on'
=>
self
::
SCENARIO_CREATE
],
[[
'project_id'
],
'required'
,
'message'
=>
'Выберите проект, к которому относится новая задача'
,
'on'
=>
self
::
SCENARIO_CREATE
],
[[
'subject'
],
'required'
,
'message'
=>
'Введите наименование задачи'
,
'on'
=>
self
::
SCENARIO_CREATE
],
[[
'description'
],
'required'
,
'message'
=>
'Укажите описание задачи'
,
'on'
=>
self
::
SCENARIO_CREATE
],
[[
'tracker_id'
,
'project_id'
,
'status_id'
,
'priority_id'
],
'integer'
,
'on'
=>
self
::
SCENARIO_CREATE
],
[[
'description'
],
'string'
,
'on'
=>
self
::
SCENARIO_CREATE
],
[[
'subject'
],
'string'
,
'max'
=>
255
,
'on'
=>
self
::
SCENARIO_CREATE
],
[[
'tracker_id'
,
'project_id'
,
'status_id'
,
'priority_id'
],
'integer'
],
[[
'description'
],
'string'
],
[[
'files'
],
'safe'
],
[[
'subject'
],
'string'
,
'max'
=>
255
],
[[
'files'
,
'notes'
],
'safe'
],
];
}
...
...
@@ -55,6 +60,7 @@ class Issue extends yii\base\Model
'description'
=>
'Текст задачи'
,
'priority_id'
=>
'Важность'
,
'status_id'
=>
'Статус'
,
'notes'
=>
'Комментарий'
,
];
}
...
...
common/modules/support/models/redmine/RedmineHelper.php
View file @
271b6012
...
...
@@ -8,6 +8,83 @@ class RedmineHelper
{
const
MAX_FILE_SIZE
=
5242880
;
//5mb
public
static
$markupSet
=
[
[
'name'
=>
'Жирный'
,
'className'
=>
'fa fa-bold'
,
'openWith'
=>
'*'
,
'closeWith'
=>
'*'
],
[
'name'
=>
'Курсив'
,
'className'
=>
'fa fa-italic'
,
'openWith'
=>
'_'
,
'closeWith'
=>
'_'
],
[
'name'
=>
'Подчеркнутый'
,
'className'
=>
'fa fa-underline'
,
'openWith'
=>
'+'
,
'closeWith'
=>
'+'
],
[
'name'
=>
'Зачеркнутый'
,
'className'
=>
'fa fa-strikethrough'
,
'openWith'
=>
'-'
,
'closeWith'
=>
'-'
],
[
'separator'
=>
'---------------'
],
[
'name'
=>
'Заголовок 1'
,
'className'
=>
'fa fa-header header-1'
,
'openWith'
=>
'h1. '
,
'closeWith'
=>
''
],
[
'name'
=>
'Заголовок 2'
,
'className'
=>
'fa fa-header header-2'
,
'openWith'
=>
'h2. '
,
'closeWith'
=>
''
],
[
'name'
=>
'Заголовок 3'
,
'className'
=>
'fa fa-header header-3'
,
'openWith'
=>
'h3. '
,
'closeWith'
=>
''
],
[
'separator'
=>
'---------------'
],
[
'name'
=>
'Маркированный список'
,
'className'
=>
'fa fa-list-ul'
,
'openWith'
=>
'* '
,
'multiline'
=>
true
,
'openBlockWith'
=>
""
,
'closeBlockWith'
=>
""
],
[
'name'
=>
'Нумерованный список'
,
'className'
=>
'fa fa-list-ol'
,
'openWith'
=>
'# '
,
'multiline'
=>
true
,
'openBlockWith'
=>
""
,
'closeBlockWith'
=>
""
],
[
'separator'
=>
'---------------'
],
[
'name'
=>
'Заранее форматированный тест'
,
'className'
=>
'fa fa-newspaper-o'
,
'openWith'
=>
'<pre>'
,
'closeWith'
=>
'</pre>'
],
[
'separator'
=>
'---------------'
],
[
'name'
=>
'Вставка изображения'
,
'className'
=>
'fa fa-picture-o'
,
'openWith'
=>
'!'
,
'closeWith'
=>
'!'
],
];
public
static
function
sortIsuues
(
$issues
=
null
)
{
if
(
$issues
)
...
...
common/modules/support/views/support/create.php
View file @
271b6012
...
...
@@ -8,7 +8,7 @@ use common\modules\support\models\redmine\RedmineHelper;
?>
<div
class=
"container_white"
>
<div
class=
"container_white
support-block
"
>
<div
class=
"container"
>
<div
class=
"right_box_top row"
>
...
...
@@ -53,82 +53,7 @@ use common\modules\support\models\redmine\RedmineHelper;
<?=
$form
->
field
(
$model
,
'description'
,
[
'template'
=>
"<p class='label_p'><strong>
{
label}</strong></p>\n{input}<br>{hint}{error
}
"
])
->
widget
(
\coderlex\markitup\MarkItUp
::
className
(),
[
'options'
=>
[
'class'
=>
'form-control'
,
'style'
=>
'overflow:auto;resize:none;width:100%;min-height:200px;'
],
'clientOptions'
=>
[
'markupSet'
=>
[
[
'name'
=>
'Жирный'
,
'className'
=>
'fa fa-bold'
,
'openWith'
=>
'*'
,
'closeWith'
=>
'*'
],
[
'name'
=>
'Курсив'
,
'className'
=>
'fa fa-italic'
,
'openWith'
=>
'_'
,
'closeWith'
=>
'_'
],
[
'name'
=>
'Подчеркнутый'
,
'className'
=>
'fa fa-underline'
,
'openWith'
=>
'+'
,
'closeWith'
=>
'+'
],
[
'name'
=>
'Зачеркнутый'
,
'className'
=>
'fa fa-strikethrough'
,
'openWith'
=>
'-'
,
'closeWith'
=>
'-'
],
[
'separator'
=>
'---------------'
],
[
'name'
=>
'Заголовок 1'
,
'className'
=>
'fa fa-header header-1'
,
'openWith'
=>
'h1. '
,
'closeWith'
=>
''
],
[
'name'
=>
'Заголовок 2'
,
'className'
=>
'fa fa-header header-2'
,
'openWith'
=>
'h2. '
,
'closeWith'
=>
''
],
[
'name'
=>
'Заголовок 3'
,
'className'
=>
'fa fa-header header-3'
,
'openWith'
=>
'h3. '
,
'closeWith'
=>
''
],
[
'separator'
=>
'---------------'
],
[
'name'
=>
'Маркированный список'
,
'className'
=>
'fa fa-list-ul'
,
'openWith'
=>
'* '
,
'multiline'
=>
true
,
'openBlockWith'
=>
""
,
'closeBlockWith'
=>
""
],
[
'name'
=>
'Нумерованный список'
,
'className'
=>
'fa fa-list-ol'
,
'openWith'
=>
'# '
,
'multiline'
=>
true
,
'openBlockWith'
=>
""
,
'closeBlockWith'
=>
""
],
[
'separator'
=>
'---------------'
],
[
'name'
=>
'Заранее форматированный тест'
,
'className'
=>
'fa fa-newspaper-o'
,
'openWith'
=>
'<pre>'
,
'closeWith'
=>
'</pre>'
],
[
'separator'
=>
'---------------'
],
[
'name'
=>
'Вставка изображения'
,
'className'
=>
'fa fa-picture-o'
,
'openWith'
=>
'!'
,
'closeWith'
=>
'!'
],
]
'markupSet'
=>
RedmineHelper
::
$markupSet
],
])
?>
...
...
@@ -163,41 +88,4 @@ use common\modules\support\models\redmine\RedmineHelper;
</div>
</div>
<style
type=
"text/css"
>
.markItUpButton
{
position
:
relative
;
width
:
23px
;
height
:
23px
;
padding
:
3px
;
font-size
:
13px
;
text-align
:
center
;
}
.markItUpButton
a
{
position
:
absolute
;
top
:
0
;
left
:
0
;
z-index
:
5
;
}
.markItUp
{
width
:
100%
;
margin
:
5px
0
5px
0
;
}
.header-2
{
font-size
:
11px
;
line-height
:
16px
;
}
.header-3
{
font-size
:
9px
;
line-height
:
16px
;
}
.help-block
{
font-size
:
12px
;
line-height
:
10px
;
margin
:
-10px
0
25px
;
}
.container_white
.form-control
{
float
:
none
;
}
</style>
<?=
$this
->
render
(
'@app/views/layouts/footer'
);
?>
\ No newline at end of file
common/modules/support/views/support/view.php
View file @
271b6012
<?php
use
yii\widgets\ActiveForm
;
use
yii\helpers\Html
;
use
common\modules\support\models\redmine\Issue
;
use
common\modules\support\models\redmine\RedmineHelper
;
$parser
=
new
\Netcarver\Textile\Parser
();
?>
<div
class=
"container_white"
>
<div
class=
"container_white
support-block
"
>
<div
class=
"container"
>
<div
class=
"right_box_top row"
>
...
...
@@ -60,8 +66,7 @@ use common\modules\support\models\redmine\Issue;
<p><strong>
Описание задачи
</strong></p>
<p>
<?php
$parser
=
new
\Netcarver\Textile\Parser
();
echo
$parser
->
textileThis
(
$model
[
'description'
]);
?>
<?=
$parser
->
textileThis
(
$model
[
'description'
]);
?>
</p>
</div>
...
...
@@ -70,16 +75,29 @@ use common\modules\support\models\redmine\Issue;
<br>
<
!-- <
div class="row">
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<p
class=
"label_p"
><strong>
Добавить комментарий к задаче
</strong></p>
<div
class=
"text_box_form text_box_form_bg"
>
<div class="text_box_form_top"><img src="/images/text_box_img.jpg" width="100%" alt=""></div>
<textarea>Высылаю нужный файл</textarea>
<?php
$form
=
ActiveForm
::
begin
();
?>
<div class="file_box_wr">
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<?=
$form
->
field
(
$issue
,
'notes'
,
[
'template'
=>
"
{
input}<br>{hint}{error
}
"
])
->
widget
(
\coderlex\markitup\MarkItUp
::
className
(),
[
'options'
=>
[
'class'
=>
'form-control'
,
'style'
=>
'overflow:auto;resize:none;width:100%;min-height:100px;'
],
'clientOptions'
=>
[
'markupSet'
=>
RedmineHelper
::
$markupSet
],
])
->
label
(
false
)
?>
</div>
</div>
<!-- <div class="file_box_wr">
<span class="glyphicon glyphicon-file"></span>
<a href="">Error_window.jpg </a>
<span class="color_gray"> 50,6 кБ </span>
...
...
@@ -96,64 +114,49 @@ use common\modules\support\models\redmine\Issue;
<a href="">Error_window.jpg </a>
<span class="color_gray"> 50,6 кБ </span>
<a href=""><span class="glyphicon glyphicon-remove color_gray"></span></a>
</div
>
</div> --
>
<?=
Html
::
submitButton
(
'Отправить'
,
[
'class'
=>
'btn btn-success-2 gray_button_poz'
])
?>
<button class="btn btn-success-2 gray_button_poz">Отправить</button>
<!-- <button class="gray_button">Прикрепить файл<i class="glyphicon glyphicon-paperclip"></i></button> -->
<?php
ActiveForm
::
end
();
?>
<button class="gray_button">Прикрепить файл<i class="glyphicon glyphicon-paperclip"></i></button>
</div>
</div>
</div>
-->
</div>
<!-- <div class="row">
<?php
if
(
isset
(
$model
[
'journals'
]))
:
?>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<div
class=
"commentary_col"
>
<strong>Комментарии (14) </strong> <span class="label label-success" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="4 задачи требуют проверки">4</span
>
<strong>
Комментарии (
<?=
count
(
$model
[
'journals'
])
?>
)
</strong>
<!-- <span class="label label-success" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="4 задачи требуют проверки">4</span> --
>
</div>
<?php
foreach
(
$model
[
'journals'
]
as
$i
=>
$journal
)
:
?>
<div
class=
"commentary_box"
>
<p><strong>Иван Иванов</strong> <span class="color_gray">16 января 2014, 12:13</span></p>
<p>Прошу направить файлы заказчику и составить для него письмо.</p>
<a href=""><span class="glyphicon glyphicon-file"></span>скан_паспорта.jpg</a>
<a href=""><span class="glyphicon glyphicon-file"></span>данные.xml</a>
<br>
<img src="/images/commentary_box_img_1.jpg" width="96" height="56" alt="commentary_box_img_1">
<img src="/images/commentary_box_img_2.jpg" width="96" height="56" alt="commentary_box_img_2">
<br>
<a href="" class="commentary_box_ok">Ответить</a> <a href="" class="commentary_box_dell">Удалить</a>
<div class="line_3"></div>
</div>
<div class="commentary_box marg_l_20">
<p><strong>Сидоров Петр</strong> <span class="color_gray">16 января 2014, 13:06</span></p>
<p>Почтовый сервер при отправке письма выдает вот такую ошибку. Что делать?</p>
<a href=""><span class="glyphicon glyphicon-file"></span>Error_window.jpg </a> <span class="color_gray">50,6 кБ</span>
<p><strong>
<?=
$journal
[
'user'
][
'name'
]
?>
</strong>
<span
class=
"color_gray"
>
<?=
Yii
::
$app
->
formatter
->
asDate
(
$journal
[
'created_on'
],
'php:d F Y, H:i'
);
?>
</span></p>
<p>
<?=
$parser
->
textileThis
(
$journal
[
'notes'
]);
?>
</p>
<br>
<a href="" class="commentary_box_ok">Ответить</a> <a href="" class="commentary_box_dell">Удалить</a>
<!-- <a href="" class="commentary_box_ok">Ответить</a> <a href="" class="commentary_box_dell">Удалить</a> -->
<?php
if
(
$i
!=
count
(
$model
[
'journals'
])
-
1
)
:
?>
<div
class=
"line_3"
></div>
<?php
endif
;
?>
</div>
<div class="commentary_box marg_l_40">
<p><strong>Сидоров Петр</strong> <span class="color_gray">16 января 2014, 13:06</span></p>
<p>Почтовый сервер при отправке письма выдает вот такую ошибку. Что делать?</p>
<a href=""><span class="glyphicon glyphicon-file"></span>Error_window.jpg </a> <span class="color_gray">50,6 кБ</span>
<br>
<a href="" class="commentary_box_ok">Ответить</a> <a href="" class="commentary_box_dell">Удалить</a>
<?php
endforeach
;
?>
</div>
</div>
</div> -->
<br>
<br>
<?php
endif
;
?>
</div>
</div>
...
...
frontend/web/css/custom.css
View file @
271b6012
...
...
@@ -1805,3 +1805,39 @@ a.keys_test_btn {
display
:
inline-block
;
cursor
:
pointer
;
}
.support-block
.markItUpButton
{
position
:
relative
;
width
:
23px
;
height
:
23px
;
padding
:
3px
;
font-size
:
13px
;
text-align
:
center
;
}
.support-block
.markItUpButton
a
{
position
:
absolute
;
top
:
0
;
left
:
0
;
z-index
:
5
;
}
.support-block
.markItUp
{
width
:
100%
;
margin
:
5px
0
5px
0
;
}
.support-block
.header-2
{
font-size
:
11px
;
line-height
:
16px
;
}
.support-block
.header-3
{
font-size
:
9px
;
line-height
:
16px
;
}
.support-block
.help-block
{
font-size
:
12px
;
line-height
:
10px
;
margin
:
-10px
0
25px
;
}
.support-block
.form-control
{
float
:
none
!important
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment