JoomGalleryfriends / JG4-dev

Development repository for JoomGallery v4.x
GNU General Public License v3.0
10 stars 6 forks source link

MVC and frontend #126

Closed Elfangor93 closed 1 year ago

Elfangor93 commented 1 year ago

This PR updates the frontend and the corresponding MVC pattern. The following views are now available in the frontend:

The templates for the list and form views are more or less copied from the backend. The templates for the image and category view are still very primitive since this PR focuses on the MVC pattern and not on the templates.

It is not the goal of this PR to create beautiful views, but to provide the data and functionality needed in the views with the help of the frontend MVC pattern. The router and the breadcrumbs do not work in this PR either. This will also be added in a later PR.

Test instructions

Flip trough the views and try to perform the provided actions. Report any error, warnings and notices.

Important

Please create a new comment for each issue found within this PR!

rowi68 commented 1 year ago

Categorie form view is not working.

Error: The requested page can't be found. categorie_form_view_error

rowi68 commented 1 year ago

Image Single View with warning:

warning_image_single_view

rowi68 commented 1 year ago

Image form view is not working.

Error: The requested page can't be found. Image Form View error

rowi68 commented 1 year ago

In List of categories it is not possible to "add new category"

Notice: list_of_categories_warning

rowi68 commented 1 year ago

Categorie form view - not possible to safe new category

Error: The requested page can't be found. safe_new_categorie

reni68 commented 1 year ago

I keep getting this warning several times for almost all points: _Warning: Attempt to read property "owner" on bool in /xampp/lampp/htdocs/Joom4_Leer/administrator/components/comjoomgallery/src/Service/Access/Base/AccessOwn.php on line 127

But the images or categories are also listed.

Elfangor93 commented 1 year ago

I keep getting this warning several times for almost all points: _Warning: Attempt to read property "owner" on bool in /xampp/lampp/htdocs/Joom4_Leer/administrator/components/comjoomgallery/src/Service/Access/Base/AccessOwn.php on line 127

But the images or categories are also listed.

@reni68 This Warning comes if your asset table in the DB is not correctly set up. Reinstalling the Component will fix that. Deinstall and then new Install.

rowi68 commented 1 year ago

List of images - Category selection does not work ( all available images are displayed )

MrMusic commented 1 year ago

In the backend, the views tags, configs and faulties no longer work. The images view is always displayed. The backend views images and categories views work normally.

MrMusic commented 1 year ago

In frontend the error 'Class "Factory" not found' appears when the single image view is called. frontend-single-image-error

AlexanderSupp commented 1 year ago

Issues in Tags, Configuration Set and Maintenance. Images will always present. As mentioned above.

AlexanderSupp commented 1 year ago

How can I uninstall JG4 now? Delete all tables of JG4 in DB? What else?

Elfangor93 commented 1 year ago

How can I uninstall JG4 now? Delete all tables of JG4 in DB? What else?

@AlexanderSupp If you use wampserver you could switch to a php version below v8.0.0. Otherwise apply changes in PR #128 or PR #129 . As soon as one of this PR is merged I can add the changes to this PR...

AlexanderSupp commented 1 year ago

@Elfangor93 thanks. I changed to 7.4.x , install the last main, and uninstalled it. All JG4 tables were deleted. I hope the code is also clean. Then I switched back to php 8.0.26. Now I wait until this pr is ready for test.

AlexanderSupp commented 1 year ago

After first superficial tests, it looks good. I think that's a good basis for further development. Of course there are e.g. with a save still errors like this: Fatal error: Declaration of Joomgallery\Component\Joomgallery\Site\Controller\ImageformController::edit() must be compatible with Joomla\CMS\MVC\Controller\FormController::edit($key = null, $urlVar = null) in C:\wamp64\www\Joomla\components\com_joomgallery\src\Controller\ImageformController.php on line 308

I will deepen further tests. I discovered a few more errors during multiple upload, which I would like to investigate separately and only report afterwards. Thank you in the meantime.

AlexanderSupp commented 1 year ago

Multiple Uploads with Nmb parallel processes = 8 will not work. Nmb parallel processes = 1 will work correct. Screenshot 2023-08-22 114653 Screenshot 2023-08-22 115956 I think this is the old bug in the code.

reni68 commented 1 year ago

Multiple upload works perfectly. I have created 2 categories and uploaded 6 images to each category. However, when viewing the images in the backend, filter options are ignored. All images are always displayed. grafik But sometimes it works if I adjust something on an image, for example, approve it.

