From 31f7e49256576d4582c8508d2d1bdc9f86831a31 Mon Sep 17 00:00:00 2001 From: Shohrat Date: Tue, 31 Oct 2023 05:19:41 +0000 Subject: [PATCH] from server 31.10 --- config/database.php | 4 +- .../controllers/api/postController.php | 2 +- .../controllers/api/sectionController.php | 18 ++++- plugins/rainlab/blog/models/Post.php | 3 + plugins/rainlab/blog/models/post/fields.yaml | 73 ++++++++++--------- ...lder_table_update_rainlab_blog_posts_2.php | 27 +++++++ plugins/rainlab/blog/updates/version.yaml | 3 + plugins/tps/airport/models/Content.php | 14 ++++ .../tps/airport/models/accardion/fields.yaml | 8 ++ .../tps/airport/models/content/fields.yaml | 17 +++++ ...er_table_update_tps_airport_contents_2.php | 27 +++++++ plugins/tps/airport/updates/version.yaml | 3 + plugins/tps/pageview/Plugin.php | 14 ++++ .../tps/pageview/controllers/PageVisit.php | 18 +++++ .../controllers/pagevisit/_list_toolbar.htm | 18 +++++ .../controllers/pagevisit/config_form.yaml | 10 +++ .../controllers/pagevisit/config_list.yaml | 12 +++ .../pageview/controllers/pagevisit/create.htm | 46 ++++++++++++ .../pageview/controllers/pagevisit/index.htm | 1 + .../controllers/pagevisit/preview.htm | 22 ++++++ .../pageview/controllers/pagevisit/update.htm | 54 ++++++++++++++ plugins/tps/pageview/lang/en/lang.php | 6 ++ plugins/tps/pageview/models/PageVisit.php | 28 +++++++ .../pageview/models/pagevisit/columns.yaml | 13 ++++ .../tps/pageview/models/pagevisit/fields.yaml | 13 ++++ plugins/tps/pageview/plugin.yaml | 11 +++ ...uilder_table_create_tps_pageview_visit.php | 27 +++++++ plugins/tps/pageview/updates/version.yaml | 5 ++ themes/airport/meta/static-pages.yaml | 1 + themes/airport/pages/privacy-policy.htm | 10 +++ 30 files changed, 468 insertions(+), 40 deletions(-) create mode 100644 plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_posts_2.php create mode 100644 plugins/tps/airport/updates/builder_table_update_tps_airport_contents_2.php create mode 100644 plugins/tps/pageview/Plugin.php create mode 100644 plugins/tps/pageview/controllers/PageVisit.php create mode 100644 plugins/tps/pageview/controllers/pagevisit/_list_toolbar.htm create mode 100644 plugins/tps/pageview/controllers/pagevisit/config_form.yaml create mode 100644 plugins/tps/pageview/controllers/pagevisit/config_list.yaml create mode 100644 plugins/tps/pageview/controllers/pagevisit/create.htm create mode 100644 plugins/tps/pageview/controllers/pagevisit/index.htm create mode 100644 plugins/tps/pageview/controllers/pagevisit/preview.htm create mode 100644 plugins/tps/pageview/controllers/pagevisit/update.htm create mode 100644 plugins/tps/pageview/lang/en/lang.php create mode 100644 plugins/tps/pageview/models/PageVisit.php create mode 100644 plugins/tps/pageview/models/pagevisit/columns.yaml create mode 100644 plugins/tps/pageview/models/pagevisit/fields.yaml create mode 100644 plugins/tps/pageview/plugin.yaml create mode 100644 plugins/tps/pageview/updates/builder_table_create_tps_pageview_visit.php create mode 100644 plugins/tps/pageview/updates/version.yaml create mode 100644 themes/airport/meta/static-pages.yaml create mode 100644 themes/airport/pages/privacy-policy.htm diff --git a/config/database.php b/config/database.php index 4565885..935ae1d 100644 --- a/config/database.php +++ b/config/database.php @@ -57,9 +57,9 @@ return [ 'engine' => 'InnoDB', 'host' => 'localhost', 'port' => 3306, - 'database' => 'airport2023', + 'database' => 'airport', 'username' => 'shohrat', - 'password' => 'bt110226', + 'password' => 'qazwsx12**', 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/postController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/postController.php index 53ac852..ac5e39b 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/postController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/postController.php @@ -69,7 +69,7 @@ class postController extends Controller $dataVal = $request->all(); $data = Post::with(['categories:id,name', 'featured_images']) - ->select('id', 'title', 'published_at', 'slug', 'excerpt', 'content_html') + ->select('id', 'title', 'published_at', 'slug', 'excerpt', 'content_html', 'meta_title', 'meta_description', 'meta_keywords') ->with('views') ->find($id); diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/sectionController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/sectionController.php index 34ef62d..7c93520 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/sectionController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/sectionController.php @@ -11,6 +11,8 @@ use Illuminate\Support\Facades\Validator; use tps\Airport\Models\Content; use tps\Airport\Models\Menu; use Config; +use Tps\Pageview\Models\PageVisit as ViewModel; +use Carbon\Carbon; class sectionController extends Controller @@ -31,9 +33,18 @@ class sectionController extends Controller return Validator::make($data, $rules); } + public function visit($page){ + //dump($data['page']); + if($page){ + $view = ViewModel::firstOrCreate(['page' => $page, 'date' => Carbon::today()]); + $view->increment('view'); + } + return ViewModel::where('page', $page)->sum('view'); + } + public function index(Request $request) { - $path = 'http://216.250.8.104:8081' . Config::get('cms.storage.media.path'); + $path = 'https://www.ashgabatairport.gov.tm/app' . Config::get('cms.storage.media.path'); $dataVal = $request->all(); @@ -47,7 +58,7 @@ class sectionController extends Controller return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validator->errors()); } - $data = Content::where('menu_slug', input('page'))->select('id', 'note', 'menu_slug', 'data')->get(); + $data = Content::where('menu_slug', input('page'))->select('id', 'note', 'menu_slug', 'data', 'meta_title', 'meta_description', 'meta_keywords')->get(); if (count($data) != 0) { @@ -97,7 +108,8 @@ class sectionController extends Controller $data[0]->section_contents = $contents; $data->makeHidden(['data']); - + + $data[0]->visit = $this->visit(input('page')); // dd($data[0]->data); return $this->helpers->apiArrayResponseBuilder(200, 'success', $data); } else { diff --git a/plugins/rainlab/blog/models/Post.php b/plugins/rainlab/blog/models/Post.php index 2aab7e5..4e78c9f 100644 --- a/plugins/rainlab/blog/models/Post.php +++ b/plugins/rainlab/blog/models/Post.php @@ -46,6 +46,9 @@ class Post extends Model 'content_html', 'excerpt', 'metadata', + 'meta_title', + 'meta_description', + 'meta_keywords', ['slug', 'index' => true] ]; diff --git a/plugins/rainlab/blog/models/post/fields.yaml b/plugins/rainlab/blog/models/post/fields.yaml index ed7f590..9a16e8e 100644 --- a/plugins/rainlab/blog/models/post/fields.yaml +++ b/plugins/rainlab/blog/models/post/fields.yaml @@ -1,58 +1,48 @@ -# =================================== -# Field Definitions -# =================================== - fields: title: - label: rainlab.blog::lang.post.title + label: 'rainlab.blog::lang.post.title' span: left - placeholder: rainlab.blog::lang.post.title_placeholder - + placeholder: 'rainlab.blog::lang.post.title_placeholder' + type: text slug: - label: rainlab.blog::lang.post.slug + label: 'rainlab.blog::lang.post.slug' span: right - placeholder: rainlab.blog::lang.post.slug_placeholder + placeholder: 'rainlab.blog::lang.post.slug_placeholder' preset: field: title type: slug - + type: text toolbar: type: partial path: post_toolbar cssClass: collapse-visible - secondaryTabs: - stretch: true fields: content: - tab: rainlab.blog::lang.post.tab_edit + tab: 'rainlab.blog::lang.post.tab_edit' type: RainLab\Blog\FormWidgets\BlogMarkdown - cssClass: field-slim blog-post-preview + cssClass: 'field-slim blog-post-preview' stretch: true mode: split - categories: - tab: rainlab.blog::lang.post.tab_categories + tab: 'rainlab.blog::lang.post.tab_categories' type: relation - commentAbove: rainlab.blog::lang.post.categories_comment - placeholder: rainlab.blog::lang.post.categories_placeholder - + commentAbove: 'rainlab.blog::lang.post.categories_comment' + placeholder: 'rainlab.blog::lang.post.categories_placeholder' published: - tab: rainlab.blog::lang.post.tab_manage - label: rainlab.blog::lang.post.published + tab: 'rainlab.blog::lang.post.tab_manage' + label: 'rainlab.blog::lang.post.published' span: left type: checkbox - user: - tab: rainlab.blog::lang.post.tab_manage - label: rainlab.blog::lang.post.published_by + tab: 'rainlab.blog::lang.post.tab_manage' + label: 'rainlab.blog::lang.post.published_by' span: right type: dropdown - emptyOption: rainlab.blog::lang.post.current_user - + emptyOption: 'rainlab.blog::lang.post.current_user' published_at: - tab: rainlab.blog::lang.post.tab_manage - label: rainlab.blog::lang.post.published_on + tab: 'rainlab.blog::lang.post.tab_manage' + label: 'rainlab.blog::lang.post.published_on' span: left cssClass: checkbox-align type: datepicker @@ -61,17 +51,32 @@ secondaryTabs: action: enable field: published condition: checked - excerpt: - tab: rainlab.blog::lang.post.tab_manage - label: rainlab.blog::lang.post.excerpt + tab: 'rainlab.blog::lang.post.tab_manage' + label: 'rainlab.blog::lang.post.excerpt' type: textarea size: small - featured_images: - tab: rainlab.blog::lang.post.tab_manage - label: rainlab.blog::lang.post.featured_images + tab: 'rainlab.blog::lang.post.tab_manage' + label: 'rainlab.blog::lang.post.featured_images' type: fileupload mode: image imageWidth: 200 imageHeight: 200 + meta_title: + label: 'Meta title' + span: auto + type: text + tab: SEO + meta_description: + label: 'Meta Description' + size: large + span: left + type: textarea + tab: SEO + meta_keywords: + label: 'Meta keywords' + span: auto + size: large + type: textarea + tab: SEO diff --git a/plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_posts_2.php b/plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_posts_2.php new file mode 100644 index 0000000..48811ff --- /dev/null +++ b/plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_posts_2.php @@ -0,0 +1,27 @@ +string('meta_title')->nullable(); + $table->text('meta_description')->nullable(); + $table->text('meta_keywords')->nullable(); + }); + } + + public function down() + { + Schema::table('rainlab_blog_posts', function($table) + { + $table->dropColumn('meta_title'); + $table->dropColumn('meta_description'); + $table->dropColumn('meta_keywords'); + }); + } +} diff --git a/plugins/rainlab/blog/updates/version.yaml b/plugins/rainlab/blog/updates/version.yaml index 70bbb90..d69d82b 100644 --- a/plugins/rainlab/blog/updates/version.yaml +++ b/plugins/rainlab/blog/updates/version.yaml @@ -70,3 +70,6 @@ 1.6.3: - 'Updated table rainlab_blog_posts' - builder_table_update_rainlab_blog_posts.php +1.6.4: + - 'Updated table rainlab_blog_posts' + - builder_table_update_rainlab_blog_posts_2.php diff --git a/plugins/tps/airport/models/Content.php b/plugins/tps/airport/models/Content.php index e35c20c..1e66c12 100644 --- a/plugins/tps/airport/models/Content.php +++ b/plugins/tps/airport/models/Content.php @@ -16,7 +16,21 @@ class Content extends Model protected $dates = ['deleted_at']; protected $jsonable = ['data']; + + public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; + public $translatable = [ + 'meta_title', + 'meta_description', + 'meta_keywords', + ]; + + public $hasMany = [ + 'view' => [ + 'Tps\Pageview\Models\PageVisit', + 'key' => 'page' + ] + ]; /** diff --git a/plugins/tps/airport/models/accardion/fields.yaml b/plugins/tps/airport/models/accardion/fields.yaml index fe3a2f4..c67bdc1 100644 --- a/plugins/tps/airport/models/accardion/fields.yaml +++ b/plugins/tps/airport/models/accardion/fields.yaml @@ -74,6 +74,14 @@ tabs: label: Text span: full type: text + type_info: + label: 'Type info' + span: auto + options: + phone: Phone + email: Email + default: phone + type: balloon-selector col2: label: Col2 prompt: 'Add new item' diff --git a/plugins/tps/airport/models/content/fields.yaml b/plugins/tps/airport/models/content/fields.yaml index 7cc645a..d5f7e64 100644 --- a/plugins/tps/airport/models/content/fields.yaml +++ b/plugins/tps/airport/models/content/fields.yaml @@ -45,3 +45,20 @@ tabs: label: 'Is FLight' span: auto type: switch + meta_title: + label: 'Meta Title' + span: full + type: text + tab: SEO + meta_description: + label: 'Meta Description' + size: large + span: left + type: textarea + tab: SEO + meta_keywords: + label: 'Meta keywords' + size: large + span: right + type: textarea + tab: SEO diff --git a/plugins/tps/airport/updates/builder_table_update_tps_airport_contents_2.php b/plugins/tps/airport/updates/builder_table_update_tps_airport_contents_2.php new file mode 100644 index 0000000..d174f39 --- /dev/null +++ b/plugins/tps/airport/updates/builder_table_update_tps_airport_contents_2.php @@ -0,0 +1,27 @@ +string('meta_title')->nullable(); + $table->text('meta_description')->nullable(); + $table->text('meta_keywords')->nullable(); + }); + } + + public function down() + { + Schema::table('tps_airport_contents', function($table) + { + $table->dropColumn('meta_title'); + $table->dropColumn('meta_description'); + $table->dropColumn('meta_keywords'); + }); + } +} diff --git a/plugins/tps/airport/updates/version.yaml b/plugins/tps/airport/updates/version.yaml index fb9cf63..9b3e469 100644 --- a/plugins/tps/airport/updates/version.yaml +++ b/plugins/tps/airport/updates/version.yaml @@ -105,3 +105,6 @@ 1.0.36: - 'Updated table tps_airport_page_content' - builder_table_update_tps_airport_page_content_2.php +1.0.37: + - 'Updated table tps_airport_contents' + - builder_table_update_tps_airport_contents_2.php diff --git a/plugins/tps/pageview/Plugin.php b/plugins/tps/pageview/Plugin.php new file mode 100644 index 0000000..6c83744 --- /dev/null +++ b/plugins/tps/pageview/Plugin.php @@ -0,0 +1,14 @@ + + + + diff --git a/plugins/tps/pageview/controllers/pagevisit/config_form.yaml b/plugins/tps/pageview/controllers/pagevisit/config_form.yaml new file mode 100644 index 0000000..7177c63 --- /dev/null +++ b/plugins/tps/pageview/controllers/pagevisit/config_form.yaml @@ -0,0 +1,10 @@ +name: PageVisit +form: $/tps/pageview/models/pagevisit/fields.yaml +modelClass: Tps\Pageview\Models\PageVisit +defaultRedirect: tps/pageview/pagevisit +create: + redirect: 'tps/pageview/pagevisit/update/:id' + redirectClose: tps/pageview/pagevisit +update: + redirect: tps/pageview/pagevisit + redirectClose: tps/pageview/pagevisit diff --git a/plugins/tps/pageview/controllers/pagevisit/config_list.yaml b/plugins/tps/pageview/controllers/pagevisit/config_list.yaml new file mode 100644 index 0000000..347201c --- /dev/null +++ b/plugins/tps/pageview/controllers/pagevisit/config_list.yaml @@ -0,0 +1,12 @@ +list: $/tps/pageview/models/pagevisit/columns.yaml +modelClass: Tps\Pageview\Models\PageVisit +title: PageVisit +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/pageview/pagevisit/update/:id' diff --git a/plugins/tps/pageview/controllers/pagevisit/create.htm b/plugins/tps/pageview/controllers/pagevisit/create.htm new file mode 100644 index 0000000..55a1218 --- /dev/null +++ b/plugins/tps/pageview/controllers/pagevisit/create.htm @@ -0,0 +1,46 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + +
+
+ + + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/tps/pageview/controllers/pagevisit/index.htm b/plugins/tps/pageview/controllers/pagevisit/index.htm new file mode 100644 index 0000000..ea43a36 --- /dev/null +++ b/plugins/tps/pageview/controllers/pagevisit/index.htm @@ -0,0 +1 @@ +listRender() ?> diff --git a/plugins/tps/pageview/controllers/pagevisit/preview.htm b/plugins/tps/pageview/controllers/pagevisit/preview.htm new file mode 100644 index 0000000..19186e8 --- /dev/null +++ b/plugins/tps/pageview/controllers/pagevisit/preview.htm @@ -0,0 +1,22 @@ + + + + +fatalError): ?> + +
+ formRenderPreview() ?> +
+ + +

