From 3848a2321a4adec541baba87b40d832d2761be6f Mon Sep 17 00:00:00 2001 From: root Date: Mon, 19 Dec 2022 09:40:00 +0000 Subject: [PATCH] from server 19.12 --- .../controllers/api/postsController.php | 2 +- plugins/rainlab/blog/components/Posts.php | 2 +- plugins/rainlab/blog/models/Post.php | 8 +- plugins/tps/reklama/models/group/columns.yaml | 4 + plugins/tps/tps/controllers/Media.php | 18 ++++ .../tps/controllers/media/_list_toolbar.htm | 18 ++++ .../tps/controllers/media/config_form.yaml | 10 ++ .../tps/controllers/media/config_list.yaml | 12 +++ plugins/tps/tps/controllers/media/create.htm | 46 ++++++++++ plugins/tps/tps/controllers/media/index.htm | 1 + plugins/tps/tps/controllers/media/preview.htm | 22 +++++ plugins/tps/tps/controllers/media/update.htm | 54 +++++++++++ plugins/tps/tps/models/Media.php | 30 ++++++ plugins/tps/tps/models/media/columns.yaml | 24 +++++ plugins/tps/tps/models/media/fields.yaml | 34 +++++++ plugins/tps/tps/plugin.yaml | 6 +- .../builder_table_create_tps_tps_media.php | 29 ++++++ plugins/tps/tps/updates/version.yaml | 3 + themes/modern2/layouts/new/master-inside.htm | 9 +- themes/modern2/layouts/new/master.htm | 10 +- themes/modern2/meta/menus/event_menu.yaml | 18 ++++ themes/modern2/meta/menus/new-top-menui.yaml | 90 +++++++++++++++++- themes/modern2/pages/new/home.htm | 91 ++++++++++++++++--- themes/modern2/pages/new/search.htm | 41 +++++++++ themes/modern2/partials/new/menu.htm | 15 ++- themes/modern2/partials/new/mobile-menu.htm | 3 + themes/modern2/partials/new/searchForm.htm | 10 ++ .../partials/newHome/main-bussiness.htm | 2 +- .../modern2/partials/newHome/main-popular.htm | 37 +++++++- .../modern2/partials/newHome/main-tender.htm | 2 +- themes/modern2/partials/newHome/main.htm | 41 +++++++-- themes/modern2/partials/newHome/partners.htm | 70 +++++++------- .../modern2/partials/newHome/publication.htm | 20 ++-- .../partials/newHome/right-sidebar.htm | 33 ++++++- themes/modern2/partials/newHome/video.htm | 6 +- 35 files changed, 717 insertions(+), 104 deletions(-) create mode 100644 plugins/tps/tps/controllers/Media.php create mode 100644 plugins/tps/tps/controllers/media/_list_toolbar.htm create mode 100644 plugins/tps/tps/controllers/media/config_form.yaml create mode 100644 plugins/tps/tps/controllers/media/config_list.yaml create mode 100644 plugins/tps/tps/controllers/media/create.htm create mode 100644 plugins/tps/tps/controllers/media/index.htm create mode 100644 plugins/tps/tps/controllers/media/preview.htm create mode 100644 plugins/tps/tps/controllers/media/update.htm create mode 100644 plugins/tps/tps/models/Media.php create mode 100644 plugins/tps/tps/models/media/columns.yaml create mode 100644 plugins/tps/tps/models/media/fields.yaml create mode 100644 plugins/tps/tps/updates/builder_table_create_tps_tps_media.php create mode 100644 themes/modern2/meta/menus/event_menu.yaml create mode 100644 themes/modern2/pages/new/search.htm create mode 100644 themes/modern2/partials/new/searchForm.htm diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/postsController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/postsController.php index 38938fa3e..5a095db6e 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/postsController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/postsController.php @@ -32,7 +32,7 @@ class postsController extends Controller 'category' => input('category'), 'date' => input('date'), 'typePost' => input('typePost'), - 'group' => input('group'), + 'postGroup' => input('group'), 'published' => true, 'featured' => input('featured'), 'select' => ['id','title','slug','published_at',DB::raw("IF(featured_image<>'',concat('$path',featured_image),featured_image) as main_image")] diff --git a/plugins/rainlab/blog/components/Posts.php b/plugins/rainlab/blog/components/Posts.php index a7f0e98b8..5a1f4773a 100644 --- a/plugins/rainlab/blog/components/Posts.php +++ b/plugins/rainlab/blog/components/Posts.php @@ -229,7 +229,7 @@ class Posts extends ComponentBase 'perPage' => $this->property('postsPerPage'), 'featured' => $featured, 'typePost' => empty($this->property('typePost')) ? null : $this->property('typePost'), - 'group' => empty($this->property('categoryGroup')) ? null : $this->property('categoryGroup'), + 'postGroup' => empty($this->property('categoryGroup')) ? null : $this->property('categoryGroup'), 'search' => trim(input('q')), 'category' => $category, 'date' => input('date'), diff --git a/plugins/rainlab/blog/models/Post.php b/plugins/rainlab/blog/models/Post.php index 0c8179884..5b12bb81a 100644 --- a/plugins/rainlab/blog/models/Post.php +++ b/plugins/rainlab/blog/models/Post.php @@ -373,7 +373,7 @@ class Post extends Model 'select' => null, 'featured' => null, 'typePost' => null, - 'group' => null, + 'postGroup' => null, ], $options)); $searchableFields = ['title', 'slug', 'excerpt']; @@ -479,11 +479,11 @@ class Post extends Model /* * Category, including children */ - if ($group !== null) { + if ($postGroup !== null) { // dd($categories); - $query->whereHas('category_groups', function($q) use ($group) { - $q->where('rainlab_blog_post_cat_group.category_group_id', $group); + $query->whereHas('category_groups', function($q) use ($postGroup) { + $q->where('slug', $postGroup); }); } diff --git a/plugins/tps/reklama/models/group/columns.yaml b/plugins/tps/reklama/models/group/columns.yaml index 0ed3b3b87..2994b88c0 100644 --- a/plugins/tps/reklama/models/group/columns.yaml +++ b/plugins/tps/reklama/models/group/columns.yaml @@ -15,3 +15,7 @@ columns: sortable: true relation: adds_count valueFrom: count + id: + label: ID + type: number + sortable: true diff --git a/plugins/tps/tps/controllers/Media.php b/plugins/tps/tps/controllers/Media.php new file mode 100644 index 000000000..1939787e4 --- /dev/null +++ b/plugins/tps/tps/controllers/Media.php @@ -0,0 +1,18 @@ + + + + diff --git a/plugins/tps/tps/controllers/media/config_form.yaml b/plugins/tps/tps/controllers/media/config_form.yaml new file mode 100644 index 000000000..3458ddb0c --- /dev/null +++ b/plugins/tps/tps/controllers/media/config_form.yaml @@ -0,0 +1,10 @@ +name: Media +form: $/tps/tps/models/media/fields.yaml +modelClass: Tps\Tps\Models\Media +defaultRedirect: tps/tps/media +create: + redirect: 'tps/tps/media/update/:id' + redirectClose: tps/tps/media +update: + redirect: tps/tps/media + redirectClose: tps/tps/media diff --git a/plugins/tps/tps/controllers/media/config_list.yaml b/plugins/tps/tps/controllers/media/config_list.yaml new file mode 100644 index 000000000..ba6d48b8e --- /dev/null +++ b/plugins/tps/tps/controllers/media/config_list.yaml @@ -0,0 +1,12 @@ +list: $/tps/tps/models/media/columns.yaml +modelClass: Tps\Tps\Models\Media +title: Media +noRecordsMessage: 'backend::lang.list.no_records' +showSetup: true +showCheckboxes: true +recordsPerPage: 20 +toolbar: + buttons: list_toolbar + search: + prompt: 'backend::lang.list.search_prompt' +recordUrl: 'tps/tps/media/update/:id' diff --git a/plugins/tps/tps/controllers/media/create.htm b/plugins/tps/tps/controllers/media/create.htm new file mode 100644 index 000000000..9f166703e --- /dev/null +++ b/plugins/tps/tps/controllers/media/create.htm @@ -0,0 +1,46 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + +
+
+ + + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/tps/tps/controllers/media/index.htm b/plugins/tps/tps/controllers/media/index.htm new file mode 100644 index 000000000..ea43a3636 --- /dev/null +++ b/plugins/tps/tps/controllers/media/index.htm @@ -0,0 +1 @@ +listRender() ?> diff --git a/plugins/tps/tps/controllers/media/preview.htm b/plugins/tps/tps/controllers/media/preview.htm new file mode 100644 index 000000000..58fd0ac89 --- /dev/null +++ b/plugins/tps/tps/controllers/media/preview.htm @@ -0,0 +1,22 @@ + + + + +fatalError): ?> + +
+ formRenderPreview() ?> +
+ + +

fatalError) ?>

