« Back Issue #487
  • 2021-05-08 01:59 Reported by anirudh95
  • 2022-03-27 18:39 Marked fixed
Status: Marked fixed
Priority: Medium

Adding a pastebin to Yioop & Adding a grid view for media list page in Yioop

anirudh95 2021-05-08 01:59

First feature, when users go to create a wiki page the Pastebin is presented as an option in settings. In the Paste Raw Data text area, the user places the desired code snippet for review and collaboration with other registered users or anonymous users. Second feature, to provide a grid view for different media types like audio, video, this feature gives any user the ability to view media in a format other than list view on Yioop. This is also a potential precursor to add a column like view for ease of drag and drop of different items into the user's folder.

anirudh95 2021-05-08 02:00

In manage locale for English (possible values to fill are given below): social_component_paste_bin - Paste Bin wiki_element_paste_bin_label - Paste Raw Data:

administrator 2021-05-09 18:08

Hey Anirudh,

Thanks for the patch. After making the tweaks to your previous patch, this patch no longer applies. Can you make me a new patch.

Best, Chris

anirudh95 2021-05-13 00:35

I have removed the old patch and uploaded the updated patch.

administrator 2021-05-13 19:30

Do not remove old patches. Issues need to preserve the complete history of the discussion. Your new patch still doesn't apply. I get a complaints about views/elements/Element.php

Chris

anirudh95 2021-05-13 19:47

Will not be deleting the patches here onwards.

Could you share the error you are seeing for Element.php?

I ask this because when I run the patch on my fresh copy of Yioop it seems to be working fine.

administrator 2021-05-13 20:06

git apply --check my.patch error: patch failed: src/views/elements/Element.php:66 error: src/views/elements/Element.php: patch does not apply

administrator 2021-05-13 20:30

Nevermind. I think I was looking at the old patch. Sorry.

administrator 2021-05-14 09:29

Your pastebin code seems to break the ability to save other kinds of wiki pages.

Do not introduce a new parameter to the setPageName method. Pages already contain information about their type in their variables.

anirudh95 2021-05-14 12:30

I made a new patch with changes you mentioned.

administrator 2021-05-14 17:50

Hey Anirudh,

Your patch is getting closer. Currently, you have the non-localized string: ≣ List

Also, can you use the $data["INCLUDE_SCRIPTS"] method to add the wiki.js file only to the new places where it is needed. It should be on most wiki pages already because of its use in initializeWikiEditor.

Best,

Chris

anirudh95 2021-05-17 21:41

Made the above changes as mentioned in the updated my-3.patch In manage locale for English (possible values to fill are given below): wiki_element_list_icon - ≣ List wiki_element_grid_icon - ⊞ Grid

administrator 2021-05-19 10:27

Hi Anirudh,

Your code doesn't work in PHP7.2. I am modifying it, but don't in the future use functions like str_contains that haven't been in PHP until recently. (I am trying to keep it working on systems going back 5 years.)

Best,

Chris

administrator 2021-05-19 10:45

Looking at your code you can't add wiki to INCLUDE_SCRIPT in weblayout that will add it to every page. What pages do you need it on? Add the line to social component when you actually need to include it. I am pushing your changes less the modifications to weblayout for the INCLUDE_SCRIPT. Tell me where you think you need wiki.js and why and I'll add it.

Best, Chris

anirudh95 2021-05-19 12:39

The getView function from wiki.js is being called on "medialist" wiki pages and the edit view page of that "medialist" page, the dependency for this getView is the initalizeWikiEditor function that gets the localised string for List and Grid text.

administrator 2021-05-19 12:40

So how is that more than where wiki pages were before? I.e., wiki.js was included for those pages before without that change.

administrator 2021-05-19 12:55

I backed out your last patch because I couldn't get it to work. It still wasn't saving wiki pages correctly once the patch was applied and the more recent patch also didn't seem to have the list versus grid view working.

anirudh95 2021-05-19 13:01

We don't need wiki.js for all the pages the reason I placed it there was because I thought all the include_scripts was done through views and weblayout seemed to be used on the edit page so I went ahead with that. Based on your input I switched the code from weblayout to SocialComponent where I called the initializeWikiEditor, it seems to be working fine there. Which specific wiki pages are giving you an issue in saving them because I tried changing to some and they looked fine to me?

administrator 2021-05-19 13:11

When I applied your latest patch, saving of pages ceased to work (any wiki page). The grid layout and list layout didn't work either. You code also generated a lot of notices. For example, [19-May-2021 12:50:49 America/Los_Angeles] PHP Notice: Undefined index: ci in /Applications/MAMP/htdocs/git/yioop/src/views/elements/Element.php on line 141

19-May-2021 12:51:09 America/Los_Angeles] PHP Notice: Undefined index: paste_bin_page in /Applications/MAMP/htdocs/git/yioop/src/controllers/components/SocialComponent.php on line 4125

anirudh95 2021-05-19 13:14

I am not sure what is the issue exactly because the code seems to be working on my system, is it possible to take a quick call over this?

anirudh95 2021-05-20 21:08

How should I proceed on this?

administrator 2021-05-20 21:11

How about we have a short call on Monday, say 1pm. I am at a virtual conference for the next few days.

anirudh95 2021-05-20 21:12

Yes that works for me. Thank-you.

anirudh95 2021-05-28 23:07

As discussed, I divided this patch into the two parts, PFA deliverable 4 (d4.patch) for grid-view.

administrator 2021-06-01 09:27

Hey Anirudh,

Thanks for your continued work on this. The d4 patch has been pushed lived, so you can start looking at the Share Note/formerly Paste Bin stuff.

Best,

Chris

anirudh95 2021-06-03 02:10

I have created the second part of this patch, PFA deliverable 3 (d3.patch) for paste bin like service. This patch was tougher than I expected I have tried to cover all scenarios like switching between different wiki page-types. I also have removed the picture resource dependency for line numbers as discussed.

administrator 2021-06-08 00:27

Hey Anirudh,

Thanks for the patch! I am in the process of coding something else, so have been a little slow with it. I can confirm it works. I will likely do some tweaking on it before pushing it live. This will happen after the indexing stuff is finished in the next week or so.

Best,

Chris

administrator 2021-07-11 14:46

Hey Anirudh,

I am just now getting to extensively testing and evaluating your code. I will probably push my modifications to your first patch in a week ( I still haven't extensively evaluated your second patch). My main problems are: (1) you should avoid using inline styles. (2) The html you output contains div tags within a table, but not within an td or th tag, which I doubt is valid HTML. (3) Using a button rather than a dropdown to control the view means that if someone wants to add additional view types it is nigh on impossible without replacing your code. (4) Your switch of views is forgotten when someone navigates away and comes back to the current page. I've pushed your code, but please keep an eye out in a week for my revised version.

Best,

Chris

administrator 2022-03-27 18:39

This was implemented before version 8.

anirudh95 2022-03-27 18:39
X