From daf1025a6ef14006bd05e77a5cd0625ed58595a9 Mon Sep 17 00:00:00 2001 From: aze088 <37347329+aze088@users.noreply.github.com> Date: Fri, 3 Feb 2023 09:19:29 -0600 Subject: [PATCH] Bug fixes (#21) * Fixed depreciation issue on line 73 * Fixed permissions not being in its own tab in tour * Fixed permissions not being in its own tab in tour * Fixed permissions not being in its own tab in steps * Added keys * Added column for step type. Still needs to be ordered by type * Added column for step type. Still needs to be ordered by type * Changed language keys from TOUR to STEP * Changed language keys from TOUR to STEP * Changed language keys from TOUR to STEP * Changed language keys from TOUR to STEP * Update default.php added spaces, re-introduced closing brace * Update default.php put endif back on its own line * Update default.php whitespace issues... * Fixed depreciation issue * Fixed depreciation issue * Added sort by Type option in Steps column * Added sort by Type language keys * Added necessary code in List for sorting by type * Added necessary code in List for sorting by type * Added necessary code in List for sorting by type * Added necessary code in List for sorting by type --------- Co-authored-by: Olivier Buisard --- .../com_guidedtours/forms/filter_steps.xml | 8 +- .../components/com_guidedtours/forms/step.xml | 24 +- .../com_guidedtours/src/Model/StepsModel.php | 3 +- .../com_guidedtours/src/Model/ToursModel.php | 6 +- .../com_guidedtours/tmpl/step/edit.php | 31 +- .../com_guidedtours/tmpl/steps/default.php | 282 ++++++++++-------- .../com_guidedtours/tmpl/tour/edit.php | 19 +- .../language/en-GB/com_guidedtours.ini | 36 ++- 8 files changed, 216 insertions(+), 193 deletions(-) diff --git a/administrator/components/com_guidedtours/forms/filter_steps.xml b/administrator/components/com_guidedtours/forms/filter_steps.xml index 697a01e42df7e..a4fe2a90fb7ec 100644 --- a/administrator/components/com_guidedtours/forms/filter_steps.xml +++ b/administrator/components/com_guidedtours/forms/filter_steps.xml @@ -13,7 +13,7 @@ type="status" label="JOPTION_SELECT_PUBLISHED" onchange="this.form.submit();" - > + > @@ -26,7 +26,7 @@ onchange="this.form.submit();" default="a.title DESC" validate="options" - > + > @@ -36,6 +36,8 @@ + + @@ -48,4 +50,4 @@ onchange="this.form.submit();" /> - \ No newline at end of file + diff --git a/administrator/components/com_guidedtours/forms/step.xml b/administrator/components/com_guidedtours/forms/step.xml index e2980160e6d77..9c66e03d7fc94 100644 --- a/administrator/components/com_guidedtours/forms/step.xml +++ b/administrator/components/com_guidedtours/forms/step.xml @@ -20,13 +20,13 @@ label="COM_GUIDEDTOURS_POSITION_LABEL" description="COM_GUIDEDTOURS_POSITION_DESC" validate="options" - > + > - > + + > @@ -85,10 +85,10 @@ default="0" description="COM_GUIDEDTOURS_TYPE_DESC" validate="options" - > + > - + - - - + > + + + + > diff --git a/administrator/components/com_guidedtours/src/Model/StepsModel.php b/administrator/components/com_guidedtours/src/Model/StepsModel.php index 3ce774b7ea62a..60f19b397e527 100644 --- a/administrator/components/com_guidedtours/src/Model/StepsModel.php +++ b/administrator/components/com_guidedtours/src/Model/StepsModel.php @@ -38,6 +38,7 @@ public function __construct($config = []) 'id', 'a.id', 'tour_id', 'a.tour_id', 'title', 'a.title', + 'type', 'a.type', 'description', 'a.description', 'published', 'a.published', 'ordering', 'a.ordering', @@ -208,7 +209,7 @@ protected function getListQuery() $search = '%' . str_replace(' ', '%', trim($search)) . '%'; $query->where( '(' . $db->quoteName('a.title') . ' LIKE :search1 OR ' . $db->quoteName('a.id') . ' LIKE :search2' - . ' OR ' . $db->quoteName('a.description') . ' LIKE :search3)' + . ' OR ' . $db->quoteName('a.description') . ' LIKE :search3)' ) ->bind([':search1', ':search2', ':search3'], $search); } diff --git a/administrator/components/com_guidedtours/src/Model/ToursModel.php b/administrator/components/com_guidedtours/src/Model/ToursModel.php index c4b8988cda6bd..5abb75486a300 100644 --- a/administrator/components/com_guidedtours/src/Model/ToursModel.php +++ b/administrator/components/com_guidedtours/src/Model/ToursModel.php @@ -71,10 +71,6 @@ protected function populateState($ordering = 'a.ordering', $direction = 'asc') $extension = $app->getUserStateFromRequest($this->context . '.filter.extension', 'extension', null, 'cmd'); $this->setState('filter.extension', $extension); - $parts = explode('.', $extension); - - // Extract the component name - $this->setState('filter.component', $parts[0]); // Extract the optional section name @@ -175,7 +171,7 @@ public function getListQuery() $search = '%' . str_replace(' ', '%', trim($search)) . '%'; $query->where( '(' . $db->quoteName('a.title') . ' LIKE :search1 OR ' . $db->quoteName('a.id') . ' LIKE :search2' - . ' OR ' . $db->quoteName('a.description') . ' LIKE :search3)' + . ' OR ' . $db->quoteName('a.description') . ' LIKE :search3)' ) ->bind([':search1', ':search2', ':search3'], $search); } diff --git a/administrator/components/com_guidedtours/tmpl/step/edit.php b/administrator/components/com_guidedtours/tmpl/step/edit.php index 6d5d5508d3837..fa7a6f801f607 100644 --- a/administrator/components/com_guidedtours/tmpl/step/edit.php +++ b/administrator/components/com_guidedtours/tmpl/step/edit.php @@ -34,7 +34,7 @@ ?>
+ (int) $this->item->id); ?>" method="post" name="adminForm" id="guidedtour-dates-form" class="form-validate">
@@ -71,20 +71,21 @@
- - -
-
-
- - form->getInput('rules'); ?> -
-
- -
+ + + +
+
+ + form->getInput('rules'); ?> +
+ +
- - - + + + + +
diff --git a/administrator/components/com_guidedtours/tmpl/steps/default.php b/administrator/components/com_guidedtours/tmpl/steps/default.php index 2424a04192d05..deeb04cfc3910 100644 --- a/administrator/components/com_guidedtours/tmpl/steps/default.php +++ b/administrator/components/com_guidedtours/tmpl/steps/default.php @@ -37,13 +37,13 @@ if ($saveOrder && !empty($this->items)) { $saveOrderingUrl = 'index.php?option=com_guidedtours&step=steps.saveOrderAjax&tmpl=component&' . - Session::getFormToken() . '=1'; + Session::getFormToken() . '=1'; HTMLHelper::_('draggablelist.draggable'); } ?>
+ method="post" name="adminForm" id="adminForm">
- - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + class="js-draggable" data-url="" data-direction=" + ?> class="js-draggable" data-url="" data-direction=" " data-nested="true" > - items as $i => $item) : - $canCreate = $user->authorise('core.create', 'com_guidedtours'); - $canEdit = $user->authorise('core.edit', 'com_guidedtours'); - $canChange = $user->authorise('core.edit.state', 'com_guidedtours'); - ?> - - - - - - id, false, 'cid', 'cb', $item->title); ?> - - - - - + endif; ?> + items as $i => $item) : + $canCreate = $user->authorise('core.create', 'com_guidedtours'); + $canEdit = $user->authorise('core.edit', 'com_guidedtours'); + $canChange = $user->authorise('core.edit.state', 'com_guidedtours'); + ?> + + + + + + id, false, 'cid', 'cb', $item->title); ?> + + + + + "> + if (!$canChange) { + $iconClass = ' inactive'; + } elseif (!$saveOrder) { + $iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED'); + } + ?> + + - - - - - - - - published, - $i, - 'steps.', - $canChange - ); ?> - - - - - - + escape($item->title); ?>"> escape($item->title); ?> - - escape($item->title); ?> + + escape($item->title); ?> + + + + note) : ?> + escape($item->note)); ?> + + + + description; ?> + - - note)) : - ?> - - - escape($item->note)); ?> - - - - - description; ?> - - - - - id; ?> - - - + + + type == 0) { + echo Text::_('COM_GUIDEDTOURS_STEP_TYPE_NEXT_STEP'); + } elseif ($item->type == 1) { + echo Text::_('COM_GUIDEDTOURS_STEP_TYPE_REDIRECT'); + } else { + echo Text::_('COM_GUIDEDTOURS_STEP_TYPE_INTERACTIVE_STEP'); + } + ?> + + + + + id; ?> + + + diff --git a/administrator/components/com_guidedtours/tmpl/tour/edit.php b/administrator/components/com_guidedtours/tmpl/tour/edit.php index 2ae83e50a5800..09286917de6ff 100644 --- a/administrator/components/com_guidedtours/tmpl/tour/edit.php +++ b/administrator/components/com_guidedtours/tmpl/tour/edit.php @@ -24,7 +24,7 @@ ?> + (int) $this->item->id); ?>"method="post" name="adminForm" id="guidedtours-form" class="form-validate"> @@ -59,20 +59,21 @@
- - + + - + +
form->getInput('rules'); ?>
- - -
- - + + + + +
diff --git a/administrator/language/en-GB/com_guidedtours.ini b/administrator/language/en-GB/com_guidedtours.ini index 9b601eccc997a..6f1f5cd6d31cb 100644 --- a/administrator/language/en-GB/com_guidedtours.ini +++ b/administrator/language/en-GB/com_guidedtours.ini @@ -3,7 +3,7 @@ ; License GNU General Public License version 2 or later; see LICENSE.txt ; Note : All ini files need to be saved as UTF-8 -COM_GUIDEDTOURS="Guided Tour" +COM_GUIDEDTOURS="Guided Tours" COM_GUIDEDTOURS_BASIC_STEP="Basic Step" COM_GUIDEDTOURS_DESCRIPTION_ASC="Description ascending"  COM_GUIDEDTOURS_DESCRIPTION_DESC="Description descending" @@ -17,7 +17,7 @@ COM_GUIDEDTOURS_FIELD_OPTION_LEFT="Left" COM_GUIDEDTOURS_FIELD_OPTION_RIGHT="Right" COM_GUIDEDTOURS_FIELD_OPTION_TOP="Top" COM_GUIDEDTOURS_FILTER_SEARCH_DESC="Search in id, title and description. Prefix with ID: to search for tour ID or DESCRIPTION: to search only description text." -COM_GUIDEDTOURS_GUIDEDTOUR_STEPS_PAGE_TITLE="Guided Tours - List of Steps" +COM_GUIDEDTOURS_GUIDEDTOUR_STEPS_PAGE_TITLE="Guided Tour - List of Steps" COM_GUIDEDTOURS_GUIDEDTOURS_LABEL_DESCRIPTION="Description" COM_GUIDEDTOURS_GUIDEDTOURS_PAGE_TITLE="Guided Tours - List of Tours" COM_GUIDEDTOURS_GUIDEDTOURS_TABLE_CAPTION="List of Tours" @@ -31,7 +31,6 @@ COM_GUIDEDTOURS_N_ITEMS_UNPUBLISHED_1="Tours disabled." COM_GUIDEDTOURS_N_ITEMS_UNPUBLISHED="%s tours disabled." COM_GUIDEDTOURS_N_ITEMS_ARCHIVED_1="Tours archived." COM_GUIDEDTOURS_N_ITEMS_ARCHIVED="%s Tours archived." -COM_GUIDEDTOURS_NO_NOTE="" COM_GUIDEDTOURS_POSITION_DESC="Add the Position where you want to display your step. e.g. Bottom, Top, Right, Left, Centered" COM_GUIDEDTOURS_POSITION_LABEL="Position" COM_GUIDEDTOURS_RULES_TAB="Permissions" @@ -40,7 +39,11 @@ COM_GUIDEDTOURS_STEP_ASC="Step ascending" COM_GUIDEDTOURS_STEP_DESC="Step descending" COM_GUIDEDTOURS_STEP_FILTER_SEARCH_DESC="Search in id, title and description. Prefix with ID: to search for step ID or DESCRIPTION: to search only description text." COM_GUIDEDTOURS_STEP_ID="ID" -COM_GUIDEDTOURS_STEP_TITLE="Step Title" +COM_GUIDEDTOURS_STEP_TITLE="Title" +COM_GUIDEDTOURS_STEP_TYPE="Type" +COM_GUIDEDTOURS_STEP_TYPE_NEXT_STEP="Next step" +COM_GUIDEDTOURS_STEP_TYPE_REDIRECT="Redirect" +COM_GUIDEDTOURS_STEP_TYPE_INTERACTIVE_STEP="Interactive step" COM_GUIDEDTOURS_STEPS="Steps" COM_GUIDEDTOURS_STEPS_LIST="Guided Tours" COM_GUIDEDTOURS_TARGET_DESC="Add the target item to attach your step element to. Options: .classname, #id or leave blank for a centered step." @@ -51,15 +54,16 @@ COM_GUIDEDTOURS_TOUR_TITLE="Tour Title" COM_GUIDEDTOURS_TYPE_REDIRECT_URL_DESC="Enter the Relative URL of the page from where you want to Start the Tour e.g administrator/index.php?option=com_guidedtours&view=tours for guided tour relative URL." COM_GUIDEDTOURS_TYPE_REDIRECT_URL_LABEL="URL" COM_GUIDEDTOURS_XML_DESCRIPTION="Component for managing Guided Tours functionality" -COM_GUIDEDTOURS_URL_LABEL = "URL" -COM_GUIDEDTOURS_URL_DESC = "Enter the Relative URL of the page from where you want to Start the Tour e.g administrator/index.php?option=com_guidedtours&view=tours for guided tour relative URL." -COM_GUIDEDTOURS_TYPE_LABEL = "Type" -COM_GUIDEDTOURS_TYPE_DESC = "Click on the type which you want to select for the tour" -COM_GUIDEDTOURS_FIELD_VALUE_REDIRECT = "Redirect" -COM_GUIDEDTOURS_FIELD_VALUE_NEXT_STEP = "Next Step" -COM_GUIDEDTOURS_FIELD_VALUE_INTERACTIVE_TOUR = "Interactive Tour" -COM_GUIDEDTOURS_INTERACTIVE_TOUR_DESC = "Click on the type of interactive step which you want to select" -COM_GUIDEDTOURS_TYPE_INTERACTIVE_TOUR_LABEL = "Interactive Step" -COM_GUIDEDTOURS_TYPE_INTERACTIVE_TOUR_BUTTON_LABEL = "Button" -COM_GUIDEDTOURS_TYPE_INTERACTIVE_TOUR_TEXT_FIELD_LABEL = "Text Field" -COM_GUIDEDTOURS_TYPE_INTERACTIVE_TOUR_OTHERS_LABEL = "Others" +MOD_MENU_MANAGE_GUIDEDTOURS="Guided Tours" +COM_GUIDEDTOURS_URL_LABEL="URL" +COM_GUIDEDTOURS_URL_DESC="Enter the Relative URL of the page from where you want to Start the Tour e.g administrator/index.php?option=com_guidedtours&view=tours for guided tour relative URL." +COM_GUIDEDTOURS_TYPE_LABEL="Type" +COM_GUIDEDTOURS_TYPE_DESC="Click on the type which you want to select for the tour" +COM_GUIDEDTOURS_FIELD_VALUE_REDIRECT="Redirect" +COM_GUIDEDTOURS_FIELD_VALUE_NEXT_STEP="Next" +COM_GUIDEDTOURS_FIELD_VALUE_INTERACTIVE_STEP="Interactive" +COM_GUIDEDTOURS_INTERACTIVE_STEP_DESC="Click on the type of interactive step which you want to select" +COM_GUIDEDTOURS_TYPE_INTERACTIVE_STEP_LABEL="Interactive Step" +COM_GUIDEDTOURS_TYPE_INTERACTIVE_STEP_BUTTON_LABEL="Button" +COM_GUIDEDTOURS_TYPE_INTERACTIVE_STEP_TEXT_FIELD_LABEL="Text Field" +COM_GUIDEDTOURS_TYPE_INTERACTIVE_STEP_OTHERS_LABEL="Others"