From cc9dff74b1ab20449e831d81cc189b5e6b8f76f4 Mon Sep 17 00:00:00 2001 From: Alexander Blanchard Date: Tue, 9 Jul 2024 12:38:30 +0100 Subject: [PATCH 1/9] fix: Add checks to database updates Add checks to db updates so that tables and columns are only created if they do not exist in order to prevent db update errors. --- .../grapes_web_builder_updates.php | 78 +++---------------- 1 file changed, 11 insertions(+), 67 deletions(-) diff --git a/code/web/sys/DBMaintenance/grapes_web_builder_updates.php b/code/web/sys/DBMaintenance/grapes_web_builder_updates.php index 8a21132c08..2d6c8fa3b1 100644 --- a/code/web/sys/DBMaintenance/grapes_web_builder_updates.php +++ b/code/web/sys/DBMaintenance/grapes_web_builder_updates.php @@ -24,7 +24,7 @@ function getGrapesWebBuilderUpdates() { 'title' => 'Template Options for Grapes Web Builder', 'description' => 'Store templates for Grapes Web Builder', 'sql' => [ - "CREATE TABLE template_options ( + "CREATE TABLE IF NOT EXISTS template_options ( id INT(11) AUTO_INCREMENT PRIMARY KEY, templateName VARCHAR(100) NOT NULL, contents TEXT NOT NULL @@ -35,7 +35,7 @@ function getGrapesWebBuilderUpdates() { 'title' => 'Templates for Grapes Web Builder', 'description' => 'Store templates for Grapes Web Builder', 'sql' => [ - "CREATE TABLE templates ( + "CREATE TABLE IF NOT EXISTS templates ( id INT(11) AUTO_INCREMENT PRIMARY KEY, templateName VARCHAR(255) NOT NULL UNIQUE, templateDescription TEXT, @@ -61,14 +61,14 @@ function getGrapesWebBuilderUpdates() { 'title' => 'Remove Description From Templates Table', 'description' => 'Remove the description column from the template table', 'sql' => [ - "ALTER TABLE templates DROP COLUMN templateDescription", + "ALTER TABLE templates DROP COLUMN IF EXISTS templateDescription", ], ], 'alter_temapltes_table_add_content' => [ 'title' => 'Add Content to Templates Table', 'description' => 'Add content column to templates table', 'sql' => [ - "ALTER TABLE templates ADD COLUMN templateContent TEXT", + "ALTER TABLE templates ADD COLUMN IF NOT EXISTS templateContent TEXT", ], ], 'add_default_for_template_file_path' => [ @@ -82,7 +82,7 @@ function getGrapesWebBuilderUpdates() { 'title' => 'Add Template Content Column to Grapes Table', 'description' => 'Add a column to the Grapes table to store the content of the chosen template', 'sql' => [ - 'ALTER TABLE grapes_web_builder ADD COLUMN templateContent TEXT', + 'ALTER TABLE grapes_web_builder ADD COLUMN IF NOT EXISTS templateContent TEXT', ], ], 'alter_contents_of_grapes_page_table' => [ @@ -98,7 +98,7 @@ function getGrapesWebBuilderUpdates() { 'title' => 'Modify a column and add a new column', 'description' => 'Add a new column for template names and modify the templateID column to alter its purpose.', 'sql' => [ - 'ALTER TABLE grapes_web_builder ADD COLUMN templateNames INT(11) DEFAULT -1', + 'ALTER TABLE grapes_web_builder ADD COLUMN IF NOT EXISTS templateNames INT(11) DEFAULT -1', 'ALTER TABLE grapes_web_builder MODIFY COLUMN templateId VARCHAR(250) UNIQUE', ], ], @@ -134,7 +134,7 @@ function getGrapesWebBuilderUpdates() { 'title' => 'Add New Template Column', 'description' => 'Add template column to grapes table', 'sql' => [ - 'ALTER TABLE grapes_web_builder ADD COLUMN templatesSelect INT(11) DEFAULT -1', + 'ALTER TABLE grapes_web_builder ADD COLUMN IF NOT EXISTS templatesSelect INT(11) DEFAULT -1', ], ], 'add_template_content_to_grapes_web_builder' => [ @@ -144,22 +144,6 @@ function getGrapesWebBuilderUpdates() { 'ALTER TABLE grapes_web_builder ADD COLUMN templateContent TEXT', ], ], - 'create_table_for_grapes_page_saved_as_page' => [ - 'title' => 'add_table_for_created_grapes_page', - 'description' => 'add_table_for_created_grapes_page_saved_as_page', - 'sql' => [ - "CREATE TABLE created_grapes_page ( - id INT(11) AUTO_INCREMENT PRIMARY KEY, - title VARCHAR(100) NOT NULL, - urlAlias VARCHAR(100) NOT NULL, - htmlData TEXT NOT NULL DEFAULT ' ', - cssData TEXT NOT NULL DEFAULT ' ', - assets TEXT NOT NULL DEFAULT '[]', - components TEXT NOT NULL DEFAULT '[]', - styles TEXT NOT NULL DEFAULT '[]' - ) ENGINE=INNODB", - ], - ], 'remove_temaplteID_column' => [ 'title' => 'Remove templateId column from templates table', 'description' => 'Remove tempalteId column from templates table', @@ -174,21 +158,6 @@ function getGrapesWebBuilderUpdates() { 'ALTER TABLE grapes_web_builder DROP COLUMN templateId', ], ], - 'add_defaults_for_created_grapes_page_table' => [ - 'title' => 'Add Defaults to Table', - 'description' => 'Add defaults to created_grapes_page table to handle empty fields', - 'sql' => [ - 'ALTER TABLE created_grapes_page MODIFY COLUMN urlAlias VARCHAR(100) NOT NULL DEFAULT " "', - 'ALTER TABLE created_grapes_page MODIFY COLUMN title VARCHAR(100) NOT NULL DEFAULT " "', - ], - ], - 'add_grapes_page_id_column' => [ - 'title' => 'Add Grapes Page Id Column', - 'description' => 'Add grapes_page_id column to created_grapes_page table', - 'sql' => [ - 'ALTER TABLE created_grapes_page ADD COLUMN grapes_page_id VARCHAR(100) NOT NULL DEFAULT " "', - ], - ], 'alterations_to_templates_table' => [ 'title' => 'Alterations to Templates Table', 'description' => 'Make changes to templates table to handle addition of templates built in grapes editor', @@ -216,29 +185,18 @@ function getGrapesWebBuilderUpdates() { ], ], - 'create_a_table_for_creating_grapes_templates' => [ - 'title' => 'Add a Table to Allow Creating Grapes Templates', - 'description' => 'Add a table to allow crearing grapes templates.', - 'sql' => [ - "CREATE TABLE create_grapes_template ( - id INT(11) AUTO_INCREMENT PRIMARY KEY, - title VARCHAR(100) NOT NULL DEFAULT ' ', - teaser VARCHAR(250) NOT NULL DEFAULT ' ' - ) ENGINE=INNODB", - ], - ], 'add_grapesPageId_to_grapes_web_builder' => [ 'title' => 'Add a Column to Store Page ID', 'description' => 'Add a column to the grapes_web_builder table', 'sql' => [ - 'ALTER TABLE grapes_web_builder ADD COLUMN grapesPageId VARCHAR(100) Not NULL DEFAULT ""', + 'ALTER TABLE grapes_web_builder ADD COLUMN IF NOT EXISTS grapesGenId VARCHAR(100) Not NULL DEFAULT ""', ], ], 'grapes_page_web_builder_scope_by_library' => [ 'title' => 'Web Builder Grapes Page Scope By Library', 'description' => 'Add the ability to scope Grapes Pages By Library', 'sql' => [ - 'CREATE TABLE library_web_builder_grapes_page ( + 'CREATE TABLE IF NOT EXISTS library_web_builder_grapes_page ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, libraryId INT(11) NOT NULL, grapesPageId INT(11) NOT NULL, @@ -251,24 +209,10 @@ function getGrapesWebBuilderUpdates() { 'title' => 'Add columns to Grapes Web Builder Table', 'description' => 'Add columns to Grapes Web Builder Table', 'sql' => [ - "ALTER TABLE grapes_web_builder ADD COLUMN htmlData TEXT NOT NULL DEFAULT ' '", - "ALTER TABLE grapes_web_builder ADD COLUMN cddData TEXT NOT NULL DEFAULT ' '", + "ALTER TABLE grapes_web_builder ADD COLUMN IF NOT EXISTS htmlData TEXT NOT NULL DEFAULT ' '", + "ALTER TABLE grapes_web_builder ADD COLUMN IF NOT EXISTS cssData TEXT NOT NULL DEFAULT ' '", ], ], - 'alter_name_of_grapes_web_builder_grapes_id_column' => [ - 'title' => 'Alter Name of grapesPageId column', - 'description' => 'Alter name of grapesPageId column for clarity', - 'sql' => [ - "ALTER TABLE grapes_web_builder RENAME COLUMN grapesPageId to grapesGenId", - ], - ], - 'correct_typo_in_column_name' => [ - 'title' => 'Correct Typo in Column Name', - 'description' => 'Correct typo in cssData column', - 'sql' => [ - "ALTER TABLE grapes_web_builder RENAME COLUMN cddData to cssData", - ], - ], 'grapes_js_web_builder_roles' => [ 'title' => 'Grapes JS Web Builder Roles and Permissions', 'description' => 'Setup roles and permissions for the Grapes JS Web Builder Pages', From 28f0b3f2abf95de39678c1a61e1e4dc747ec8218 Mon Sep 17 00:00:00 2001 From: Alexander Blanchard Date: Tue, 9 Jul 2024 13:44:09 +0100 Subject: [PATCH 2/9] feat: Change background color of save button Change background color of save button on grapes js editors for grapes pages and templates to make it easier to find as requested in user testing. --- .../themes/responsive/WebBuilder/createTemplatejs.tpl | 4 ++++ code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/code/web/interface/themes/responsive/WebBuilder/createTemplatejs.tpl b/code/web/interface/themes/responsive/WebBuilder/createTemplatejs.tpl index 3fce72dc87..ab27eec6f1 100644 --- a/code/web/interface/themes/responsive/WebBuilder/createTemplatejs.tpl +++ b/code/web/interface/themes/responsive/WebBuilder/createTemplatejs.tpl @@ -147,6 +147,10 @@ z-index: 1; position: relative; } + .fa-save { + background-color: green; + border: 1px solid green; + } diff --git a/code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl b/code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl index 632fa85444..24f051e0e8 100644 --- a/code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl +++ b/code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl @@ -146,6 +146,11 @@ z-index: 1; position: relative; } + + .fa-save { + background-color: green; + border: 1px solid green; + } \ No newline at end of file From d2b3eb561ae230cb56b7f107a5c6c05d369659ea Mon Sep 17 00:00:00 2001 From: Alexander Blanchard Date: Tue, 9 Jul 2024 14:59:14 +0100 Subject: [PATCH 3/9] feat: Add No Template Option Add a blank template to the db to allow Grapes pages to be created without needing to set up a template first. --- code/web/sys/DBMaintenance/grapes_web_builder_updates.php | 7 +++++++ code/web/sys/WebBuilder/Template.php | 2 ++ 2 files changed, 9 insertions(+) diff --git a/code/web/sys/DBMaintenance/grapes_web_builder_updates.php b/code/web/sys/DBMaintenance/grapes_web_builder_updates.php index 2d6c8fa3b1..28e90cf6c3 100644 --- a/code/web/sys/DBMaintenance/grapes_web_builder_updates.php +++ b/code/web/sys/DBMaintenance/grapes_web_builder_updates.php @@ -232,6 +232,13 @@ function getGrapesWebBuilderUpdates() { "INSERT INTO role_permissions(roleId, permissionId) VALUES ((SELECT roleId from roles where name='Library Web Admin'), (SELECT id from permissions where name='Administer Library Grapes Pages'))" ], ], + 'add_a_blank_template' => [ + 'title' => 'Add a blank template', + 'description' => 'Add a blank template', + 'sql' => [ + "INSERT INTO templates (templateName) VALUES ('No Template')", + ], + ], ]; } diff --git a/code/web/sys/WebBuilder/Template.php b/code/web/sys/WebBuilder/Template.php index 232ad906e5..76a2995abe 100644 --- a/code/web/sys/WebBuilder/Template.php +++ b/code/web/sys/WebBuilder/Template.php @@ -96,6 +96,8 @@ static function getTemplateList(): array { $template->orderBy('templateName'); $template->find(); $templateList = []; + + $templateList[1] = 'No Template'; while ($template->fetch()){ $currentTemplate = new stdClass(); $currentTemplate->id = $template->id; From 638fe7f9a564e5a498c4959414b600613d65edaf Mon Sep 17 00:00:00 2001 From: Alexander Blanchard Date: Tue, 9 Jul 2024 16:16:35 +0100 Subject: [PATCH 4/9] refactor: Add required fields for pages and templates --- code/web/sys/WebBuilder/GrapesPage.php | 2 ++ code/web/sys/WebBuilder/Template.php | 1 + 2 files changed, 3 insertions(+) diff --git a/code/web/sys/WebBuilder/GrapesPage.php b/code/web/sys/WebBuilder/GrapesPage.php index 59eaa9891f..1c5e867a77 100644 --- a/code/web/sys/WebBuilder/GrapesPage.php +++ b/code/web/sys/WebBuilder/GrapesPage.php @@ -45,6 +45,7 @@ static function getObjectStructure($context = ''): array { 'description' => 'The title of the page', 'size' => '40', 'maxLength' => 100, + 'required' => true, ], 'urlAlias' => [ 'property' => 'urlAlias', @@ -53,6 +54,7 @@ static function getObjectStructure($context = ''): array { 'description' => 'The url of the page (no domain name)', 'size' => '40', 'maxLength' => 100, + 'required' => true, ], 'teaser' => [ 'property' => 'teaser', diff --git a/code/web/sys/WebBuilder/Template.php b/code/web/sys/WebBuilder/Template.php index 76a2995abe..5ff795b0a4 100644 --- a/code/web/sys/WebBuilder/Template.php +++ b/code/web/sys/WebBuilder/Template.php @@ -29,6 +29,7 @@ static function getObjectStructure($context = ''): array { 'type' => 'text', 'label' => 'Template Name', 'description' => 'The Name assigned to the template', + 'required' => true, ], 'templateContent' => [ 'property' => 'templateContent', From beb5fdcf59ad0b8e92d9242537a50a0c01d47ee5 Mon Sep 17 00:00:00 2001 From: Alexander Blanchard Date: Tue, 9 Jul 2024 16:24:50 +0100 Subject: [PATCH 5/9] refactor: Alter size of grapes blocks labels Increase the size of grapes blocks labels based on user testing feedback. --- .../themes/responsive/WebBuilder/createTemplatejs.tpl | 4 ++++ code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/code/web/interface/themes/responsive/WebBuilder/createTemplatejs.tpl b/code/web/interface/themes/responsive/WebBuilder/createTemplatejs.tpl index ab27eec6f1..9ae74de791 100644 --- a/code/web/interface/themes/responsive/WebBuilder/createTemplatejs.tpl +++ b/code/web/interface/themes/responsive/WebBuilder/createTemplatejs.tpl @@ -151,6 +151,10 @@ background-color: green; border: 1px solid green; } + + .gjs-block-label { + font-size: 10px; + } diff --git a/code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl b/code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl index 24f051e0e8..546da99b99 100644 --- a/code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl +++ b/code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl @@ -151,6 +151,10 @@ background-color: green; border: 1px solid green; } + + .gjs-block-label { + font-size: 10px; + } \ No newline at end of file From 4545ad2517576dc41bfd9dba0e08b39b0816d193 Mon Sep 17 00:00:00 2001 From: Alexander Blanchard Date: Fri, 12 Jul 2024 08:24:17 +0100 Subject: [PATCH 6/9] chore: Update change logs --- code/web/release_notes/24.08.00.MD | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/web/release_notes/24.08.00.MD b/code/web/release_notes/24.08.00.MD index 9ce005af6d..1ed95aed0c 100644 --- a/code/web/release_notes/24.08.00.MD +++ b/code/web/release_notes/24.08.00.MD @@ -16,6 +16,9 @@ - Added Grapes Pages and Templates to WebBuilder Section. (*AB*) - Added ability to create templates that can be selected and used for Grapes Pages (*AB*) - Added Grapes Pages to Web Indexer so that Grapes Pages are displayed in line with other WebBuilder pages when url is navigated to. (*AB*) +- Added the option to create a Grapes Page from no template. (*AB*) +- Increased the font size of the labels for the Grapes JS components (*AB*) +- Added a green background to the save button on the Grapes JS Editor in order to make it easier for users to find (*AB*) // jacob From 80bc03ba7176c5ccbe1c705f8f930af6a8359a4f Mon Sep 17 00:00:00 2001 From: Alexander Blanchard Date: Wed, 24 Jul 2024 09:26:45 +0100 Subject: [PATCH 7/9] refactor: Update gjs editor save button color Update background color of save button on Grapes JS Editor. --- .../themes/responsive/WebBuilder/createTemplatejs.tpl | 4 ++-- code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl | 4 ++-- code/web/release_notes/24.08.00.MD | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/web/interface/themes/responsive/WebBuilder/createTemplatejs.tpl b/code/web/interface/themes/responsive/WebBuilder/createTemplatejs.tpl index 9ae74de791..266dc88a81 100644 --- a/code/web/interface/themes/responsive/WebBuilder/createTemplatejs.tpl +++ b/code/web/interface/themes/responsive/WebBuilder/createTemplatejs.tpl @@ -148,8 +148,8 @@ position: relative; } .fa-save { - background-color: green; - border: 1px solid green; + background-color: #3174AF; + border: 1px solid #3174AF; } .gjs-block-label { diff --git a/code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl b/code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl index 546da99b99..b4c15b8d6c 100644 --- a/code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl +++ b/code/web/interface/themes/responsive/WebBuilder/grapesjs.tpl @@ -148,8 +148,8 @@ } .fa-save { - background-color: green; - border: 1px solid green; + background-color: #3174AF; + border: 1px solid #3174AF; } .gjs-block-label { diff --git a/code/web/release_notes/24.08.00.MD b/code/web/release_notes/24.08.00.MD index 1ed95aed0c..4f615632cf 100644 --- a/code/web/release_notes/24.08.00.MD +++ b/code/web/release_notes/24.08.00.MD @@ -18,7 +18,7 @@ - Added Grapes Pages to Web Indexer so that Grapes Pages are displayed in line with other WebBuilder pages when url is navigated to. (*AB*) - Added the option to create a Grapes Page from no template. (*AB*) - Increased the font size of the labels for the Grapes JS components (*AB*) -- Added a green background to the save button on the Grapes JS Editor in order to make it easier for users to find (*AB*) +- Added a blue background to the save button on the Grapes JS Editor in order to make it easier for users to find (*AB*) // jacob From a2cb45c89b46bb9c05594e9e61952194baddd578 Mon Sep 17 00:00:00 2001 From: Alexander Blanchard Date: Wed, 24 Jul 2024 13:14:22 +0100 Subject: [PATCH 8/9] feat: Add Edit Page Button Add an edit page button to all indexed grapes pages that takes users to the editor for the page they are on. Button only visible to those with Grapes Page permissions. --- .../themes/responsive/WebBuilder/grapesPage.tpl | 3 +++ code/web/services/WebBuilder/GrapesPage.php | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/code/web/interface/themes/responsive/WebBuilder/grapesPage.tpl b/code/web/interface/themes/responsive/WebBuilder/grapesPage.tpl index 2c42da706d..30d60d1f1a 100644 --- a/code/web/interface/themes/responsive/WebBuilder/grapesPage.tpl +++ b/code/web/interface/themes/responsive/WebBuilder/grapesPage.tpl @@ -2,6 +2,9 @@ + {if $canEdit} +
+ {/if} {$title|escape: 'html'} diff --git a/code/web/services/WebBuilder/GrapesPage.php b/code/web/services/WebBuilder/GrapesPage.php index ed5ff6bb10..aaae1e742a 100644 --- a/code/web/services/WebBuilder/GrapesPage.php +++ b/code/web/services/WebBuilder/GrapesPage.php @@ -42,7 +42,11 @@ function launch() { $title = $this->grapesPage->title; $interface->assign('id', $this->grapesPage->id); $interface->assign('contents', $this->grapesPage->getFormattedContents()); - + $editButton = $this->generateEditPageUrl(); + $interface->assign('editPageUrl', $editButton); + $canEdit = UserAccount::userHasPermission( 'Administer All Grapes Pages', + 'Administer Library Grapes Pages'); + $interface->assign('canEdit', $canEdit); // $interface->assign('templateContent', $this->grapesPage->templateContent); // $interface->assign('title', $title); @@ -62,6 +66,12 @@ function canView(): bool { return true; } + function generateEditPageUrl() { + $objectId = $this->grapesPage->id; + $templatesSelect - $this->grapesPage->templatesSelect; + return '/services/WebBuilder/GrapesJSEditor?objectAction=edit&id=' . $objectId . '&tempalteId=' . $templatesSelect; + } + function getBreadcrumbs(): array { $breadcrumbs = []; $breadcrumbs[] = new Breadcrumb('/', 'Home'); From 59e7ba42e07e147df03e6235b0a6b55147831622 Mon Sep 17 00:00:00 2001 From: Alexander Blanchard Date: Wed, 24 Jul 2024 18:13:24 +0100 Subject: [PATCH 9/9] chore: Remove unused code from DB --- .../grapes_web_builder_updates.php | 314 ++++-------------- 1 file changed, 72 insertions(+), 242 deletions(-) diff --git a/code/web/sys/DBMaintenance/grapes_web_builder_updates.php b/code/web/sys/DBMaintenance/grapes_web_builder_updates.php index 28e90cf6c3..ed6b9d620c 100644 --- a/code/web/sys/DBMaintenance/grapes_web_builder_updates.php +++ b/code/web/sys/DBMaintenance/grapes_web_builder_updates.php @@ -1,244 +1,74 @@ [ - 'title' => 'Web Builder Basic Pages', - 'description' => 'Setup Basic Pages within Web Builder', - 'sql' => [ - "CREATE TABLE grapes_web_builder ( - id INT(11) AUTO_INCREMENT PRIMARY KEY, - title VARCHAR(100) NOT NULL, - urlAlias VARCHAR(100), - teaser VARCHAR(512) - ) ENGINE=INNODB", - ], - ], - 'add_template_options' => [ - 'title' => 'Add Template Options', - 'description' => 'Add Template Options for Grapes Pages', - 'sql' => [ - "ALTER TABLE grapes_web_builder ADD COLUMN pageType INT", - ], - ], - 'template_options_for_grapes_web_builder' => [ - 'title' => 'Template Options for Grapes Web Builder', - 'description' => 'Store templates for Grapes Web Builder', - 'sql' => [ - "CREATE TABLE IF NOT EXISTS template_options ( - id INT(11) AUTO_INCREMENT PRIMARY KEY, - templateName VARCHAR(100) NOT NULL, - contents TEXT NOT NULL - )ENGINE=INNODB", - ], - ], - 'templates_for_grapes_web_builder' => [ - 'title' => 'Templates for Grapes Web Builder', - 'description' => 'Store templates for Grapes Web Builder', - 'sql' => [ - "CREATE TABLE IF NOT EXISTS templates ( - id INT(11) AUTO_INCREMENT PRIMARY KEY, - templateName VARCHAR(255) NOT NULL UNIQUE, - templateDescription TEXT, - templateFilePath VARCHAR(255) NOT NULL - )ENGINE=INNODB", - ], - ], - 'alter_template_option_type_remove_and_re_add' => [ - 'title' => 'Alter Type of Template Options', - 'description' => 'Alter Template Options for Grapes Pages', - 'sql' => [ - "ALTER TABLE grapes_web_builder DROP COLUMN pageType", - ], - ], - 're_add_page_type_with_new_data_type' => [ - 'title' => 'Alter Type of Template Options', - 'description' => 'Alter Template Options for Grapes Pages', - 'sql' => [ - "ALTER TABLE grapes_web_builder ADD COLUMN pageType VARCHAR(512)", - ], - ], - 'alter_templates_table_remove_description' => [ - 'title' => 'Remove Description From Templates Table', - 'description' => 'Remove the description column from the template table', - 'sql' => [ - "ALTER TABLE templates DROP COLUMN IF EXISTS templateDescription", - ], - ], - 'alter_temapltes_table_add_content' => [ - 'title' => 'Add Content to Templates Table', - 'description' => 'Add content column to templates table', - 'sql' => [ - "ALTER TABLE templates ADD COLUMN IF NOT EXISTS templateContent TEXT", - ], - ], - 'add_default_for_template_file_path' => [ - 'title' => 'Add Default to Template File Path', - 'description' => 'Add default value to template file path in templates table', - 'sql' => [ - "ALTER TABLE templates MODIFY COLUMN templateFilePath VARCHAR(255) DEFAULT NULL", - ], - ], - 'add_template_content_column_to_the_grapes_page_table' => [ - 'title' => 'Add Template Content Column to Grapes Table', - 'description' => 'Add a column to the Grapes table to store the content of the chosen template', - 'sql' => [ - 'ALTER TABLE grapes_web_builder ADD COLUMN IF NOT EXISTS templateContent TEXT', - ], - ], - 'alter_contents_of_grapes_page_table' => [ - 'title' => 'Alter the contents of the Grapes page table', - 'description' => 'Remove columns pageType and templateContent from the Grapes table', - 'sql' => [ - 'ALTER TABLE grapes_web_builder DROP COLUMN pageType', - 'ALTER TABLE grapes_web_builder DROP COLUMN templateContent', - 'ALTER TABLE grapes_web_builder ADD COLUMN templateId INT(11) DEFAULT -1', - ], - ], - 'rename_templateId_to_tempalte_names_and_add_new_temaplate_id_column' => [ - 'title' => 'Modify a column and add a new column', - 'description' => 'Add a new column for template names and modify the templateID column to alter its purpose.', - 'sql' => [ - 'ALTER TABLE grapes_web_builder ADD COLUMN IF NOT EXISTS templateNames INT(11) DEFAULT -1', - 'ALTER TABLE grapes_web_builder MODIFY COLUMN templateId VARCHAR(250) UNIQUE', - ], - ], - 'add_templateId_column_to_templates_table' => [ - 'title' => 'Add templateId column to templates table', - 'description' => 'Add a new column to store the templateId in the templates table', - 'sql' => [ - 'ALTER TABLE templates ADD COLUMN templateId VARCHAR(250) UNIQUE', - ], - ], - 'change_template_name_data_type' => [ - 'title' => 'Change Template Name Data Type', - 'description' => 'Change template name data type to varchar', - 'sql' => [ - 'ALTER TABLE grapes_web_builder MODIFY COLUMN templateNames INT(11)', - ], - ], - 'modify_template_name_column' => [ - 'title' => 'Change Template Column', - 'description' => 'Change template name column to not allow NULL', - 'sql' => [ - 'ALTER TABLE grapes_web_builder MODIFY COLUMN templateNames INT(11) NOT NULL', - ], - ], - 'modify_template_name_column_add_default' => [ - 'title' => 'Change Template Column', - 'description' => 'Change template name column to add default', - 'sql' => [ - 'ALTER TABLE grapes_web_builder MODIFY COLUMN templateNames INT(11) DEFAULT -1', - ], - ], - 'add_new_template_column' => [ - 'title' => 'Add New Template Column', - 'description' => 'Add template column to grapes table', - 'sql' => [ - 'ALTER TABLE grapes_web_builder ADD COLUMN IF NOT EXISTS templatesSelect INT(11) DEFAULT -1', - ], - ], - 'add_template_content_to_grapes_web_builder' => [ - 'title' => 'add_column_for_template_content', - 'description' => 'add_column_in_grapes_web_builder_table_for_template_content', - 'sql' => [ - 'ALTER TABLE grapes_web_builder ADD COLUMN templateContent TEXT', - ], - ], - 'remove_temaplteID_column' => [ - 'title' => 'Remove templateId column from templates table', - 'description' => 'Remove tempalteId column from templates table', - 'sql' => [ - 'ALTER TABLE templates DROP COLUMN templateId', - ], - ], - 'delete_column_from_grapes_web_builder' => [ - 'title' => 'Delete column from grapes_web_builder table', - 'description' => 'Delte templateId from grapes_web_builder table', - 'sql' => [ - 'ALTER TABLE grapes_web_builder DROP COLUMN templateId', - ], - ], - 'alterations_to_templates_table' => [ - 'title' => 'Alterations to Templates Table', - 'description' => 'Make changes to templates table to handle addition of templates built in grapes editor', - 'sql' => [ - 'ALTER TABLE templates ADD COLUMN htmlData TEXT NOT NULL DEFAULT " "', - 'ALTER TABLE templates ADD COLUMN cssData TEXT NOT NULL DEFAULT " "', - 'ALTER TABLE templates ADD COLUMN assets TEXT NOT NULL DEFAULT "[]"', - 'ALTER TABLE templates ADD COLUMN components TEXT NOT NULL DEFAULT "[]"', - 'ALTER TABLE templates ADD COLUMN styles TEXT NOT NULL DEFAULT "[]"', - ], - ], - 'add_id_grapes_page_id_column_to_template_table' => [ - 'title' => 'Add grapes_page_id Column to Template Table', - 'description' => 'Add a column to the tempaltes table to store the id given by grapes', - 'sql' => [ - 'ALTER TABLE templates ADD COLUMN grapes_page_id VARCHAR(100) NOT NULL DEFAULT " "', - ], - ], - 'modify_templateName_column_in_templates' => [ - 'title' => 'Modify Tempalte Name Column in Templates', - 'description' => 'Modify templateName column in templates to have a default', - 'sql' => [ - "ALTER TABLE templates MODIFY COLUMN templateName VARCHAR(100) NOT NULL DEFAULT ' '", - "ALTER TABLE templates MODIFY COLUMN templateContent TEXT NOT NULL DEFAULT ' '", - - ], - ], - 'add_grapesPageId_to_grapes_web_builder' => [ - 'title' => 'Add a Column to Store Page ID', - 'description' => 'Add a column to the grapes_web_builder table', - 'sql' => [ - 'ALTER TABLE grapes_web_builder ADD COLUMN IF NOT EXISTS grapesGenId VARCHAR(100) Not NULL DEFAULT ""', - ], - ], - 'grapes_page_web_builder_scope_by_library' => [ - 'title' => 'Web Builder Grapes Page Scope By Library', - 'description' => 'Add the ability to scope Grapes Pages By Library', - 'sql' => [ - 'CREATE TABLE IF NOT EXISTS library_web_builder_grapes_page ( - id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - libraryId INT(11) NOT NULL, - grapesPageId INT(11) NOT NULL, - INDEX libraryId(libraryId), - INDEX grapesPageId(grapesPageId) - ) ENGINE INNODB', - ], - ], - 'add_html_and_css_columns_to_grapes_web_builder' => [ - 'title' => 'Add columns to Grapes Web Builder Table', - 'description' => 'Add columns to Grapes Web Builder Table', - 'sql' => [ - "ALTER TABLE grapes_web_builder ADD COLUMN IF NOT EXISTS htmlData TEXT NOT NULL DEFAULT ' '", - "ALTER TABLE grapes_web_builder ADD COLUMN IF NOT EXISTS cssData TEXT NOT NULL DEFAULT ' '", - ], - ], - 'grapes_js_web_builder_roles' => [ - 'title' => 'Grapes JS Web Builder Roles and Permissions', - 'description' => 'Setup roles and permissions for the Grapes JS Web Builder Pages', - 'sql' => [ - "INSERT INTO permissions (sectionName, name, requiredModule, weight, description) VALUES - ('Web Builder', 'Administer All Grapes Pages', 'Web Builder', 150, 'Allows the user to define grapes pages for all libraries.'), - ('Web Builder', 'Administer Library Grapes Pages', 'Web Builder', 151, 'Allows the user to define grapes pages for their home library.') - ", - ], - ], - 'grapes_js_web_builder_roles_for_permissions' => [ - 'title' => 'Grapes JS Web Builder Roles', - 'description' => 'Setup roles for Grapes Js Pages', - 'sql' => [ - "INSERT INTO role_permissions(roleId, permissionId) VALUES ((SELECT roleId from roles where name='opacAdmin'), (SELECT id from permissions where name='Administer All Grapes Pages'))", - "INSERT INTO role_permissions(roleId, permissionId) VALUES ((SELECT roleId from roles where name='Web Admin'), (SELECT id from permissions where name='Administer All Grapes Pages'))", - "INSERT INTO role_permissions(roleId, permissionId) VALUES ((SELECT roleId from roles where name='Library Web Admin'), (SELECT id from permissions where name='Administer Library Grapes Pages'))" - ], - ], - 'add_a_blank_template' => [ - 'title' => 'Add a blank template', - 'description' => 'Add a blank template', - 'sql' => [ - "INSERT INTO templates (templateName) VALUES ('No Template')", - ], - ], - ]; -} - + return [ + 'grapes_web_builder' => [ + 'title' => 'Web Builder Basic Pages', + 'description' => 'Setup Basic Pages within Web Builder', + 'sql' => [ + "CREATE TABLE IF NOT EXISTS grapes_web_builder ( + id INT(11) AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(100) NOT NULL, + urlAlias VARCHAR(100), + teaser VARCHAR(512), + templatesSelect INT(11) DEFAULT -1, + templateContent TEXT, + grapesGenId VARCHAR(100) NOT NULL DEFAULT '', + htmlData TEXT, + cssData TEXT + ) ENGINE=INNODB", + ], + ], + 'templates_for_grapes_web_builder' => [ + 'title' => 'Templates for Grapes Web Builder', + 'description' => 'Store templates for Grapes Web Builder', + 'sql' => [ + "CREATE TABLE IF NOT EXISTS templates ( + id INT(11) AUTO_INCREMENT PRIMARY KEY, + templateName VARCHAR(100) NOT NULL DEFAULT ' ', + templateContent TEXT NOT NULL, + htmlData TEXT, + cssData TEXT + )ENGINE=INNODB", + ], + ], + 'grapes_page_web_builder_scope_by_library' => [ + 'title' => 'Web Builder Grapes Page Scope By Library', + 'description' => 'Add the ability to scope Grapes Pages By Library', + 'sql' => [ + 'CREATE TABLE IF NOT EXISTS library_web_builder_grapes_page ( + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + libraryId INT(11) NOT NULL, + grapesPageId INT(11) NOT NULL, + INDEX libraryId(libraryId), + INDEX grapesPageId(grapesPageId) + ) ENGINE INNODB', + ], + ], + 'grapes_js_web_builder_roles' => [ + 'title' => 'Grapes JS Web Builder Roles and Permissions', + 'description' => 'Setup roles and permissions for the Grapes JS Web Builder Pages', + 'sql' => [ + "INSERT INTO permissions (sectionName, name, requiredModule, weight, description) VALUES + ('Web Builder', 'Administer All Grapes Pages', 'Web Builder', 150, 'Allows the user to define grapes pages for all libraries.'), + ('Web Builder', 'Administer Library Grapes Pages', 'Web Builder', 151, 'Allows the user to define grapes pages for their home library.') + ", + ], + ], + 'grapes_js_web_builder_roles_for_permissions' => [ + 'title' => 'Grapes JS Web Builder Roles', + 'description' => 'Setup roles for Grapes Js Pages', + 'sql' => [ + "INSERT INTO role_permissions(roleId, permissionId) VALUES ((SELECT roleId from roles where name='opacAdmin'), (SELECT id from permissions where name='Administer All Grapes Pages'))", + "INSERT INTO role_permissions(roleId, permissionId) VALUES ((SELECT roleId from roles where name='Web Admin'), (SELECT id from permissions where name='Administer All Grapes Pages'))", + "INSERT INTO role_permissions(roleId, permissionId) VALUES ((SELECT roleId from roles where name='Library Web Admin'), (SELECT id from permissions where name='Administer Library Grapes Pages'))" + ], + ], + 'add_a_blank_template_to_template_list' => [ + 'title' => 'Add a blank template to list', + 'description' => 'Add a blank template to template list', + 'sql' => [ + "INSERT INTO templates (templateName, templateContent) VALUES ('No Template', ' ')", + ], + ], + ]; +} \ No newline at end of file