Displays tested in the frontend:

  1. category list

    • all categories are displayed
    • Filter without function
    • Select status works grafik
  2. image list

    • all images are displayed
    • Filter without function
    • Select status works grafik

Other things I could not test yet :(

reni68 commented 1 year ago

I keep getting this error now: Warning: Attempt to read property "owner" on bool in /xampp/lampp/htdocs/Joom4_Leer/administrator/components/com_joomgallery/src/Service/Access/Base/AccessOwn.php on line 127

Wanted to uninstall, but that ended with error. Then installed the JG4-dev-fix-deinstall.zip. With this I could uninstall without error. After reinstalling JG4-dev-MVC-frontend.zip but still again this error.

Elfangor93 commented 1 year ago

I keep getting this error now: Warning: Attempt to read property "owner" on bool in /xampp/lampp/htdocs/Joom4_Leer/administrator/components/com_joomgallery/src/Service/Access/Base/AccessOwn.php on line 127

@reni68 Can you please provide me more information on how to reproduce this issue. Because I dont get it. Please provide me with the following info such that I can fix it. https://github.com/JoomGalleryfriends/JG4-dev/tree/main#steps-to-reproduce-the-issue

Elfangor93 commented 1 year ago

Fatal error: Declaration of Joomgallery\Component\Joomgallery\Site\Controller\ImageformController::edit() must be compatible with Joomla\CMS\MVC\Controller\FormController::edit($key = null, $urlVar = null) in C:\wamp64\www\Joomla\components\com_joomgallery\src\Controller\ImageformController.php on line 308

@AlexanderSupp Can you please provide me with more infos on that error. What do I have to do to get this error, because I dont get it.

AlexanderSupp commented 1 year ago

Here is the flow: Screenshot 2023-08-23 221950

Category Form View - Root / In the first screen Edit is active.

Screenshot 2023-08-23 223022

I click to Categories and the following screen will appear.

Screenshot 2023-08-23 222056

I click the edit action in the Reisen category.

Screenshot 2023-08-23 222143

Screenshot 2023-08-23 222205

And now I clicked save.

Screenshot 2023-08-23 222232

A similar situation is if I click the delete action.

Screenshot 2023-08-23 223822

AlexanderSupp commented 1 year ago

List of Categories Screenshot 2023-08-23 230720 Rio shows 64 images, but Click to Rio

Screenshot 2023-08-23 230751

AlexanderSupp commented 1 year ago

List of Images

Screenshot 2023-08-24 134507

Select first image.

Screenshot 2023-08-24 134531

Select Edit

Screenshot 2023-08-24 134602

Change Author and then SAVE

Screenshot 2023-08-24 134636

Returned to List images

Screenshot 2023-08-24 134718

Checked in

Screenshot 2023-08-24 134747

And everything is OK

AlexanderSupp commented 1 year ago

Category Form View Starts with the page "Add"-function or the last used function "Edit". Screenshot 2023-08-24 125036

Expected start with the "View"-Page. A click to Categories display the correct page.

Screenshot 2023-08-24 130304

But if I select "+ Add new Category" and if I was previous in "Edit", the Edit-Page will come up. At this point, I have no chance to switch to another dialogue within Category Form View.

Function: Delete a Category Result: Delete successful but Error Message "Check-in failed with the following error:" displayed with no more information. May be also a checked-in problem?

AlexanderSupp commented 1 year ago

List of Categories produced a warning, if you select the status unpublished and there are no unpublished categories available. Screenshot 2023-08-24 155321

AlexanderSupp commented 1 year ago

Backend - Images - Select Category does not work

AlexanderSupp commented 1 year ago

Backend - Images - How can I approve several images? Issue?

AlexanderSupp commented 1 year ago

List of Categories If a Category has no images (and) a subcategory has no images, then "No elements in this category..." will be displayed. Screenshot 2023-08-24 162657

Screenshot 2023-08-24 162726 Screenshot 2023-08-24 162900

reni68 commented 1 year ago

@reni68 Can you please provide me more information on how to reproduce this issue. Because I dont get it. Please provide me with the following info such that I can fix it.

@Elfangor93 I found out today that this only occurs when I install the "sampledata" with. If I create my own categories and upload images myself, the errors do not occur in the frontend! Now I test first of all with fresh code further :-)

reni68 commented 1 year ago

