From 6eedbc84a96af9cc2f8617a46ace7daaaa6070e6 Mon Sep 17 00:00:00 2001 From: csanz Date: Thu, 18 Apr 2024 15:59:52 +0200 Subject: [PATCH] Front office : Add edit button on video page (#319) --------- Co-authored-by: MacWarrior --- upload/admin_area/main.php | 2 ++ .../styles/cb_2014/layout/main.html | 10 ++++++- upload/cb_install/sql/5.5.1/00014.sql | 28 +++++++++++++++++++ upload/cb_install/sql/configs.sql | 3 +- upload/cb_install/sql/language_ENG.sql | 6 ++++ upload/cb_install/sql/language_FRA.sql | 6 ++++ upload/cb_install/sql/languages.sql | 5 +++- upload/changelog/551.json | 5 ++-- upload/styles/cb_28/layout/watch_video.html | 22 +++++++++++++++ upload/watch_video.php | 4 +++ 10 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 upload/cb_install/sql/5.5.1/00014.sql diff --git a/upload/admin_area/main.php b/upload/admin_area/main.php index 6d9581f14..0339650f8 100644 --- a/upload/admin_area/main.php +++ b/upload/admin_area/main.php @@ -112,6 +112,7 @@ , 'enable_video_crew' , 'enable_video_poster' , 'enable_video_backdrop' + , 'enable_edit_button' ]; $config_booleans_to_refactor = [ @@ -406,6 +407,7 @@ 'enable_video_crew', 'enable_video_poster', 'enable_video_backdrop', + 'enable_edit_button', 'hide_empty_collection', 'display_video_comments', diff --git a/upload/admin_area/styles/cb_2014/layout/main.html b/upload/admin_area/styles/cb_2014/layout/main.html index 7baab1135..e56e573e4 100644 --- a/upload/admin_area/styles/cb_2014/layout/main.html +++ b/upload/admin_area/styles/cb_2014/layout/main.html @@ -1500,7 +1500,15 @@

Website Configurations


- +
+
+ +
+
+ + +
+
diff --git a/upload/cb_install/sql/5.5.1/00014.sql b/upload/cb_install/sql/5.5.1/00014.sql new file mode 100644 index 000000000..2fca3746a --- /dev/null +++ b/upload/cb_install/sql/5.5.1/00014.sql @@ -0,0 +1,28 @@ +SET @language_id_eng = (SELECT `language_id` FROM `{tbl_prefix}languages` WHERE language_code = 'en'); +SET @language_id_fra = (SELECT `language_id` FROM `{tbl_prefix}languages` WHERE language_code = 'fr'); + +SET @language_key = 'edit_from_BO' COLLATE utf8mb4_unicode_520_ci; +INSERT IGNORE INTO `{tbl_prefix}languages_keys` (`language_key`) VALUES (@language_key); +SET @id_language_key = (SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` COLLATE utf8mb4_unicode_520_ci = @language_key); +INSERT IGNORE INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`) +VALUES (@id_language_key, 'From admin area', @language_id_eng); +INSERT IGNORE INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`) +VALUES (@id_language_key, 'Depuis l''administration', @language_id_fra); + +SET @language_key = 'edit_from_FO' COLLATE utf8mb4_unicode_520_ci; +INSERT IGNORE INTO `{tbl_prefix}languages_keys` (`language_key`) VALUES (@language_key); +SET @id_language_key = (SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` COLLATE utf8mb4_unicode_520_ci = @language_key); +INSERT IGNORE INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`) +VALUES (@id_language_key, 'From my account', @language_id_eng); +INSERT IGNORE INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`) +VALUES (@id_language_key, 'Depuis mon compte', @language_id_fra); + +SET @language_key = 'enable_edit_button' COLLATE utf8mb4_unicode_520_ci; +INSERT IGNORE INTO `{tbl_prefix}languages_keys` (`language_key`) VALUES (@language_key); +SET @id_language_key = (SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` COLLATE utf8mb4_unicode_520_ci = @language_key); +INSERT IGNORE INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`) +VALUES (@id_language_key, 'Enable edit button', @language_id_eng); +INSERT IGNORE INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`) +VALUES (@id_language_key, 'Activer le bouton d''édition', @language_id_fra); + +INSERT INTO `{tbl_prefix}config` (`name`, `value`) VALUES ('enable_edit_button','yes'); \ No newline at end of file diff --git a/upload/cb_install/sql/configs.sql b/upload/cb_install/sql/configs.sql index 43c77c85d..46d43c402 100644 --- a/upload/cb_install/sql/configs.sql +++ b/upload/cb_install/sql/configs.sql @@ -273,7 +273,8 @@ INSERT INTO `{tbl_prefix}config` (`configid`, `name`, `value`) VALUES (NULL, 'enable_video_crew', 'yes'), (NULL, 'enable_video_poster', 'no'), (NULL, 'enable_video_backdrop', 'no'), - (NULL, 'tmdb_search', '10'); + (NULL, 'tmdb_search', '10'), + (NULL, 'enable_edit_button', 'yes'); INSERT INTO `{tbl_prefix}video_resolution` (`title`, `ratio`, `enabled`, `width`, `height`, `video_bitrate`) VALUES ('240p', '16/9', 1, 428, 240, 240000), diff --git a/upload/cb_install/sql/language_ENG.sql b/upload/cb_install/sql/language_ENG.sql index d3af4cbbd..7ea378ad0 100644 --- a/upload/cb_install/sql/language_ENG.sql +++ b/upload/cb_install/sql/language_ENG.sql @@ -2233,3 +2233,9 @@ INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translatio VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'update_category'), 'Update category', @language_id); INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`) VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'add_new_category'), 'Add new category', @language_id); +INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`) +VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'edit_from_BO'), 'From admin area', @language_id); +INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`) +VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'edit_from_FO'), 'From my account', @language_id); +INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`) +VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'enable_edit_button'), 'Enable edit button', @language_id); diff --git a/upload/cb_install/sql/language_FRA.sql b/upload/cb_install/sql/language_FRA.sql index 6a7e6e532..30d763638 100644 --- a/upload/cb_install/sql/language_FRA.sql +++ b/upload/cb_install/sql/language_FRA.sql @@ -1395,3 +1395,9 @@ INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translatio VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'update_category'), 'Mettre à jour la catégorie', @language_id); INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`) VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'add_new_category'), 'Ajouter une nouvelle catégorie', @language_id); +INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`) +VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'edit_from_BO'), 'Depuis l''administration', @language_id); +INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`) +VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'edit_from_FO'), 'Depuis mon compte', @language_id); +INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`) +VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'enable_edit_button'), 'Activer le bouton d''édition', @language_id); diff --git a/upload/cb_install/sql/languages.sql b/upload/cb_install/sql/languages.sql index 2e3fb2bb9..4ba2c9385 100644 --- a/upload/cb_install/sql/languages.sql +++ b/upload/cb_install/sql/languages.sql @@ -1116,4 +1116,7 @@ VALUES ('admin_setting'), ('select_as_default_x'), ('enable_x_field'), ('update_category'), - ('add_new_category'); + ('add_new_category'), + ('edit_from_BO'), + ('edit_from_FO'), + ('enable_edit_button'); diff --git a/upload/changelog/551.json b/upload/changelog/551.json index cde46bf40..a673f532a 100644 --- a/upload/changelog/551.json +++ b/upload/changelog/551.json @@ -1,6 +1,6 @@ { "version":"5.5.1", - "revision":"13", + "revision":"14", "status":"dev", "detail":[ { @@ -15,7 +15,8 @@ "description": [ "Refactor collections page" ,"Fix pagination on videos, collections & photos" - ,"Fix comments display on photos collection (#91)" + ,"Fix comments display on photos collection (#91)" + ,"Add edit button on video page (#319)" ] }, { diff --git a/upload/styles/cb_28/layout/watch_video.html b/upload/styles/cb_28/layout/watch_video.html index cf2f8caab..505081533 100644 --- a/upload/styles/cb_28/layout/watch_video.html +++ b/upload/styles/cb_28/layout/watch_video.html @@ -76,6 +76,28 @@

{/if} {/if} + + {if config('enable_edit_button') == 'yes'} + {if has_access('admin_access', true)} + {if user_id() && $video.userid == user_id()} + + {else} + {lang code='edit'} + {/if} + {elseif user_id() && $video.userid == user_id()} + {lang code='edit'} + {/if} + {/if} + {if $Cbucket->configs.video_download==1 && $cbvid->downloadable($vdo)}