fatalError) ?>

+ + +

+ + + +

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

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/tps/pageview/lang/en/lang.php b/plugins/tps/pageview/lang/en/lang.php new file mode 100644 index 0000000..6c36366 --- /dev/null +++ b/plugins/tps/pageview/lang/en/lang.php @@ -0,0 +1,6 @@ + [ + 'name' => 'PageView', + 'description' => '' + ] +]; \ No newline at end of file diff --git a/plugins/tps/pageview/models/PageVisit.php b/plugins/tps/pageview/models/PageVisit.php new file mode 100644 index 0000000..a50a7f3 --- /dev/null +++ b/plugins/tps/pageview/models/PageVisit.php @@ -0,0 +1,28 @@ +engine = 'InnoDB'; + $table->increments('id')->unsigned(); + $table->timestamp('created_at')->nullable(); + $table->timestamp('updated_at')->nullable(); + $table->timestamp('deleted_at')->nullable(); + $table->bigInteger('view')->default(0); + $table->date('date'); + $table->string('page')->nullable(); + }); + } + + public function down() + { + Schema::dropIfExists('tps_pageview_visit'); + } +} diff --git a/plugins/tps/pageview/updates/version.yaml b/plugins/tps/pageview/updates/version.yaml new file mode 100644 index 0000000..6f2c83b --- /dev/null +++ b/plugins/tps/pageview/updates/version.yaml @@ -0,0 +1,5 @@ +1.0.1: + - 'Initialize plugin.' +1.0.2: + - 'Created table tps_pageview_visit' + - builder_table_create_tps_pageview_visit.php diff --git a/themes/airport/meta/static-pages.yaml b/themes/airport/meta/static-pages.yaml new file mode 100644 index 0000000..69beb95 --- /dev/null +++ b/themes/airport/meta/static-pages.yaml @@ -0,0 +1 @@ +static-pages: { } diff --git a/themes/airport/pages/privacy-policy.htm b/themes/airport/pages/privacy-policy.htm new file mode 100644 index 0000000..d1f26cf --- /dev/null +++ b/themes/airport/pages/privacy-policy.htm @@ -0,0 +1,10 @@ +title = "privacy-policy" +url = "/privacy-policy" +is_hidden = 0 +== +
+
+

Политика конфиденциальности

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi, voluptatibus, perferendis, nobis, magni id reiciendis laborum sunt quod quisquam impedit omnis aperiam hic sapiente eligendi inventore voluptatem corporis saepe suscipit officiis libero dolores possimus error tenetur u> +

+
\ No newline at end of file