+ + +

+ + + +

\ No newline at end of file diff --git a/plugins/tps/tps/controllers/media/update.htm b/plugins/tps/tps/controllers/media/update.htm new file mode 100644 index 000000000..2b23e0163 --- /dev/null +++ b/plugins/tps/tps/controllers/media/update.htm @@ -0,0 +1,54 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + + + +
+
+ + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/tps/tps/models/Media.php b/plugins/tps/tps/models/Media.php new file mode 100644 index 000000000..39d4e8cec --- /dev/null +++ b/plugins/tps/tps/models/Media.php @@ -0,0 +1,30 @@ +engine = 'InnoDB'; + $table->increments('id')->unsigned(); + $table->timestamp('created_at')->nullable(); + $table->timestamp('updated_at')->nullable(); + $table->string('name')->nullable(); + $table->string('type')->nullable(); + $table->text('media_file')->nullable(); + $table->string('poster_file')->nullable(); + $table->text('note')->nullable(); + $table->timestamp('published_at')->nullable(); + }); + } + + public function down() + { + Schema::dropIfExists('tps_tps_media'); + } +} diff --git a/plugins/tps/tps/updates/version.yaml b/plugins/tps/tps/updates/version.yaml index 210a73f52..ff57b46e1 100644 --- a/plugins/tps/tps/updates/version.yaml +++ b/plugins/tps/tps/updates/version.yaml @@ -3,3 +3,6 @@ 1.0.2: - 'Created table tps_tps_afisha' - builder_table_create_tps_tps_afisha.php +1.0.3: + - 'Created table tps_tps_media' + - builder_table_create_tps_tps_media.php diff --git a/themes/modern2/layouts/new/master-inside.htm b/themes/modern2/layouts/new/master-inside.htm index 6849cd1cf..bc2dd4e47 100644 --- a/themes/modern2/layouts/new/master-inside.htm +++ b/themes/modern2/layouts/new/master-inside.htm @@ -84,14 +84,7 @@ random = 0 {% endif %} - + {% partial 'new/searchForm' %}
diff --git a/themes/modern2/layouts/new/master.htm b/themes/modern2/layouts/new/master.htm index 8a48d093d..0f5c5551d 100644 --- a/themes/modern2/layouts/new/master.htm +++ b/themes/modern2/layouts/new/master.htm @@ -84,14 +84,8 @@ random = 0 {% endif %} - + + {% partial 'new/searchForm' %}
diff --git a/themes/modern2/meta/menus/event_menu.yaml b/themes/modern2/meta/menus/event_menu.yaml new file mode 100644 index 000000000..7cd609894 --- /dev/null +++ b/themes/modern2/meta/menus/event_menu.yaml @@ -0,0 +1,18 @@ +items: + - + title: OGT + type: url + url: / + code: '' + viewBag: + locale: + en: + title: '' + url: '' + tm: + title: '' + url: '' + isHidden: '1' + cssClass: '' + isExternal: '0' +name: event_menu diff --git a/themes/modern2/meta/menus/new-top-menui.yaml b/themes/modern2/meta/menus/new-top-menui.yaml index 0bb254f85..816140c0a 100644 --- a/themes/modern2/meta/menus/new-top-menui.yaml +++ b/themes/modern2/meta/menus/new-top-menui.yaml @@ -100,6 +100,25 @@ items: isHidden: '0' cssClass: '' isExternal: '0' + - + title: События + nesting: 0 + type: blog-category + code: '' + reference: '9' + cmsPage: new/category + replace: 0 + viewBag: + locale: + en: + title: '' + url: '' + tm: + title: '' + url: '' + isHidden: '0' + cssClass: '' + isExternal: '0' - title: Статьи nesting: null @@ -245,7 +264,7 @@ items: title: Media nesting: null type: url - url: / + url: /ru/new/posts/media code: '' reference: null cmsPage: null @@ -261,11 +280,56 @@ items: isHidden: '0' cssClass: '' isExternal: '0' + items: + - + title: Photo + nesting: null + type: url + url: /ru/new/posts/media/photo + code: '' + reference: null + cmsPage: null + replace: null + viewBag: + locale: + en: + title: '' + url: '' + tm: + title: '' + url: '' + isHidden: '0' + cssClass: '' + isExternal: '0' + - + title: Video + nesting: null + type: url + url: /ru/new/posts/media/video + code: '' + reference: null + cmsPage: null + replace: null + viewBag: + locale: + en: + title: '' + url: '' + tm: + title: '' + url: '' + isHidden: '0' + cssClass: '' + isExternal: '0' - title: Афиша + nesting: null type: url url: /ru/new/posts/poster code: '' + reference: null + cmsPage: null + replace: null viewBag: locale: en: @@ -280,9 +344,13 @@ items: items: - title: Театры + nesting: null type: url url: /ru/new/posts/poster/teatry code: '' + reference: null + cmsPage: null + replace: null viewBag: locale: en: @@ -296,9 +364,13 @@ items: isExternal: '0' - title: Спорт + nesting: null type: url url: /ru/new/posts/poster/sport code: '' + reference: null + cmsPage: null + replace: null viewBag: locale: en: @@ -312,9 +384,13 @@ items: isExternal: '0' - title: Объявления + nesting: null type: url url: /ru/new/posts/poster/obyavleniya code: '' + reference: null + cmsPage: null + replace: null viewBag: locale: en: @@ -328,9 +404,13 @@ items: isExternal: '0' - title: Концерты + nesting: null type: url url: /ru/new/posts/poster/koncerty code: '' + reference: null + cmsPage: null + replace: null viewBag: locale: en: @@ -344,9 +424,13 @@ items: isExternal: '0' - title: Кинотеатры + nesting: null type: url url: /ru/new/posts/poster/kinoteatry code: '' + reference: null + cmsPage: null + replace: null viewBag: locale: en: @@ -360,9 +444,13 @@ items: isExternal: '0' - title: Выставки + nesting: null type: url url: /ru/new/posts/poster/vystavki code: '' + reference: null + cmsPage: null + replace: null viewBag: locale: en: diff --git a/themes/modern2/pages/new/home.htm b/themes/modern2/pages/new/home.htm index c2e9fe7a7..efc92587f 100644 --- a/themes/modern2/pages/new/home.htm +++ b/themes/modern2/pages/new/home.htm @@ -4,34 +4,101 @@ layout = "new/master" is_hidden = 0 robot_index = "index" robot_follow = "follow" + +[builderList adv4] +modelClass = "Tps\Reklama\Models\Reklama" +scope = "-" +scopeValue = "{{ :scope }}" +displayColumn = "id" +noRecordsMessage = "No records found" +detailsPage = "-" +detailsUrlParameter = "id" +pageNumber = "{{ :page }}" + +[builderList adv5] +modelClass = "Tps\Reklama\Models\Reklama" +scope = "-" +scopeValue = "{{ :scope }}" +displayColumn = "id" +noRecordsMessage = "No records found" +detailsPage = "-" +detailsUrlParameter = "id" +pageNumber = "{{ :page }}" == +{% set records = adv4.records %} +{% set displayColumn = adv4.displayColumn %} +{% set noRecordsMessage = adv4.noRecordsMessage %} +{% set detailsPage = adv4.detailsPage %} +{% set detailsKeyColumn = adv4.detailsKeyColumn %} +{% set detailsUrlParameter = adv4.detailsUrlParameter %} + + + {% partial 'newHome/main' %} {% partial 'newHome/main-popular' %}
{% partial 'newHome/publication' %} + + +{% set records = adv5.records %} +{% set displayColumn = adv5.displayColumn %} +{% set noRecordsMessage = adv5.noRecordsMessage %} +{% set detailsPage = adv5.detailsPage %} +{% set detailsKeyColumn = adv5.detailsKeyColumn %} +{% set detailsUrlParameter = adv5.detailsUrlParameter %} + + +
diff --git a/themes/modern2/pages/new/search.htm b/themes/modern2/pages/new/search.htm new file mode 100644 index 000000000..ba3e4230b --- /dev/null +++ b/themes/modern2/pages/new/search.htm @@ -0,0 +1,41 @@ +title = "new/search" +url = "/new/search" +layout = "new/master-inside" +is_hidden = 0 +robot_index = "index" +robot_follow = "follow" + +[blogPosts] +pageNumber = "{{ :page }}" +postsPerPage = 10 +noPostsMessage = "No posts found" +sortOrder = "published_at desc" +categoryPage = "blog/category" +postPage = "blog/post" +== + +
+
+
+ + + +
+ + {% for post in blogPosts.posts %} + {% partial 'new/post_list_item' post = post %} + {% else %} +