The multiple upload works perfectly. I have created 2 categories and uploaded 6 images to each category and 2 images uncategorized. The filter options in the backend do not work. All images are still displayed.

  1. image list
    • all images are displayed, whether approved or not.
    • Filterbuton without function and also sorting at column header without function
    • Select status works

PR126_1

  1. category list

PR126_4

PR126_2

PR126_3

  1. category view

PR126_5

  1. image (Single image view) works, the selected image is displayed.

My system: Linux, XAMPP, Joomla 4.3.3, PHP-Version 8.0.15

Elfangor93 commented 1 year ago

Everything related to the category filter in the images view I have to shift to another PR. This heavily relates to how the images view should actually work. Do we wanna have it like in the JG3 or more like we have it in the backend? But this is a discussion I dont want peform here...

Elfangor93 commented 1 year ago

Category view currently only shows images which are published, approved and not hidden. We still have to decides about possible settings for the frontend views and where we wanna place them. But also this is not a discussion I dont want peform here. This will be part of a next PR...

Elfangor93 commented 1 year ago

Category Form View Starts with the page "Add"-function or the last used function "Edit".

Sorry. But I don't get what you wanna tell here in this comment.

Elfangor93 commented 1 year ago

Backend - Images - How can I approve several images? Issue?

No issue. Function just not yet available.

Elfangor93 commented 1 year ago

@reni68 Can you please provide me more information on how to reproduce this issue. Because I dont get it. Please provide me with the following info such that I can fix it.

@Elfangor93 I found out today that this only occurs when I install the "sampledata" with. If I create my own categories and upload images myself, the errors do not occur in the frontend! Now I test first of all with fresh code further :-)

@MrMusic Probably you have to update the asset table and the reference to the asset table in the sample data such that the methods from the access service work again.

MrMusic commented 1 year ago

Probably you have to update the asset table and the reference to the asset table in the sample data such that the methods from the access service work again.

I would recommend not to use the sample data any more. It was only an interim solution as long as the multiple upload did not work. With the multiple upload now you have better control over if everything works.

AlexanderSupp commented 1 year ago

Administrator - Images I can't reach my unapproved images any more.

rowi68 commented 1 year ago

In Backend images and empty categories are not displayed anymore...

Elfangor93 commented 1 year ago

List of images - Category selection does not work ( all available images are displayed )

Yes the Category selection does not work yet. But this will not be implemented within this PR since this depends heavily on how the images list view in the frontend should actually work.

rowi68 commented 1 year ago

I have tested all views ✅ successfully. Also category selection is working now...

reni68 commented 1 year ago

I have tested all views ✅ successfully. Also category selection is working now...

I can confirm this :-)

reilldesign commented 1 year ago

I tested

Category View List of Categories List of Images Single Image View

✅ successfully

reilldesign commented 1 year ago

To familiarize myself with the views i did something with category view default.php and inserted the following code in line 114 for the thumbnail:

<img src="<?php echo JoomHelper::getImg($image, 'thumbnail'); ?>" class="figure-img img-fluid rounded" alt="<?php echo $image->imgtitle; ?>" style="width:auto;" itemprop="image" loading="lazy">

Is this the right way apart from the class?

MrMusic commented 1 year ago

I have not found any more errors, only a small "unsightly" behaviour with the "Filter Options": The 'Filter Options' are always folded out when you click on 'Clear'. In Joomla itself, the options are collapsed when you click on 'Clear'. However, there is nothing to stop merging this PR.

MrMusic commented 1 year ago

@reilldesign Looks good for me. Thanks.

Elfangor93 commented 1 year ago

@reilldesign Yes, exactly. The JoomHelper::getImg() is returning you the URL to a specific image/imagetype.

/**
   * Returns the URL or the path to an image
   *
   * @param   string/object/int $img     Filename, database object, ID or URL of the image
   * @param   string            $type    The image type
   * @param   bool              $url     True to return an image URL, false for a system path (default: true)
   * @param   bool              $root    True to add the system root to path. Only if $url=false. (default: true)
   *
   * @return  mixed             URL or path to the image on success, false otherwise
   *
   * @since   4.0.0
   */
  public static function getImg($img, $type, $url=true, $root=true)

In the first argument, you select the image record for which you need an image URL. You can provide here an image object as you did or if you dont have that an image ID or even a filename. In the second argument, you select the type of image you want the URL for. The image type has to be available for this image. Image types can be added and configured in the configuration manager in the backend. This image types allows you to create fancy designs with exactly the image size and crop/section you need.