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
140451ed
Commit
140451ed
authored
Mar 11, 2019
by
john
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3009
parent
1c19a163
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
316 additions
and
316 deletions
+316
-316
backend/web/plugins/editormd/documentation.js
backend/web/plugins/editormd/documentation.js
+1
-1
backend/web/plugins/editormd/examples/php/editormd.uploader.class.php
...plugins/editormd/examples/php/editormd.uploader.class.php
+279
-311
backend/web/plugins/editormd/examples/php/upload.php
backend/web/plugins/editormd/examples/php/upload.php
+2
-2
common/modules/documentation/controllers/DocumentationAdminController.php
...ocumentation/controllers/DocumentationAdminController.php
+32
-0
common/modules/documentation/models/DocList.php
common/modules/documentation/models/DocList.php
+1
-1
common/modules/documentation/views/documentation-admin/index.php
...modules/documentation/views/documentation-admin/index.php
+1
-1
No files found.
backend/web/plugins/editormd/documentation.js
View file @
140451ed
...
...
@@ -35,7 +35,7 @@ $(function ()
imageUpload
:
true
,
imageFormats
:
[
"
jpg
"
,
"
jpeg
"
,
"
gif
"
,
"
png
"
,
"
bmp
"
,
"
webp
"
],
imageUploadURL
:
"
./php/upload.php
"
,
imageUploadURL
:
"
/documentation/documentation-admin/upload
"
,
onload
:
function
()
{
console
.
log
(
'
onload
'
,
this
);
...
...
backend/web/plugins/editormd/examples/php/editormd.uploader.class.php
View file @
140451ed
This diff is collapsed.
Click to expand it.
backend/web/plugins/editormd/examples/php/upload.php
View file @
140451ed
...
...
@@ -41,11 +41,11 @@
if
(
$imageUploader
->
upload
(
$name
))
{
$imageUploader
->
message
(
'
上传成功!
'
,
1
);
$imageUploader
->
message
(
'
Загружен успешно!
'
,
1
);
}
else
{
$imageUploader
->
message
(
'
上传失败!
'
,
0
);
$imageUploader
->
message
(
'
Загрузка не удалась!
'
,
0
);
}
}
?>
\ No newline at end of file
common/modules/documentation/controllers/DocumentationAdminController.php
View file @
140451ed
...
...
@@ -24,6 +24,7 @@ class DocumentationAdminController extends AdminController
'Update'
=>
'Редактирование контента'
,
'Delete'
=>
'Удаление контента'
,
'View'
=>
'Просмотр контента'
,
'Upload'
=>
'Загрузка картинок'
,
];
}
...
...
@@ -235,4 +236,35 @@ class DocumentationAdminController extends AdminController
}
}
public
function
actionUpload
()
{
require
(
\yii\helpers\FileHelper
::
normalizePath
(
\Yii
::
getAlias
(
'@webroot'
)
.
DIRECTORY_SEPARATOR
.
'plugins'
.
DIRECTORY_SEPARATOR
.
'editormd'
.
DIRECTORY_SEPARATOR
.
'examples'
.
DIRECTORY_SEPARATOR
.
'php'
.
DIRECTORY_SEPARATOR
.
'editormd.uploader.class.php'
));
$savePath
=
\yii\helpers\FileHelper
::
normalizePath
(
\Yii
::
getAlias
(
'@frontend'
)
.
DIRECTORY_SEPARATOR
.
'web'
.
DIRECTORY_SEPARATOR
.
'uploads'
.
DIRECTORY_SEPARATOR
.
'documentation'
.
DIRECTORY_SEPARATOR
);
$saveURL
=
Yii
::
$app
->
params
[
'frontUrl'
]
.
'/uploads/documentation/'
;
$formats
=
array
(
'image'
=>
array
(
'gif'
,
'jpg'
,
'jpeg'
,
'png'
,
'bmp'
)
);
$name
=
'editormd-image-file'
;
if
(
isset
(
$_FILES
[
$name
]))
{
$imageUploader
=
new
\EditorMdUploader
(
$savePath
,
$saveURL
,
$formats
[
'image'
],
false
);
// Ymdhis表示按日期生成文件名,利用date()函数
$imageUploader
->
config
(
array
(
'maxSize'
=>
1024
,
// 允许上传的最大文件大小,以KB为单位,默认值为1024
'randomNameType'
=>
2
,
'randomLength'
=>
20
,
'cover'
=>
true
// 是否覆盖同名文件,默认为true
));
if
(
$imageUploader
->
upload
(
$name
))
{
$imageUploader
->
message
(
'Загружен успешно!'
,
1
);
}
else
{
$imageUploader
->
message
(
'Загрузка не удалась!'
,
0
);
}
}
}
}
common/modules/documentation/models/DocList.php
View file @
140451ed
...
...
@@ -139,7 +139,7 @@ class DocList extends \yii\db\ActiveRecord
$list
=
[];
$thisLevel
=
DocList
::
find
()
->
where
([
'='
,
'parent_id'
,
$parent_id
])
->
orderBy
([
'position'
=>
SORT_ASC
])
->
all
();
foreach
(
$thisLevel
as
$level
)
{
if
(
$updated
->
id
==
$level
->
id
&&
!
$ignore
)
if
(
$updated
&&
$updated
->
id
==
$level
->
id
&&
!
$ignore
)
continue
;
$l
=
''
;
...
...
common/modules/documentation/views/documentation-admin/index.php
View file @
140451ed
...
...
@@ -43,7 +43,7 @@ use common\modules\documentation\models\DocList;
],
[
'class'
=>
'common\components\ColorActionColumn'
,
'template'
=>
'{
view} {
update} {delete}'
,
'template'
=>
'{update} {delete}'
,
// 'buttons' => [
// 'copy' => function ($url, $model, $key) {
// return '<a href="' . Url::toRoute(['copy', 'id' => $model->id]) . '">' . Html::beginTag('i', [
...
...
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