No posts found

+ {% endfor %} + +
+ + {% partial 'new/pagination' items = blogPosts.posts filter = ['q',input('q')] %} + + +
+
+
\ No newline at end of file diff --git a/themes/modern2/partials/new/menu.htm b/themes/modern2/partials/new/menu.htm index d3aa55dd2..a3075b82e 100644 --- a/themes/modern2/partials/new/menu.htm +++ b/themes/modern2/partials/new/menu.htm @@ -2,6 +2,9 @@ [staticMenu] code = "new-top-menui" + +[staticMenu staticMenu2] +code = "event_menu" ==
diff --git a/themes/modern2/partials/newHome/main-tender.htm b/themes/modern2/partials/newHome/main-tender.htm index 1408f43f0..f8d9e0183 100644 --- a/themes/modern2/partials/newHome/main-tender.htm +++ b/themes/modern2/partials/newHome/main-tender.htm @@ -10,7 +10,7 @@ $this['afisha'] = RainLab\Blog\Models\CategoryGroup::where('slug', 'poster')->wi ==
-

Watan

+

{{'new.home.page.right'|_ }}

{% for post in categoryPosts %} diff --git a/themes/modern2/partials/newHome/main.htm b/themes/modern2/partials/newHome/main.htm index 5293df8a9..c15810335 100644 --- a/themes/modern2/partials/newHome/main.htm +++ b/themes/modern2/partials/newHome/main.htm @@ -2,7 +2,7 @@ [blogPosts postsMainLeft] pageNumber = "{{ :page }}" -categoryFilter = "economy" +categoryFilter = "novosti-biznesa" postsPerPage = 5 noPostsMessage = "No posts found" sortOrder = "published_at desc" @@ -11,17 +11,22 @@ postPage = 404 [blogPosts postsMainRight] pageNumber = "{{ :page }}" -categoryFilter = "tendery" +categoryFilter = "watan" postsPerPage = 4 noPostsMessage = "No posts found" sortOrder = "published_at desc" categoryPage = 404 postPage = 404 -[adverts adv_center_1] -code = "bank" -type = "slider" -random = 0 +[builderList adv1] +modelClass = "Tps\Reklama\Models\Reklama" +scope = "-" +scopeValue = "{{ :scope }}" +displayColumn = "id" +noRecordsMessage = "No records found" +detailsPage = "-" +detailsUrlParameter = "id" +pageNumber = "{{ :page }}" == {% set postsMainLeft = postsMainLeft.posts %} {% set postsMainRight = postsMainRight.posts %} @@ -36,13 +41,31 @@ random = 0 {% partial 'newHome/main-slider' %} + {% set records = adv1.records %} + {% set displayColumn = adv1.displayColumn %} + {% set noRecordsMessage = adv1.noRecordsMessage %} + {% set detailsPage = adv1.detailsPage %} + {% set detailsKeyColumn = adv1.detailsKeyColumn %} + {% set detailsUrlParameter = adv1.detailsUrlParameter %} + +
- - - + + + {% for key, record in records if record.group_id == 3 %} + + {% if record.id == 45 %} + + + + {% endif %} + {% else %} +
  • {{ noRecordsMessage }}
  • + {% endfor %} +
    diff --git a/themes/modern2/partials/newHome/partners.htm b/themes/modern2/partials/newHome/partners.htm index f76e5db17..a81a42d27 100644 --- a/themes/modern2/partials/newHome/partners.htm +++ b/themes/modern2/partials/newHome/partners.htm @@ -1,50 +1,48 @@ +[viewBag] + [adverts partners] code = "media" type = "slider" random = 0 -[viewBag] +[builderList partners] +modelClass = "Tps\Reklama\Models\Reklama" +scope = "-" +scopeValue = "{{ :scope }}" +displayColumn = "id" +noRecordsMessage = "No records found" +detailsPage = "-" +detailsUrlParameter = "id" +pageNumber = "{{ :page }}" == +{% set records = partners.records %} +{% set displayColumn = partners.displayColumn %} +{% set noRecordsMessage = partners.noRecordsMessage %} +{% set detailsPage = partners.detailsPage %} +{% set detailsKeyColumn = partners.detailsKeyColumn %} +{% set detailsUrlParameter = partners.detailsUrlParameter %} + + + +

    Наши партнеры

    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    + + {% for record in records if record.group_id == 1 %} + +
    +
    + +
    +
    + + {% else %} +
  • {{ noRecordsMessage }}
  • + {% endfor %} +
    diff --git a/themes/modern2/partials/newHome/publication.htm b/themes/modern2/partials/newHome/publication.htm index 69292b390..0da0e707a 100644 --- a/themes/modern2/partials/newHome/publication.htm +++ b/themes/modern2/partials/newHome/publication.htm @@ -2,8 +2,8 @@ [blogPosts] pageNumber = "{{ :page }}" -featured = "yes" -postsPerPage = 14 +categoryGroup = "stati" +postsPerPage = 9 noPostsMessage = "No posts found" sortOrder = "published_at desc" categoryPage = 404 @@ -15,33 +15,33 @@ postPage = 404
    - + - {% for key, post in posts.slice(6,14) %} + {% for key, post in posts.slice(1,9) %}
    - - - + {% for record in records if record.group_id == 7 %} + + {% if record.id == 81 %} + + + + {% endif %} + + {% else %} +
  • {{ noRecordsMessage }}
  • + {% endfor %} +
    \ No newline at end of file diff --git a/themes/modern2/partials/newHome/video.htm b/themes/modern2/partials/newHome/video.htm index 5c8fd2918..51b798d35 100644 --- a/themes/modern2/partials/newHome/video.htm +++ b/themes/modern2/partials/newHome/video.htm @@ -1,3 +1,5 @@ +[viewBag] + [blogPosts videos] pageNumber = "{{ :page }}" categoryFilter = "video" @@ -6,11 +8,11 @@ noPostsMessage = "No posts found" sortOrder = "published_at desc" categoryPage = 404 postPage = 404 - -[viewBag] == {% set posts = videos.posts %} + +